/* ── SANT RESEARCH · deep-space monochrome ─────────────────────────────
   One committed world: void black, starlight white. The contact chapter
   inverts the universe. Motion is slow, staged, and revealing.
──────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #030303;
  --ink: #f4f4f4;
  --dim: rgba(244, 244, 244, 0.6);
  --faint: rgba(244, 244, 244, 0.32);
  --hairline: rgba(244, 244, 244, 0.13);
  --scrim: rgba(3, 3, 3, 0.5);
  --halo: rgba(3, 3, 3, 0.92);
  --font: "Helvetica Neue", Helvetica, "Segoe UI", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --reveal: 1.6s;
}

body.inverted {
  --bg: #f4f4f4;
  --ink: #080808;
  --dim: rgba(8, 8, 8, 0.6);
  --faint: rgba(8, 8, 8, 0.34);
  --hairline: rgba(8, 8, 8, 0.16);
  --scrim: rgba(244, 244, 244, 0.55);
  --halo: rgba(244, 244, 244, 0.92);
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  transition: background 1.6s var(--ease), color 1.6s var(--ease);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── space layers ── */
#nebula, #stars, #field {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
}

#nebula {
  animation: nebula-drift 160s ease-in-out infinite alternate;
  transition: opacity 1.6s var(--ease);
}

body.inverted #nebula { opacity: 0; }

@keyframes nebula-drift {
  0%   { transform: translate3d(-1.5%, -1%, 0) scale(1.04); }
  100% { transform: translate3d(1.5%, 1%, 0) scale(1.12); }
}

.vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 130% 110% at 50% 45%,
              transparent 55%, rgba(0, 0, 0, 0.38) 100%);
  transition: opacity 1.6s var(--ease);
  z-index: 3;
}

body.inverted .vignette { opacity: 0.25; }

/* ── header ── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 30px 40px;
  z-index: 20;
  transition: opacity 0.5s var(--ease);
}

/* expanded chapter: CLOSE takes the header corner */
body.expanded .site-header { opacity: 0; pointer-events: none; }

.wordmark, .contact-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.38em;
  transition: opacity 0.4s, color 1.6s var(--ease);
}

.wordmark { font-weight: 500; }
.contact-link { font-weight: 400; opacity: 0.55; }
.contact-link:hover, .wordmark:hover { opacity: 1; }

a:focus-visible, button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 5px;
}

/* ── chapter ticks ── */
.ticks {
  position: fixed; right: 34px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: flex-end; gap: 16px;
  z-index: 50;   /* stays clickable above the expand layer */
}

.tick {
  width: 14px; height: 1px;
  padding: 6px 0;                 /* generous hit area */
  border: 0;
  background: transparent;
  position: relative;
  cursor: pointer;
}

.tick::after {
  content: "";
  position: absolute; right: 0; top: 50%;
  width: 14px; height: 1px;
  background: var(--ink);
  opacity: 0.3;
  transition: width 0.7s var(--ease), opacity 0.5s, background 1.6s var(--ease);
}

.tick:hover::after { opacity: 0.7; }
.tick.active::after { width: 30px; opacity: 1; }

/* ── chapters ── */
.chapter {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 8vw;
  visibility: hidden;
  transition: visibility 0s linear 0.9s;
  z-index: 10;
  pointer-events: none;
}

.chapter.active {
  visibility: visible;
  transition: visibility 0s;
  pointer-events: auto;
}

/* staged reveal: each element carries --d (stagger step).
   Exits are quicker and un-staggered — the pause before the next copy
   arrives is deliberate: the field morphs alone for a beat. */
.eyebrow, .head, .body, .statement, .frames, .cta-row, .colophon,
.more, .hero-foot .hero-sub {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(10px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease),
    filter 0.7s var(--ease);
}

.chapter.active .eyebrow, .chapter.active .head, .chapter.active .body,
.chapter.active .statement, .chapter.active .frames, .chapter.active .cta-row,
.chapter.active .colophon, .chapter.active .more, .chapter.active .hero-sub {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  transition:
    opacity var(--reveal) var(--ease),
    transform var(--reveal) var(--ease),
    filter var(--reveal) var(--ease);
  transition-delay: calc(0.55s + var(--d, 0) * 0.3s);
}

/* first arrival: hold the hero copy back until the wordmark has condensed */
body.boot .chapter--hero.active .eyebrow,
body.boot .chapter--hero.active .hero-sub {
  transition-delay: calc(3.4s + var(--d, 0) * 0.5s);
}

/* ── copy blocks ── */
.copy { max-width: 640px; width: 100%; position: relative; }
.copy--center { text-align: center; }
.copy--right { margin-left: auto; text-align: right; }
.copy--wide { max-width: 1100px; }

/* legibility over the particle field:
   a soft ground-colored scrim behind each copy block… */
.copy::before, .hero-foot::before {
  content: "";
  position: absolute;
  inset: -16% -20%;
  background: radial-gradient(ellipse 100% 100% at 50% 50%,
              var(--scrim) 0%, transparent 68%);
  z-index: -1;
  pointer-events: none;
}

/* …and a same-color halo that masks particles directly behind the letters */
.eyebrow, .head, .body, .statement, .hero-sub,
.colophon, .frame-id, .frame-status, .frame-note, .meta {
  text-shadow: 0 0 6px var(--halo), 0 0 16px var(--halo), 0 0 34px var(--halo);
}

.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.38em;
  color: var(--dim);
  margin-bottom: 28px;
}

.statement {
  font-size: clamp(2rem, 5vw, 4.1rem);
  font-weight: 200;
  letter-spacing: -0.015em;
  line-height: 1.16;
  text-wrap: balance;
}

.statement--serif {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.7rem, 4.2vw, 3.4rem);
  color: var(--dim);
  margin-top: 0.4em;
}

.head {
  font-size: clamp(2rem, 4.4vw, 3.7rem);
  font-weight: 200;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin-bottom: 24px;
  text-wrap: balance;
}

.head--big { font-size: clamp(2.6rem, 6.2vw, 5.2rem); margin-bottom: 30px; }

.body {
  font-size: clamp(0.95rem, 1.25vw, 1.08rem);
  font-weight: 300;
  line-height: 1.7;
  color: var(--dim);
  max-width: 46ch;
}

.copy--right .body { margin-left: auto; }

/* ── hero ── */
.chapter--hero { align-items: flex-end; justify-content: center; }

.hero-foot {
  text-align: center;
  padding-bottom: 14vh;
  position: relative;
}

.hero-foot .eyebrow { margin-bottom: 14px; }

.hero-sub {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--faint);
}

/* ── placeholder project frames ── */
.frames {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.frame {
  position: relative;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--hairline);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,0.015), transparent 40%);
  transition: border-color 0.6s;
}

.frame::before, .frame::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border-color: var(--dim);
  border-style: solid;
  border-width: 0;
  opacity: 0.8;
  transition: width 0.6s var(--ease), height 0.6s var(--ease);
}

.frame::before { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.frame::after  { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }

.frame:hover { border-color: var(--dim); }
.frame:hover::before, .frame:hover::after { width: 30px; height: 30px; }

.frame-id {
  font-size: clamp(1.7rem, 2.6vw, 2.5rem);
  font-weight: 200;
  letter-spacing: 0.14em;
}

.frame-status {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.34em;
  color: var(--dim);
}

.frame-note {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--faint);
}

/* ── contact ── */
.cta {
  display: inline-block;
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.38em;
  padding: 20px 46px;
  border: 1px solid var(--ink);
  background: var(--scrim);
  transition: background 0.5s, color 0.5s, letter-spacing 0.8s var(--ease);
}

.cta:hover {
  background: var(--ink);
  color: var(--bg);
  letter-spacing: 0.5em;
}

.colophon {
  margin-top: 64px;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--faint);
}

/* ── learn-more: rest on it → 2s white fill → detonation ── */
.more {
  position: relative;
  display: inline-block;
  vertical-align: top;
  margin-top: 36px;
  padding: 17px 34px;
  border: 1px solid var(--hairline);
  background: var(--scrim);
  overflow: hidden;
  transition:
    opacity 0.7s var(--ease), filter 0.7s var(--ease),
    transform 0.7s var(--ease), border-color 0.5s;
}

.more:hover { border-color: var(--dim); }
.more:focus-visible { outline: 1px solid var(--ink); outline-offset: 5px; }

/* the fuse: particles condense INSIDE the pill (canvas-driven); the pill
   goes transparent so the swarm is the fill — border sharpens, it strains */
.more.filling {
  border-color: var(--ink);
  background: transparent;
  animation: pill-strain 0.09s linear infinite alternate;
}

@keyframes pill-strain {
  from { transform: translate(-0.6px, 0.4px); }
  to   { transform: translate(0.6px, -0.4px); }
}

.more-label {
  position: relative;
  z-index: 1;
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.34em;
  color: var(--dim);
  transition: color 0.4s;
}

.more:hover .more-label, .more.filling .more-label { color: var(--ink); }

/* detonated: the pill itself blows out */
.more.exploded {
  opacity: 0;
  transform: scale(1.3);
  filter: blur(8px);
  transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;
  pointer-events: none;
}

/* ── text fragments (shatter / assemble) ── */
.word { display: inline-block; white-space: nowrap; }
.frag { display: inline-block; will-change: transform, opacity; }

/* inline-block spans swallow letter-spacing between characters — restore it */
.eyebrow .frag, .d-eyebrow .frag { margin-right: 0.38em; }
.more-label .frag { margin-right: 0.34em; }
.head .frag, .d-title .frag, .statement .frag { margin-right: -0.015em; }

/* ── chapter expand: the detail builds in place of the compact chapter ──
   No popup, no backdrop: the same space, more information. While
   .building, elements materialize one by one; movement cancels (site.js
   reverses the classes); when the build completes it becomes .locked. */
.detail-layer {
  position: fixed; inset: 0;
  z-index: 40;
  pointer-events: none;
}

.detail-layer.locked { pointer-events: auto; }

.detail-close {
  position: absolute;
  top: 28px; right: 40px;
  padding: 10px 18px;
  border: 1px solid var(--hairline);
  background: var(--scrim);
  color: var(--ink);
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.34em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s, border-color 0.4s;
}

.detail-close:hover { border-color: var(--ink); }
.detail-layer.locked .detail-close { opacity: 1; pointer-events: auto; }

/* continue: bottom-center exit affordance for the captive page */
.detail-continue {
  position: absolute;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 22px;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.4em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s var(--ease) 0.9s, color 0.4s;
}

.detail-continue:hover { color: var(--ink); }

.dc-line {
  width: 1px; height: 26px;
  background: linear-gradient(var(--dim), transparent);
}

.detail-layer.locked .detail-continue { opacity: 1; pointer-events: auto; }

.d-cta { margin-bottom: 34px; }

.detail-scroll {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.detail-page {
  display: none;
  position: relative;
  max-width: 980px;
  width: 100%;
  padding: 0 8vw;
}

.detail-page.active { display: block; }

.detail-page::before {
  content: "";
  position: absolute;
  inset: -12% -16%;
  background: radial-gradient(ellipse 100% 100% at 50% 50%,
              var(--scrim) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* assembly is fragment-driven from JS (letters/words fly in from the
   debris field with randomized vectors) — no top-down staged fades here. */

.d-eyebrow {
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.38em;
  color: var(--dim);
  margin-bottom: 22px;
}

.d-title {
  font-size: clamp(1.9rem, 3.8vw, 3.2rem);
  font-weight: 200;
  letter-spacing: -0.015em;
  line-height: 1.08;
  margin-bottom: 22px;
  text-wrap: balance;
}

.d-lead {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  font-weight: 300;
  line-height: 1.55;
  color: var(--ink);
  max-width: 58ch;
  margin-bottom: 34px;
}

.d-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 34px;
}

.d-media .frame { aspect-ratio: 16 / 9; max-height: 24vh; }

.d-body {
  font-size: clamp(0.92rem, 1.15vw, 1.02rem);
  font-weight: 300;
  line-height: 1.65;
  color: var(--dim);
  max-width: 66ch;
  margin-bottom: 16px;
}

/* ── corner meta ── */
.meta {
  position: fixed; bottom: 30px;
  font-size: 10px;
  letter-spacing: 0.26em;
  color: var(--faint);
  z-index: 20;
  font-variant-numeric: tabular-nums;
  transition: color 1.6s var(--ease), opacity 2s var(--ease) 3.5s;
}

.meta--left { left: 40px; }
.meta--right { right: 40px; }

body.boot .meta { opacity: 0; }
body:not(.boot) .meta, body.boot .meta { opacity: 1; }
body.boot .meta { opacity: 0; animation: meta-in 2s var(--ease) 3.8s forwards; }

@keyframes meta-in { to { opacity: 1; } }

#chapter-index { transition: opacity 0.4s; }
#chapter-index.swap { opacity: 0; }

/* ── scroll hint ── */
.hint {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  z-index: 20;
  opacity: 0;
  animation: hint-in 2.4s var(--ease) 4.6s forwards;
  transition: opacity 0.9s;
}

.hint.hidden { animation: none; opacity: 0; }

@keyframes hint-in { to { opacity: 1; } }

.hint-label {
  font-size: 9px;
  letter-spacing: 0.44em;
  color: var(--faint);
}

.hint-line {
  width: 1px; height: 44px;
  background: linear-gradient(var(--dim), transparent);
  overflow: hidden;
  position: relative;
}

.hint-line::after {
  content: "";
  position: absolute; left: 0; top: -50%;
  width: 100%; height: 50%;
  background: var(--ink);
  animation: hint-drop 2.6s var(--ease) infinite;
}

@keyframes hint-drop {
  0%   { top: -50%; }
  70%, 100% { top: 110%; }
}

/* ── custom cursor ── */
.cursor { display: none; }

@media (pointer: fine) {
  body { cursor: none; }
  a, button { cursor: none; }

  .cursor { display: block; }

  .cursor-dot, .cursor-ring {
    position: fixed;
    top: 0; left: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    will-change: transform;
  }

  .cursor-dot {
    width: 4px; height: 4px;
    background: var(--ink);
    transition: background 1.6s var(--ease), opacity 0.3s;
  }

  .cursor-ring {
    width: 38px; height: 38px;
    border: 1px solid var(--faint);
    transition: border-color 1.6s var(--ease),
                width 0.5s var(--ease), height 0.5s var(--ease);
  }

  .cursor.hovering .cursor-ring { width: 64px; height: 64px; border-color: var(--ink); }
  .cursor.hovering .cursor-dot { opacity: 0; }
}

/* ── reduced motion: plain scrolling document ── */
@media (prefers-reduced-motion: reduce) {
  #nebula { animation: none; }
  .hint-line::after { animation: none; }
}

body.static { overflow: auto; }
body.static main { position: relative; }

body.static .chapter {
  position: relative;
  min-height: 100vh;
  visibility: visible;
  pointer-events: auto;
}

body.static .eyebrow, body.static .head, body.static .body,
body.static .statement, body.static .frames, body.static .cta-row,
body.static .colophon, body.static .hero-sub {
  opacity: 1; transform: none; filter: none; transition: none;
}

body.static .hint, body.static .ticks, body.static .meta { display: none; }

body.static .more { opacity: 1; transform: none; filter: none; }
body.static .detail-layer { transition: opacity 0.3s; }
body.static, body.static a, body.static button { cursor: auto; }
body.static .cursor { display: none; }

/* ── small screens ── */
@media (max-width: 760px) {
  .site-header { padding: 22px 24px; }
  .ticks { right: 18px; }
  .chapter { padding: 0 10vw; }
  .frames { grid-template-columns: 1fr; gap: 14px; }
  .frame { aspect-ratio: 5 / 2; }
  .copy--right { text-align: left; }
  .copy--right .body { margin-left: 0; }
  .hero-foot { padding-bottom: 12vh; }
  .meta--left { left: 24px; }
  .meta--right { right: 24px; }
  .detail-close { top: 20px; right: 24px; }
  .detail-frame { inset: 12px; }
  .d-media { grid-template-columns: 1fr; }
}
