/* ============================================================================
   Tech binder — benmoyer.org
   Obsidian / indigo / brushed silver. Dense engineering-document layout with
   a live 3D chassis behind each machine sheet.
   ========================================================================= */

/* --------------------------------- tokens -------------------------------- */
:root {
  --bg: #08080a;
  --panel: #0d0d11;
  --panel-2: #121218;
  --panel-3: #17171e;

  --indigo: #6366f1;
  --indigo-bright: #8d95ff;
  --silver: #c8cbd2;
  --signal: #3fd39b;
  --warn: #f0a860;

  --text: #e9eaec;
  --text-2: #b2b6bc;
  --muted: #878c94;
  --faint: #5d6169;

  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.15);
  --hair: rgba(255, 255, 255, 0.045);

  --max: 1320px;
  --radius: 4px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

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

  --grid-line: rgba(255, 255, 255, 0.028);
}

html[data-theme="light"] {
  --bg: #edebe6;
  --panel: #ffffff;
  --panel-2: #f6f4ef;
  --panel-3: #eceae3;

  --indigo: #4f46e5;
  --indigo-bright: #4338ca;
  --silver: #33373d;
  --signal: #0f8f63;
  --warn: #a5611b;

  --text: #131417;
  --text-2: #363a40;
  --muted: #5b6069;
  --faint: #888d94;

  --line: rgba(19, 20, 23, 0.12);
  --line-2: rgba(19, 20, 23, 0.24);
  --hair: rgba(19, 20, 23, 0.07);

  --grid-line: rgba(19, 20, 23, 0.035);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}
html[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.62;
  letter-spacing: -0.004em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 120% 70% at 50% 0%, #000 10%, transparent 72%);
  mask-image: radial-gradient(ellipse 120% 70% at 50% 0%, #000 10%, transparent 72%);
}

::selection { background: var(--indigo); color: #fff; }
a { color: var(--indigo-bright); text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--indigo-bright);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 32px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  transform: translateY(-180%);
  padding: 9px 15px;
  border-radius: var(--radius);
  background: var(--indigo);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease;
}
.skip:focus { transform: translateY(0); }

[data-lucide] {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.125em;
  stroke-width: 1.7;
}
.lucide { display: inline-block; width: 1em; height: 1em; flex: none; }

/* ------------------------------ film grain ------------------------------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.038;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: grain 6s steps(8) infinite;
}
@keyframes grain {
  0% { background-position: 0 0; }
  12% { background-position: -18px 12px; }
  25% { background-position: 26px -22px; }
  37% { background-position: -12px 30px; }
  50% { background-position: 22px 18px; }
  62% { background-position: -24px -14px; }
  75% { background-position: 14px 26px; }
  87% { background-position: -20px 6px; }
  100% { background-position: 0 0; }
}

/* ------------------------------ 3d canvas layer --------------------------- */
.scene-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.scene-layer canvas {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* --------------------------------- topbar -------------------------------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.topbar.is-stuck { border-bottom-color: var(--line); }

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 52px;
  padding-block: 7px;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.wordmark span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.tabs {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs li { display: flex; }
.tab {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 11px;
  border-radius: var(--radius);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.tab:hover { color: var(--text-2); background: var(--panel); }
.tab[aria-current="true"] { color: var(--text); background: var(--panel-2); }
.tab b { font-weight: 500; opacity: 0.55; }
.tab[aria-current="true"] b { color: var(--indigo-bright); opacity: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); background: var(--panel); }
.icon-btn[aria-pressed="true"] { color: var(--indigo-bright); border-color: color-mix(in srgb, var(--indigo) 40%, transparent); }
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:hover { color: var(--text); border-color: var(--indigo); background: color-mix(in srgb, var(--indigo) 14%, transparent); }
.btn svg { width: 13px; height: 13px; flex: none; }
.btn-accent {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}
.btn-accent:hover { background: var(--indigo-bright); border-color: var(--indigo-bright); color: #fff; }

/* ---------------------------------- cover -------------------------------- */
.cover {
  position: relative;
  z-index: 2;
  padding-top: 120px;
  padding-bottom: 64px;
}
.cover-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
  gap: 40px 64px;
  align-items: center;
  padding-bottom: 40px;
}
.cover-copy { min-width: 0; }
.cover-stage { min-width: 0; }
.cover-stage .viewport {
  height: clamp(320px, 40vw, 460px);
  border: 1px solid var(--line);
  background: radial-gradient(130% 110% at 50% 50%, transparent 52%, color-mix(in srgb, var(--bg) 72%, transparent) 100%);
  overflow: hidden;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--indigo-bright);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}
.cover h1 {
  margin: 22px 0 20px;
  font-family: var(--font-display);
  font-size: clamp(3rem, 7.5vw, 5.8rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.04em;
}
.cover h1 em {
  font-style: normal;
  color: var(--indigo-bright);
}
.lede {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.68;
}

.cover-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
.cover-meta > div {
  padding: 14px 18px 14px 0;
  border-bottom: 1px solid var(--line);
}
.cover-meta dt {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.cover-meta dd {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-2);
}

/* ------------------------------- section head ---------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.section-head .sh-index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--indigo-bright);
  letter-spacing: 0.1em;
}
.section-head .sh-note {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--faint);
  letter-spacing: 0.04em;
}

/* -------------------------------- contents ------------------------------- */
.section { position: relative; z-index: 2; padding-bottom: 90px; }

.contents-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 0.85rem;
}
#contents-table { overflow-x: auto; }
.contents-table thead th {
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
}
.contents-table thead th:first-child { padding-left: 0; width: 40px; }
.contents-table tbody tr { border-bottom: 1px solid var(--hair); }
.contents-table tbody tr:hover { background: color-mix(in srgb, var(--panel) 60%, transparent); }
.contents-table td { padding: 16px 14px; vertical-align: baseline; }
.contents-table td:first-child { padding-left: 0; }
.c-index { font-family: var(--font-mono); font-size: 0.68rem; color: var(--indigo-bright); }
.c-name a { display: flex; align-items: baseline; gap: 10px; color: var(--text); }
.c-name a:hover .c-model { color: var(--indigo-bright); }
.c-maker { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.c-model { font-weight: 600; letter-spacing: -0.02em; transition: color 0.2s ease; }
.c-role { color: var(--text-2); font-size: 0.82rem; }
.c-spec {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ------------------------------ machine sheet ---------------------------- */
.sheet {
  position: relative;
  z-index: 2;
  padding-top: 56px;
  padding-bottom: 72px;
  border-top: 1px solid var(--line);
}
.sheet:first-of-type { border-top: 0; }

.sheet-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px 40px;
  align-items: end;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.sheet-ident { display: flex; align-items: flex-start; gap: 20px; }
.sheet-index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--indigo-bright);
  letter-spacing: 0.1em;
  padding-top: 8px;
}
.sheet-maker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}
.sheet-title h2 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.6vw, 2.9rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 34px;
  margin: 0;
}
.sheet-meta > div { padding: 2px 0; }
.sheet-meta dt {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.sheet-meta dd { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-2); }

.status { display: inline-flex; align-items: center; gap: 7px; }
.status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 8px color-mix(in srgb, var(--signal) 70%, transparent);
}

/* ------------------------------- viewport panel --------------------------- */
.sheet-body {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 26px 44px;
  align-items: start;
}

/* the live viewport stays pinned while the sheet scrolls past it */
.sheet-stage {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.viewport {
  position: relative;
  height: clamp(340px, 40vw, 480px);
  border: 1px solid var(--line);
  background: radial-gradient(130% 110% at 50% 50%, transparent 52%, color-mix(in srgb, var(--bg) 72%, transparent) 100%);
  overflow: hidden;
}

/* The product photograph. When WebGL is available the canvas draws the
   product in 3D and the image is only the fallback. */
.vp-product {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center 62%;
  filter: drop-shadow(0 26px 26px rgba(0, 0, 0, 0.55));
  transition: opacity 0.4s ease;
}
html.has-webgl .vp-product { opacity: 0; }
.viewport::before,
.viewport::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-style: solid;
  border-color: var(--line-2);
  pointer-events: none;
}
.viewport::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.viewport::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.vp-tag {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.13em;
  color: var(--faint);
  pointer-events: none;
}
.vp-tag--tl { top: 10px; left: 12px; }
.vp-tag--tr { top: 10px; right: 12px; }
.vp-tag--bl { bottom: 10px; left: 12px; }
.vp-tag--br { bottom: 10px; right: 12px; }

.vp-axis {
  position: absolute;
  pointer-events: none;
  opacity: 0.5;
}
.vp-axis--h {
  left: 12px;
  right: 12px;
  top: 50%;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 10px);
}

/* the jump to the exploded view */
.vp-open {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}
.vp-open svg { width: 13px; height: 13px; }
.vp-open:hover {
  color: var(--text);
  border-color: var(--indigo);
  background: color-mix(in srgb, var(--indigo) 18%, var(--panel));
  transform: translateY(-1px);
}

.stage-meta { display: flex; flex-direction: column; gap: 16px; }
.sheet-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.68;
}

.spec-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line);
  border: 1px solid var(--line);
}
.spec-strip li {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  background: var(--bg);
}
.ss-label {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.ss-value {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ------------------------------ spec columns ----------------------------- */
.spec-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 26px 40px;
  margin-bottom: 46px;
}
.spec-group { min-width: 0; }
.spec-group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--indigo-bright);
}
.spec-group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.spec-table { margin: 0; }
.spec-row {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(16px, 1fr) minmax(0, max-content);
  gap: 0 10px;
  align-items: baseline;
  padding: 5px 0;
}
.spec-row::before {
  content: "";
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  border-bottom: 1px dotted var(--line);
  transform: translateY(-3px);
}
.spec-row dt {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.78rem;
  color: var(--muted);
  overflow-wrap: break-word;
}
.spec-row dd {
  grid-column: 3;
  grid-row: 1;
  margin: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

/* -------------------------------- sections -------------------------------- */
.sheet-section { margin-bottom: 44px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}
.section-title::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid var(--indigo);
  border-radius: 2px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.section-note {
  margin: -8px 0 18px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

/* ------------------------------- port maps ------------------------------- */
.port-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 26px;
}
.pd {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.pd-figure { margin: 0; }
.pd-figure svg { width: 100%; height: auto; max-width: 300px; }
.pd-panel { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.pd-port path,
.pd-port rect,
.pd-port circle { fill: none; stroke: var(--silver); stroke-width: 1.4; }
.pd-port .fill { fill: var(--silver); stroke: none; }
.pd-num {
  fill: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
}
.pd-cap {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.pd-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  align-content: start;
}
.pd-legend li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid var(--hair);
}
.pl-num { font-family: var(--font-mono); font-size: 0.62rem; color: var(--indigo-bright); }
.pl-label { font-size: 0.74rem; color: var(--muted); }

/* ------------------------------- internals ------------------------------- */
.internal-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line);
  border: 1px solid var(--line);
}
.internal-list li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 4px 12px;
  padding: 14px 16px;
  background: var(--bg);
}
.il-index { font-family: var(--font-mono); font-size: 0.62rem; color: var(--faint); }
.il-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--indigo-bright);
  letter-spacing: 0.04em;
}
.internal-list p {
  grid-column: 2;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

/* --------------------------------- notes --------------------------------- */
.note-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.note-list li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 5%, transparent);
}
.note-index { font-family: var(--font-mono); font-size: 0.62rem; color: var(--warn); }
.note-list p { margin: 0; color: var(--text-2); font-size: 0.85rem; line-height: 1.6; }

/* ------------------------------ upgrade table ---------------------------- */
.upgrade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.upgrade-table th,
.upgrade-table td {
  padding: 13px 16px 13px 0;
  border-bottom: 1px solid var(--hair);
  text-align: left;
  vertical-align: top;
}
.upgrade-table th {
  width: 30%;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
}
.upgrade-table td { color: var(--muted); padding-right: 0; }
.upgrade-table tr:last-child th,
.upgrade-table tr:last-child td { border-bottom: 0; }

/* -------------------------------- topology ------------------------------- */
.topology-svg { width: 100%; height: auto; }
.tp-node rect,
.tp-switch rect {
  fill: var(--panel);
  stroke: var(--line-2);
  stroke-width: 1;
}
.tp-index { fill: var(--indigo-bright); font-family: var(--font-mono); font-size: 11px; }
.tp-model { fill: var(--text); font-family: "Space Grotesk", sans-serif; font-size: 15px; font-weight: 600; }
.tp-role { fill: var(--muted); font-size: 12px; }
.tp-ip { fill: var(--faint); font-family: "JetBrains Mono", monospace; font-size: 11px; }
.tp-switch-name { fill: var(--text); font-family: "Space Grotesk", sans-serif; font-size: 14px; font-weight: 600; }
.tp-switch-meta { fill: var(--faint); font-family: "JetBrains Mono", monospace; font-size: 11px; }
.tp-link path,
.tp-uplink path {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1.2;
  stroke-dasharray: 4 5;
}
.tp-link-label { fill: var(--muted); font-family: "JetBrains Mono", monospace; font-size: 11px; }
.tp-link-note { fill: var(--faint); font-size: 11px; }

.topology-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 26px;
}
.tl-block h3 {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--faint);
}
.tl-block ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.tl-block li { font-size: 0.82rem; color: var(--muted); }
.tl-block li b { color: var(--text-2); font-weight: 600; }

/* ---------------------------------- about -------------------------------- */
.about {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--line);
  padding-top: 72px;
  padding-bottom: 90px;
}
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 48px 64px;
  align-items: start;
}
.about-lede {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.03em;
}
.about-lede em { font-style: normal; color: var(--indigo-bright); }
.about p { margin: 0 0 16px; color: var(--muted); font-size: 0.94rem; line-height: 1.72; max-width: 40rem; }

.contact {
  padding: 22px;
  border: 1px solid var(--line-2);
  background: linear-gradient(160deg, color-mix(in srgb, var(--indigo) 12%, transparent), transparent 62%), var(--panel);
}
.contact h3 {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hair);
}
.contact-row:last-child { border-bottom: 0; }
.contact-row a { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text); }
.contact-row a:hover { color: var(--indigo-bright); }
.contact-row span { font-family: var(--font-mono); font-size: 0.62rem; color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.copy-btn svg { width: 12px; height: 12px; }
.copy-btn:hover { color: var(--indigo-bright); border-color: var(--line-2); }
.copy-btn.copied { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 45%, transparent); }

/* --------------------------------- footer -------------------------------- */
footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding-bottom: 34px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 28px;
  padding-block: 26px 0;
}
.footer-note {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  color: var(--faint);
}

/* ------------------------------- animations ------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; }

/* ------------------------------- responsive ------------------------------ */
@media (max-width: 1080px) {
  /* a flex column gives the sticky viewport room to travel as the sheet
     scrolls past, so the chassis can still come apart on a narrow screen.
     The stage becomes opaque to hide the text sliding under it, and the
     canvas lifts above it so the model still draws into the viewport. */
  .sheet-body {
    display: flex;
    flex-direction: column;
    gap: 26px;
  }
  .sheet-stage {
    position: sticky;
    top: 62px;
    z-index: 3;
    background: var(--bg);
    padding-bottom: 10px;
  }
  .scene-layer { z-index: 4; }
  .viewport {
    height: 320px;
    width: min(100%, 420px);
    align-self: center;
  }
  .about-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .sheet-head { grid-template-columns: minmax(0, 1fr); }
  .contents-table .c-role, .contents-table .c-spec { display: none; }
  .contents-table .c-spec:last-child { display: table-cell; }
}

@media (max-width: 900px) {
  .cover-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: start; }
  .contact { grid-template-columns: minmax(0, 1fr); }
  .contact .btn { justify-self: start; }
  .toolbox { grid-template-columns: minmax(0, 1fr); }
  .topology-legend { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .wrap { padding-inline: 18px; }
  .cover { padding-top: 96px; }
  .tabs { display: none; }
  .spec-strip { grid-template-columns: minmax(0, 1fr); }
  .pd { grid-template-columns: minmax(0, 1fr); }
  .sheet-meta { gap: 0 24px; }
  .upgrade-table th { width: auto; }
  .upgrade-table th, .upgrade-table td { display: block; padding-right: 0; }
  .upgrade-table td { padding-top: 0; }
  .internal-list li { grid-template-columns: 26px minmax(0, 1fr); }
}

@media (max-width: 430px) {
  .topbar .btn { display: none; }
  .hero-facts { gap: 8px 16px; }
}

/* ------------------------------ reduced motion --------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .grain { animation: none; }
  .reveal { opacity: 1; transform: none; }
}

html[data-motion="reduced"] .grain { animation: none; }
html[data-motion="reduced"] .reveal { opacity: 1; transform: none; transition: none; }
