:root {
  --ink: #0d0d0e;
  --paper: #ece9e2;
  --paper-dim: rgba(236, 233, 226, 0.55);
  --paper-faint: rgba(236, 233, 226, 0.28);
  --yellow: #fdc922;
  --hairline: rgba(236, 233, 226, 0.14);
  --pad: clamp(20px, 4vw, 64px);
  --anno: rgba(253, 201, 34, 0.85);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: "Playfair Display", Georgia, serif;
  min-height: 100svh;
  overflow-x: hidden;
}

.mono {
  font-family: "IBM Plex Mono", "SF Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.serif { font-family: "Playfair Display", Georgia, serif; }

/* ---------- generative substrate ---------- */

#field {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  z-index: 0;
  display: block;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(4) infinite;
}

@keyframes grain-shift {
  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%); }
}

/* ---------- header ---------- */

.site-header {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(var(--pad) * 0.6) var(--pad);
}

.wordmark img {
  width: 92px;
  height: auto;
  display: block;
  /* crop wordmark's built-in canvas padding */
  margin: -14px 0 0 -6px;
}

.session { text-align: right; color: var(--paper-dim); }

.session button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  padding: 2px 0;
}

.session-line { display: block; color: var(--paper); }
.session-line:hover { color: var(--yellow); }
#seedLabel { color: var(--yellow); }

.session-controls { margin-top: 6px; display: flex; gap: 14px; justify-content: flex-end; }
.session-controls button:hover { color: var(--yellow); }
.session-controls button[aria-pressed="true"] { color: var(--yellow); }

/* ---------- hero ---------- */

main {
  position: relative;
  z-index: 3;
  padding: 0 var(--pad);
}

.hero {
  min-height: 62svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: clamp(40px, 7vh, 90px);
  max-width: 1400px;
}

.hero h1 {
  font-weight: 400;
  font-size: clamp(44px, 8.2vw, 128px);
  line-height: 0.98;
  letter-spacing: -0.01em;
}

.hero h1 .line { display: block; }
.hero h1 .accent em { color: var(--yellow); font-style: italic; }

.lede {
  margin-top: 34px;
  max-width: 560px;
  line-height: 1.75;
  color: var(--paper-dim);
}

.lede.dim { margin-top: 14px; color: var(--paper-faint); }

/* ---------- ledger ---------- */

.ledger {
  margin-top: clamp(40px, 8vh, 110px);
  padding-bottom: clamp(60px, 10vh, 140px);
  max-width: 1400px;
}

.ledger-head,
.row {
  display: grid;
  grid-template-columns: 130px 1fr 1fr 170px;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0;
  border-top: 1px solid var(--hairline);
}

.ledger-head {
  color: var(--paper-faint);
  border-top: none;
  padding-bottom: 10px;
  font-size: 10px;
}

.row {
  color: var(--paper);
  text-decoration: none;
  transition: background 0.35s ease, padding-left 0.35s ease;
}

.row .idx { color: var(--paper-dim); }
.row .title { font-size: clamp(24px, 3vw, 40px); line-height: 1; }
.row .class, .row .status { color: var(--paper-dim); }

a.row:hover { background: rgba(236, 233, 226, 0.045); padding-left: 12px; }
a.row:hover .title { color: var(--yellow); }
a.row:hover .idx { color: var(--yellow); }

.row.pending .redacted { color: var(--paper-faint); letter-spacing: -0.04em; }
.row.pending .status.live { color: var(--yellow); }
.row.empty { opacity: 0.35; }

.pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  margin-right: 8px;
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ---------- footer ---------- */

.site-footer {
  position: relative;
  z-index: 3;
  display: flex;
  gap: 28px;
  align-items: baseline;
  padding: 20px var(--pad) 26px;
  border-top: 1px solid var(--hairline);
  color: var(--paper-dim);
}

.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--yellow); }
.foot-mid { flex: 1; }
.foot-links { display: flex; gap: 14px; }
.ver { color: var(--paper-faint); }

/* ---------- annotation layer ---------- */

.anno-grid {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background-image: repeating-linear-gradient(
    to right,
    rgba(253, 201, 34, 0.10) 0,
    rgba(253, 201, 34, 0.10) 1px,
    transparent 1px,
    transparent calc((100vw - 2 * var(--pad)) / 12)
  );
  background-position: var(--pad) 0;
  background-size: calc(100vw - 2 * var(--pad)) 100%;
  background-repeat: no-repeat;
}

.anno-panel {
  position: fixed;
  right: var(--pad);
  bottom: 84px;
  z-index: 4;
  min-width: 230px;
  padding: 14px 16px;
  border: 1px dashed var(--anno);
  background: rgba(13, 13, 14, 0.94);
  color: var(--anno);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.anno-panel-title { font-size: 10px; margin-bottom: 10px; opacity: 0.7; }

.anno-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 18px;
  font-size: 11px;
}

.anno-panel dd { text-align: right; }

.anno-tag {
  position: fixed;
  z-index: 2;
  color: var(--anno);
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.anno-tag-field { left: var(--pad); bottom: 84px; }

.anno-outline { position: relative; }

.anno-outline::before {
  content: attr(data-label);
  position: absolute;
  top: -18px;
  left: -13px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--anno);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.anno-outline::after {
  content: "";
  position: absolute;
  inset: -12px;
  border: 1px dashed rgba(253, 201, 34, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

body.reveal .anno-grid,
body.reveal .anno-tag,
body.reveal .anno-outline::before,
body.reveal .anno-outline::after { opacity: 1; }

body.reveal .anno-panel {
  opacity: 1;
  transform: none;
}

/* ---------- project views ---------- */

.backline { padding: 6px 0 0; }
.backline a, .nextline a { color: var(--paper-dim); text-decoration: none; }
.backline a:hover, .nextline a:hover { color: var(--yellow); }

.proj-head {
  max-width: 1400px;
  padding: clamp(28px, 5vh, 64px) 0 clamp(20px, 3vh, 40px);
}

.proj-head .idx { color: var(--paper-dim); }
.proj-head .idx::before { content: ""; }

.proj-head h1 {
  font-weight: 400;
  font-size: clamp(48px, 7.5vw, 116px);
  line-height: 1;
  margin: 10px 0 18px;
}

.proj-head .statement {
  font-size: clamp(20px, 2.2vw, 30px);
  color: var(--paper-dim);
}

.proj-head .statement em { color: var(--yellow); }

.film { max-width: 1400px; margin-top: 12px; }

.film-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--hairline);
}

.film-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.record {
  max-width: 1400px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 72px);
  padding: clamp(36px, 6vh, 72px) 0;
}

.rec-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--paper-faint);
  margin-bottom: 16px;
}

.record p {
  line-height: 1.75;
  color: var(--paper-dim);
  margin-bottom: 14px;
  max-width: 560px;
}

.meta {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 20px;
  border-top: 1px solid var(--hairline);
  padding-top: 18px;
}

.meta dt { color: var(--paper-faint); }
.meta dd { color: var(--paper-dim); }

.specimens { max-width: 1400px; padding-bottom: clamp(40px, 7vh, 90px); }

.spec-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-flow: dense;
  gap: clamp(14px, 2vw, 28px);
}

.fig { grid-column: span 6; margin: 0; }
.fig.wide { grid-column: span 12; }
.fig.portrait { grid-column: span 3; }

.fig video {
  width: 100%;
  display: block;
  background: #000;
  border: 1px solid var(--hairline);
}

.fig figcaption {
  padding-top: 8px;
  color: var(--paper-faint);
  font-size: 10px;
}

.nextline {
  max-width: 1400px;
  padding: 0 0 clamp(48px, 8vh, 100px);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .ledger-head { display: none; }
  .ledger-head, .row {
    grid-template-columns: 90px 1fr;
    grid-auto-rows: auto;
    gap: 6px 16px;
  }
  .row .class { grid-column: 2; }
  .row .status { grid-column: 2; }
  .site-header { flex-direction: column; gap: 18px; }
  .session { text-align: left; }
  .session-controls { justify-content: flex-start; }
  .anno-panel { display: none; }
  .record { grid-template-columns: 1fr; }
  .fig { grid-column: span 12; }
  .fig.portrait { grid-column: span 6; }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .pulse { animation: none; }
  html { scroll-behavior: auto; }
}
