/* Machina: "Hangar" design system. Dark technical by default, light as an option. */
:root {
  --bg: #0a0e13;
  --bg-2: #0e131a;
  --surface: #121821;
  --raised: #18202b;
  --line: #222b37;
  --line-2: #2d3846;
  --ink: #e7ecf2;
  --muted: #8794a5;
  --faint: #75839a; /* 4.6:1 on the dark background */
  --accent: #ff8a3d;
  --accent-ink: #ffb07a;
  --accent-soft: rgba(255, 138, 61, 0.12);
  --data: #5ec8ff;
  --data-soft: rgba(94, 200, 255, 0.1);
  --grid: rgba(94, 200, 255, 0.05);
  --stage-top: #141b25;
  --stage-bottom: #07090d;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eef1f4;
  --bg-2: #e7ebef;
  --surface: #ffffff;
  --raised: #f6f8fa;
  --line: #dde3ea;
  --line-2: #cbd3dd;
  --ink: #141a22;
  --muted: #5d6877;
  --faint: #67727f; /* 4.8:1 on white */
  --accent: #e8681a;
  --accent-ink: #b84e0e;
  --accent-soft: rgba(232, 104, 26, 0.1);
  --data: #0b7fc0;
  --data-soft: rgba(11, 127, 192, 0.08);
  --grid: rgba(11, 127, 192, 0.06);
  --stage-top: #fbfcfd;
  --stage-bottom: #dfe5eb;
  --shadow: 0 10px 30px rgba(20, 30, 40, 0.1);
  color-scheme: light;
}

/* Blueprint: the brand theme. Prussian-blue drawing paper, white linework, amber markup. */
:root[data-theme="blueprint"] {
  --bg: #0b2b4c;
  --bg-2: #0d3155;
  --surface: #0f375f;
  --raised: #14426f;
  --line: #24527f;
  --line-2: #33679a;
  --ink: #f3f8fd;
  --muted: #b3cbe2;
  --faint: #93b3d2; /* 6:1 on the paper */
  --accent: #ffad4a;
  --accent-ink: #ffc98a;
  --accent-soft: rgba(255, 173, 74, 0.14);
  --data: #a6e6ff;
  --data-soft: rgba(166, 230, 255, 0.12);
  --grid: rgba(255, 255, 255, 0.075);
  --stage-top: #134574;
  --stage-bottom: #082341;
  --shadow: 0 10px 30px rgba(2, 16, 32, 0.45);
  color-scheme: dark;
}
:root[data-theme="blueprint"] .blueprint { background-size: 24px 24px; }
:root[data-theme="blueprint"] h1 { letter-spacing: -0.01em; text-transform: uppercase; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.blueprint {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}

.label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); }

/* Corner brackets on technical panels */
.bracket { position: relative; }
.bracket::before, .bracket::after {
  content: ""; position: absolute; width: 10px; height: 10px; pointer-events: none;
  border-color: var(--accent); border-style: solid; opacity: 0.7;
}
.bracket::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.bracket::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: 28px;
  padding: 0 20px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; font-size: 13px; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--accent); border-radius: 5px; }
.brand-mark span { width: 10px; height: 10px; background: var(--accent); clip-path: polygon(0 60%, 100% 0, 65% 100%, 50% 70%); }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 6px; color: var(--muted); font-weight: 600; }
.nav a:hover { color: var(--ink); background: var(--raised); }
.nav a[aria-current="page"] { color: var(--ink); border-radius: 0; }
.nav .soon { font-family: var(--mono); font-size: 10px; color: var(--faint); margin-left: 4px; }
.topbar-end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.themes { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.themes button { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; }
.themes button span { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(127, 140, 160, 0.6); }
.themes button[aria-checked="true"] { box-shadow: 0 0 0 1.5px var(--accent); }
.themes button:hover span { transform: scale(1.12); }

/* Page container */
.page { max-width: 1320px; margin: 0 auto; padding: 32px 24px 64px; }

/* Home hero */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: end; padding: 40px 0 28px; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: clamp(34px, 5vw, 60px); line-height: 1.02; letter-spacing: -0.035em; margin: 12px 0 14px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); font-size: 16px; max-width: 560px; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat { padding: 18px 20px; border-inline-start: 1px solid var(--line); }
.stat:first-child { border-inline-start: 0; }
.stat b { display: block; font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 40px 0 16px; }
.section-head h2 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }

/* Category cards */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cat {
  display: grid; grid-template-rows: 150px auto; text-decoration: none; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; transition: border-color 0.2s, transform 0.2s;
}
.cat:hover { border-color: var(--accent); transform: translateY(-2px); }
.cat-art { display: flex; align-items: flex-end; justify-content: center; gap: 4px; padding: 10px; background: linear-gradient(var(--stage-top), var(--stage-bottom)); }
.cat-art img { height: 100%; width: 100%; object-fit: contain; }
.cat-body { padding: 14px 16px 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.cat-body h3 { margin: 4px 0 2px; font-size: 18px; }
.cat-body p { margin: 0; color: var(--muted); font-size: 13px; }
.count { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--accent-ink); }
.cat.soon { opacity: 0.55; pointer-events: none; grid-template-rows: auto; }
.cats-live { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.cats-live .cat { grid-template-rows: 220px auto; }
.cats-planned { margin-top: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cat-art img { max-width: 100%; }

/* Gallery */
.toolbar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { min-width: 240px; padding: 9px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; color: var(--ink); font: inherit; }
.search::placeholder { color: var(--faint); }
.group-title { margin: 28px 0 12px; display: flex; align-items: center; gap: 12px; }
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; text-decoration: none; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.thumb { aspect-ratio: 16 / 10; background: linear-gradient(var(--stage-top), var(--stage-bottom)); display: grid; place-items: center; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb .code { position: absolute; top: 10px; left: 12px; }
.thumb .spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card-body { padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.card-body h3 { margin: 0 0 4px; font-size: 15px; line-height: 1.3; }
.dims { display: flex; gap: 14px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.dims b { color: var(--data); font-weight: 600; }

/* Model page */
.model-page { display: grid; grid-template-columns: 272px 1fr 392px; height: calc(100vh - 56px); }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--faint); }

.sys-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }

.stage { position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 35%, var(--stage-top), var(--stage-bottom) 75%); }
.stage-host, .stage-host canvas { width: 100%; height: 100%; display: block; }
.hud-top { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; gap: 12px; }
.hud-top > * { pointer-events: auto; }
.readout { display: flex; gap: 18px; font-family: var(--mono); font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; backdrop-filter: blur(6px); }
.readout b { color: var(--data); font-weight: 600; }
.stepper { display: flex; gap: 6px; }
.dock {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  backdrop-filter: blur(8px); box-shadow: var(--shadow); white-space: nowrap;
}
.tool { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none; border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.tool:hover { color: var(--ink); background: var(--raised); }
.tool[aria-pressed="true"] { color: var(--accent-ink); border-color: transparent; border-radius: 0; --k: 6px; }
.tool kbd { font-family: var(--mono); font-size: 10px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.tool input[type="range"] { width: 110px; accent-color: var(--accent); }
.dock .sep { width: 1px; height: 22px; background: var(--line); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 4px; transform: translate(14px, 14px); z-index: 2; }

.specs { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.specs div { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); }
.specs div:first-child { border-top: 0; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; text-align: end; font-weight: 600; }
.specs dd.num { font-family: var(--mono); color: var(--data); font-weight: 600; }
.part-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.back { display: block; border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 600; cursor: pointer; }
.sources a { display: block; color: var(--accent-ink); margin-bottom: 6px; text-decoration: none; }
.sources a:hover { text-decoration: underline; }
.note { color: var(--faint); font-size: 12px; margin-top: 18px; }
.verified { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--data); background: var(--data-soft); border-radius: 999px; padding: 2px 10px; }

@media (max-width: 1100px) {
  .model-page { grid-template-columns: 220px 1fr; }
  .sheet { grid-column: 1 / -1; border-inline-start: 0; border-top: 1px solid var(--line); }
  .model-page { height: auto; grid-template-rows: 65vh auto; }
}
@media (max-width: 760px) {
  .cats-live { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .topbar { gap: 12px; padding: 0 12px; }
  .nav .soon { display: none; }
  .page { padding: 20px 16px 48px; }
  .model-page { grid-template-columns: 1fr; grid-template-rows: auto 60vh auto; }
  .rail { border-inline-end: 0; border-bottom: 1px solid var(--line); max-height: 220px; }
  .dock { left: 8px; right: 8px; transform: none; overflow-x: auto; }
  .readout { display: none; }
}

.loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; background: color-mix(in srgb, var(--bg) 55%, transparent); z-index: 3; }
.loading .spinner { width: 26px; height: 26px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.specs dd a { color: var(--accent-ink); text-decoration: none; word-break: break-all; }
.loading[hidden] { display: none; }
.verified.warn { color: var(--accent-ink); background: var(--accent-soft); }

/* Phone layout */
@media (max-width: 760px) {
  .topbar { gap: 10px; }
  .nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .topbar-end { flex: none; }
  .model-page { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "stage" "sheet" "rail"; height: auto; }
  .model-page .stage { grid-area: stage; height: 62vh; min-height: 340px; }
  .model-page .sheet { grid-area: sheet; border-top: 1px solid var(--line); }
  .model-page .rail { grid-area: rail; max-height: none; border-top: 1px solid var(--line); border-bottom: 0; }
  .dock { gap: 2px; padding: 4px; bottom: 10px; }
  .tool { padding: 6px 8px; }
  .tool kbd { display: none; }
  .tool input[type="range"] { width: 72px; }
}
@media (max-width: 420px) {
  .brand { letter-spacing: 0.1em; }
  .brand > :not(.brand-mark) { display: none; }
  .stats .stat b { font-size: 22px; }
}

/* Accessibility */
.sys-dot, .dot { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 6px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 10px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .card:hover, .cat:hover { transform: none; }
}

/* Selected state: four corner ticks, like a target lock on a head-up display */
.nav a[aria-current="page"], .tool[aria-pressed="true"] {
  --t: var(--accent); --k: 7px; --w: 1.5px;
  background:
    linear-gradient(var(--t), var(--t)) top left / var(--k) var(--w),
    linear-gradient(var(--t), var(--t)) top left / var(--w) var(--k),
    linear-gradient(var(--t), var(--t)) top right / var(--k) var(--w),
    linear-gradient(var(--t), var(--t)) top right / var(--w) var(--k),
    linear-gradient(var(--t), var(--t)) bottom left / var(--k) var(--w),
    linear-gradient(var(--t), var(--t)) bottom left / var(--w) var(--k),
    linear-gradient(var(--t), var(--t)) bottom right / var(--k) var(--w),
    linear-gradient(var(--t), var(--t)) bottom right / var(--w) var(--k),
    var(--accent-soft);
  background-repeat: no-repeat;
}

/* Three-view drawing in the spec sheet: the SVG keeps its white paper in every theme */
.drawing { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; margin-bottom: 18px; }
.drawing img { display: block; width: 100%; height: auto; }
.drawing:hover { border-color: var(--accent); }

/* ── Model page: parts rail ───────────────────────────── */
.rail { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); background: var(--bg-2); }
.rail-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.rail-title { display: flex; align-items: center; justify-content: space-between; }
.rail-tools { display: flex; gap: 2px; }
.icon-sm { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--faint); cursor: pointer; }
.icon-sm:hover { color: var(--ink); background: var(--raised); }
.filter { position: relative; display: block; }
.filter .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.filter input { width: 100%; font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px 8px 32px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.filter input::placeholder { color: var(--faint); }
.filter input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tree { list-style: none; margin: 0; padding: 10px 10px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.tree-sys { margin-bottom: 2px; }
.tree-sys[hidden], .tree-sys li[hidden] { display: none; }
.sys-head { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; text-align: start; }
.sys-head:hover { background: var(--raised); }
.sys-head .chev { width: 10px; color: var(--faint); transition: transform 0.15s; flex: none; }
.sys-head .n { margin-inline-start: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted); background: var(--raised); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.tree-sys[data-open="false"] .chev { transform: rotate(-90deg); }
.tree-sys[data-open="false"] ul { display: none; }
.tree-sys ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 19px; border-inline-start: 1px solid var(--line); margin-inline-start: 13px; }
.part-btn { position: relative; width: 100%; text-align: start; border: 0; background: none; padding: 6px 10px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1.35; }
.part-btn:hover { color: var(--ink); background: var(--raised); }
.part-btn[aria-current="true"] { color: var(--ink); background: var(--accent-soft); font-weight: 600; }
.part-btn[aria-current="true"]::before { content: ""; position: absolute; left: -20px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--accent); }
.rail-foot { display: flex; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* ── Model page: livery palette in the stage ─────────── */
.paint { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 9px 7px; background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(8px); box-shadow: var(--shadow); z-index: 2; }
.paint[hidden] { display: none; }
.paint-ic { color: var(--faint); display: grid; place-items: center; padding-bottom: 2px; }
.paint-btn { position: relative; width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--line-2); transition: transform 0.12s, box-shadow 0.12s; }
.paint-btn:hover { transform: scale(1.1); }
.paint-btn[aria-checked="true"] { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28), 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.paint-btn::after { content: attr(data-name); position: absolute; right: calc(100% + 12px); top: 50%; transform: translate(4px, -50%); white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--bg); background: var(--ink); padding: 4px 9px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity 0.12s, transform 0.12s; }
.paint-btn:hover::after, .paint-btn:focus-visible::after { opacity: 1; transform: translate(0, -50%); }

/* ── Model page: tabbed sheet ────────────────────────── */
.sheet { display: grid; grid-template-columns: 1fr 68px; min-height: 0; border-inline-start: 1px solid var(--line); background: var(--bg-2); }
.panel { overflow-y: auto; padding: 22px 20px 28px; min-width: 0; }
.panel h1 { font-size: 22px; line-height: 1.2; margin: 6px 0 8px; letter-spacing: -0.02em; }
.panel .sub { color: var(--muted); margin: 0 0 12px; }
.panel h2 { margin: 22px 0 10px; }
.vtabs { display: flex; flex-direction: column; gap: 4px; padding: 12px 8px; border-inline-start: 1px solid var(--line); background: var(--bg); }
.vtab { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 2px 8px; border: 0; border-radius: 10px; background: none; color: var(--faint); cursor: pointer; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; }
.vtab:hover:not([disabled]) { color: var(--ink); background: var(--raised); }
.vtab[aria-selected="true"] { color: var(--accent-ink); background: var(--accent-soft); }
.vtab[aria-selected="true"]::before { content: ""; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--accent); }
.vtab[disabled] { opacity: 0.35; cursor: default; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 6px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 2px; }
.tile span { font-size: 11px; color: var(--muted); }
.tile b { font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--data); }
.tile b i { font-style: normal; font-size: 11px; color: var(--muted); margin-inline-start: 3px; }
.facts { margin: 16px 0 0; display: grid; gap: 0; }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-weight: 600; font-size: 13px; }
.link-btn { margin-top: 14px; border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.chip { display: inline-flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.note.tight { margin-top: 4px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: 13px; }
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.sources a { display: flex; align-items: center; gap: 8px; color: var(--accent-ink); margin-bottom: 8px; text-decoration: none; }
.sources a:hover { text-decoration: underline; }

/* Three-view drawing: the SVG keeps its white paper in every theme */
.drawing { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; margin: 4px 0 12px; }
.drawing img { display: block; width: 100%; height: auto; }
.drawing:hover { border-color: var(--accent); }

@media (min-width: 761px) and (max-width: 1100px) {
  .model-page { grid-template-columns: 240px 1fr; }
  .model-page .sheet { grid-column: 1 / -1; border-inline-start: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .paint { top: 12px; left: 10px; right: auto; transform: none; flex-direction: row; padding: 6px 9px; }
  .paint-btn::after { right: auto; left: 50%; top: calc(100% + 10px); transform: translate(-50%, -4px); }
  .paint-btn:hover::after, .paint-btn:focus-visible::after { transform: translate(-50%, 0); }
  .rail { max-height: 420px; }
  .sheet { grid-template-columns: 1fr; }
  .vtabs { order: -1; flex-direction: row; overflow-x: auto; border-inline-start: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; }
  .vtab { grid-auto-flow: column; gap: 6px; padding: 8px 12px; font-size: 12px; }
  .vtab[aria-selected="true"]::before { left: 12px; right: 12px; top: auto; bottom: -6px; width: auto; height: 2px; }
}

/* Drawers: hide the parts rail, fold the sheet to its tab rail */
.model-page { transition: grid-template-columns 0.2s ease; }
.model-page.rail-closed { grid-template-columns: 0 1fr 392px; }
.model-page.sheet-closed { grid-template-columns: 272px 1fr 68px; }
.model-page.rail-closed.sheet-closed { grid-template-columns: 0 1fr 68px; }
.model-page.rail-closed .rail { overflow: hidden; border: 0; }
.model-page.sheet-closed .panel { display: none; }
.model-page.sheet-closed .sheet { grid-template-columns: 68px; }
.model-page.sheet-closed .vtab[aria-selected="true"] { background: none; color: var(--faint); }
.model-page.sheet-closed .vtab[aria-selected="true"]::before { display: none; }
.drawer-open { position: absolute; left: 14px; top: 58px; z-index: 2; display: none; align-items: center; gap: 4px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(8px); color: var(--muted); font-weight: 600; font-size: 12px; cursor: pointer; }
.drawer-open:hover { color: var(--ink); border-color: var(--accent); }
.model-page.rail-closed .drawer-open { display: inline-flex; }
@media (max-width: 1100px) { .model-page.rail-closed, .model-page.sheet-closed, .model-page.rail-closed.sheet-closed { grid-template-columns: 240px 1fr; } .drawer-open, [data-drawer] { display: none !important; } }

.paint-custom { position: relative; overflow: hidden; background-image: conic-gradient(from 0deg, #f44, #fd4, #4f6, #4df, #64f, #f4d, #f44) !important; }
.paint-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* Project history: compact, one line per entry, expand on click */
.history { max-width: 1000px; }
.history h1 { margin: 4px 0 6px; }
.history .sub { color: var(--muted); margin: 0; max-width: 520px; }
.hist-top { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; margin-bottom: 20px; }
.hist-next { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; }
.hist-next ul { margin: 6px 0 0; padding-left: 16px; font-size: 13px; }
.hist-next li { margin-bottom: 4px; line-height: 1.45; }
.hist-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.hist-item + .hist-item { border-top: 1px solid var(--line); }
.hist-item summary { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; list-style: none; }
.hist-item summary::-webkit-details-marker { display: none; }
.hist-item summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(-45deg); transition: transform 0.15s; flex: none; }
.hist-item[open] summary::before { transform: rotate(45deg); }
.hist-item summary:hover { background: var(--raised); }
.hist-item time { font-family: var(--mono); font-size: 12px; color: var(--muted); flex: none; width: 42px; }
.hist-title { font-weight: 600; flex: 1; min-width: 0; }
.tl-tag { font-family: var(--mono); font-size: 11px; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 1px 9px; font-weight: 600; }
.hist-n { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.hist-item ul { margin: 0; padding: 0 16px 12px 70px; font-size: 13.5px; }
.hist-item li { margin-bottom: 5px; line-height: 1.5; }
@media (max-width: 760px) { .hist-top { grid-template-columns: 1fr; } .hist-item ul { padding-left: 32px; } }

/* ── Picker (Machina's dropdown) ───────────────────── */
.pick { position: relative; display: inline-block; }
.pick-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px 0 12px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; white-space: nowrap; }
.pick-btn:hover:not(:disabled) { border-color: var(--line-2); }
.pick-btn:focus-visible, .pick.open .pick-btn { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pick-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pick-pre { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pick-chev { color: var(--muted); transition: transform 0.15s; }
.pick.open .pick-chev { transform: rotate(180deg); }
.pick-action .pick-btn { color: var(--accent-ink); }
.pick-list { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: min(340px, calc(100vw - 32px)); max-height: 320px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow);; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.pick-list.pick-end { left: auto; right: 0; }
.pick-list.pick-up { top: auto; bottom: calc(100% + 6px); }
.pick-list[hidden] { display: none; }
.pick-group { padding: 10px 10px 4px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.pick-group:first-child { padding-top: 4px; }
.pick-list [role="option"] { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 7px 10px; border-radius: 6px; font-size: 13px; color: var(--ink); cursor: pointer; outline: none; }
.pick-list [role="option"]:hover, .pick-list [role="option"]:focus { background: var(--raised); }
.pick-list [role="option"][aria-selected="true"] { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }
.pick-hint { font-family: var(--mono); font-size: 11px; color: var(--faint); font-weight: 400; }

/* ── Compare: a full-height page, one panel per tab ───── */
.compare-page { height: calc(100vh - 56px); height: calc(100dvh - 56px); display: flex; flex-direction: column; min-height: 520px; }
.cmp-bar { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 14px 20px 12px; border-bottom: 1px solid var(--line); }
.cmp-title { display: flex; align-items: baseline; gap: 10px; }
.cmp-title h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; font-weight: 800; }
.cmp-picks { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.cmp-spacer { flex: 1; }
.cmp-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; white-space: nowrap; max-width: 100%; font-size: 13px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px 0 12px; }
.cmp-chip .x { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--muted); text-decoration: none; font-size: 16px; line-height: 1; }
.cmp-chip .x:hover { background: var(--raised); color: var(--ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.cmp-tabbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.cmp-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.cmp-tab { position: relative; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 13px 14px 12px; cursor: pointer; white-space: nowrap; }
.cmp-tab:hover:not(:disabled) { color: var(--ink); }
.cmp-tab[aria-selected="true"] { color: var(--ink); }
.cmp-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); }
.cmp-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 6px; }
.cmp-tab:disabled { opacity: 0.4; cursor: not-allowed; }
.cmp-tools { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.cmp-panels { position: relative; flex: 1; min-height: 0; }
.cmp-panels > [hidden] { display: none !important; }
.cmp-stage { position: absolute; inset: 0; }
.cmp-panel { position: absolute; inset: 0; overflow: auto; padding: 20px; }
.cmp-empty { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; z-index: 2; }
.cmp-empty > div { max-width: 460px; }
.cmp-empty h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.02em; }
.cmp-empty p { color: var(--muted); margin: 0 0 18px; }
.cmp-empty .label { margin-bottom: 10px; }
.cmp-empty-sets { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cmp-preset { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; }
.cmp-preset:hover { border-color: var(--accent); color: var(--accent-ink); }
.cmp-sil { min-height: 100%; display: grid; place-items: center; }
.sil-sheet { display: grid; align-items: end; }
.sil { margin: 0; }
.sil[data-v="top"] { align-self: start; }
.sil figcaption { margin-bottom: 6px; }
.sil canvas { display: block; max-width: none; }
.sil-key { align-self: start; padding-top: 24px; display: grid; gap: 12px; }
.sil-key ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; font-weight: 600; }
.sil-key li { display: flex; align-items: center; gap: 8px; }
.cmp-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-width: 1240px; margin: 0 auto; }
.cmp-panel .note { max-width: 1240px; margin-inline: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cmp-table th, .cmp-table td { padding: 7px 14px; border-top: 1px solid var(--line); text-align: start; vertical-align: top; }
.cmp-table thead th { border-top: 0; font-size: 13px; white-space: nowrap; }
.cmp-table thead a { color: var(--ink); text-decoration: none; margin-inline-start: 8px; }
.cmp-table thead a:hover { color: var(--accent-ink); }
.cmp-table tbody th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.cmp-table td .v { font-weight: 600; }
.cmp-table td small, .cmp-table th small { color: var(--faint); font-weight: 400; }
.cmp-table td .d { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.cmp-table td.max .v { color: var(--data); }
.cmp-table td.max .v::after { content: " \25B2"; font-size: 9px; vertical-align: 2px; }
.cmp-table td.none { color: var(--faint); }
.cmp-table tr.same td, .cmp-table tr.same th { opacity: 0.55; }
@media (max-width: 760px) {
  .compare-page { min-height: calc(100dvh - 56px); height: auto; }
  .cmp-bar { padding: 12px 16px; flex-direction: column; align-items: stretch; gap: 10px; }
  .cmp-title h1 { font-size: 19px; }
  .cmp-spacer { display: none; }
  .cmp-tabbar { padding: 0 8px; flex-wrap: wrap; row-gap: 0; }
  .cmp-tools { padding: 0 0 8px 6px; }
  .cmp-tools:empty { display: none; }
  .cmp-tab { padding: 12px 10px 11px; }
  .cmp-panels { flex: none; height: 62dvh; min-height: 380px; }
  .cmp-panel { padding: 14px; }
}
