/* days of mri */
:root {
  --bg: #eef0f3;
  --ink: #1038c4;
  --ink-2: rgba(16, 56, 196, .66);
  --ink-3: rgba(16, 56, 196, .4);
  --hair: rgba(16, 56, 196, .2);
  --chip: rgba(16, 56, 196, .075);
  --dim: rgba(16, 56, 196, .16);
  --accent: #1038c4;
  --on-accent: #eef0f3;
  --s1: #eef0f3; --s2: #1038c4; --s3: #0092cd; --s4: #0a1f6e;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --pad: clamp(20px, 5vw, 72px);
}
:root[data-theme="night"] {
  --bg: #0b0c0a;
  --ink: #ece7da;
  --ink-2: rgba(236, 231, 218, .62);
  --ink-3: rgba(236, 231, 218, .36);
  --hair: rgba(236, 231, 218, .16);
  --chip: rgba(236, 231, 218, .07);
  --dim: rgba(236, 231, 218, .12);
  --accent: #f5c63a;
  --on-accent: #0b0c0a;
  --s1: #0b0c0a; --s2: #f5c63a; --s3: #e5482c; --s4: #93bd57;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--mono); font-size: 13px; line-height: 1.55; letter-spacing: .005em;
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .5s ease, color .5s ease;
  overflow-x: hidden;
}
/* paper grain */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .55 -.18'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
:root[data-theme="night"] body::before { mix-blend-mode: screen; opacity: .22; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
h1, h2, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--ink); color: var(--bg); padding: 6px 10px; }
.skip:focus { left: 8px; }

/* ───────── hero ───────── */
.hero { position: relative; height: 100svh; min-height: 560px; overflow: hidden; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
#island { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tilt { position: absolute; left: 0; right: 0; height: 24%; pointer-events: none; -webkit-backdrop-filter: blur(2.6px); backdrop-filter: blur(2.6px); }
.tilt-top { top: 0; -webkit-mask-image: linear-gradient(#000 20%, transparent); mask-image: linear-gradient(#000 20%, transparent); }
.tilt-bot { bottom: 0; height: 20%; -webkit-mask-image: linear-gradient(transparent, #000 80%); mask-image: linear-gradient(transparent, #000 80%); }

.bar {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 28px; padding: 22px var(--pad);
  font-size: 12px;
}
.bar-home { font-weight: 500; }
.bar-links { display: flex; gap: clamp(14px, 2.2vw, 30px); margin-left: auto; }
.bar-links a { color: var(--ink-2); position: relative; padding: 4px 0; transition: color .2s; }
.bar-links a:hover { color: var(--ink); }
.bar-links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.bar-links a:hover::after { transform: scaleX(1); }
.toggle { display: inline-flex; gap: 6px; padding: 5px 9px; border: 1px solid var(--hair); color: var(--ink-3); }
.toggle:hover { border-color: var(--ink-2); }
:root[data-theme="day"] .t-day, :root[data-theme="night"] .t-night { color: var(--ink); }

.hero-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.no-gl .hero-title {
  position: absolute; width: auto; height: auto; clip-path: none; overflow: visible;
  left: var(--pad); top: 50%; transform: translateY(-50%);
  font-family: var(--serif); font-weight: 400; font-size: clamp(64px, 12vw, 190px); letter-spacing: -.022em; line-height: 1;
}

.hero-foot {
  position: absolute; z-index: 5; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 32px;
  padding: 0 var(--pad) clamp(22px, 4.5vh, 44px);
}
.lede { font-family: var(--serif); font-size: clamp(19px, 1.75vw, 25px); line-height: 1.24; letter-spacing: -.008em; max-width: 27ch; text-wrap: balance; }
.hero-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; font-size: 11.5px; }
.render { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.render .k { background: var(--chip); padding: 3px 7px; color: var(--ink-2); }
.render .eq { color: var(--ink-3); margin: 0 3px 0 4px; }
.render button { padding: 3px 7px; color: var(--ink-2); border: 1px solid transparent; transition: background-color .15s, color .15s; }
.render button:hover { border-color: var(--hair); color: var(--ink); }
.render button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.render button.live:not([aria-pressed="true"]) { border-color: var(--ink-2); color: var(--ink); }
.readout { color: var(--ink-3); font-size: 10.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.readout.hint { color: var(--ink-2); min-height: 1.5em; }
.readout.hint.live { color: var(--ink); }
.readout.hint.live::before { content: "→ "; color: var(--accent); }
.no-gl .hero-meta { display: none; }

/* ───────── sections ───────── */
.sec { padding: clamp(84px, 13vh, 150px) var(--pad) 0; max-width: 1480px; margin: 0 auto; }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: clamp(34px, 6vh, 64px); font-size: 12px; }
.sec-head .idx { color: var(--ink-3); }
.sec-head h2 { font: inherit; font-weight: 500; background: var(--chip); padding: 2px 8px; }
.sec-head .rule { flex: 1; height: 1px; background: var(--hair); align-self: center; }
.sec-head .note { color: var(--ink-3); }

.about { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 3.1fr); gap: clamp(28px, 6vw, 96px); }
.facts { display: flex; flex-direction: column; gap: 7px; align-self: start; font-size: 12px; }
.facts > div { display: flex; gap: 8px; align-items: baseline; }
.facts dt { background: var(--chip); padding: 2px 7px; color: var(--ink-2); flex: none; }
.facts dd { color: var(--ink); }
.facts dd::before { content: "= "; color: var(--ink-3); }
.hooks { display: flex; flex-direction: column; gap: clamp(20px, 3vh, 34px); }
.hooks p { font-family: var(--serif); font-size: clamp(25px, 3.05vw, 46px); line-height: 1.13; letter-spacing: -.017em; text-wrap: pretty; max-width: 19.5em; }
.hooks p + p { color: var(--ink-2); }
.hooks p:hover { color: var(--ink); }
.hooks p { transition: color .3s; }

/* word field */
.field-wrap { position: relative; margin-top: clamp(84px, 13vh, 150px); height: clamp(420px, 72vh, 720px); overflow: hidden; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.field { position: absolute; inset: 0; font-size: 11px; line-height: 19px; white-space: pre; color: var(--dim); user-select: none; padding-top: 6px; }
.field div { height: 19px; overflow: hidden; }
.field b { font-weight: 500; color: var(--ink); }
.field i { font-style: normal; color: var(--ink-2); }
.field mark { background: var(--accent); color: var(--on-accent); font-weight: 700; padding: 2px 0; cursor: pointer; transition: box-shadow .15s; }
.field mark:hover { box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--accent); }
.field { cursor: crosshair; background: radial-gradient(circle 170px at var(--mx, -999px) var(--my, -999px), var(--dim), transparent 72%); }
.field.shuffle { animation: shuffle .32s steps(4); }
@keyframes shuffle { 0% { opacity: .2; transform: translateX(-6px); } 50% { opacity: .6; transform: translateX(4px); } 100% { opacity: 1; transform: none; } }
.field-line {
  position: absolute; left: var(--pad); bottom: clamp(24px, 6vh, 56px);
  font-family: var(--serif); font-size: clamp(34px, 5.4vw, 84px); line-height: 1.02; letter-spacing: -.024em;
  text-shadow: 0 0 18px var(--bg), 0 0 18px var(--bg), 0 0 6px var(--bg);
}

/* work */
.work { border-top: 1px solid var(--hair); }
.work li { border-bottom: 1px solid var(--hair); }
.work a {
  display: grid; grid-template-columns: 2.2em minmax(0, 1.25fr) minmax(0, 1.6fr) auto 1.4em; align-items: baseline; gap: clamp(12px, 2vw, 32px);
  padding: clamp(18px, 2.6vh, 28px) 10px; margin: 0 -10px; transition: background-color .18s, color .18s;
}
.work a:hover, .work a:focus-visible { background: var(--ink); color: var(--bg); }
.w-n { color: var(--ink-3); font-size: 12px; }
.w-name { font-family: var(--serif); font-size: clamp(32px, 4.4vw, 68px); line-height: 1; letter-spacing: -.024em; }
.w-desc { color: var(--ink-2); font-size: 12.5px; max-width: 44ch; }
.w-tag { font-size: 11.5px; padding: 2px 7px; border: 1px solid var(--hair); white-space: nowrap; }
.w-go { font-size: 15px; transition: transform .2s; }
.work a:hover .w-n, .work a:hover .w-desc { color: inherit; opacity: .78; }
.work a:hover .w-tag { border-color: currentColor; }
.work a:hover .w-go { transform: translate(3px, -3px); }

.little { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 3.1fr); gap: clamp(28px, 6vw, 96px); margin-top: clamp(36px, 6vh, 60px); }
.little-head { color: var(--ink-3); font-size: 12px; }
.little ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 22px clamp(24px, 4vw, 64px); }
.little li { display: flex; flex-direction: column; gap: 5px; padding-top: 12px; border-top: 1px solid var(--hair); }
.little b { font-family: var(--serif); font-weight: 400; font-size: clamp(21px, 1.9vw, 27px); letter-spacing: -.012em; line-height: 1.1; }
.little span { color: var(--ink-2); font-size: 12.5px; max-width: 40ch; }
.little a i { font-style: normal; font-family: var(--mono); font-size: 12px; margin-left: 7px; color: var(--ink-3); vertical-align: .55em; display: inline-block; transition: transform .2s, color .2s; }
.little a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.little a:hover i { transform: translate(2px, -2px); color: var(--ink); }
.work li.flash a, .little li.flash, .sec.flash .sec-head h2 { animation: flash 1.5s ease; }
@keyframes flash { 0%, 35% { background: var(--dim); box-shadow: inset 0 0 0 1px var(--accent); } 100% { background: transparent; box-shadow: inset 0 0 0 1px transparent; } }

/* aims */
.aims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(22px, 3.4vw, 56px); }
.aims li { border-top: 1px solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; gap: clamp(26px, 6vh, 70px); }
.a-n { color: var(--ink-3); font-size: 12px; }
.aims p { font-family: var(--serif); font-size: clamp(24px, 2.5vw, 38px); line-height: 1.12; letter-spacing: -.016em; text-wrap: balance; }
.aims-coda { margin-top: clamp(28px, 5vh, 48px); color: var(--ink-2); font-size: 12.5px; }
.aims-coda::before { content: "→ "; color: var(--accent); }

/* find me */
.find { border-top: 1px solid var(--hair); }
.find li { border-bottom: 1px solid var(--hair); }
.find a, .find button {
  display: grid; grid-template-columns: minmax(84px, 1fr) minmax(0, 3.1fr) auto; align-items: baseline; gap: clamp(28px, 6vw, 96px);
  width: calc(100% + 20px); text-align: left; padding: clamp(12px, 1.8vh, 20px) 10px; margin: 0 -10px; transition: background-color .18s, color .18s;
}
.find a:hover, .find button:hover, .find a:focus-visible, .find button:focus-visible { background: var(--ink); color: var(--bg); }
.f-k { font-size: 12px; color: var(--ink-2); }
.f-v { font-family: var(--serif); font-size: clamp(30px, 4.6vw, 72px); line-height: 1.04; letter-spacing: -.024em; }
.f-go { font-size: 12px; }
.find a:hover .f-k, .find button:hover .f-k { color: inherit; opacity: .78; }
.find [hidden] { display: none; }

/* footer */
.foot { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: clamp(20px, 4vw, 64px); padding: clamp(84px, 14vh, 160px) var(--pad) 34px; max-width: 1480px; margin: 0 auto; font-size: 11.5px; color: var(--ink-2); }
.swatches { display: flex; gap: 6px; }
.sw { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.sw:hover i { border-color: var(--ink); }
.sw.copied em { color: var(--ink); }
.sw i { width: 44px; height: 22px; border: 1px solid var(--hair); }
.sw em { font-style: normal; font-size: 9.5px; color: var(--ink-3); }
.sw-1 i { background: var(--s1); } .sw-2 i { background: var(--s2); } .sw-3 i { background: var(--s3); } .sw-4 i { background: var(--s4); }
.colophon { max-width: 52ch; }
.sign { color: var(--ink); font-family: var(--serif); font-size: 20px; }

/* reveal on scroll */
.rv { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
.rv.in { opacity: 1; transform: none; }

@media (max-width: 860px) {
  .bar { gap: 14px; padding-top: 16px; }
  .bar-links { gap: 13px; }
  .bar-home { display: none; }
  .bar-links { margin-left: 0; }
  .toggle { margin-left: auto; }
  .hero-foot { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero-meta { align-items: flex-start; }
  .render { justify-content: flex-start; }
  .lede { max-width: 30ch; font-size: 18px; }
  .about, .little { grid-template-columns: 1fr; }
  .facts { flex-direction: row; flex-wrap: wrap; gap: 8px 16px; }
  .work a { grid-template-columns: 1.6em minmax(0, 1fr) auto 1.2em; row-gap: 8px; }
  .w-desc { grid-column: 2 / -1; grid-row: 2; }
  .little ul { grid-template-columns: 1fr; }
  .aims { grid-template-columns: 1fr; }
  .aims li { gap: 14px; }
  .find a, .find button { grid-template-columns: 1fr auto; row-gap: 2px; }
  .f-k { grid-column: 1 / -1; }
  .foot { grid-template-columns: 1fr; align-items: start; }
  .readout { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  body { transition: none; }
  .field.shuffle, .work li.flash a, .little li.flash, .sec.flash .sec-head h2 { animation: none; }
}
