/* ============================================
   Suleyman Ates — The Changelog
   Design System + Styles
   ============================================ */

/* --- Tokens --- */
:root {
  --bg: #09090b;
  --bg-surface: #111113;
  --bg-surface-hover: #18181b;
  --text-primary: #e4e4e7;
  --text-secondary: #71717a;
  --text-muted: #3f3f46;
  --accent: #d4a574;
  --accent-muted: rgba(212, 165, 116, 0.2);
  --accent-subtle: rgba(212, 165, 116, 0.08);

  --content-width: 680px;
  --page-padding: clamp(1.5rem, 5vw, 4rem);
  --spine-offset: 2.5rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --space-32: 8rem;

  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- Base --- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg);
  overflow-x: hidden;
}

::selection {
  background: var(--accent-muted);
  color: var(--text-primary);
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 200ms ease;
}

a:hover {
  color: var(--accent);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Layout --- */
main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
  position: relative;
}

/* --- Timeline Spine --- */
.timeline-spine {
  position: fixed;
  left: calc(50% - var(--content-width) / 2 - var(--spine-offset));
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--text-muted);
  opacity: 0.4;
  z-index: 1;
  pointer-events: none;
}

.timeline-nav {
  position: fixed;
  left: calc(50% - var(--content-width) / 2 - var(--spine-offset));
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  align-items: center;
}

.timeline-nav-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 300ms ease, transform 300ms ease, box-shadow 300ms ease;
}

.timeline-nav-dot:hover,
.timeline-nav-dot.active {
  background: var(--accent);
  transform: scale(1.5);
  box-shadow: 0 0 8px var(--accent-muted);
}

.timeline-nav-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* --- Hero --- */
.hero {
  padding-top: clamp(var(--space-32), 20vh, 12rem);
  padding-bottom: var(--space-32);
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero h1 {
  font-family: var(--font-body);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
}

.hero .subtitle {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-3);
  letter-spacing: 0.01em;
}

.hero .version-counter {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.hero .tagline {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-top: var(--space-8);
  max-width: 540px;
}

.hero-cta {
  margin-top: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.cta-email {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--text-primary);
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--text-muted);
  border-radius: 4px;
  transition: border-color 200ms ease, background 200ms ease;
  position: relative;
}

.cta-email:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
}

.cta-scroll {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: color 200ms ease;
}

.cta-scroll:hover {
  color: var(--text-primary);
}

/* --- Section Base --- */
.section {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
  border-top: 1px solid var(--text-muted);
}

.section-header {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-8);
}

/* --- Changelog Entry --- */
.changelog-entry {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
  border-top: 1px solid rgba(63, 63, 70, 0.4);
}

.changelog-entry:first-of-type {
  border-top: none;
}

.entry-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.entry-version {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.entry-title {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
}

.entry-era {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-left: auto;
  white-space: nowrap;
}

/* Details / Summary (collapsible subsections) */
.entry-content details {
  margin-top: var(--space-4);
  border-radius: 4px;
  transition: background 200ms ease;
}

.entry-content details[open] {
  background: var(--bg-surface);
  padding-bottom: var(--space-4);
}

.entry-content summary {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  border-radius: 4px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: color 200ms ease, background 200ms ease;
  user-select: none;
}

.entry-content summary::-webkit-details-marker {
  display: none;
}

.entry-content summary::before {
  content: '+';
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
  width: 1rem;
  text-align: center;
  transition: color 200ms ease, transform 300ms var(--ease-in-out);
  flex-shrink: 0;
}

.entry-content details[open] > summary::before {
  content: '\2212'; /* minus */
  color: var(--accent);
}

.entry-content summary:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.entry-content .detail-body {
  padding: 0 var(--space-4) 0 calc(var(--space-4) + 1rem + var(--space-3));
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.8;
}

.entry-content .detail-body li {
  list-style: none;
  position: relative;
  padding-left: var(--space-6);
}

.entry-content .detail-body li::before {
  content: '\2014'; /* em dash */
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.entry-content .detail-body li + li {
  margin-top: var(--space-2);
}

/* Current entry special styling */
.changelog-entry.current .entry-version {
  position: relative;
}

.changelog-entry.current .entry-version::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: var(--space-2);
  vertical-align: middle;
  animation: pulse 2s ease-in-out infinite;
}

/* --- Philosophy --- */
.philosophy-text {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 600px;
}

.philosophy-text p + p {
  margin-top: var(--space-6);
}

.philosophy-text em {
  color: var(--text-primary);
  font-style: normal;
}

.philosophy-list {
  list-style: none;
  margin-top: var(--space-8);
  padding: 0;
}

.philosophy-list li {
  position: relative;
  padding-left: var(--space-6);
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.philosophy-list li::before {
  content: '\2014';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.philosophy-list li + li {
  margin-top: var(--space-3);
}

/* --- Stack --- */
.stack-grid {
  display: grid;
  gap: var(--space-1);
}

.stack-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  align-items: baseline;
  border-bottom: 1px solid rgba(63, 63, 70, 0.2);
}

.stack-label {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.stack-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-primary);
}

.stack-note {
  margin-top: var(--space-8);
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* --- Signal (numbers) --- */
.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-8);
}

.signal-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.signal-number {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}

.signal-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Contact / Footer --- */
.contact {
  padding-top: var(--space-32);
  padding-bottom: var(--space-32);
  border-top: 1px solid var(--text-muted);
  text-align: left;
}

.contact h2 {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.contact .contact-tagline {
  color: var(--text-secondary);
  margin-top: var(--space-2);
  font-size: 1rem;
}

.contact .cta-email {
  display: inline-block;
  margin-top: var(--space-8);
  font-size: 1.0625rem;
}

.status {
  margin-top: var(--space-6);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.contact-links {
  margin-top: var(--space-8);
  display: flex;
  gap: var(--space-6);
}

.contact-links a {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.contact-links a::after {
  content: ' \2192';
  transition: transform 200ms ease;
  display: inline-block;
}

.contact-links a:hover::after {
  transform: translateX(3px);
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  background: var(--bg-surface);
  border: 1px solid var(--text-muted);
  padding: var(--space-2) var(--space-6);
  border-radius: 4px;
  opacity: 0;
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
  z-index: 100;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Command Palette --- */
.cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.cmd-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cmd-palette {
  position: fixed;
  top: min(20vh, 180px);
  left: 50%;
  transform: translateX(-50%) scale(0.96);
  width: min(480px, calc(100vw - 2rem));
  background: var(--bg-surface);
  border: 1px solid var(--text-muted);
  border-radius: 8px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.cmd-palette.open {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

.cmd-input-wrapper {
  padding: var(--space-4);
  border-bottom: 1px solid var(--text-muted);
}

.cmd-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
}

.cmd-input::placeholder {
  color: var(--text-muted);
}

.cmd-list {
  padding: var(--space-2);
  max-height: 280px;
  overflow-y: auto;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-radius: 4px;
  cursor: pointer;
  transition: background 150ms ease;
}

.cmd-item:hover,
.cmd-item.selected {
  background: var(--accent-subtle);
}

.cmd-item-label {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-primary);
}

.cmd-item-hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cmd-footer {
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid rgba(63, 63, 70, 0.3);
  display: flex;
  gap: var(--space-4);
}

.cmd-footer kbd {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  padding: 1px var(--space-1);
  border: 1px solid var(--text-muted);
  border-radius: 3px;
}

.cmd-footer span {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* stagger children */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 400ms; }

/* --- Animations --- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .status-dot,
  .changelog-entry.current .entry-version::after {
    animation: none;
  }
}

/* --- Responsive --- */

/* Tablet: hide timeline spine */
@media (max-width: 1024px) {
  .timeline-spine,
  .timeline-nav {
    display: none;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .hero {
    padding-top: var(--space-24);
    padding-bottom: var(--space-16);
    min-height: auto;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .entry-header {
    flex-wrap: wrap;
  }

  .entry-era {
    margin-left: 0;
    width: 100%;
  }

  .stack-row {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  .signal-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
