/* === Cosmic Engineer === */
@property --wr {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
:root {
  --bg: #0a0908;
  --bg-2: #131110;
  --fg: #f3efe6;
  --fg-dim: #a8a298;
  --fg-mute: #6b665e;
  --line: rgba(243, 239, 230, 0.08);
  --accent: oklch(0.78 0.14 65);
  --accent-2: oklch(0.78 0.14 220);
  --grain: 0.04;
  --serif: "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  --sans: "Geist", "Inter", -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f4f0e8;
  --bg-2: #ebe6dc;
  --fg: #1a1815;
  --fg-dim: #5a564f;
  --fg-mute: #8a8478;
  --line: rgba(26, 24, 21, 0.1);
  --grain: 0.03;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  cursor: none;
  transition: background 0.6s ease, color 0.6s ease;
}

/* film grain overlay */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.6'/></svg>");
  mix-blend-mode: overlay;
}

/* mouse-reactive gradient mesh */
.mesh {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle 600px at var(--mx, 50%) var(--my, 50%), color-mix(in oklch, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(circle 800px at calc(100% - var(--mx, 50%)) calc(100% - var(--my, 50%)), color-mix(in oklch, var(--accent-2) 12%, transparent), transparent 70%);
  transition: opacity 0.4s;
}

/* canvas particle field */
#particles {
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
}

main { position: relative; z-index: 2; }

a { color: inherit; text-decoration: none; }

/* === Custom cursor === */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--fg);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.15s, opacity 0.2s;
}
.cursor-ring {
  width: 32px; height: 32px;
  border: 1px solid var(--fg);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, border-color 0.25s;
}
.cursor-ring.hover {
  width: 56px; height: 56px;
  border-color: var(--accent);
}
@media (hover: none) {
  body { cursor: auto; }
  .cursor-dot, .cursor-ring { display: none; }
}

/* === Layout === */
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

section {
  padding: 120px 0;
  position: relative;
}

/* === Type === */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 1; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mute); }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-mute); }
.eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--fg-mute); }

/* word reveal */
.reveal-word { display: inline-block; overflow: hidden; vertical-align: bottom; }
.reveal-word > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal-word.in > span { transform: translateY(0); }

/* fade up */
.fade-up { opacity: 0; transform: translateY(24px); transition: opacity 0.8s, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.fade-up.in { opacity: 1; transform: none; }

/* === Nav === */
nav.top {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 32px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  background: color-mix(in oklch, var(--bg) 60%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
nav.top.scrolled { border-bottom-color: var(--line); }
nav.top .brand { display: flex; align-items: center; gap: 10px; color: var(--fg); }
nav.top .brand .dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 12px var(--accent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
nav.top ul { display: flex; gap: 28px; list-style: none; }
nav.top ul a { color: var(--fg-dim); transition: color 0.2s; }
nav.top ul a:hover { color: var(--fg); }
nav.top .meta { display: flex; align-items: center; gap: 16px; color: var(--fg-dim); }
nav.top .theme-btn {
  background: none; border: 1px solid var(--line);
  color: var(--fg-dim); cursor: none;
  padding: 6px 12px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  transition: all 0.2s;
}
.theme-btn:hover { color: var(--fg); border-color: var(--fg-dim); }
@media (max-width: 720px) {
  nav.top ul { display: none; }
  nav.top { padding: 18px 20px; }
}

/* === Sections === */
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 64px; gap: 24px; flex-wrap: wrap; }
.section-header h2 { font-size: clamp(40px, 6vw, 80px); }
.section-header .meta-num { font-family: var(--mono); color: var(--fg-mute); font-size: 12px; letter-spacing: 0.1em; }

/* === Footer === */
footer {
  border-top: 1px solid var(--line);
  padding: 60px 0 40px;
  position: relative; z-index: 2;
  background: var(--bg);
}
footer .wrap { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; flex-wrap: wrap; }
footer .big {
  font-family: var(--serif);
  font-size: clamp(60px, 12vw, 180px);
  line-height: 0.9;
  letter-spacing: -0.04em;
}
footer .big em { font-style: italic; color: var(--accent); }
footer .meta { font-family: var(--mono); font-size: 11px; color: var(--fg-mute); letter-spacing: 0.1em; text-transform: uppercase; }

/* utility */
.divider { height: 1px; background: var(--line); margin: 0 32px; }
.tag { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-dim); }

/* hidden but present */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
