/* Timothy Kirk — studio system
   Laid paper, oxide ink, print type. A report room, not a HUD. */

:root,
html[data-theme="light"] {
  --bg: #f3ece2;
  --panel: #fbf8f2;
  --spine: #e8dfd2;
  --text: #1b1713;
  --muted: #5a5148;
  --accent: #b03d1c;
  --accent-dim: rgba(176, 61, 28, 0.10);
  --line: rgba(27, 23, 19, 0.12);
  --line-strong: rgba(27, 23, 19, 0.28);
  --add: #2f6b45;
  --gone: #a33a2c;
  --fill-fg: #fbf8f2;
  --spine-w: 72px;
  --radius: 14px;
  --radius-sm: 8px;
  --font-display: "Newsreader", "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  --font-ui: "Source Sans 3", "Source Sans Pro", "Segoe UI", sans-serif;
  --font-mono: "Source Code Pro", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --press: 100ms ease-out;
  --material: rgba(251, 248, 242, 0.92);
  --material-heavy: rgba(232, 223, 210, 0.96);
  --blur: blur(10px) saturate(100%);
}

html[data-theme="dark"] {
  --bg: #15181c;
  --panel: #1e2329;
  --spine: #191c21;
  --text: #ece7df;
  --muted: #9aa3ae;
  --accent: #e06a3c;
  --accent-dim: rgba(224, 106, 60, 0.16);
  --line: rgba(236, 231, 223, 0.12);
  --line-strong: rgba(236, 231, 223, 0.26);
  --add: #7fba8c;
  --gone: #e07068;
  --fill-fg: #15181c;
  --material: rgba(30, 35, 41, 0.94);
  --material-heavy: rgba(21, 24, 28, 0.96);
  --blur: blur(12px) saturate(108%);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
  font-optical-sizing: auto;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

body.is-locked { overflow: hidden; }

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: 0.055;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='420'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.36  0 0 0 0 0.28  0 0 0 0.45 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 420px 420px;
}

html[data-theme="dark"] body::after {
  display: none;
}

button, a, .work, .notes-toggle {
  -webkit-tap-highlight-color: transparent;
}

button, a, .notes-toggle, .spine-menu {
  touch-action: manipulation;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
button, input, select, textarea { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--fill-fg); }

.app-brand {
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 15px;
  text-decoration: none;
}
.app-brand:hover { color: var(--text); }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 200;
  background: var(--accent);
  color: var(--fill-fg);
  padding: 8px 12px;
  font-size: 13px;
}
.skip:focus { top: 12px; border-radius: var(--radius-sm); }

/* ── Spine ─────────────────────────────────────────────── */

.spine {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: var(--spine-w);
  min-height: 100dvh;
  padding: 22px 14px calc(20px + env(safe-area-inset-bottom));
  padding-left: calc(14px + env(safe-area-inset-left));
  background: var(--material-heavy);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--text);
  border-right: 1px solid var(--line);
  z-index: 40;
}

body.studio-home .spine {
  --spine-w: min(34vw, 320px);
  width: var(--spine-w);
  padding: clamp(14px, 2vh, 28px) 24px clamp(12px, 1.6vh, 24px);
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  height: 100dvh;
  overflow: hidden;
  gap: clamp(6px, 1.1vh, 18px);
}

body.studio-app {
  display: grid;
  grid-template-columns: 72px 1fr;
  min-height: 100dvh;
}

body.studio-app.studio-flush,
body.studio-app.studio-fit {
  height: 100dvh;
  overflow: hidden;
  grid-template-rows: 1fr;
}

body.studio-flush #layout {
  height: 100% !important;
  margin-top: 0 !important;
  min-height: 0;
}

body.studio-app > *:not(.spine) {
  grid-column: 2;
  min-width: 0;
}

body.studio-home {
  --spine-w: min(34vw, 320px);
  display: grid;
  grid-template-columns: var(--spine-w) 1fr;
  min-height: 100dvh;
  height: auto;
  overflow: visible;
  align-items: start;
}

body.studio-home .stage {
  grid-column: 2;
}

.spine-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 0;
  overflow: hidden;
  transition: transform var(--press);
}
.spine-mark:active { transform: scale(0.94); }
.spine-mark svg { width: 100%; height: 100%; }
body.studio-home .spine-mark { width: 44px; height: 44px; }

.spine-identity { display: flex; flex-direction: column; gap: 8px; }

.spine-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.spine-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}

body.studio-home .spine-name {
  font-size: 1.35rem;
}

.spine-role {
  margin: 4px 0 0;
  max-width: 28ch;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}

.spine-facts {
  margin: 0;
  max-width: 32ch;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.spine-index {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spine-index a {
  position: relative;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding: clamp(4px, 0.7vh, 10px) 0 clamp(4px, 0.7vh, 10px) 12px;
  border-bottom: 1px solid var(--line);
  transition: color var(--press);
}

.spine-index a::after {
  content: "";
  position: absolute;
  inset: -4px -10px;
}

.spine-index a:hover { color: var(--text); }
.spine-index a:active { color: var(--muted); }
.spine-index a.is-here {
  color: var(--text);
}

.spine-index a.is-here::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--accent);
}

.spine-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
}

.spine-nav a,
.spine-nav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 10px 0;
  min-height: 44px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  text-decoration: none;
  transition: color var(--press), transform var(--press);
}

body.studio-home .spine-nav a,
body.studio-home .spine-nav button {
  padding: clamp(6px, 0.8vh, 10px) 0;
  min-height: 0;
}

.spine-nav a:active,
.spine-nav button:active { transform: scale(0.97); }

body.studio-home .spine-foot {
  padding-top: 0;
}

body.studio-home .spine-foot a {
  min-height: 38px;
  padding: 8px 12px;
}

@media (max-height: 840px) {
  body.studio-home .spine-facts { display: none; }
}

@media (max-height: 700px) {
  body.studio-home .spine-role { display: none; }
  body.studio-home .spine-mark { width: 36px; height: 36px; }
}

.spine-nav .idx {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

.spine-nav .is-active .idx,
.spine-nav a:hover .idx,
.spine-nav button:hover .idx,
.spine-nav .is-active { color: var(--text); }

.spine-foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}

.spine-foot a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  padding: 10px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: var(--radius-sm);
  transition: background-color var(--press), border-color var(--press), transform var(--press);
}

.spine-foot a:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.spine-foot a:active { transform: scale(0.97); }

.spine-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.theme-toggle {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: transform var(--press), background-color var(--press), border-color var(--press);
}

.theme-toggle:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.theme-toggle:active { transform: scale(0.94); }

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-theme="dark"] .theme-toggle .icon-moon,
html[data-theme="light"] .theme-toggle .icon-sun { display: none; }

.theme-toggle { order: 20; }
.spine-foot { order: 21; }

.spine-seal { display: none; }

.spine-menu {
  display: none;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  width: 44px;
  height: 44px;
  cursor: pointer;
  color: var(--text);
  margin-left: auto;
  transition: transform var(--press), background-color var(--press), border-color var(--press);
}

.spine-menu:active { transform: scale(0.94); }

.spine-menu span,
.spine-menu span::before,
.spine-menu span::after {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  position: relative;
  margin: 0 auto;
}
.spine-menu span::before,
.spine-menu span::after {
  content: "";
  position: absolute;
  left: 0;
}
.spine-menu span::before { top: -5px; }
.spine-menu span::after { top: 5px; }

body.studio-app .spine-kicker,
body.studio-app .spine-role,
body.studio-app .spine-facts,
body.studio-app .spine-index,
body.studio-app .spine-seal,
body.studio-app .spine-foot .spine-meta { display: none; }

body.studio-app .spine-identity { flex: 1; min-height: 0; }

body.studio-app .spine-name {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

body.studio-app .spine-nav { margin-top: 0; }

body.studio-app .spine-nav a {
  display: block;
  padding: 6px 0;
  border-bottom: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: center;
  grid-template-columns: 1fr;
}

body.studio-app .spine-nav .label { display: none; }
body.studio-app .spine-foot { align-items: center; }
body.studio-app .theme-toggle {
  width: 36px;
  height: 36px;
}
body.studio-app .spine-foot a {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  border: 0;
  border-left: 1px solid var(--accent);
  padding: 0 0 0 6px;
  font-size: 10px;
  min-height: 0;
}
body.studio-app .spine-foot a:active {
  transform: rotate(180deg) scale(0.97);
}

@media (min-width: 901px) {
  body.studio-app.studio-scroll .spine,
  body.studio-articles .spine {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* ── Stage ─────────────────────────────────────────────── */

.stage {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 100dvh;
  padding: 3rem 3.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 4.5rem;
}

.chapter { scroll-margin-top: 32px; }

.sec-rule {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.sec-rule b { color: var(--text); font-weight: 500; }
.sec-rule-line { height: 1px; background: var(--line); }

.chapter-kicker {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.chapter-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  letter-spacing: -0.018em;
  line-height: 1.12;
  text-wrap: balance;
}

.chapter-lead {
  margin: 0 0 20px;
  max-width: 50ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.chapter-lead strong { color: var(--text); font-weight: 600; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--add);
}

.hero-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.95;
  text-wrap: balance;
}

.hero-role {
  margin: 16px 0 0;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--muted);
  max-width: 40rem;
  line-height: 1.4;
}

.prose {
  max-width: 50rem;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 22px;
}

.prose p {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.55;
  letter-spacing: 0.004em;
  color: var(--muted);
  text-wrap: pretty;
}

.prose strong { color: var(--text); font-weight: 600; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn-outline,
.btn-fill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 12px 16px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  transition: background-color var(--press), border-color var(--press), color var(--press), transform var(--press), filter var(--press);
}

.btn-outline {
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: transparent;
}

.btn-outline:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.btn-fill {
  color: var(--fill-fg);
  background: var(--accent);
  border: 1px solid var(--accent);
}

.btn-fill:hover { filter: brightness(1.08); }

.btn-outline:active,
.btn-fill:active { transform: scale(0.97); }

.hud-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 36px;
  max-width: 720px;
}

.hud-card {
  position: relative;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.hud-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-value {
  margin: 6px 0 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.practice {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.practice article {
  padding: 20px 18px;
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.practice h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.practice p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}

.practice ul {
  margin: 12px 0 0;
  padding: 0 0 0 1.1em;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.practice li + li { margin-top: 4px; }

.practice-idx {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.article-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.article-list article {
  padding: 20px 18px;
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.article-list h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.article-list p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}

.article-list p + p { margin-top: 14px; }

.article-list a:not(.article-row),
.article-list .study-open {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.22em;
  cursor: pointer;
}

.article-list a:not(.article-row):hover,
.article-list .study-open:hover { color: var(--text); }
.article-list a:not(.article-row):active,
.article-list .study-open:active { color: var(--muted); }

.article-list-home {
  grid-template-columns: repeat(3, 1fr);
}

.article-more {
  margin: 20px 0 0;
}

.article-more a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.article-more a:hover { color: var(--text); }
.article-more a:active { color: var(--muted); }

.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.spec-card {
  padding: 20px 18px;
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.spec-card h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
}

.spec-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.spec-tags li {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.craft-list {
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.craft-list div {
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.craft-list dt { font-size: 0.95rem; font-weight: 500; }
.craft-list dd { margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.4; }

.chapter-now {
  padding-top: 8px;
}

.fun-log {
  padding: 28px 0 8px;
  border-top: 1px solid var(--line);
  max-width: 42rem;
}

.fun-kicker {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.fun-log h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.015em;
}

.fun-log p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.stage-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.lede {
  margin: 0;
  max-width: 42rem;
  font-weight: 400;
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  line-height: 1.45;
  color: var(--text);
}

.lede em { font-family: var(--font-display); font-style: italic; color: var(--text); }

.stage-index {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.stage-index b { color: var(--text); font-weight: 500; }

.bench {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  height: min(82vh, 820px);
  min-height: 560px;
}

.bench-switch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.bench .work {
  flex: 1;
  min-height: 0;
  cursor: pointer;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  appearance: none;
  width: 100%;
  transition: border-color var(--press), background-color var(--press);
}

.bench .work:active { background: var(--accent-dim); }

.bench .work h3 { font-size: 0.92rem; }
.bench .work.is-featured h3 { font-size: 0.92rem; }
.bench .work-preview { margin-top: 8px; flex: 1; }
.bench .work:not(.is-featured) .mini-bento,
.bench .work:not(.is-featured) .mini-delim,
.bench .work:not(.is-featured) .mini-diff,
.bench .work:not(.is-featured) .mini-workbench,
.bench .work:not(.is-featured) .mini-board {
  transform: none;
  opacity: 1;
}

.bench-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.bench-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.bench-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.bench-copy {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.bench-launch {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fill-fg);
  background: var(--accent);
  border: 1px solid var(--accent);
  padding: 12px 16px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  transition: filter var(--press), transform var(--press);
}

.bench-launch:hover { filter: brightness(1.08); }
.bench-launch:active { transform: scale(0.97); }

.bench-pane {
  display: none;
  flex: 1;
  min-height: 0;
}

.bench-pane.is-active { display: flex; flex-direction: column; }

.bench-pane iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: var(--panel);
}

.embed-poster {
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 28px 24px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--text) 4%, transparent), transparent 42%),
    var(--panel);
  border-top: 1px solid var(--line);
}

.embed-poster-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.embed-poster p {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.embed-poster .btn-fill {
  align-self: flex-start;
}

.bento-standin { display: none; }

.mini-tool {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.mini-tool-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.mini-tool textarea,
.diff-out {
  flex: 1;
  min-height: 80px;
  width: 100%;
  resize: none;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}

.mini-tool-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.mini-tool-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.mini-tool-controls select,
.mini-tool-controls input[type="text"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  min-width: 0;
}

.mini-check {
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  padding-bottom: 8px;
}

.mini-tool-controls button {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--fill-fg);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: auto;
  transition: filter var(--press), transform var(--press);
}

.mini-tool-controls button:hover { filter: brightness(1.08); }
.mini-tool-controls button:active { transform: scale(0.97); }

.mini-tool-diff .diff-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 8px 12px;
  flex: 1;
  min-height: 0;
}

.mini-tool-diff .diff-cols textarea { min-height: 120px; }

.diff-out {
  flex: 1.1;
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
}

.diff-out .gone { color: var(--gone); }
.diff-out .add { color: var(--add); }
.diff-out .stay { color: var(--muted); }

html.studio-embed,
html.studio-embed body {
  height: 100%;
  overflow: hidden;
}

html.studio-embed body::after { display: none; }

html.studio-embed body.studio-app,
html.studio-embed body.studio-home {
  display: block;
  grid-template-columns: none;
}

html.studio-embed .spine { display: none !important; }
html.studio-embed .skip,
html.studio-embed .theme-toggle { display: none !important; }

html.studio-embed #layout,
html.studio-embed .studio-page {
  width: 100%;
  height: 100% !important;
  margin: 0 !important;
  padding: 0;
}

html.studio-embed .studio-page { overflow: auto; }
html.studio-embed .tool-masthead { display: none; }

.board {
  flex: none;
  height: min(68vh, 620px);
  min-height: 420px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1.45fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.board[data-active="bento"] .work[data-work="bento"],
.board[data-active="delimiter"] .work[data-work="delimiter"],
.board[data-active="diff"] .work[data-work="diff"],
.board[data-active="workbench"] .work[data-work="workbench"] {
  grid-column: 1;
  grid-row: 1 / -1;
}

.board[data-active="bento"] .work[data-work="delimiter"],
.board[data-active="delimiter"] .work[data-work="bento"],
.board[data-active="diff"] .work[data-work="bento"] {
  grid-column: 2;
  grid-row: 1;
}

.board[data-active="bento"] .work[data-work="diff"],
.board[data-active="delimiter"] .work[data-work="diff"],
.board[data-active="diff"] .work[data-work="delimiter"] {
  grid-column: 2;
  grid-row: 2;
}

.work {
  view-transition-name: var(--vt);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  transition: border-color 200ms var(--ease), background-color var(--press);
}

.work[data-work="bento"] { --vt: work-bento; }
.work[data-work="delimiter"] { --vt: work-delim; }
.work[data-work="diff"] { --vt: work-diff; }
.work[data-work="workbench"] { --vt: work-bench; }
.work[data-work="board"] { --vt: work-board; }

.work:hover,
.work.is-featured { border-color: var(--line-strong); }

.work-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  z-index: 1;
}

.work-idx {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.work.is-featured .work-idx { color: var(--text); }

.work h3 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.work.is-featured h3 { font-size: clamp(1.5rem, 2.2vw, 2rem); }

.work-copy {
  display: none;
  margin: 10px 0 0;
  max-width: 42ch;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  z-index: 1;
}

.work.is-featured .work-copy { display: block; }

.work-preview {
  flex: 1;
  min-height: 0;
  margin-top: 14px;
  position: relative;
}

.work-open {
  display: none;
  margin-top: 14px;
  z-index: 2;
  position: relative;
  width: max-content;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

.work.is-featured .work-open { display: inline-flex; }
.work-open:hover { color: var(--accent); }

.mini-bento {
  height: 100%;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  grid-template-rows: 1.1fr 0.9fr;
  gap: 8px;
}

.mb-cell {
  background: color-mix(in srgb, var(--text) 8%, var(--bg));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.mb-hero {
  grid-column: 1;
  grid-row: 1 / -1;
  background: linear-gradient(160deg, color-mix(in srgb, var(--text) 14%, var(--bg)), var(--bg) 70%);
  position: relative;
}
.mb-hero::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 18%;
  bottom: 16%;
  height: 38%;
  background:
    linear-gradient(var(--accent) 0 0) 0 100%/18% 54% no-repeat,
    linear-gradient(var(--muted) 0 0) 28% 100%/18% 78% no-repeat,
    linear-gradient(var(--add) 0 0) 56% 100%/18% 42% no-repeat,
    linear-gradient(var(--text) 0 0) 84% 100%/18% 88% no-repeat;
}

.mb-kpi {
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  color: var(--text);
}
.mb-kpi span { font-size: 0.65rem; color: var(--muted); display: block; text-align: center; font-family: var(--font-mono); }

.mb-line {
  background:
    radial-gradient(circle at 20% 70%, transparent 0 6px, var(--accent) 6.5px 7.5px, transparent 8px),
    linear-gradient(110deg, transparent 10%, color-mix(in srgb, var(--text) 35%, transparent) 10% 10.6%, transparent 11%),
    color-mix(in srgb, var(--text) 8%, var(--bg));
  background-size: 100% 100%, 100% 2px, 100% 100%;
  background-position: 0 0, 0 60%, 0 0;
  background-repeat: no-repeat;
}

.mini-delim {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
}

.md-in, .md-out {
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  height: 100%;
  overflow: hidden;
  color: var(--muted);
}
.md-out { color: var(--text); }
.md-arrow { color: var(--accent); font-size: 18px; }

.mini-diff {
  height: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow: hidden;
}
.mini-diff .gone { color: var(--gone); }
.mini-diff .add { color: var(--add); }
.mini-diff .stay { color: var(--muted); }
.mini-diff p { margin: 0; white-space: nowrap; }

.mini-workbench {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 0;
}
.mw-swatches {
  display: flex;
  gap: 4px;
  height: 14px;
}
.mw-swatches span {
  flex: 1;
  border-radius: 4px;
}
.mw-dax {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
}

.mini-board {
  height: 100%;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  min-height: 0;
}
.mini-board .mb-note {
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  border: 1px solid var(--line);
  border-radius: 2px;
}
.mini-board .mb-box {
  background: color-mix(in srgb, var(--text) 6%, var(--bg));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.mini-board .mb-box:nth-child(1) { grid-column: 1; grid-row: 1 / -1; }
.mini-board .mb-box:nth-child(4) { grid-column: 2 / -1; }

.work:not(.is-featured) .mini-bento,
.work:not(.is-featured) .mini-delim,
.work:not(.is-featured) .mini-diff,
.work:not(.is-featured) .mini-workbench,
.work:not(.is-featured) .mini-board {
  transform: scale(0.92);
  transform-origin: top left;
  opacity: 0.8;
}
.work:not(.is-featured) .work-preview { pointer-events: none; }
.work:not(.is-featured) .md-arrow { display: none; }

.stage-notes {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.notes-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 8px 0;
  min-height: 44px;
  text-align: left;
  font-family: var(--font-mono);
  transition: color var(--press), transform var(--press);
}
.notes-toggle:hover { color: var(--text); }
.notes-toggle:active { transform: scale(0.98); color: var(--text); }

.notes-scrim {
  position: fixed;
  inset: 0;
  z-index: 28;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms var(--spring);
}

.notes-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

.study-modal {
  display: block;
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(860px, calc(100% - 40px));
  max-height: min(86vh, 760px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--material-heavy);
  backdrop-filter: blur(18px) saturate(110%);
  -webkit-backdrop-filter: blur(18px) saturate(110%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 16px 22px 22px;
  z-index: 30;
  box-shadow: 0 18px 50px color-mix(in srgb, var(--text) 16%, transparent);
  transform: translate(-50%, -50%);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 0s 180ms;
}

.study-modal.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 180ms ease, visibility 0s;
}

.study-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}

.study-modal h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
}
.study-modal p { margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.study-modal .iframe-wrap { margin-bottom: 12px; }
.study-modal a { font-family: var(--font-mono); font-size: 11px; color: var(--text); }

.notes-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  flex-shrink: 0;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-mono);
  min-height: 44px;
  min-width: 44px;
  padding: 0 8px;
  transition: color var(--press), transform var(--press);
}
.notes-close:hover { color: var(--text); }
.notes-close:active { transform: scale(0.96); }
.study { margin-bottom: 20px; }
.study h4 { margin: 0 0 6px; font-size: 0.95rem; }
.study p { margin: 0 0 10px; font-size: 0.82rem; }

.iframe-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: var(--bg);
  border: 1px solid var(--line);
}
.iframe-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.iframe-wrap .embed-poster {
  position: absolute;
  inset: 0;
  min-height: 0;
  padding: 20px 16px;
  border-top: 0;
}
.iframe-wrap .embed-poster[hidden] { display: none; }
.study a { font-family: var(--font-mono); font-size: 11px; color: var(--text); }

.tool-masthead { padding: 28px 32px 8px; }
.tool-masthead h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.018em;
  line-height: 1.1;
  text-wrap: balance;
}
.tool-masthead p { margin: 8px 0 0; max-width: 52ch; color: var(--muted); font-size: 1rem; line-height: 1.5; text-wrap: pretty; }

body.studio-scroll { background: var(--bg); }
body.studio-scroll .studio-page { padding: 8px 28px calc(48px + env(safe-area-inset-bottom)); }

.article-page {
  max-width: 42rem;
  padding: 28px 8px 48px;
}

body.studio-articles .studio-page {
  min-height: 100dvh;
  display: flex;
  padding: 16px 28px calc(36px + env(safe-area-inset-bottom));
}

.article-index {
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  padding: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.article-index-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 0;
}

.article-index-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.article-index-count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.article-index-count b {
  color: var(--text);
  font-weight: 500;
}

.article-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-search input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--material);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

.article-search input::placeholder { color: var(--muted); }
.article-search input:focus { border-color: var(--accent); outline: none; }

.article-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.article-filter {
  appearance: none;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color var(--press), border-color var(--press), color var(--press);
}

.article-filter:hover {
  color: var(--text);
  border-color: var(--accent);
}

.article-filter.is-active {
  color: var(--fill-fg);
  background: var(--accent);
  border-color: var(--accent);
}

.article-index .article-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line);
}

.article-index .article-list article {
  padding: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.article-index .article-list article[hidden] { display: none; }

.article-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) auto;
  gap: 14px 18px;
  align-items: baseline;
  padding: 16px 6px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  color: inherit;
  font-family: var(--font-ui);
  font-size: 1rem;
  transition: background-color 160ms var(--ease);
}

.article-row:hover,
.article-row:focus-visible {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.article-row .practice-idx { margin: 0; }

.article-row-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--text);
}

.article-row-body p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}

.article-row-tag {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: center;
}

.article-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.article-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0 0 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.article-crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.article-crumbs a:hover { color: var(--text); }

.article-crumbs [aria-current="page"] { color: var(--text); }

.article-index .article-crumbs { margin: 0; }

.article-kicker {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.article-page h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.018em;
  line-height: 1.1;
  text-wrap: balance;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.article-meta a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.article-meta a:hover { color: var(--muted); }

.article-page .prose { margin-top: 28px; }

.article-page .prose a,
.article-faq a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.article-page .prose a:hover,
.article-faq a:hover { color: var(--muted); }

.article-page .prose h2 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: -0.015em;
  color: var(--text);
}

.article-page .prose ul,
.article-page .prose ol {
  margin: 0;
  padding: 0 0 0 1.1em;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.article-page .prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--text);
}

.article-page .prose ol li + li { margin-top: 8px; }

.article-page .prose ol strong { color: var(--text); font-weight: 500; }

.article-faq {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-faq h2 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
}

.article-faq h3 {
  margin: 18px 0 6px;
  font-weight: 500;
  font-size: 1rem;
}

.article-faq p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.article-related {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-related h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
}

.article-related ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-related li + li { margin-top: 8px; }

.article-related a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.article-related a:hover { color: var(--muted); }
body.studio-fit .studio-page {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 10px 20px 14px;
}

body.studio-app {
  -webkit-tap-highlight-color: transparent;
}

body.studio-app #layout button,
body.studio-app .studio-page button,
body.studio-app .studio-page .upload-chip,
body.studio-app .studio-page .toggle-btn,
body.studio-app .studio-page .action-button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--press), opacity var(--press), background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), filter var(--press);
}

body.studio-app #layout button:active,
body.studio-app .studio-page button:active,
body.studio-app .studio-page .upload-chip:active,
body.studio-app .studio-page .toggle-btn:active,
body.studio-app .studio-page .action-button:active {
  transform: scale(0.97);
}

body.studio-app .studio-page .glass-card,
body.studio-app .studio-page .glass-panel {
  background: var(--material-heavy);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius);
}

@media (max-width: 900px) {
  body.studio-home,
  body.studio-app {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  body.studio-app.studio-flush { height: 100dvh; overflow: hidden; }
  body.studio-app.studio-fit { height: auto; overflow: auto; }

  .spine {
    width: 100%;
    min-height: 0;
    height: 64px;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
    position: sticky;
    top: 0;
  }

  body.studio-home .spine { width: 100%; height: 64px; padding: 10px 16px; position: sticky; left: auto; overflow: visible; }

  .spine-nav,
  .spine-foot,
  .spine-seal,
  .spine-facts,
  .spine-index { display: none; }

  .spine-mark { order: 0; }
  .spine-identity { order: 1; display: flex; flex: 1; min-width: 0; }
  .theme-toggle {
    order: 2;
    position: static;
    flex-shrink: 0;
    margin-left: auto;
    background: var(--material-heavy);
  }
  .spine-menu { order: 3; flex-shrink: 0; }

  .spine.is-open .spine-menu {
    position: absolute;
    top: 16px;
    right: max(16px, env(safe-area-inset-right));
    z-index: 2;
  }
  .spine.is-open .theme-toggle {
    position: absolute;
    top: 16px;
    right: calc(max(16px, env(safe-area-inset-right)) + 44px + 8px);
    margin-left: 0;
    z-index: 2;
  }
  .spine-kicker, .spine-role { display: none; }
  .spine-name {
    writing-mode: horizontal-tb !important;
    transform: none !important;
    font-size: 1rem !important;
    letter-spacing: -0.015em !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .spine-menu { display: grid; place-items: center; }
  .stage-notes .stage-index { display: none; }
  .chapter { scroll-margin-top: 80px; }

  .spine.is-open {
    height: auto;
    min-height: 100dvh;
    align-items: stretch;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 80;
    padding: 16px 20px 28px;
  }

  .spine.is-open .spine-identity,
  .spine.is-open .spine-nav,
  .spine.is-open .spine-foot,
  .spine.is-open .spine-index { display: flex; }
  .spine.is-open .spine-facts { display: block; }

  .spine.is-open .spine-name {
    writing-mode: horizontal-tb !important;
    transform: none !important;
    font-size: 1.85rem !important;
    letter-spacing: -0.02em !important;
    white-space: normal;
  }

  .spine.is-open .spine-kicker,
  .spine.is-open .spine-role { display: block; }

  .spine.is-open .spine-nav a,
  .spine.is-open .spine-nav button {
    display: grid;
    grid-template-columns: 28px 1fr;
    text-align: left;
    font-family: var(--font-ui);
    font-size: 16px;
    letter-spacing: 0;
    text-transform: none;
  }

  .spine.is-open .spine-nav .label { display: inline; }
  .spine.is-open .spine-foot a {
    writing-mode: horizontal-tb;
    transform: none;
    border: 1px solid var(--line-strong);
    padding: 10px 12px;
    font-size: 12px;
  }

  .stage {
    padding: 1.25rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
    gap: 2.5rem;
    grid-column: auto;
  }
  .hud-row, .practice, .spec-grid, .craft, .article-list, .article-list-home { grid-template-columns: 1fr; }
  .article-index-head { flex-direction: column; align-items: flex-start; }
  body.studio-articles .studio-page { padding: 12px 16px calc(24px + env(safe-area-inset-bottom)); }
  .article-row {
    grid-template-columns: 2.2rem minmax(0, 1fr);
  }
  .article-row-tag { grid-column: 2; }
  .hero-name { font-size: 2.4rem; }
  .btn-row a { flex: 1 1 10rem; justify-content: center; }
  .stage-notes { display: none; }

  .bench {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  .bench-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .bench .work,
  .bench .work.is-featured,
  .work,
  .work.is-featured {
    min-width: 0;
    min-height: 0;
    flex: none;
    padding: 12px 10px;
  }

  .bench .work-preview { display: none; }
  .stage-top { flex-direction: column; gap: 8px; }
  .bench .work h3,
  .bench .work.is-featured h3 {
    font-size: 0.92rem;
    line-height: 1.3;
    text-wrap: balance;
  }

  .bench-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .bench-launch { width: 100%; justify-content: center; }
  .bench-stage { min-height: min(78dvh, 740px); }
  .bench-stage:has(#pane-bento.is-active) { min-height: 0; }
  .bench-pane iframe {
    min-height: min(72dvh, 680px);
    height: min(72dvh, 680px);
  }

  #pane-bento .embed-poster,
  #pane-bento iframe { display: none !important; }

  .bento-standin {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: min(52dvh, 440px);
  }
  .bento-standin-canvas {
    flex: 1;
    min-height: 220px;
    padding: 16px;
    background: var(--panel);
    border-top: 1px solid var(--line);
  }
  .bento-standin-canvas .mini-bento {
    height: 100%;
    min-height: 200px;
  }
  .bento-standin-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 16px 18px;
    border-top: 1px solid var(--line);
  }
  .bento-standin-copy p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

  .embed-poster {
    min-height: min(52dvh, 420px);
    padding: 20px 16px 18px;
    justify-content: flex-end;
  }
  .embed-poster p { max-width: none; font-size: 0.9rem; }
  .embed-poster .btn-fill {
    align-self: stretch;
    justify-content: center;
    width: 100%;
  }

  .iframe-wrap {
    padding-bottom: 0;
    height: min(62dvh, 520px);
  }

  .mini-tool textarea,
  .diff-out { min-height: 140px; }

  .mini-tool { padding: 12px; }
  .mini-tool-controls { align-items: stretch; }
  .mini-tool-controls button { margin-left: 0; width: 100%; justify-content: center; }
  .mini-tool-diff .diff-cols {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .tool-masthead { padding: 20px 16px 8px; }
  body.studio-scroll .studio-page {
    padding: 8px max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .glass-card { padding: 18px !important; }

  body.studio-flush #layout {
    flex: 1;
    min-height: 0;
    height: auto !important;
    margin-top: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .spine-mark,
  .spine-index a,
  .spine-nav a,
  .spine-nav button,
  .spine-foot a,
  .spine-menu,
  .btn-outline,
  .btn-fill,
  .bench-launch,
  .mini-tool-controls button,
  .notes-toggle,
  .notes-close,
  .work,
  .bench .work {
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
  }

  .spine-mark:active,
  .spine-nav a:active,
  .spine-nav button:active,
  .spine-foot a:active,
  .spine-menu:active,
  .btn-outline:active,
  .btn-fill:active,
  .bench-launch:active,
  .mini-tool-controls button:active,
  body.studio-app #layout button:active,
  body.studio-app .studio-page button:active,
  body.studio-app .studio-page .upload-chip:active,
  body.studio-app .studio-page .toggle-btn:active,
  body.studio-app .studio-page .action-button:active {
    transform: none;
  }

  .notes-scrim { transition: opacity 200ms ease; }

  .study-modal {
    transition: opacity 160ms ease, visibility 160ms ease;
    opacity: 0;
  }

  .study-modal.is-open { opacity: 1; }

  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  body::after { display: none; }

  .spine,
  .status-pill,
  .hud-card,
  .practice article,
  .spec-card,
  .article-list article,
  .bench-stage,
  .work,
  .glass-card,
  .glass-panel,
  .study-modal {
    background: var(--panel);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .spine,
  .status-pill,
  .hud-card,
  .practice article,
  .spec-card,
  .article-list article,
  .bench-stage,
  .work,
  .glass-card,
  .glass-panel,
  .study-modal {
    background: var(--bg);
    border-color: var(--accent);
  }

  .btn-outline,
  .spine-foot a {
    border-color: var(--text);
  }
}

.bench-pane[hidden] { display: none !important; }

/* ── Light interiors for tool pages ─────────────────────── */

html[data-theme="light"] body.studio-app {
  background: var(--bg) !important;
  color: var(--text) !important;
}

html[data-theme="light"] body.studio-app .text-white,
html[data-theme="light"] body.studio-app .text-gray-200,
html[data-theme="light"] body.studio-app .text-slate-100,
html[data-theme="light"] body.studio-app .text-cyan-100 {
  color: var(--text) !important;
}

html[data-theme="light"] body.studio-app .text-gray-300,
html[data-theme="light"] body.studio-app .text-slate-300,
html[data-theme="light"] body.studio-app .text-gray-400,
html[data-theme="light"] body.studio-app .placeholder-slate-400 {
  color: var(--muted) !important;
}

html[data-theme="light"] body.studio-app header.bg-gray-900,
html[data-theme="light"] body.studio-app #sidebar.bg-gray-900 {
  background: var(--panel) !important;
  border-color: var(--line) !important;
}

html[data-theme="light"] .studio-page .bg-gray-800,
html[data-theme="light"] .studio-page .bg-gray-900,
html[data-theme="light"] .studio-page .bg-slate-900,
html[data-theme="light"] .studio-page .bg-slate-900\/70,
html[data-theme="light"] .studio-page .bg-slate-900\/80 {
  background-color: var(--panel) !important;
}

html[data-theme="light"] .studio-page .border-gray-600,
html[data-theme="light"] .studio-page .border-gray-700,
html[data-theme="light"] .studio-page .border-slate-700 {
  border-color: var(--line-strong) !important;
}

html[data-theme="light"] .studio-page .toggle-btn {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

html[data-theme="light"] .studio-page .toggle-btn-group .active,
html[data-theme="light"] .studio-page .seg .active {
  background: var(--accent);
  color: var(--fill-fg);
  border-color: var(--accent);
}

html[data-theme="light"] .studio-page .settings-input,
html[data-theme="light"] .studio-page .shared-input-style,
html[data-theme="light"] .studio-page .input-surface {
  background-color: var(--panel);
  border-color: var(--line-strong);
  color: var(--text);
}

html[data-theme="light"] .studio-page #copy-btn {
  background: var(--accent);
  color: var(--fill-fg);
}

html[data-theme="light"] #sidebar,
html[data-theme="light"] .toggle-header,
html[data-theme="light"] .sidebar-toggle,
html[data-theme="light"] .app-header,
html[data-theme="light"] .app-footer,
html[data-theme="light"] .toggle-section,
html[data-theme="light"] .help-box,
html[data-theme="light"] #cell-panel {
  background: var(--panel) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}

html[data-theme="light"] #preview-area {
  background: var(--spine) !important;
}

html[data-theme="light"] .app-brand,
html[data-theme="light"] .app-nav-link:hover,
html[data-theme="light"] .app-footer-inner a:hover,
html[data-theme="light"] .panel-label,
html[data-theme="light"] .toggle-section > summary,
html[data-theme="light"] .toggle-header,
html[data-theme="light"] .toggle-row label,
html[data-theme="light"] .help-box p,
html[data-theme="light"] .ctrl-select,
html[data-theme="light"] .ctrl-number,
html[data-theme="light"] .cp-input,
html[data-theme="light"] .cp-close:hover,
html[data-theme="light"] .cp-reset:hover,
html[data-theme="light"] #selected-info {
  color: var(--text) !important;
}

html[data-theme="light"] .app-nav-link,
html[data-theme="light"] .app-footer-inner,
html[data-theme="light"] .ctrl-label,
html[data-theme="light"] .tmpl-label,
html[data-theme="light"] .tmpl-filter,
html[data-theme="light"] .tmpl-btn svg,
html[data-theme="light"] .color-item label,
html[data-theme="light"] .cp-label,
html[data-theme="light"] .cp-close,
html[data-theme="light"] .cp-reset,
html[data-theme="light"] .btn-add-cell,
html[data-theme="light"] .accent-side-btn,
html[data-theme="light"] #zoom-label {
  color: var(--muted) !important;
}

html[data-theme="light"] .toggle-icon,
html[data-theme="light"] .sidebar-toggle,
html[data-theme="light"] .tmpl-filter.active,
html[data-theme="light"] .tmpl-btn.active svg,
html[data-theme="light"] .accent-side-btn.active,
html[data-theme="light"] .btn-add-cell:hover,
html[data-theme="light"] .btn-add-cell.armed,
html[data-theme="light"] .app-footer-inner a.active,
html[data-theme="light"] .cp-title,
html[data-theme="light"] .cp-val,
html[data-theme="light"] .range-val,
html[data-theme="light"] #export-size-label {
  color: var(--accent) !important;
}

html[data-theme="light"] .cp-delete {
  color: var(--gone) !important;
}

html[data-theme="light"] .semantic-badge-neutral {
  color: var(--muted);
  border-color: var(--line);
  background: var(--accent-dim);
}

html[data-theme="light"] .metric-card,
html[data-theme="light"] .semantic-panel,
html[data-theme="light"] .input-surface {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

@media (forced-colors: active) {
  .spine,
  .btn-outline,
  .btn-fill,
  .theme-toggle,
  .work,
  .bench-stage,
  .study-modal,
  .status-pill,
  .hud-card {
    border: 1px solid ButtonText;
  }

  .btn-fill,
  .bench-launch,
  .skip {
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }

  :focus-visible { outline: 3px solid Highlight; }
}

::view-transition-old(root),
::view-transition-new(root) { animation-duration: 280ms; }
