/* Ray K. · the blob. Two grounds, one design: every colour is a token, and data-theme on <html> picks them.
   Sentient for reading and display, Cabinet Grotesk for small interface text, in sentence case at a size you
   can read, and Martian Mono only where the machine itself is speaking. */
@font-face { font-family: "Sentient"; src: url("fonts/sentient.woff2") format("woff2"); font-weight: 200 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Cabinet Grotesk"; src: url("fonts/cabinet-grotesk.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Martian Mono"; src: url("fonts/martian-mono.woff2") format("woff2"); font-weight: 300 600; font-stretch: 75% 112.5%; font-style: normal; font-display: swap; }
:root, [data-theme="light"] {
  color-scheme: light;
  --ground: #ece5d4;
  --sheet: url("assets/paper.png") 0 0 / 256px 256px, radial-gradient(130% 120% at 62% 44%, #efe8d9 0%, #ece5d4 55%, #e8dfc9 100%);
  --hire-wash: rgba(196, 164, 96, .09);
  --ink: #1c1b19;
  --ink-rgb: 28, 27, 25;
  --ink-85: rgba(28, 27, 25, .86);
  --ink-60: rgba(28, 27, 25, .62);
  --mute: #6d685e;
  --mute-2: #8a8477;
  --hair: rgba(28, 27, 25, .16);
  --hair-2: rgba(28, 27, 25, .09);
  --gold-rgb: 146, 108, 40;
  --solid-hover: #33312e;
}
[data-theme="dark"] {
  color-scheme: dark;
  --ground: #191613;
  --sheet: url("assets/paper-dark.png") 0 0 / 256px 256px, radial-gradient(62% 72% at 68% 44%, rgba(127, 85, 25, .3) 0%, rgba(127, 85, 25, .1) 48%, rgba(127, 85, 25, 0) 78%), #191613;
  --hire-wash: rgba(127, 85, 25, .13);
  --ink: #ece5d4;
  --ink-rgb: 236, 229, 212;
  --ink-85: rgba(236, 229, 212, .85);
  --ink-60: rgba(236, 229, 212, .62);
  --mute: #a39b8b;
  --mute-2: #857e70;
  --hair: rgba(236, 229, 212, .17);
  --hair-2: rgba(236, 229, 212, .09);
  --gold-rgb: 205, 165, 92;
  --solid-hover: #fffaf0;
}
:root {
  --display: "Cabinet Grotesk", "Helvetica Neue", Arial, sans-serif;
  --serif: "Sentient", Georgia, "Times New Roman", serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --small: clamp(.875rem, .35vw + .78rem, 1rem);
  --gutter: clamp(20px, 4.2vw, 72px);
  --maxw: 1760px;
  --edge: max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
}

* { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1.05rem/1.5 var(--serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
p a, .sec-foot a, .foot a { text-decoration: underline; text-decoration-color: var(--hair); text-decoration-thickness: 1px; text-underline-offset: .22em; transition: text-decoration-color .35s; }
p a:hover, .sec-foot a:hover, .foot a:hover { text-decoration-color: currentColor; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
textarea { font: inherit; color: inherit; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 3px; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--ink); color: var(--ground); font: 500 var(--small) var(--display); padding: .5em .8em; }
.skip:focus { top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* the machine's voice: condensed, so it reads as a readout and not as a label style */
.machine, .log, .peaks, .rack-cap, .draft-head, .draft-why, .tbl .num { font-family: var(--mono); font-stretch: 75%; font-weight: 400; letter-spacing: 0; }

/* ---------- the sheet: a very gentle wash under a fine static tooth ---------- */
.paper, .bar::before { background: var(--sheet); background-attachment: fixed; }
.paper { position: fixed; inset: 0; z-index: -1; }

/* ---------- the stage ---------- */
.stage { position: fixed; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.stage canvas {
  --fade: 1; display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 1.6s ease;
  /* in the macro the digits fill the frame: the drawing dissolves into the ground under the copy */
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, var(--fade)) 26%, #000 50%);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, var(--fade)) 26%, #000 50%);
}
.stage.live canvas { opacity: 1; }
.poster { position: absolute; right: 2%; top: 50%; width: min(58vw, 980px); height: auto; transform: translateY(-50%); display: none; }
.stage.nogl .poster { display: block; }
.stage.nogl canvas { display: none; }

/* ---------- header ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
  padding: 20px var(--edge) 18px;
  pointer-events: none;
}
/* the bar is the ground itself: it hides what scrolls under it with no visible edge */
.bar::before { content: ""; position: absolute; inset: 0 0 -14px 0; z-index: -1; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.bar > * { pointer-events: auto; }
.mark { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.mark-name { font: 500 1.1rem/1 var(--display); letter-spacing: -.01em; }
.mark-handle { font: 400 var(--small)/1 var(--display); color: var(--mute); }
.nav { display: flex; gap: clamp(16px, 2.2vw, 30px); }
.nav a { font: 400 var(--small)/1 var(--display); color: var(--mute); padding: 6px 0; white-space: nowrap; transition: color .35s; }
.nav a:hover, .nav a.is-current { color: var(--ink); }

/* ---------- type ---------- */
.eyebrow { margin: 0; font: 400 var(--small)/1.4 var(--display); color: var(--mute); }
.h1 { margin: 1.5rem 0 0; font-weight: 400; }
.stem { display: block; font: 400 clamp(1.15rem, 1.55vw, 1.6rem)/1.2 var(--serif); letter-spacing: -.005em; color: var(--ink-85); }
.line { position: relative; display: block; min-height: 2.06em; margin-top: .22em; font: 300 clamp(3rem, 5.5vw, 7rem)/1.0 var(--serif); letter-spacing: -.028em; color: var(--ink); }
.line-text {
  --m: 1; position: absolute; left: 0; top: 0; width: 6.9em; display: block; opacity: 0; will-change: opacity, transform;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(var(--m) * 140% - 40%), transparent calc(var(--m) * 140%));
  mask-image: linear-gradient(to bottom, #000 calc(var(--m) * 140% - 40%), transparent calc(var(--m) * 140%));
}
.h2 { margin: 0; font: 300 clamp(2.1rem, 3.9vw, 4rem)/1.04 var(--serif); letter-spacing: -.022em; max-width: 21ch; text-wrap: balance; }
.lede, .sec-lede { font-size: clamp(1.05rem, 1.25vw, 1.2rem); line-height: 1.5; color: var(--ink-85); max-width: 44ch; margin: 1.2rem 0 0; }
.sec-lede { max-width: 56ch; margin-top: 1.2rem; }
.sec-foot { font-size: 1rem; color: var(--mute); max-width: 62ch; margin: 2.4rem 0 0; }

/* ---------- actions: a thin rule and a word; only the thing you must decide gets ink ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 500 var(--small)/1 var(--display);
  padding: .68em 1.05em .72em; border: 1px solid var(--hair); color: var(--ink); background: transparent;
  transition: border-color .35s, background .35s, color .35s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn-solid { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.btn-solid:hover { background: var(--solid-hover); border-color: var(--solid-hover); }
.btn-big { font-size: 1.06rem; padding: .85em 1.5em .9em; margin-top: 2.4rem; }
.btn[hidden] { display: none; }
.btn:disabled { opacity: .55; cursor: default; }
.link { font: 400 clamp(1rem, 1.1vw, 1.1rem)/1.3 var(--serif); padding-bottom: 2px; border-bottom: 1px solid var(--hair); transition: border-color .35s; }
.link:hover { border-bottom-color: var(--ink); }
.link-strong { border-bottom-color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  position: relative; z-index: 2; height: 100svh; min-height: 560px;
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); align-items: center;
  padding: 12vh var(--edge) 9vh; margin: 0;
}
.hero-copy { position: relative; }
.hero-close { position: absolute; left: 0; right: 0; top: calc(var(--small) * 1.4 + 1.5rem); opacity: 0; }
.close-line { margin: 0; font: 300 clamp(2.4rem, 4.6vw, 5.6rem)/1.02 var(--serif); letter-spacing: -.026em; max-width: 12.5ch; }
.hero-close .lede { margin-top: 1.4rem; }
.hero-note { position: absolute; left: 0; top: 100%; margin: 1.3rem 0 0; max-width: 38ch; font: 400 var(--small)/1.45 var(--display); color: var(--mute); opacity: 0; }
.cta-row { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 1.6rem; }
.is-close .cta-row { opacity: 0 !important; pointer-events: none; }
.hero-object { min-height: 30vh; }
.anchor { position: absolute; inset: 0; pointer-events: none; }
.scroll-cue { position: absolute; left: var(--edge); bottom: 4vh; margin: 0; font: 400 var(--small)/1 var(--display); color: var(--mute-2); transition: opacity 1s ease; }
.hero.is-close .scroll-cue { opacity: 0; }

/* ---------- sections ---------- */
.sec { position: relative; z-index: 2; padding: clamp(96px, 14vh, 190px) var(--gutter); max-width: var(--maxw); margin: 0 auto; }
.sec-head { max-width: 64rem; }
.anchor-sort { position: absolute; right: var(--gutter); top: clamp(80px, 11vh, 150px); width: clamp(220px, 24vw, 400px); height: clamp(210px, 28vh, 320px); pointer-events: none; }

/* approval: a ledger on the ground */
.gate-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(280px, 5fr); gap: clamp(32px, 4vw, 64px); margin-top: clamp(40px, 6vh, 72px); align-items: start; }
.drafts { list-style: none; margin: 0; padding: 0; display: grid; }
.draft { position: relative; padding: 22px 0 26px; border-top: 1px solid var(--hair); transition: opacity 1s ease; }
.draft:last-child { border-bottom: 1px solid var(--hair); }
.draft[data-state="rejected"] { opacity: .55; }
.draft-head { display: grid; gap: 4px; font-size: .8rem; line-height: 1.35; color: var(--mute); padding-right: 9rem; }
.draft-to { color: var(--ink); overflow-wrap: anywhere; }
.draft-why { margin: .75rem 0 .5rem; font-size: .8rem; line-height: 1.5; color: var(--mute); }
.draft-why::before { content: "Agent: "; color: var(--ink); }
.draft-text { width: 100%; display: block; background: transparent; border: 0; border-bottom: 1px solid var(--hair); padding: .3rem 0 .6rem; font: 400 1.08rem/1.45 var(--serif); color: var(--ink); resize: none; field-sizing: content; min-height: 3.6em; transition: border-color .35s; border-radius: 0; }
.draft-text:focus { outline: none; border-bottom-color: var(--ink); }
.draft-text[readonly] { color: var(--ink-60); }
.draft-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1rem; }
.stamp { position: absolute; top: 20px; right: 0; font: 500 var(--small)/1 var(--display); color: var(--mute); opacity: 0; transition: opacity .9s ease; }
.draft[data-state="approved"] .stamp, .draft[data-state="sent"] .stamp, .draft[data-state="rejected"] .stamp { opacity: 1; }
.draft[data-state="approved"] .stamp, .draft[data-state="sent"] .stamp { color: var(--ink); }
.draft[data-state="rejected"] .stamp { text-decoration: line-through; }

.record { position: sticky; top: 84px; display: grid; gap: 18px; }
.anchor-slot { position: relative; height: clamp(240px, 38vh, 420px); }
.counter { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-top: 1px solid var(--hair); padding-top: 14px; }
.counter-label, .record-title, .field-label { font: 400 var(--small)/1.2 var(--display); color: var(--mute); }
.counter-num { font: 300 2.2rem/1 var(--serif); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.record-title { margin: 6px 0 0; }
#self-approve { justify-self: start; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; max-height: 15.5rem; overflow: auto; font-size: .78rem; line-height: 1.45; scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }
.log li { display: grid; grid-template-columns: 1.8em 5.4em minmax(0, 1fr); gap: .6em; border-left: 1px solid var(--hair); padding-left: .8em; overflow-wrap: anywhere; animation: logline 1s ease; }
.log .no { color: var(--mute); }
.log .hash { color: var(--mute-2); }
.log li.good { border-left-color: var(--ink-60); }
.log li.bad { border-left: 2px solid var(--ink); font-weight: 500; }
@keyframes logline { from { opacity: 0; } to { opacity: 1; } }

/* sorting */
.sorter-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 4vw, 64px); margin-top: clamp(40px, 6vh, 72px); align-items: start; }
.field-label { display: block; margin-bottom: 10px; }
.field { width: 100%; display: block; background: transparent; color: var(--ink); border: 0; border-bottom: 1px solid var(--ink-60); border-radius: 0; padding: 8px 0 12px; font: 400 1.05rem/1.45 var(--serif); resize: none; field-sizing: content; min-height: 4.4em; transition: border-color .35s; }
.field:focus { outline: none; border-bottom-color: var(--ink); }
.tries { display: grid; gap: 4px; margin-top: 14px; justify-items: start; }
.try { font: 400 var(--small)/1.4 var(--display); color: var(--mute); text-align: left; padding: 2px 0; border-bottom: 1px solid transparent; transition: color .35s, border-color .35s; }
.try:hover { color: var(--ink); border-bottom-color: var(--hair); }
.rack-frame { position: relative; }
.rack { display: block; width: 100%; aspect-ratio: 5 / 2; }
.rack-cap { position: absolute; top: 4px; font-size: .75rem; line-height: 1; color: var(--mute); }
.rack-cap-l { left: 0; }
.rack-cap-r { right: 0; }
.peaks { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; font-size: .8rem; line-height: 1.4; }
.peaks li { display: grid; grid-template-columns: 1.6em minmax(0, 1fr) 4em; gap: 12px; align-items: baseline; color: var(--mute); border-bottom: 1px solid var(--hair-2); padding-bottom: 6px; }
.peaks li:first-child { color: var(--ink); }
.peaks .pk-n { color: var(--mute-2); }
.peaks .pk-p { text-align: right; font-variant-numeric: tabular-nums; }
.verdict { margin: 1.3rem 0 0; font: 300 clamp(1.6rem, 2.5vw, 2.3rem)/1.1 var(--serif); letter-spacing: -.018em; min-height: 2.3em; }
.verdict small { display: block; margin-top: .45rem; font: 400 .98rem/1.45 var(--serif); color: var(--mute); letter-spacing: 0; }
.results { margin-top: clamp(56px, 9vh, 110px); max-width: 64rem; }
.results-lede { font-size: 1.1rem; color: var(--ink-85); max-width: 60ch; margin: 0 0 1.6rem; }
.tbl { width: 100%; border-collapse: collapse; font: 400 var(--small)/1.35 var(--display); }
.tbl th, .tbl td { text-align: left; padding: .8em 0; border-bottom: 1px solid var(--hair); font-weight: 400; vertical-align: baseline; }
.tbl thead th { color: var(--mute); }
.tbl .num { text-align: right; font-size: .82rem; font-variant-numeric: tabular-nums; padding-left: 16px; }
.tbl thead .num { font-family: var(--display); font-stretch: normal; font-size: var(--small); }
.tbl tbody th { color: var(--ink-85); }
.tbl tr.pick th, .tbl tr.pick td { color: var(--ink); font-weight: 500; }

/* work: drawings straight on the ground, no frame */
.pieces { list-style: none; margin: clamp(32px, 5vh, 56px) 0 0; padding: 0; }
.piece { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: clamp(20px, 3vw, 56px); align-items: center; padding: clamp(14px, 2vh, 32px) 0; }
.piece:nth-child(even) .piece-fig { order: 2; }
.piece-fig { margin: 0; }
.piece-fig img { display: block; width: 100%; height: auto; }
.piece-copy h3 { margin: 0; font: 300 clamp(1.6rem, 2.4vw, 2.4rem)/1.08 var(--serif); letter-spacing: -.018em; max-width: 22ch; text-wrap: balance; }
.piece-copy p { max-width: 54ch; color: var(--ink-85); margin: 1rem 0 0; }
.piece-copy .facts { margin-top: 1rem; font: 400 var(--small)/1.45 var(--display); color: var(--mute); }

/* hire: the same ground, a little deeper, with the blob beside it and the thread at the button */
.hire { max-width: none; padding: clamp(40px, 7vh, 90px) 0 clamp(36px, 6vh, 64px); background: linear-gradient(180deg, transparent 0, var(--hire-wash) 280px); }
.hire-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(24px, 4vw, 64px); align-items: center; }
.anchor-hire { height: clamp(300px, 50vh, 520px); }
.hire-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 3vw, 48px); margin-top: 1.6rem; }
.hire-grid p { margin: 0; color: var(--ink-85); font-size: clamp(1.02rem, 1.2vw, 1.15rem); }
.foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: clamp(40px, 7vh, 80px); padding-top: 20px; border-top: 1px solid var(--hair); font: 400 var(--small)/1.4 var(--display); color: var(--mute); }

/* reveal states: set by JS only when motion is allowed */
.js-motion .reveal, .js-motion .h2, .js-motion .sec-lede, .js-motion .piece, .js-motion .results, .js-motion .hire-grid, .js-motion .btn-big { opacity: 0; }
.still .stem { display: block; }
.still .scroll-cue { display: none; }
.still .hero-close { position: static; margin-top: 1.4rem; opacity: 1; }
.still .close-line { font-size: clamp(1.6rem, 2.6vw, 2.6rem); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* ---------- responsive ---------- */
@media (max-width: 1440px) {
  .eyebrow-more { display: none; }
}
@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}
@media (max-width: 900px) {
  .bar { padding: 16px var(--gutter) 12px; }
  .mark-handle { display: none; }
  .nav { gap: 14px; }
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; align-content: start; padding-top: 11vh; padding-bottom: 6vh; min-height: 100svh; }
  .hero-object, .scroll-cue { display: none; }
  .h1 { margin-top: 1.1rem; }
  .line { min-height: 2.06em; font-size: clamp(2.5rem, 11.4vw, 4.6rem); }
  .close-line { font-size: clamp(2rem, 9vw, 3.6rem); }
  .hero-close { top: calc(var(--small) * 1.4 + 1.1rem); }
  .hero-close .lede { font-size: 1rem; max-width: 34ch; margin-top: .9rem; }
  .hero-note { position: static; margin-top: .6rem; max-width: 36ch; }
  .cta-row { margin-top: .8rem; gap: 20px; }
  .stage canvas { -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, var(--fade)) 38%, #000 56%); mask-image: linear-gradient(180deg, rgba(0, 0, 0, var(--fade)) 38%, #000 56%); }
  .poster { right: auto; left: 50%; top: auto; bottom: 4%; width: 92vw; transform: translateX(-50%); }
  .sorter-grid, .piece, .hire-grid, .hire-inner { grid-template-columns: minmax(0, 1fr); }
  .anchor-sort { display: none; }
  .anchor-hire { height: clamp(240px, 66vw, 420px); margin-top: 20px; }
  .gate { display: grid; row-gap: 18px; padding-top: clamp(72px, 10vh, 120px); }
  .gate-grid, .record { display: contents; }
  .anchor-slot { order: 0; height: clamp(240px, 66vw, 460px); }
  .counter { order: 1; }
  .gate > .sec-head { order: 2; margin-top: 28px; }
  .drafts { order: 3; margin-top: 10px; }
  #self-approve { order: 4; }
  .record-title { order: 5; }
  .log { order: 6; }
  .gate > .sec-foot { order: 7; }
  .piece:nth-child(even) .piece-fig { order: 0; }
  .draft-head { padding-right: 0; }
  .stamp { position: static; display: block; margin-top: 12px; }
  .draft[data-state="pending"] .stamp { display: none; }
  .log { max-height: 12rem; }
  .rack { aspect-ratio: 3 / 2; }
  .tbl .num { font-size: .74rem; }
}
@media (max-width: 520px) {
  .btn-big { width: 100%; }
  .draft-acts .btn { flex: 1 1 auto; }
  #self-approve { white-space: normal; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
