:root {
  --grid-lattice: #ffffff;
  --bg: #0c0c0d;
  --fg: #f2f2f0;
  --dim: #6a6a70;
  --grotesk: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
  --pad: 2rem;
}

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

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* persistent webgl background */
#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* text survives full-frame inversion via difference blend */
.masthead, .status, .section__head, .about__lead, .about__body,
.colophon__big, .colophon__meta, .scroll-cue,
.brand, .schem, .instance, .idx {
  mix-blend-mode: difference;
}

/* ===== tracking annotations (follow the 3D object) ===== */
.trackers {
  position: fixed; inset: 0; z-index: 15;
  pointer-events: none; mix-blend-mode: difference;
  transition: opacity 0.6s;
}
.trk {
  position: absolute; top: 0; left: 0;
  font-size: 0.55rem; letter-spacing: 0.08em;
  color: var(--fg); white-space: nowrap;
  transition: opacity 0.3s;
}
.trk i {
  display: block; width: 10px; height: 10px;
  border: 1px solid var(--fg);
  margin: -5px 0 3px -5px; /* box centered on the tracked point */
}

/* ===== fixed HUD ===== */
.masthead { position: fixed; top: 1.8rem; left: var(--pad); z-index: 20; }
.masthead__label { font-size: 0.62rem; letter-spacing: 0.16em; line-height: 1.8; }

.status {
  position: fixed; right: var(--pad); top: 1.8rem; z-index: 20;
  text-align: right; font-size: 0.6rem; letter-spacing: 0.12em; line-height: 1.9; color: var(--dim);
}
.status b { color: var(--fg); font-weight: 400; }
.dot { display: inline-block; width: 7px; height: 7px; background: var(--fg); border-radius: 50%; margin-left: 2px; vertical-align: middle; }

.readout {
  position: fixed; bottom: 1.1rem; left: var(--pad); right: var(--pad); z-index: 20;
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: 0.55rem; letter-spacing: 0.14em; color: var(--dim);
  mix-blend-mode: difference;
}

/* ===== scroll sections ===== */
/* no z-index here: a stacking context would isolate the difference blends
   from the canvas backdrop (DOM order already places it above #gl) */
.scroll { position: relative; }
.section {
  position: relative;
  min-height: 100vh;
  padding: 7rem var(--pad) 5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.section__head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2.5rem; }
.section__idx { font-size: 0.62rem; letter-spacing: 0.2em; color: var(--dim); }
.section__title {
  font-family: var(--grotesk); font-weight: 700;
  font-size: clamp(1.4rem, 3.4vw, 2.6rem); letter-spacing: 0.02em;
}

/* ----- HERO ----- */
.hero { justify-content: flex-end; }
.hero__inner { display: flex; align-items: flex-end; gap: 1.6rem; max-width: min(92vw, 920px); }
.brand {
  font-family: var(--grotesk); font-weight: 700;
  font-size: clamp(7rem, 26vh, 19rem); line-height: 0.78; letter-spacing: -0.02em;
  display: flex; align-items: baseline; user-select: none;
}
.brand__delim { font-family: var(--mono); display: inline-block; }
.hero__text { padding-bottom: 0.9rem; }
.schem { font-family: var(--grotesk); font-weight: 700; font-size: clamp(0.85rem, 1.7vw, 1.25rem); line-height: 1.15; }
.instance { margin-top: 0.9rem; font-size: 0.6rem; letter-spacing: 0.14em; color: var(--dim); }

.index { display: flex; margin-top: 1.4rem; }
.idx {
  background: transparent; color: var(--dim);
  border: 1px solid var(--grid-lattice); border-right: none;
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em;
  padding: 0.5rem 0.85rem; cursor: pointer; transition: color 0.2s, background 0.2s;
}
.idx:last-child { border-right: 1px solid var(--grid-lattice); }
.idx:hover, .idx.is-active { color: var(--bg); background: var(--fg); }

.scroll-cue {
  position: absolute; left: var(--pad); bottom: 2.6rem;
  font-size: 0.55rem; letter-spacing: 0.2em; color: var(--dim);
  display: none;
}

/* ----- WORKS (rides on the inverted white field) ----- */
.grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--grid-lattice); border: 1px solid var(--grid-lattice);
  transition: background 0.6s, border-color 0.6s;
}
.card {
  background: var(--bg);
  padding: 2rem 1.6rem; min-height: 220px;
  display: flex; flex-direction: column; gap: 0.7rem;
  transition: background 0.25s;
}
.card:hover { background: var(--fg); color: var(--bg); }
.card:hover .card__no, .card:hover .card__meta { color: var(--bg); }

/* inverted look: black hairlines around solid black cards on the white field */
body[data-look="1"] .grid { background: var(--bg); border-color: var(--bg); }
.card__no { font-size: 0.6rem; letter-spacing: 0.16em; color: var(--dim); }
.card__t { font-family: var(--grotesk); font-weight: 700; font-size: clamp(1.3rem, 2.6vw, 2.1rem); }
.card__d { font-size: 0.72rem; line-height: 1.7; max-width: 34ch; margin-top: auto; }
.card__meta { font-size: 0.55rem; letter-spacing: 0.16em; color: var(--dim); }

/* ----- ABOUT ----- */
.about__lead {
  font-family: var(--grotesk); font-weight: 300;
  font-size: clamp(1.4rem, 3.6vw, 3rem); line-height: 1.25; max-width: 20ch; letter-spacing: -0.01em;
}
.about__lead em { font-style: italic; }
.about__body { margin-top: 2rem; font-size: 0.8rem; line-height: 1.9; max-width: 52ch; color: var(--dim); }
.about__body b { color: var(--fg); }

/* ----- COLOPHON ----- */
.colophon { justify-content: space-between; min-height: 100vh; }
.colophon__big {
  font-family: var(--grotesk); font-weight: 700; line-height: 0.82;
  font-size: clamp(4rem, 16vw, 14rem); letter-spacing: -0.02em; margin-top: 4rem;
}
.colophon__meta { font-size: 0.62rem; letter-spacing: 0.12em; line-height: 2; color: var(--dim); }

/* reveal init state (GSAP animates from this) */
[data-reveal] { will-change: transform, opacity; }

@media (max-width: 720px) {
  :root { --pad: 1.2rem; }
  .status { display: none; }
  .readout span:nth-child(2) { display: none; }
  .hero__inner { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .brand { font-size: clamp(5rem, 22vw, 9rem); }
  .grid { grid-template-columns: 1fr; }
}
