/* ==========================================================================
   ToolSmith project page
   Visual language: a forge. Colors come from the logo: UCLA blue (--blue)
   for the agent and its base library, gold (--gold) for generated tools.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-grid: rgba(17, 19, 24, 0.045);
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --surface-3: #e9ebef;
  --ink: #111318;
  --ink-2: #444a55;
  --ink-3: #737a85;
  --line: #e3e5ea;
  --line-2: #cdd1d9;

  --blue: #2774ae;
  --blue-soft: rgba(39, 116, 174, 0.10);
  --gold: #b9842a;
  --gold-hi: #e9bc70;
  --gold-soft: rgba(233, 188, 112, 0.18);
  --ok: #1f8a5b;
  --bad: #c0392b;
  --on-accent: #ffffff;

  --s-base: #a4a8ae;
  --s-ours: #2774ae;

  --shadow: 0 1px 2px rgba(20, 24, 27, 0.04), 0 8px 24px -12px rgba(20, 24, 27, 0.12);
  --radius: 14px;
  --radius-sm: 9px;

  --f-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --maxw: 1180px;
  --gutter: clamp(16px, 3vw, 40px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --bg-grid: rgba(238, 240, 244, 0.045);
  --surface: #14171c;
  --surface-2: #1a1e24;
  --surface-3: #222730;
  --ink: #eef0f4;
  --ink-2: #b3b9c4;
  --ink-3: #808896;
  --line: #232831;
  --line-2: #303641;
  --blue: #6aaee6;
  --blue-soft: rgba(106, 174, 230, 0.13);
  --gold: #e9bc70;
  --gold-hi: #f5d08f;
  --gold-soft: rgba(233, 188, 112, 0.14);
  --ok: #4cc38a;
  --bad: #f07a6a;
  --on-accent: #0f1115;
  --s-base: #6b7380;
  --s-ours: #5b9fd8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s, color .3s;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
code, .mono { font-family: var(--f-mono); font-size: 0.86em; }
h1, h2, h3, h4 { font-family: var(--f-display); letter-spacing: -0.015em; line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }
b, strong { font-weight: 600; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--f-display); font-weight: 700; color: var(--ink); text-decoration: none; font-size: 17px; letter-spacing: -0.02em; }
.brand img { width: 24px; height: auto; }
.nav-links { display: flex; gap: 2px; margin-left: auto; }
.nav-links a {
  color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 6px 10px; border-radius: 8px; transition: background .2s, color .2s; white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: var(--surface-2); }
.nav-links .ext { color: var(--ink-3); }
.nav-links .ext::after { content: " ↗"; font-size: 12px; }
.theme-switch {
  position: relative; flex: none; width: 58px; height: 30px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between; padding: 0 8px;
  transition: background .25s, border-color .25s;
}
.theme-switch:hover { border-color: var(--ink-3); }
.theme-switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.theme-switch svg { width: 13px; height: 13px; color: var(--ink-3); position: relative; z-index: 1; }
.theme-switch .ts-sun { color: var(--gold); }
.theme-switch .ts-knob {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 1px var(--line);
  transition: transform .28s cubic-bezier(.3,1.3,.5,1);
}
:root[data-theme="dark"] .theme-switch { background: var(--surface-3); }
:root[data-theme="dark"] .theme-switch .ts-knob { transform: translateX(28px); }
:root[data-theme="dark"] .theme-switch .ts-moon { color: var(--blue); }

/* ---------- hero ---------- */
.hero { position: relative; padding: 64px 0 40px; text-align: center; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background-image: linear-gradient(var(--bg-grid) 1px, transparent 1px), linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
}
.hero::after {
  content: ""; position: absolute; left: 50%; top: 40px; width: 560px; height: 360px; z-index: -1;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--gold-soft), transparent 70%);
  filter: blur(10px); pointer-events: none;
}
#sparks { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

.forge-line {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 5px 14px 5px 10px; margin-bottom: 26px; box-shadow: var(--shadow);
  white-space: nowrap; overflow: hidden;
}
.forge-line .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; box-shadow: 0 0 0 0 var(--gold); animation: ping 1.8s infinite; }
.forge-line .ph { color: var(--blue); font-weight: 600; }
.forge-line .msg { overflow: hidden; text-overflow: ellipsis; }
.forge-line .msg b { color: var(--gold); font-weight: 600; }
.forge-line .caret { width: 7px; height: 14px; background: var(--ink-3); flex: none; animation: blink 1s steps(1) infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 8px transparent; } }
@keyframes blink { 50% { opacity: 0; } }

.title-row { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 14px; }
.hero-logo { width: 96px; height: auto; filter: drop-shadow(0 6px 22px color-mix(in srgb, var(--gold) 35%, transparent)); animation: logoIn .9s cubic-bezier(.2,.8,.2,1) both; }
.hero-logo:hover { animation: strike .5s ease; }
@keyframes logoIn { from { opacity: 0; transform: translateY(-14px) rotate(-14deg) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes strike { 0% { transform: rotate(0); } 35% { transform: rotate(-16deg); } 60% { transform: rotate(6deg); } 100% { transform: rotate(0); } }
.hero h1 {
  font-size: clamp(48px, 8.4vw, 96px); font-weight: 700; letter-spacing: -0.04em; line-height: 1;
}
.hero h1 .smith {
  background: linear-gradient(100deg, var(--gold) 0%, var(--gold-hi) 40%, var(--gold) 60%, var(--gold-hi) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 6s ease-in-out infinite;
}
.hero h1 .tool { color: var(--blue); }
@keyframes sheen { 0%, 100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }
.hero .subtitle { font-family: var(--f-display); font-size: clamp(19px, 2.4vw, 26px); color: var(--ink-2); font-weight: 500; margin: 6px auto 22px; max-width: 960px; line-height: 1.3; }
.authors { font-size: 17px; margin: 0 auto 6px; max-width: 860px; }
.authors span { white-space: nowrap; }
.authors sup, .affils sup { font-size: 0.65em; color: var(--ink-3); }
.affils { display: flex; justify-content: center; align-items: center; gap: 22px; flex-wrap: wrap; color: var(--ink-2); font-size: 15px; margin: 10px 0 4px; }
.affils .aff { display: inline-flex; align-items: center; gap: 8px; }
.affils img { height: 30px; width: 30px; border-radius: 6px; object-fit: cover; }
.eq { color: var(--ink-3); font-size: 13.5px; margin: 6px 0 0; }
.venue {
  display: inline-block; margin: 18px 0 4px; padding: 5px 16px; border-radius: 999px;
  font-family: var(--f-display); font-weight: 700; font-size: 17px; letter-spacing: .02em;
  color: var(--gold); background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
}

.btn-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; text-decoration: none; transition: transform .15s, border-color .2s, background .2s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { transform: translateY(-1px); border-color: var(--ink-3); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.soon { opacity: .55; pointer-events: none; }
.btn.soon small { font-weight: 500; color: var(--ink-3); }
.btn.sib { border-color: color-mix(in srgb, var(--blue) 45%, transparent); background: var(--blue-soft); }

/* ---------- sections ---------- */
.block { padding: 72px 0; }
.block + .block { border-top: 1px solid var(--line); }
.sec-head { margin-bottom: 30px; max-width: 820px; }
.sec-head .kicker { font-family: var(--f-mono); font-size: 12.5px; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.sec-head h2 { font-size: clamp(28px, 3.6vw, 40px); }
.sec-head .lead { color: var(--ink-2); font-size: 17px; margin: 12px 0 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* teaser */
.teaser { display: grid; grid-template-columns: 1fr 1.05fr; gap: 36px; align-items: center; }
.teaser-fig { padding: 14px; background: #fff; cursor: zoom-in; }
.teaser-fig img { border-radius: 8px; }
.teaser-text p { color: var(--ink-2); font-size: 17px; }
.teaser-text .big { font-family: var(--f-display); font-size: clamp(22px, 2.6vw, 30px); line-height: 1.25; color: var(--ink); margin-bottom: 18px; }
.teaser-text .big em { font-style: normal; color: var(--gold); }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.vs > div { padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); font-size: 14.5px; color: var(--ink-2); }
.vs h4 { font-size: 15px; margin-bottom: 6px; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.vs .x h4::before { content: "✕"; color: var(--bad); }
.vs .o { border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: var(--gold-soft); }
.vs .o h4::before { content: "✓"; color: var(--ok); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 20px 20px 18px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--gold), var(--blue)); }
.stat .n { font-family: var(--f-display); font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.stat .n .u { font-size: 22px; color: var(--ink-3); margin-left: 2px; }
.stat .l { color: var(--ink-2); font-size: 14px; margin-top: 8px; line-height: 1.4; }

.chart-card { padding: 22px 22px 14px; }
.chart-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-title { font-family: var(--f-display); font-weight: 600; font-size: 17px; }
.chart-sub { display: block; color: var(--ink-3); font-family: var(--f-body); font-weight: 400; font-size: 13px; margin-top: 3px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin: 6px 0 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  font: 500 13.5px var(--f-body); color: var(--ink-2); background: none; border: 0; cursor: pointer;
  padding: 6px 14px; border-radius: 7px; transition: background .2s, color .2s;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 0 0 1px var(--line); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--f-body); fill: var(--ink-3); font-size: 12px; }
.chart .grid { stroke: var(--line); }
.chart .bar { transition: height .7s cubic-bezier(.2,.8,.2,1), y .7s cubic-bezier(.2,.8,.2,1); }
.chart .val { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.chart .gain { fill: var(--gold); font-weight: 700; font-size: 13px; }
.chart .xl { fill: var(--ink); font-size: 13.5px; font-weight: 600; }

/* method: pipeline */
.pipe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; position: relative; margin-bottom: 18px; }
.phase {
  position: relative; padding: 18px 16px 16px; cursor: pointer; text-align: left; font: inherit; color: inherit;
  transition: border-color .3s, transform .3s, box-shadow .3s, background .3s;
}
.phase:hover { transform: translateY(-2px); }
.phase .pn { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
.phase h3 { font-size: 17px; margin: 4px 0 10px; }
.phase .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); margin-bottom: 12px; transition: background .3s, color .3s; }
.phase .ic svg { width: 21px; height: 21px; }
.phase .bar { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.phase .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--gold)); }
.phase.on { border-color: color-mix(in srgb, var(--gold) 60%, transparent); box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow); }
.phase.on .ic { background: var(--gold-soft); color: var(--gold); }
.phase.on .bar i { animation: fill var(--dur, 4.5s) linear forwards; }
.phase.done .bar i { width: 100%; }
.pipe.paused .phase.on .bar i { animation-play-state: paused; }
@keyframes fill { to { width: 100%; } }
.phase.infer .ic { background: var(--surface-3); color: var(--ink-2); }
.phase.infer.on .ic { background: var(--blue-soft); color: var(--blue); }

.phase-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 0; overflow: hidden; }
.pd-text { padding: 26px 28px; border-right: 1px solid var(--line); }
.pd-text .pn { font-family: var(--f-mono); font-size: 12.5px; color: var(--gold); }
.pd-text h3 { font-size: 24px; margin: 6px 0 12px; }
.pd-text p { color: var(--ink-2); margin: 0; }
.pd-text ul { margin: 14px 0 0; padding: 0; list-style: none; }
.pd-text li { position: relative; padding-left: 20px; color: var(--ink-2); font-size: 15px; margin-bottom: 6px; }
.pd-text li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--gold); transform: rotate(45deg); }
.pd-viz { padding: 22px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; min-height: 280px; position: relative; }
.pd-viz::after { content: "Illustrative"; position: absolute; top: 10px; right: 12px; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.swap { animation: swapIn .45s ease both; }
@keyframes swapIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* viz: terminal */
.term { width: 100%; max-width: 470px; border-radius: 10px; background: #0b0d11; border: 1px solid #262b34; color: #d6dae2; font-family: var(--f-mono); font-size: 12.5px; line-height: 1.7; overflow: hidden; box-shadow: 0 14px 40px -18px rgba(0,0,0,.6); }
.term .tb { display: flex; gap: 6px; padding: 9px 12px; background: #151920; border-bottom: 1px solid #262b34; }
.term .tb i { width: 10px; height: 10px; border-radius: 50%; background: #3a404b; }
.term .tb i:nth-child(1) { background: #ef6a5e; } .term .tb i:nth-child(2) { background: #f4be4f; } .term .tb i:nth-child(3) { background: #5fc454; }
.term .tb span { margin-left: 8px; color: #7d8592; font-size: 11.5px; }
.term pre { margin: 0; padding: 14px 16px; white-space: pre-wrap; word-break: break-word; min-height: 210px; font: inherit; }
.term .k { color: #c792ea; } .term .f { color: #82aaff; } .term .s { color: #c3e88d; } .term .c { color: #6b7380; } .term .g { color: #e9bc70; } .term .ok { color: #4cc38a; } .term .no { color: #f07a6a; }

/* viz: clusters */
.clusters { width: 100%; max-width: 440px; }
.clusters svg { width: 100%; height: auto; display: block; }
.clusters circle { transition: cx 1.1s cubic-bezier(.2,.8,.2,1), cy 1.1s cubic-bezier(.2,.8,.2,1), r .6s, opacity .6s; }
.clusters text { font-family: var(--f-mono); font-size: 11px; fill: var(--ink-2); }

/* viz: library */
.lib { width: 100%; max-width: 460px; }
.lib .lh { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.chip { font-size: 13px; padding: 5px 11px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chip.gen { border-color: color-mix(in srgb, var(--gold) 55%, transparent); background: var(--gold-soft); color: var(--ink); }
.chip.gen::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.chip.pop { animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
.chip.hit { outline: 2px solid var(--blue); outline-offset: 1px; }
.chip.dim { opacity: .35; }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.query { font-size: 14px; padding: 10px 12px; border-radius: 9px; background: var(--surface); border: 1px dashed var(--line-2); margin-bottom: 14px; color: var(--ink); }
.query b { font-family: var(--f-mono); font-size: 11.5px; color: var(--blue); margin-right: 6px; }

.fig-full { margin-top: 18px; padding: 16px; background: #fff; cursor: zoom-in; }
.fig-full img { width: 100%; border-radius: 6px; }
.fig-cap { color: var(--ink-3); font-size: 13.5px; margin: 10px 2px 0; }
details.figd { margin-top: 18px; }
details.figd summary { cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 15px; list-style: none; display: inline-flex; align-items: center; gap: 8px; }
details.figd summary::-webkit-details-marker { display: none; }
details.figd summary::before { content: "▸"; color: var(--gold); transition: transform .2s; }
details.figd[open] summary::before { transform: rotate(90deg); }

/* results table */
.tbl-wrap { overflow-x: auto; }
table.res { width: 100%; border-collapse: collapse; font-size: 15.5px; min-width: 560px; }
table.res th, table.res td { padding: 14px 18px; text-align: center; border-bottom: 1px solid var(--line); }
table.res th { font-family: var(--f-display); font-weight: 600; font-size: 14px; color: var(--ink-2); background: var(--surface-2); }
table.res th:first-child, table.res td:first-child { text-align: left; }
table.res tbody tr { transition: background .2s; }
table.res tbody tr:hover { background: var(--surface-2); }
table.res tbody tr:last-child td { border-bottom: 0; }
table.res .arrow { color: var(--ink-3); margin: 0 6px; }
table.res .new { font-weight: 700; }
.delta { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--gold); background: var(--gold-soft); font-variant-numeric: tabular-nums; }
.tbl-cap { color: var(--ink-3); font-size: 14px; margin: 14px 2px 0; }
.findings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.finding { padding: 18px 20px; }
.finding h4 { font-size: 16px; margin-bottom: 6px; }
.finding p { color: var(--ink-2); font-size: 14.5px; margin: 0; }

/* cases */
.cases { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.case-tabs { display: flex; flex-direction: column; gap: 8px; }
.case-tab {
  text-align: left; font: inherit; color: var(--ink-2); cursor: pointer; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); transition: border-color .2s, background .2s, color .2s;
}
.case-tab .cn { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); display: block; }
.case-tab .ct { font-weight: 600; font-size: 14.5px; }
.case-tab[aria-selected="true"] { border-color: color-mix(in srgb, var(--gold) 60%, transparent); background: var(--gold-soft); color: var(--ink); }
.case-view { padding: 16px; background: #fff; position: relative; cursor: zoom-in; }
.case-view img { margin: 0 auto; max-height: 820px; width: auto; border-radius: 6px; }
.case-nav { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.ctl { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.ctl:hover { border-color: var(--ink-3); }
.ctl svg { width: 16px; height: 16px; }

/* related */
.related { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; padding: 22px 26px; text-decoration: none; color: inherit; transition: transform .2s, border-color .2s; }
.related:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--blue) 50%, transparent); }
.related .rm { width: 54px; height: 54px; }
.related h3 { font-size: 22px; margin-bottom: 4px; }
.related h3 .vl { color: var(--blue); }
.related p { color: var(--ink-2); margin: 0; font-size: 15px; }
.related .go { font-weight: 600; color: var(--blue); white-space: nowrap; }

/* about logo */
.about { display: grid; grid-template-columns: 150px 1fr; gap: 28px; align-items: center; padding: 26px 28px; }
.about img { width: 130px; }
.about p { color: var(--ink-2); margin: 0; }
.swatches { display: flex; gap: 10px; margin-top: 14px; }
.swatches span { display: inline-flex; align-items: center; gap: 7px; font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-2); }
.swatches i { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--line-2); }

/* bib */
.bib { position: relative; padding: 0; overflow: hidden; }
.bib pre { margin: 0; padding: 22px 24px; overflow-x: auto; font-family: var(--f-mono); font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.copy-btn {
  position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 6px;
  font: 500 13px var(--f-body); color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn.ok { color: var(--ok); border-color: var(--ok); }

footer { border-top: 1px solid var(--line); padding: 34px 0 46px; color: var(--ink-3); font-size: 14px; text-align: center; }
footer a { color: var(--ink-2); }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8, 10, 13, .88); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1400px, 96vw); max-height: 92vh; width: auto; border-radius: 8px; background: #fff; animation: swapIn .3s ease; }

/* reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .pipe { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .findings { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .nav-links { display: none; }
  .theme-switch { margin-left: auto; }
  .teaser, .phase-detail { grid-template-columns: 1fr; }
  .pd-text { border-right: 0; border-bottom: 1px solid var(--line); }
  .cases { grid-template-columns: 1fr; }
  .case-tabs { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .case-tab { flex: none; }
  .related { grid-template-columns: auto 1fr; }
  .related .go { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .hero { padding-top: 36px; }
  .title-row { gap: 12px; }
  .hero-logo { width: 62px; }
  .pipe { grid-template-columns: repeat(5, 156px); overflow-x: auto; padding: 4px 4px 8px; margin: 0 -4px 14px; scroll-snap-type: x mandatory; }
  .phase { scroll-snap-align: start; padding: 14px 14px 12px; }
  .phase .ic { width: 32px; height: 32px; margin-bottom: 8px; }
  .phase h3 { font-size: 15px; }
  .pd-viz { min-height: 0; padding: 30px 12px 16px; }
  .term { font-size: 11px; }
  .pd-text { padding: 22px 20px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .n { font-size: 32px; }
  .vs { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; text-align: left; }
  .about img { width: 100px; }
  .block { padding: 54px 0; }
  .btn { height: 42px; padding: 0 14px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  #sparks { display: none; }
}

/* ---------- research line (shared by the GENOME and ToolSmith pages) ---------- */
.series { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.series .step { display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; text-decoration: none; color: var(--ink); transition: transform .2s, border-color .2s; position: relative; }
.series a.step:hover { transform: translateY(-2px); border-color: var(--ink-3); }
.series .yr { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-3); letter-spacing: .06em; }
.series h3 { font-size: 24px; }
.series .tag { font-family: var(--f-display); font-size: 15px; color: var(--ink-2); font-weight: 500; }
.series p { color: var(--ink-2); font-size: 15px; margin: 2px 0 0; }
.series .go { margin-top: auto; padding-top: 8px; font-weight: 600; font-size: 14.5px; color: var(--blue); }
.series .here { position: absolute; top: 18px; right: 18px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-3); }
.series .step.cur { border-color: color-mix(in srgb, var(--gold) 55%, transparent); box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow); }
.series .arrow { display: grid; place-items: center; color: var(--ink-3); font-size: 26px; }
.series .g-genome { width: fit-content; background: linear-gradient(100deg, #025df8 0%, #7444c4 40%, #b82da3 72%, #9d1f33 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .series .g-genome { background-image: linear-gradient(100deg, #3d82ff 0%, #9466e6 40%, #d257c2 72%, #d4465f 100%); }
.series .g-toolsmith .t { color: #2774ae; } .series .g-toolsmith .s { color: #e9bc70; }
:root[data-theme="dark"] .series .g-toolsmith .t { color: #6aaee6; }
.series-note { color: var(--ink-3); font-size: 14px; margin: 14px 2px 0; }
@media (max-width: 860px) {
  .series { grid-template-columns: 1fr; }
  .series .arrow { transform: rotate(90deg); font-size: 22px; }
}
.series .lg-logo { width: 44px; height: 44px; object-fit: contain; position: absolute; right: 20px; bottom: 18px; opacity: .9; }
