/* ============================================================
   NOCTURNE — styles.css
   Pure black / white system · acid lime accent · motion-driven
   ============================================================ */

:root {
  --bg: #000000;
  --bg-soft: #0a0a0b;
  --ink: #fafafa;
  --ink-dim: #8f8f96;
  --line: rgba(250, 250, 250, 0.12);
  --accent: #d4ff3f;
  --accent-dim: rgba(212, 255, 63, 0.35);
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --z-cursor: 100;
  --z-noise: 90;
  --z-nav: 50;
  --z-preloader: 200;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2e var(--bg);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #000; }

a { color: inherit; text-decoration: none; }
em { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: 0.01em; }

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

/* custom cursor active → hide native (fine pointers only) */
html.cursor-on, html.cursor-on a, html.cursor-on button { cursor: none; }
html.cursor-on * { cursor: none !important; }

/* ---------- scroll progress ---------- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px;
  z-index: calc(var(--z-nav) + 1); pointer-events: none;
}
.progress span {
  display: block; height: 100%; width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}

/* ---------- film grain ---------- */
.noise {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  z-index: var(--z-noise);
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

/* ---------- cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  z-index: var(--z-cursor);
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  will-change: transform;
}
html.cursor-on .cursor-dot, html.cursor-on .cursor-ring { opacity: 1; }
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  margin: -3px 0 0 -3px;
}
.cursor-ring {
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid rgba(250, 250, 250, 0.5);
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out),
              margin 0.25s var(--ease-out), border-color 0.25s, background-color 0.25s;
}
.cursor-ring.is-hover {
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  border-color: var(--accent);
  background: rgba(212, 255, 63, 0.08);
}
.cursor-ring.is-down { transform-origin: center; }

/* ---------- preloader ---------- */
.preloader {
  position: fixed; inset: 0;
  z-index: var(--z-preloader);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.9s var(--ease-out), visibility 0s linear 0.9s;
}
.preloader.done { transform: translateY(-101%); visibility: hidden; }
.preloader__inner { text-align: center; }
.preloader__count {
  display: block;
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.preloader__label {
  display: block; margin-top: 1rem;
  font-size: 0.65rem; letter-spacing: 0.35em;
  color: var(--ink-dim);
}
.preloader__bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: rgba(250, 250, 250, 0.08);
}
.preloader__bar span {
  display: block; height: 100%; width: 0%;
  background: var(--accent);
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: var(--z-nav);
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  transition: background-color 0.35s, backdrop-filter 0.35s, border-color 0.35s, padding 0.35s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.nav__logo {
  font-weight: 700; letter-spacing: 0.06em; font-size: 0.95rem;
  display: inline-block;
}
.nav__logo sup { color: var(--accent); font-size: 0.55rem; }
.nav__links { display: flex; gap: clamp(1rem, 3vw, 2.5rem); }
.nav__links a {
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim);
  position: relative; padding: 0.5rem 0;
  transition: color 0.25s;
  display: inline-block;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: 0.25rem;
  width: 100%; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.35s var(--ease-out);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__clock {
  font-size: 0.72rem; letter-spacing: 0.18em;
  color: var(--ink-dim); font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) { .nav__clock { display: none; } .nav__links { gap: 1rem; } }
@media (max-width: 560px) {
  .nav { padding-left: 1rem; padding-right: 1rem; }
  .nav__logo { font-size: 0.78rem; }
  .nav__links { gap: 0.7rem; }
  .nav__links a { font-size: 0.6rem; letter-spacing: 0.07em; padding: 0.4rem 0; }
}

/* ---------- generic reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out) var(--d, 0s),
              transform 0.9s var(--ease-out) var(--d, 0s);
}
[data-reveal].in { opacity: 1; transform: translateY(0); }

.section-tag {
  display: inline-block;
  font-size: 0.68rem; letter-spacing: 0.35em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2rem;
}
.section-tag::before {
  content: ""; display: inline-block;
  width: 2rem; height: 1px; background: var(--accent);
  vertical-align: middle; margin-right: 0.9rem;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column;
  justify-content: center;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  overflow: hidden;
}
#hero-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.hero__glow {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 70% 20%, rgba(212, 255, 63, 0.07), transparent 70%),
    radial-gradient(ellipse 50% 40% at 15% 85%, rgba(120, 140, 255, 0.06), transparent 70%);
}
.hero__title {
  position: relative;
  font-size: clamp(3.4rem, 13.5vw, 13rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.95;
  user-select: none;
}
.hero__letters { display: block; white-space: nowrap; }
.hero__letter {
  display: inline-block;
  transform: translateY(115%) rotate(6deg);
  opacity: 0;
  transition: transform 1s var(--ease-out), opacity 0.6s ease;
  transition-delay: calc(var(--i) * 55ms + 150ms);
}
body.loaded .hero__letter { transform: translateY(0) rotate(0deg); opacity: 1; }
.hero__title sup {
  font-size: 0.18em; color: var(--accent);
  vertical-align: super; letter-spacing: 0;
}
.hero__sub {
  position: relative;
  max-width: 34ch;
  margin-top: 2.25rem;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  color: var(--ink-dim);
  line-height: 1.55;
}
.hero__sub em { color: var(--ink); }
.hero__meta {
  position: relative;
  display: flex; gap: 2.5rem; flex-wrap: wrap;
  margin-top: 3rem;
  font-size: 0.66rem; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--ink-dim);
}
.hero__scroll {
  position: absolute; right: clamp(1.25rem, 4vw, 3rem); bottom: 2.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
  font-size: 0.62rem; letter-spacing: 0.35em; color: var(--ink-dim);
  writing-mode: vertical-rl;
  transition: color 0.25s;
}
.hero__scroll:hover { color: var(--accent); }
.hero__scroll-line {
  width: 1px; height: 56px;
  background: linear-gradient(var(--accent), transparent);
  animation: drip 1.8s var(--ease-out) infinite;
}
@keyframes drip {
  0% { transform: scaleY(0); transform-origin: top; }
  45% { transform: scaleY(1); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- marquee ---------- */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: 1.4rem 0;
  background: var(--bg-soft);
}
.marquee__track {
  display: flex; width: max-content;
  animation: marquee 26s linear infinite;
}
.marquee__track span {
  font-size: clamp(1.6rem, 4vw, 3.2rem);
  font-weight: 600; letter-spacing: -0.02em;
  text-transform: uppercase;
  padding-right: 2.5rem;
  white-space: nowrap;
}
.marquee__track span:nth-child(even) {
  color: transparent;
  -webkit-text-stroke: 1px rgba(250, 250, 250, 0.45);
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- manifesto ---------- */
.manifesto {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(7rem, 16vh, 12rem) clamp(1.25rem, 4vw, 3rem);
}
.manifesto__text {
  font-size: clamp(1.6rem, 3.6vw, 3.1rem);
  font-weight: 500;
  line-height: 1.32;
  letter-spacing: -0.02em;
}
.manifesto__text .w {
  opacity: 0.14;
  transition: opacity 0.4s ease, color 0.4s ease;
}
.manifesto__text .w.lit { opacity: 1; }
.manifesto__text .w.accent.lit { color: var(--accent); }

/* ---------- works ---------- */
.works {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem) clamp(7rem, 16vh, 11rem);
}
.works__head {
  display: flex; flex-direction: column;
  margin-bottom: 4rem;
}
.works__title {
  font-size: clamp(2.6rem, 7vw, 5.5rem);
  font-weight: 600; letter-spacing: -0.03em; line-height: 1.02;
}
.works__title em { color: var(--accent); }
.works__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
}
@media (max-width: 820px) { .works__grid { grid-template-columns: 1fr; } }

.card { perspective: 1200px; }
.card__inner {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-soft);
  transform-style: preserve-3d;
  transition: border-color 0.35s, transform 0.5s var(--ease-out), box-shadow 0.5s;
  will-change: transform;
}
.card:hover .card__inner,
.card:focus-visible .card__inner {
  border-color: var(--accent-dim);
  box-shadow: 0 30px 80px -30px rgba(212, 255, 63, 0.14);
}
.card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.card__media canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  transition: transform 0.8s var(--ease-out), filter 0.5s;
}
.card:hover .card__media canvas { transform: scale(1.05); filter: brightness(1.12); }
.card__glare {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  mix-blend-mode: screen;
}
.card:hover .card__glare { opacity: 1; }
.card__meta {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 1.4rem 1.5rem 1.5rem;
  gap: 1rem;
}
.card__meta h3 {
  font-size: 1.15rem; font-weight: 600; letter-spacing: 0.02em;
}
.card__meta p { color: var(--ink-dim); font-size: 0.85rem; margin-top: 0.2rem; }
.card__year {
  font-size: 0.72rem; letter-spacing: 0.2em; color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.card__arrow {
  position: absolute; top: 1.1rem; right: 1.1rem;
  width: 2.4rem; height: 2.4rem;
  padding: 0.55rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  color: var(--ink);
  opacity: 0;
  transform: rotate(-45deg) scale(0.8);
  transition: opacity 0.35s, transform 0.45s var(--ease-out), background-color 0.3s, color 0.3s;
}
.card:hover .card__arrow,
.card:focus-visible .card__arrow {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* ---------- playground ---------- */
.playground {
  position: relative;
  height: min(92svh, 900px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
#play-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.playground__overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  pointer-events: none;
}
.playground__overlay h2 {
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 600; letter-spacing: -0.03em; line-height: 1.05;
  mix-blend-mode: difference;
}
.playground__overlay h2 em { color: var(--accent); mix-blend-mode: normal; }
.playground__hint {
  margin-top: 1.5rem;
  font-size: 0.72rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--ink-dim);
  transition: opacity 0.6s;
}
.playground__hint.gone { opacity: 0; }

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(5rem, 12vh, 8rem) clamp(1.25rem, 4vw, 3rem);
  gap: 2rem;
}
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { border-left: 1px solid var(--line); padding-left: 1.5rem; }
.stat__num {
  display: block;
  font-size: clamp(2.6rem, 5.5vw, 4.5rem);
  font-weight: 600; letter-spacing: -0.03em; line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat__label {
  display: block; margin-top: 0.7rem;
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim);
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: clamp(6rem, 14vh, 10rem) clamp(1.25rem, 4vw, 3rem) 2rem;
  max-width: 1280px;
  margin: 0 auto;
}
.footer__cta {
  font-size: clamp(2.8rem, 8.5vw, 7.5rem);
  font-weight: 600; letter-spacing: -0.04em; line-height: 1;
}
.footer__cta em { color: var(--accent); }
.footer__mail {
  display: inline-block;
  margin-top: 3rem;
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  font-weight: 500;
  position: relative;
  padding-bottom: 0.35rem;
}
.footer__mail::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 2px; background: var(--accent);
  transform: scaleX(0.22); transform-origin: left;
  transition: transform 0.5s var(--ease-out);
}
.footer__mail:hover::after { transform: scaleX(1); }
.footer__socials { display: flex; gap: 1rem; margin-top: 3rem; }
.footer__socials a {
  display: grid; place-items: center;
  width: 48px; height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-dim);
  transition: color 0.3s, border-color 0.3s, background-color 0.3s;
}
.footer__socials a:hover {
  color: #000; border-color: var(--accent); background: var(--accent);
}
.footer__socials svg { width: 18px; height: 18px; }
.footer__bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  margin-top: 6rem; padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-dim);
}
.footer__bar a { transition: color 0.25s; }
.footer__bar a:hover { color: var(--accent); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .hero__letter { transform: none; opacity: 1; }
  .marquee__track { animation: none; }
  .noise { animation: none; }
}
