/* ============ TOKENS ============ */
:root {
  --bg: #0b0b0d;
  --bg-2: #121215;
  --bg-3: #1a1a1f;
  --line: rgba(244, 241, 234, 0.10);
  --line-strong: rgba(244, 241, 234, 0.22);
  --fg: #f4f1ea;
  --fg-dim: rgba(244, 241, 234, 0.62);
  --fg-soft: rgba(244, 241, 234, 0.40);
  --accent: oklch(0.78 0.14 62);
  --accent-soft: oklch(0.78 0.14 62 / 0.16);
  --accent-line: oklch(0.78 0.14 62 / 0.40);
  --radius: 14px;
  --maxw: 1240px;
  --pad: clamp(20px, 4vw, 56px);
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
html[data-theme="light"] {
  --bg: #f4f1ea;
  --bg-2: #ece8de;
  --bg-3: #e3ddcd;
  --line: rgba(11, 11, 13, 0.10);
  --line-strong: rgba(11, 11, 13, 0.22);
  --fg: #14141a;
  --fg-dim: rgba(20, 20, 26, 0.62);
  --fg-soft: rgba(20, 20, 26, 0.40);
  --accent: oklch(0.55 0.16 50);
  --accent-soft: oklch(0.55 0.16 50 / 0.14);
  --accent-line: oklch(0.55 0.16 50 / 0.40);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  overflow-x: hidden;
  transition: background 320ms ease, color 320ms ease;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #14141a; }

/* Cursor dot */
.cursor-dot {
  position: fixed;
  pointer-events: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 200ms ease, height 200ms ease, opacity 200ms ease;
  mix-blend-mode: difference;
  opacity: 0;
}
@media (pointer: fine) {
  .cursor-dot { opacity: 1; }
  .cursor-dot.expand { width: 36px; height: 36px; background: transparent; border: 1px solid var(--accent); }
}

/* ============ NAV ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--pad);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in oklch, var(--bg) 70%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 320ms ease, background 320ms ease;
}
.nav.scrolled { border-bottom-color: var(--line); }
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
.nav-links {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--mono);
  font-size: 12px;
  list-style: none;
  padding: 6px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in oklch, var(--bg-2) 80%, transparent);
}
.nav-links a {
  display: block;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--fg-dim);
  transition: color 180ms ease, background 180ms ease;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a.active {
  color: var(--fg);
  background: var(--bg-3);
}
.nav-right { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  display: grid; place-items: center;
  transition: border-color 180ms ease, background 180ms ease;
}
.theme-toggle:hover { border-color: var(--line-strong); background: var(--bg-2); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }
html[data-theme-pref="light"] .icon-sun { display: block; }
html[data-theme-pref="dark"] .icon-moon { display: block; }
.cta {
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  cursor: pointer;
  transition: transform 180ms ease;
}
.cta:hover { transform: translateY(-1px); }

/* Mobile menu toggle (hamburger) */
.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color 180ms ease, background 180ms ease;
}
.menu-toggle:hover { border-color: var(--line-strong); background: var(--bg-2); }
.menu-toggle span {
  display: block;
  width: 16px; height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 220ms ease, opacity 200ms ease;
  transform-origin: center;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; }
  .nav-links {
    position: fixed;
    top: 70px;
    left: var(--pad);
    right: var(--pad);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px;
    border-radius: 18px;
    background: color-mix(in oklch, var(--bg) 92%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px -20px rgba(0,0,0,0.45);
    z-index: 95;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    pointer-events: none;
    transition: opacity 220ms ease, transform 260ms cubic-bezier(.2,.7,.2,1);
  }
  .nav-links.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }
  .nav-links a {
    display: block;
    padding: 12px 14px;
    font-size: 13px;
    border-radius: 10px;
  }
  .cta { padding: 9px 12px; font-size: 11px; }
}
@media (max-width: 420px) {
  .cta { display: none; }
}

/* ============ PAGE LAYOUT ============ */
main {
  padding-top: 92px;
  min-height: 100vh;
}
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(40px, 8vh, 80px) var(--pad) 60px;
}
.page-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 56px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.section-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-soft);
  letter-spacing: 0.08em;
}
.page-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 6vw, 80px);
  line-height: 0.96;
  letter-spacing: -0.015em;
  margin: 0;
}
.page-title em {
  font-style: italic;
  color: var(--accent);
}
.page-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-soft);
  letter-spacing: 0.05em;
  text-align: right;
  align-self: end;
}
@media (max-width: 760px) {
  .page-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .page-meta { text-align: left; }
}

/* Buttons */
.btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 14px 20px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.btn:hover { background: var(--bg-2); transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1305;
}
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn .arrow { transition: transform 200ms ease; }
.btn:hover .arrow { transform: translate(3px, -3px); }

/* Pills */
.pill {
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--fg-dim);
}
.pill.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* ============ FOOTER ============ */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 60px;
  padding: 60px var(--pad) 40px;
  max-width: var(--maxw);
  margin-left: auto; margin-right: auto;
}
.footer-head {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin: 0 0 28px;
}
.footer-head em { font-style: italic; color: var(--accent); }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 20px; } }
.footer-col h5 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-soft);
  margin: 0 0 12px;
  font-weight: 500;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 6px; }
.footer-col a {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--fg);
  font-size: 15px;
  border-bottom: 1px solid transparent;
  transition: color 180ms ease, border-color 180ms ease;
}
.footer-col a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.colophon {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-soft);
  flex-wrap: wrap;
}
.colophon .clock { display: inline-flex; align-items: center; gap: 8px; }
.colophon .clock::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: oklch(0.78 0.14 145);
  box-shadow: 0 0 8px oklch(0.78 0.14 145);
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms ease, transform 320ms cubic-bezier(.2,.7,.2,1);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Reveal on scroll */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms ease, transform 700ms cubic-bezier(.2,.6,.2,1);
}
[data-reveal].in {
  opacity: 1; transform: none;
}

/* Fade-in page */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.page > * { animation: pageIn 600ms ease both; }
.page > *:nth-child(2) { animation-delay: 80ms; }
.page > *:nth-child(3) { animation-delay: 140ms; }
.page > *:nth-child(4) { animation-delay: 200ms; }
