/* ---------- themes ---------- */
:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --bg-raise: #ffffff;
  --ink: #17171c;
  --dim: #5f5f58;
  --hairline: rgba(23, 23, 28, 0.13);
  --accent: #2b57e0;
  --accent-soft: rgba(43, 87, 224, 0.07);
  --term-bg: #0b0f1c;
  --term-ink: #d7e0f4;
  --term-dim: #8792b0;
  --term-accent: #7cc4ff;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease-spring: cubic-bezier(0.22, 1.2, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b14;
  --bg-raise: #0d1322;
  --ink: #e9ecf5;
  --dim: #8b91a8;
  --hairline: rgba(233, 236, 245, 0.13);
  --accent: #6ea8ff;
  --accent-soft: rgba(110, 168, 255, 0.09);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #070b14;
    --bg-raise: #0d1322;
    --ink: #e9ecf5;
    --dim: #8b91a8;
    --hairline: rgba(233, 236, 245, 0.13);
    --accent: #6ea8ff;
    --accent-soft: rgba(110, 168, 255, 0.09);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  position: relative;
  z-index: 0;
  font: 1rem/1.7 var(--sans);
  color: var(--ink);
  background: var(--bg);
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--bg); }
@media (prefers-reduced-motion: no-preference) {
  html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease, box-shadow 0.45s ease !important;
  }
}
a { color: inherit; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 20rem;
  display: flex;
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
html.pulling, html.pulling * { -webkit-user-select: none !important; user-select: none !important; }
#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}
.hero-inner {
  position: relative;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(0.8rem, 3svh, 2.5rem) clamp(0.8rem, 4vw, 4rem);
}
.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--dim);
  margin-bottom: clamp(0.6rem, 3svh, 2rem);
  flex: none;
}
.hero .topline { width: min(100%, 60rem); }
.brand { letter-spacing: 0.06em; margin: 0; font: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#projects { margin-bottom: 5.5rem; }
#theme-toggle {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--dim);
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0.1rem 0.55rem;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, transform 0.25s var(--ease-spring);
}
#theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(180deg); }

/* ---------- terminal ---------- */
.term {
  background: var(--term-bg);
  will-change: transform;
  border-radius: 12px;
  box-shadow: 0 24px 70px -18px rgba(7, 11, 20, 0.55), 0 4px 18px rgba(7, 11, 20, 0.25);
  overflow: hidden;
  text-align: left;
  position: relative;
  display: flex;
  flex-direction: column;
}
.hero .term {
  width: min(100%, 60rem);
  max-width: 100%;
  flex: 0 1 clamp(15rem, 60svh, 52rem);
  min-height: 0;
}
.hero .term.max { width: 100%; flex: 1 1 auto; }
.term.resizing { transform: none !important; }
#term-grip {
  position: absolute; right: 0; bottom: 0;
  width: 30px; height: 30px; padding: 0; border: 0;
  background: linear-gradient(135deg, transparent 62%, var(--term-dim) 62% 67%, transparent 67% 76%, var(--term-dim) 76% 81%, transparent 81%);
  cursor: nwse-resize;
  touch-action: none;
}
.term-bar button.tl { padding: 0; border: 0; cursor: pointer; position: relative; }
.term-bar button.tl::after { content: ""; position: absolute; inset: -9px -10px -9px -3px; }
.term-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.tl { width: 11px; height: 11px; border-radius: 50%; }
.tl-r { background: #ff5f57; } .tl-y { background: #febc2e; } .tl-g { background: #28c840; }
.term-title {
  margin-left: auto; margin-right: auto;
  transform: translateX(-1.4rem);
  font: 0.72rem var(--mono);
  color: var(--term-dim);
}
.term-body {
  font: 0.845rem/1.65 var(--mono);
  color: var(--term-ink);
  padding: 1.1rem 1.15rem 1.25rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: auto;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}
#term-out .tline { white-space: pre-wrap; word-break: break-word; }
#term-out .tline + .tline { margin-top: 0.1rem; }
#term-out .dim { color: var(--term-dim); }
#term-out .ok { color: #4ade80; }
#term-out .acc { color: var(--term-accent); }
#term-out a { color: var(--term-accent); text-decoration: none; border-bottom: 1px dotted rgba(124, 196, 255, 0.5); }
#term-out a:hover { border-bottom-style: solid; }
.term-line { display: flex; align-items: baseline; margin-top: 0.35rem; }
.ps1 { color: var(--term-accent); white-space: pre; }
.ps1-dim { color: var(--term-dim); }
#term-in {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--term-ink);
  font: inherit;
  padding: 0 0 0 0.5ch;
  caret-color: var(--term-accent);
}
.term-echo { color: var(--term-ink); }

.hero-note {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--dim);
  text-align: center;
  margin: clamp(0.5rem, 2svh, 1.4rem) 0 clamp(0.4rem, 1.6svh, 1rem);
  flex: none;
}
.hero-note code { color: var(--accent); font-family: inherit; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.chip {
  font: 0.75rem var(--mono);
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  cursor: pointer;
  transition: all 0.22s var(--ease-out);
}
.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* ---------- sections ---------- */
main { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }
main.thought { max-width: 46rem; margin-left: auto; margin-right: auto; }
section { margin-top: 5.5rem; }
h2 {
  font: 600 1.6rem/1.2 var(--serif);
  letter-spacing: -0.01em;
  margin: 0 0 0.3rem;
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  flex-direction: column;
}
.sec-idx { font: 500 0.8rem var(--mono); color: var(--accent); }
.kicker { font: 0.78rem var(--mono); color: var(--dim); margin: 0 0 2rem; }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* about */
.lede { font: 500 1.5rem/1.45 var(--serif); letter-spacing: -0.01em; margin: 0 0 0.8rem; }
.body-copy { color: var(--dim); margin: 0 0 1rem; max-width: 38rem; }
.body-copy strong { color: var(--ink); font-weight: 600; }

/* projects */
.proj {
  display: flex;
  gap: 1.3rem;
  padding: 1.4rem 0.2rem;
  border-top: 1px solid var(--hairline);
  text-decoration: none;
  position: relative;
  transition: padding-left 0.25s var(--ease-out), background 0.25s;
}
.proj:last-child, #thoughts .proj { border-bottom: 1px solid var(--hairline); }
.proj::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 2px; height: 0;
  background: var(--accent);
  transition: height 0.3s var(--ease-out);
}
.proj:hover { padding-left: 1rem; }
.proj:hover::before { height: 100%; }
.proj-idx { font: 0.78rem var(--mono); color: var(--accent); padding-top: 0.35rem; }
.proj-main { flex: 1; min-width: 0; }
.proj-name { display: block; font: 600 1.3rem/1.3 var(--serif); }
.proj-desc { display: block; color: var(--dim); font-size: 0.92rem; margin-top: 0.3rem; max-width: 34rem; }
.proj-art {
  display: block;
  font: 0.72rem var(--mono);
  color: var(--accent);
  opacity: 0.75;
  margin-top: 0.55rem;
}
.proj-meta {
  font: 0.72rem/1.6 var(--mono);
  color: var(--dim);
  text-align: right;
  white-space: nowrap;
  padding-top: 0.35rem;
}

/* now */
#now .body-copy { font-size: 1.05rem; color: var(--ink); }
.clock { font: 0.8rem var(--mono); color: var(--dim); margin-top: 0.6rem; }
#clock { color: var(--accent); }

/* footer */
footer {
  max-width: 46rem;
  margin: 6rem auto 0;
  padding: 1.6rem 1.5rem 3.5rem;
  border-top: 1px solid var(--hairline);
}
.foot-links { font: 0.85rem var(--mono); margin: 0 0 0.8rem; }
.foot-links a { text-decoration: none; border-bottom: 1px solid var(--hairline); }
.foot-links a:hover { color: var(--accent); border-color: var(--accent); }
.colophon { color: var(--dim); font-size: 0.82rem; line-height: 1.7; margin: 0; max-width: 36rem; }
.colophon code { font: 0.78rem var(--mono); color: var(--accent); }
.colophon a { color: var(--ink); }
.colophon a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  
  .term-body { font-size: 0.78rem; padding: 0.9rem 0.85rem 1.1rem; }
  h2 { font-size: 1.4rem; }
  .lede { font-size: 1.3rem; }
  .proj { gap: 0.9rem; }
  .proj-meta { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .chip, #theme-toggle { transition: none; }
}


/* ================= 404 ================= */
.page-404 {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 2rem 1rem;
}
.four04 { width: min(680px, 100%); }
.four04-term { margin: 0; width: 100%; }
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  vertical-align: -0.12em;
  background: var(--term-ink);
  animation: caret-blink 1.1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }


/* ================= section dividers ================= */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem auto;
  width: min(720px, 100%);
}
.divider::before, .divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--hairline), transparent);
}
.divider-mark {
  width: 7px;
  height: 7px;
  margin: 0 14px;
  background: var(--accent);
  opacity: 0.55;
  transform: rotate(45deg);
  animation: diamond-spin 14s cubic-bezier(0.6, 0, 0.2, 1) infinite;
}
@keyframes diamond-spin {
  0%, 42% { transform: rotate(45deg); }
  50%, 92% { transform: rotate(225deg); }
  100% { transform: rotate(405deg); }
}
@media (prefers-reduced-motion: reduce) { .divider-mark { animation: none; } }

/* ================= focus ================= */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
.proj:focus-visible { outline-offset: -2px; }
#term-in:focus-visible { outline: none; }

/* ================= thought pages ================= */
.thought { padding-top: 3rem; padding-bottom: 5rem; }
.thought .brand { text-decoration: none; }
.thought h1 { font: 600 2.2rem/1.2 var(--serif); letter-spacing: -0.015em; margin: 0 0 0.5rem; }
.thought article p { font: 1.15rem/1.7 var(--serif); margin: 0 0 1.2rem; max-width: 36rem; }
.thought article .kicker { font: 0.78rem var(--mono); margin-bottom: 2.2rem; }
.thought blockquote { margin: 2rem 0; padding-left: 1.1rem; border-left: 2px solid var(--accent); }
.thought pre { font: 0.8rem/1.65 var(--mono); background: var(--term-bg); color: var(--term-ink); padding: 1rem 1.15rem; border-radius: 10px; overflow-x: auto; margin: 0 0 1.5rem; }
.thought-back { display: inline-block; margin-top: 1.5rem; font: 0.8rem var(--mono); color: var(--dim); }
.thought-back:hover { color: var(--accent); }


/* ================= bands + toys ================= */
@media (pointer: coarse) { #term-in { font-size: 16px; } }
@media (max-height: 520px) { .hero-note { display: none; } }
.chips { flex: none; }
.band { display: grid; gap: 2.5rem; margin: 5.5rem 0; }
.band section { margin-top: 0; }
.band-text, .band-toys { min-width: 0; }
@media (min-width: 900px) {
  .band { grid-template-columns: 1fr 1fr; align-items: center; gap: 4.5rem; min-height: 60vh; }
  .band.left .band-toys { order: -1; }
}
.phil { margin-top: 1.5rem; }
.toy {
  margin: 0;
  background: var(--term-bg);
  color: var(--term-ink);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 70px -18px rgba(7, 11, 20, 0.55), 0 4px 18px rgba(7, 11, 20, 0.25);
  -webkit-user-select: none;
  user-select: none;
}
.toy-body { padding: 1.1rem; font: 0.85rem/1.6 var(--mono); }
.toy figcaption { font: 0.72rem/1.5 var(--mono); color: #97a2bf; padding: 0 1.1rem 1rem; }
.toy code { color: var(--term-accent); font: inherit; }
.toy .chip { color: var(--term-ink); border-color: rgba(255, 255, 255, 0.22); }
.toy .chip:hover { color: var(--term-accent); border-color: var(--term-accent); }
.toy p { margin: 0 0 0.8rem; }
.toy-big { font-size: 1.5rem; color: var(--term-accent); }
.toy .toy-out { margin: 0.8rem 0 0; min-height: 1.6em; }
.attn-ctl { display: flex; gap: 0.5rem; }
.attn-ctl[hidden] { display: none; }
#attn-arcs { display: block; width: 100%; height: 76px; }
#attn-arcs path { fill: none; stroke: var(--term-accent); }
.attn-scroll { overflow-x: auto; }
.attn-inner { width: max-content; min-width: 100%; }
#attn-toks { display: flex; justify-content: center; gap: 3px; padding-bottom: 3px; }
#attn-toks button { font: 0.72rem var(--mono); color: var(--term-ink); background: rgba(124, 196, 255, 0.08); border: 0; border-radius: 4px; padding: 0.35rem 0.5rem; flex: none; white-space: pre; cursor: pointer; }
#attn-toks button.on { box-shadow: inset 0 0 0 1px var(--term-accent); }
#tree { display: block; width: 100%; aspect-ratio: 25 / 18; border-radius: 8px; background: #0b0f1c; touch-action: pan-y; }
#fermi-in { width: 100%; accent-color: var(--term-accent); }
#ship { display: block; width: 100%; border-radius: 8px; }
#ship .plank { stroke: #0b0f1c; stroke-width: 1.5; stroke-linejoin: round; cursor: pointer; transition: fill 0.4s, filter 0.2s; }
#ship .plank:not(.new):hover { filter: brightness(1.25); }
#ship .plank:focus { outline: none; }
#ship .plank:focus-visible { stroke: #fff; stroke-width: 2.5; }
#ship .wave { pointer-events: none; }
.ship-fade { transition: opacity 1.2s; }
@media (prefers-reduced-motion: no-preference) {
  .ship-bob { animation: bob 6s ease-in-out infinite; transform-origin: 240px 230px; }
  .w1 { animation: drift 14s linear infinite; --w: 96px; }
  .w2 { animation: drift 8s linear infinite; --w: 72px; }
  .w3 { animation: drift 11s linear infinite reverse; --w: 120px; }
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-0.8deg); } 50% { transform: translateY(4px) rotate(0.8deg); } }
@keyframes drift { to { transform: translateX(var(--w)); } }
.toy button:disabled, .toy input:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

/* attention math panel */
#attn-math { margin-top: 0.7rem; }
#attn-math summary { cursor: pointer; color: var(--term-accent); font-size: 0.78rem; }
#attn-math canvas { display: block; width: 100%; image-rendering: pixelated; }
.am-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0; }
.am-row b { color: var(--term-dim); font-weight: 400; }
.am-m { flex: 1 1 0; min-width: 0; text-align: center; }
.am-m canvas { height: 72px; background: rgba(255, 255, 255, 0.02); }
.am-m i, .am-dot i { font: 0.68rem var(--mono); color: #97a2bf; }
#am-s { cursor: crosshair; }
.am-dot { display: grid; grid-template-columns: 2.4rem 1fr; gap: 4px 0.4rem; align-items: center; }
.am-dot canvas { height: 14px; }
.toy .am-cap { font-size: 0.7rem; color: #97a2bf; margin: 0 0 0.5rem; overflow-wrap: anywhere; }
.toy .am-eq { font-size: 0.75rem; margin: 0.4rem 0 0; min-height: 1.6em; white-space: pre-wrap; font-variant-numeric: tabular-nums; }

/* project files */
#projects .kicker code { color: var(--accent); font: inherit; }
.fs-body { display: grid; grid-template-columns: 15rem 1fr; min-height: 20rem; font: 0.85rem/1.7 var(--mono); }
.fs-tree { padding: 1.1rem; border-right: 1px solid rgba(255, 255, 255, 0.07); }
.fs-tree summary { cursor: pointer; color: var(--term-accent); }
.fs-tree details + details { margin-top: 0.5rem; }
.fs-tree button { display: block; width: calc(100% - 0.4rem); margin-left: 0.4rem; text-align: left; font: inherit; color: var(--term-ink); background: none; border: 0; border-left: 1px solid rgba(255, 255, 255, 0.15); padding: 0.2rem 0.8rem; cursor: pointer; }
.fs-tree button:hover { color: var(--term-accent); }
.fs-tree button.on { background: rgba(124, 196, 255, 0.12); border-left-color: var(--term-accent); }
.fs-view { padding: 1.4rem 1.6rem; min-width: 0; -webkit-user-select: text; user-select: text; }
.fs-view .fs-path { margin-top: 0; }
#ship-vote { margin-top: 0.8rem; }
.fs-view h3 { font: 600 1.6rem/1.2 var(--serif); margin: 0 0 0.7rem; }
.fs-view .fs-path, .fs-view .fs-meta { color: #97a2bf; font-size: 0.75rem; }
.fs-view .fs-desc { font: 1rem/1.65 var(--sans); max-width: 36rem; }
.fs-view .fs-art { color: var(--term-accent); font-size: 0.78rem; overflow-wrap: anywhere; }
.fs-view a { color: var(--term-accent); }
@media (max-width: 640px) {
  .fs-body { grid-template-columns: 1fr; }
  .fs-tree { border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
  .fs-view { padding: 1.2rem 1.1rem; min-height: 22rem; }
}

.band[hidden] { display: none; }
.thought-talk { color: var(--dim); margin: 2.5rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--hairline); max-width: 36rem; }

/* model diagram */
#arch { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.2rem; font-size: 0.7rem; line-height: 1.35; }
.ar-io { border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 8px; padding: 0.6rem 0.5rem; text-align: center; width: 5.4rem; }
.ar-io strong, .ar-layer strong { display: block; font-weight: 500; color: var(--term-ink); }
.ar-io span { color: #97a2bf; }
.ar-layers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; }
.ar-layer { position: relative; border: 1px solid rgba(124, 196, 255, 0.28); border-radius: 8px; padding: 0.5rem; text-align: center; }
.ar-layer::before, .ar-io:last-child::before { content: "\2192"; position: absolute; left: -1.05rem; top: 50%; transform: translateY(-50%); color: #97a2bf; }
.ar-io { position: relative; }
.ar-heads { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0.4rem 0; }
.ar-heads button { padding: 2px; border: 1px solid transparent; border-radius: 4px; background: rgba(255, 255, 255, 0.05); cursor: pointer; aspect-ratio: 1; min-width: 0; }
.ar-heads button:hover { border-color: #97a2bf; }
.ar-heads button.on { border-color: #fff; background: rgba(124, 196, 255, 0.25); }
.ar-heads canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.ar-mlp { display: block; border-radius: 4px; background: rgba(255, 255, 255, 0.05); color: #97a2bf; padding: 0.15rem; }
.toy .am-sel { margin: 1rem 0 0; color: var(--term-accent); font-size: 0.78rem; }
#attn-math h3 { font: 500 0.78rem var(--mono); margin: 0.9rem 0 0.2rem; color: var(--term-ink); }
.toy .am-key { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.7rem; color: #97a2bf; margin: 0.9rem 0 0; }
.am-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.4rem; }
.k-pos { background: #7cc4ff; } .k-neg { background: #ff965a; } .k-zero { background: rgba(124, 196, 255, 0.1); }
@media (max-width: 1250px) {
  #arch { grid-template-columns: 1fr; gap: 0.7rem; }
  .ar-io { width: auto; padding: 0.35rem; }
  .ar-io span { margin-left: 0.6rem; }
  .ar-io strong { display: inline; }
  .ar-io:last-child::before { content: none; }
  .ar-layer:first-child::before { content: none; }
}

.addr { font-family: var(--mono); font-size: 0.85em; color: var(--ink); }

.links { display: grid; grid-template-columns: 6rem 1fr; gap: 0.35rem 1rem; margin: 1.4rem 0 0; font: 0.85rem/1.7 var(--mono); }
.links dt { color: var(--dim); }
.links dd { margin: 0; overflow-wrap: anywhere; }

/* keep the attention window compact: fixed-size heads, math scrolls inside */
#toy-attn .toy-body { padding-bottom: 0.7rem; }
.ar-layer { padding: 0.35rem 0.5rem; }
.ar-heads { grid-template-columns: repeat(2, minmax(0, 34px)); justify-content: center; margin: 0.25rem 0; }
.toy .am-sel { margin-top: 0.6rem; }
.am-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 0.5rem; }
.toy .am-head .am-key { margin: 0; }
.am-head .chip { flex: none; }
.am-scroll { max-height: min(17rem, 42vh); overflow-y: auto; margin-top: 0.5rem; padding-right: 0.6rem; border-top: 1px solid rgba(255, 255, 255, 0.08); scrollbar-width: thin; scrollbar-color: #8792b0 transparent; }
.am-scroll:focus-visible { outline-offset: 0; }
.am-scroll h3:first-child { margin-top: 0.6rem; }

/* math steps as tabs; opening it folds the arcs away so the window barely grows */
.toy.math-open #attn-arcs, .toy.math-open #attn-math ~ *, .toy.math-open figcaption, .toy.math-open .toy-body > .am-cap { display: none; }
.toy.math-open .attn-scroll { margin-top: 0.3rem; }
.am-head { flex-wrap: wrap; }
.am-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.am-tabs button { font: 0.72rem var(--mono); color: #97a2bf; background: none; border: 0; border-bottom: 1px solid transparent; padding: 0.3rem 0.35rem; cursor: pointer; }
.am-tabs button:hover { color: var(--term-ink); }
.am-tabs button.on { color: var(--term-accent); border-color: var(--term-accent); }
.am-step { min-height: 8.2rem; padding-top: 0.5rem; }
.am-step[hidden] { display: none; }
.toy .am-key { margin: 0.4rem 0 0; font-size: 0.66rem; }
.toy .am-step .am-cap:last-child, .toy .am-step .am-eq:last-child { margin-bottom: 0; }
.fermi-type { display: flex; align-items: baseline; gap: 0.8rem; margin: 0.5rem 0 0.9rem; }
.fermi-type span { font-size: 0.72rem; color: #97a2bf; }
#fermi-val { flex: 1; min-width: 0; font: 1.4rem var(--mono); color: var(--term-accent); background: none; border: 0; border-bottom: 1px dashed rgba(124, 196, 255, 0.4); padding: 0.1rem 0; user-select: text; -webkit-user-select: text; }
#chain[hidden], #chain-again[hidden] { display: none; }
#chain { margin-top: 0.9rem; }
.toy .chain-score { min-height: 3.2em; margin: 0 0 0.4rem; color: var(--term-accent); }
#chain-cv { display: block; width: 100%; height: 220px; border: 1px solid rgba(124, 196, 255, 0.25); border-radius: 8px; cursor: crosshair; margin-bottom: 0.7rem; touch-action: manipulation; }

.am-step { padding: 0.6rem 4px 0.2rem; }
.am-row { gap: 0.8rem; }
.am-m i { display: block; margin-top: 0.35rem; }
.am-dot { gap: 9px 0.6rem; }
/* what it would answer after each layer */
.toy .am-lt { margin: 0.6rem 0 0.3rem; }
.am-lens { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.am-lens button { text-align: left; font: 0.68rem/1.4 var(--mono); color: var(--term-ink); background: none; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px; padding: 0.3rem 0.4rem; cursor: pointer; min-width: 0; }
.am-lens button.on { border-color: var(--term-accent); }
.am-lens strong { display: block; font-weight: 500; color: #97a2bf; }
.am-lens span { position: relative; display: block; margin-top: 2px; background: rgba(255, 255, 255, 0.04); border-radius: 3px; overflow: hidden; }
.am-lens span i { position: absolute; inset: 0 auto 0 0; background: rgba(124, 196, 255, 0.32); }
.am-lens em { position: relative; font-style: normal; padding: 0 0.3rem; white-space: nowrap; }

.support { margin: 0 0 0.8rem; font-size: 0.9rem; color: var(--dim); }
.support .kofi { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.9rem; border-radius: 7px; background: var(--accent); color: var(--bg); font-weight: 600; text-decoration: none; transition: opacity 0.2s; }
.support .kofi:hover { opacity: 0.85; }

.am-lens em { display: block; overflow: hidden; text-overflow: ellipsis; }
.toy .am-lt { margin: 0.4rem 0 0.2rem; }
.am-lens button { padding: 0.2rem 0.35rem; }
@media (max-width: 640px) { #am-step3 .am-cap:first-child { display: none; } .toy .am-key span:last-child { display: none; } .am-head { gap: 0.2rem; } .am-head .chip { padding: 0.15rem 0.6rem; } }

/* photos */
.ph-view { position: relative; aspect-ratio: 1400 / 930; overflow: hidden; background: #0b0f1c; }
.ph-view img { display: block; width: 100%; height: 100%; object-fit: cover; }
#ph-cv { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ph-view.lens { cursor: crosshair; touch-action: pan-y; }
.ph-strip { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; padding: 8px 1.1rem 0; }
.ph-strip button { padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: none; cursor: pointer; opacity: 0.55; transition: opacity 0.2s; }
.ph-strip button:hover, .ph-strip button[aria-pressed="true"] { opacity: 1; }
.ph-strip button[aria-pressed="true"], .ph-strip button:focus-visible { outline: 2px solid var(--term-accent); outline-offset: 1px; }
.ph-strip img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.ph-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.1rem 1rem; }
.ph-foot figcaption { padding: 0; }
.ph-foot .chip { flex: none; }
@media (max-width: 640px) { .ph-strip { grid-template-columns: repeat(4, 1fr); } }

/* bottom links: side by side when there is room */
@media (min-width: 980px) {
  .links { grid-template-columns: auto 1fr auto 1fr; gap: 0.35rem 0.9rem; }
  .links dd:first-of-type { grid-column: 2 / -1; }
}
@media (min-width: 760px) {
  #colophon { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; max-width: 72rem; }
  #colophon > p { margin: 0; white-space: nowrap; }
}
