:root {
  color-scheme: dark;
  --bg: #07090a;
  --bg-alt: #0b0f0e;
  --surface: #0f1513;
  --text: #d6e2dc;
  --muted: #7d9188;
  --border: #1d2a25;
  --accent: #39ff88;
  --accent-dim: rgb(57 255 136 / .14);
  --accent-ink: #03110a;
  --top: #4cc9ff;
  --bottom: #ffb547;
  --kit: #ff5fd2;
  --radius: 3px;
  --wrap: 1120px;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(var(--bg) 0 0) padding-box,
    var(--bg);
  background-image:
    linear-gradient(rgb(57 255 136 / .035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(57 255 136 / .035) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
  font: 15px/1.7 var(--mono);
}

/* CRT scanlines */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(0deg, rgb(0 0 0 / .18) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: var(--accent); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 800; }
h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.4rem, 2.8vw, 1.9rem); letter-spacing: -0.02em; }
h2::before { content: "// "; color: var(--accent); font-weight: 400; }
h3 { font-size: 1rem; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.center { text-align: center; }

/* Banner + header */
.preview-banner {
  background: #1a1404;
  color: var(--bottom);
  border-bottom: 1px solid #3a2c08;
  text-align: center;
  font-size: .78rem;
  padding: 6px 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(7 9 10 / .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }
.logo .prompt { color: var(--muted); font-weight: 400; margin-right: 6px; }
nav { display: flex; align-items: center; gap: 22px; font-size: .88rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--accent); }
nav .btn { color: var(--accent-ink); }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .85rem;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  transition: box-shadow .15s;
}
.btn:hover { box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgb(57 255 136 / .45); }
.btn-small { padding: 6px 14px; font-size: .75rem; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost::before { content: "> "; }

/* Hero */
.hero { padding: 80px 0 64px; position: relative; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 60%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgb(57 255 136 / .12), transparent 65%);
  pointer-events: none;
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.eyebrow { font-size: .82rem; color: var(--accent); margin: 0 0 16px; }
.eyebrow::before { content: "$ "; color: var(--muted); }
.cursor {
  display: inline-block;
  width: .55em;
  height: .9em;
  margin-left: .12em;
  vertical-align: -0.05em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.lead { font-size: 1rem; color: var(--muted); max-width: 52ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-figure { margin: 0; }
.hero-photo img {
  width: 100%;
  height: auto;
  display: block;
  filter: grayscale(.55) contrast(1.1) brightness(.9) drop-shadow(0 0 40px rgb(57 255 136 / .25));
}

/* Diagram */
.diagram { margin: 0; }
.diagram svg { width: 100%; height: auto; display: block; }
.boards-layout { display: grid; grid-template-columns: 340px 1fr; gap: 32px; align-items: center; margin-top: 28px; }
.boards-layout .grid-2 { margin-top: 0; }

.d-body { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; stroke-opacity: .5; }
.d-term circle { fill: var(--bg); stroke: var(--muted); stroke-width: 1.5; }
.d-board-top { fill: rgb(76 201 255 / .12); stroke: var(--top); stroke-width: 1.5; }
.d-board-bottom { fill: rgb(255 181 71 / .12); stroke: var(--bottom); stroke-width: 1.5; }
.d-board-label { fill: var(--text); font: 700 12px var(--mono); letter-spacing: .12em; text-anchor: middle; }
.d-small { fill: var(--muted); font: 600 10px var(--mono); text-anchor: middle; }
.d-opta { fill: var(--accent); font: 800 20px var(--mono); letter-spacing: .3em; text-anchor: middle; opacity: .35; }

/* Sections */
.section { padding: 80px 0; border-top: 1px solid var(--border); }
.section-alt { background: rgb(11 15 14 / .85); }
.section-lead { color: var(--muted); max-width: 72ch; margin-bottom: 36px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 28px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: rgb(57 255 136 / .5); box-shadow: 0 0 20px rgb(57 255 136 / .08); }
.card h3::before { content: "> "; color: var(--accent); }
.card p { color: var(--muted); margin: 0; font-size: .9rem; }
.card-flat h3 { margin-top: 10px; }
.card-flat h3::before { content: none; }

.tag {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.tag::before { content: "["; }
.tag::after { content: "]"; }
.tag-top { color: var(--top); }
.tag-bottom { color: var(--bottom); }
.tag-kit { color: var(--kit); }

/* Photos: green phosphor tint, full color on hover */
.tinted { position: relative; overflow: hidden; }
.tinted img { filter: grayscale(1) contrast(1.15) brightness(.75); transition: filter .25s; }
.tinted::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  mix-blend-mode: multiply;
  opacity: .55;
  pointer-events: none;
  transition: opacity .25s;
}
.tinted:hover img { filter: none; }
.tinted:hover::after { opacity: 0; }

.before-after { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 36px; }
.before-after figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.before-after img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.before-after figcaption { padding: 12px 16px; color: var(--muted); font-size: .88rem; }
.before-after strong { color: var(--text); }

.product-img { margin: -22px -22px 16px; aspect-ratio: 4 / 3; border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.product-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.band { position: relative; min-height: 400px; display: grid; align-items: end; overflow: hidden; border-top: 1px solid var(--border); }
.band > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; filter: grayscale(1) contrast(1.2) brightness(.6); }
.band::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  mix-blend-mode: multiply;
  opacity: .5;
  z-index: 1;
}
.band-copy { position: relative; z-index: 2; padding: 140px 0 52px; background: linear-gradient(transparent, rgb(0 0 0 / .85)); color: #fff; }
.band-copy p { max-width: 60ch; opacity: .85; margin: 0; }

/* Tables */
.compare, .spec-table { margin-top: 40px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); font-size: .88rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px dashed var(--border); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom-style: solid; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--accent-dim); }
td:first-child { font-weight: 700; white-space: nowrap; color: var(--text); }
.compare td:nth-child(2) { color: #ff6b6b; }
.compare td:last-child { color: var(--accent); font-weight: 700; }

/* Products */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter {
  font: inherit;
  font-size: .8rem;
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.filter::before { content: "--"; opacity: .6; }
.filter:hover { color: var(--accent); border-color: rgb(57 255 136 / .5); }
.filter.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.product {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.product:hover { border-color: rgb(57 255 136 / .5); box-shadow: 0 0 24px rgb(57 255 136 / .1); }
.product[hidden] { display: none; }
.product-kit { border-color: rgb(255 95 210 / .35); }
.product-head { display: flex; gap: 10px; margin-bottom: 10px; }
.product h3 { font-size: .95rem; }
.product p { color: var(--muted); flex: 1; margin: 0 0 18px; font-size: .86rem; }
.product-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px dashed var(--border); padding-top: 14px; }
.price { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.note { margin-top: 24px; color: var(--muted); font-size: .9rem; }

/* Steps */
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--muted);
  font-size: .9rem;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.steps strong { color: var(--text); }

/* FAQ */
details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 10px; }
details[open] { border-color: rgb(57 255 136 / .4); }
summary { font-weight: 700; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "[+] "; color: var(--accent); }
details[open] summary::before { content: "[-] "; }
details p { color: var(--muted); margin: 12px 0 0; font-size: .9rem; }

/* CTA + footer */
.cta { background: radial-gradient(ellipse at center, rgb(57 255 136 / .08), transparent 70%); }
.cta p { color: var(--muted); margin-bottom: 24px; }
.site-footer { border-top: 1px solid var(--border); padding: 32px 0; color: var(--muted); font-size: .8rem; }
.site-footer p { margin: 0 0 6px; }
.fine { font-size: .72rem; opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

/* Responsive */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-figure { max-width: 520px; }
  .boards-layout { grid-template-columns: 1fr; }
  .diagram { max-width: 360px; }
  .grid-3, .products, .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  nav a:not(.btn) { display: none; }
  .hero { padding: 48px 0 40px; }
  .section { padding: 56px 0; }
  .grid-3, .grid-2, .products, .steps, .before-after { grid-template-columns: 1fr; }
  td:first-child { white-space: normal; }
}

/* Part-number pages (B001/ …) */
.part-hero { padding: 64px 0 48px; }
.pn {
  display: inline-block;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0 .25em;
  margin-right: .2em;
  box-shadow: 0 0 24px rgb(57 255 136 / .25);
}
td.ok { color: var(--accent); font-weight: 700; }
td.ok::before { content: "✓ "; }
td.tbd { color: var(--bottom); }
.variant-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.variant-row .btn { background: transparent; color: var(--accent); }

/* 3D viewer (js/viewer.js) */
.viewer { margin-top: 32px; }
.viewer .filters { margin-bottom: 12px; }
.viewer-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  background: radial-gradient(ellipse at 50% 40%, #16201c, var(--surface) 70%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.viewer-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.viewer-stage canvas:active { cursor: grabbing; }
.viewer-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.viewer-stage canvas { position: relative; }
.viewer-status { position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; color: var(--muted); font-size: .8rem; }
.filter[data-lift]::before { content: "^^"; }
@media (max-width: 600px) { .viewer-stage { aspect-ratio: 4 / 5; } }
.viewer-status[hidden] { display: none; }

/* Shop: module picker (index.html) */
.module-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 8px 0 28px; }
.module-picker span { color: var(--muted); font-size: .85rem; }
.module-picker select {
  font: inherit; font-size: .95rem;
  padding: 10px 14px; min-width: min(100%, 380px);
  color: var(--text); background: var(--surface);
  border: 1px solid var(--accent); border-radius: var(--radius);
}
.module-picker select:focus { outline: 2px solid var(--accent-dim); outline-offset: 2px; }
.module-head { margin-bottom: 20px; }
.module-head h3 { margin: 0 0 6px; font-size: 1.2rem; }
.module-head h3 .pn { font-size: 1rem; padding: 2px 8px; }
.module-head p { margin: 0 0 4px; }
.module-head .note { margin-top: 6px; }
.sub-head { margin: 48px 0 16px; font-size: 1.05rem; color: var(--muted); }
.product .btn[aria-disabled="true"] { opacity: .55; cursor: default; }

/* Features (index.html) */
.feature-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; align-items: start; margin-top: 32px; }
.feature-fig { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.feature-fig img { display: block; width: 100%; height: auto; }
.feature-fig figcaption { padding: 10px 14px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); }
@media (max-width: 900px) { .feature-grid { grid-template-columns: 1fr; } }

/* Cart (js/cart.js): header button + slide-out drawer */
button.btn { font-family: inherit; cursor: pointer; }
button.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cart-toggle {
  font: inherit; font-size: .88rem;
  background: none; border: 0; padding: 6px 2px; cursor: pointer;
  color: var(--muted);
}
.cart-toggle:hover, .cart-toggle.has-items { color: var(--accent); }
.cart-count { font-weight: 800; }

.cart-drawer {
  margin: 0 0 0 auto; padding: 0;
  width: min(440px, 100vw); max-width: 100vw;
  height: 100dvh; max-height: 100dvh;
  background: var(--bg-alt); color: var(--text);
  border: 0; border-left: 1px solid var(--accent);
  box-shadow: -12px 0 48px rgb(57 255 136 / .12);
  transform: translateX(100%);
  transition: transform .22s ease-out, overlay .22s allow-discrete, display .22s allow-discrete;
}
.cart-drawer[open] { transform: none; }
@starting-style { .cart-drawer[open] { transform: translateX(100%); } }
.cart-drawer::backdrop { background: rgb(0 0 0 / .6); backdrop-filter: blur(2px); }
body:has(.cart-drawer[open]) { overflow: hidden; }

.cart-panel { display: flex; flex-direction: column; height: 100%; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cart-head h2 { margin: 0; font-size: 1.2rem; }
.cart-x { font: inherit; font-weight: 700; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; }
.cart-x:hover { color: var(--accent); }
.cart-empty { padding: 24px 20px; color: var(--muted); margin: 0; }
.cart-drawer:not(.is-empty) .cart-empty, .cart-drawer.is-empty .cart-lines { display: none; }

.cart-lines { list-style: none; margin: 0; padding: 4px 20px; overflow-y: auto; flex: 1; }
.cart-line { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px dashed var(--border); }
.cart-line img { width: 72px; height: 54px; object-fit: cover; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.cart-line-info p { margin: 0; }
.cart-line-name { font-weight: 700; font-size: .9rem; line-height: 1.3; }
.cart-line-sku { color: var(--muted); font-size: .75rem; margin-bottom: 8px !important; }
.cart-line-end { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.cart-line-total { font-weight: 800; color: var(--accent); }
.cart-remove { font: inherit; font-size: .72rem; background: none; border: 0; padding: 4px 0; color: var(--muted); cursor: pointer; text-decoration: underline; }
.cart-remove:hover { color: #ff6b6b; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius); }
.qty button {
  font: inherit; font-weight: 700; width: 32px; height: 30px;
  background: var(--surface); color: var(--accent); border: 0; cursor: pointer;
}
.qty button:disabled { color: var(--border); cursor: default; }
.qty button:not(:disabled):hover { background: var(--accent-dim); }
.qty-n { min-width: 32px; text-align: center; font-weight: 700; font-size: .9rem; }

.cart-foot { padding: 16px 20px 20px; border-top: 1px solid var(--border); background: var(--surface); }
.cart-foot p { margin: 0; }
.cart-subtotal { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; }
.cart-subtotal strong { font-size: 1.3rem; color: var(--accent); }
.cart-fine { color: var(--muted); font-size: .75rem; margin: 2px 0 12px !important; }
.cart-foot .cart-fine:last-child { margin: 10px 0 0 !important; text-align: center; }
.cart-error:not(:empty) { color: #ff6b6b; font-size: .82rem; border: 1px solid rgb(255 107 107 / .4); background: rgb(255 107 107 / .08); padding: 8px 12px; margin-bottom: 12px !important; border-radius: var(--radius); }
.cart-checkout { width: 100%; }

@media (prefers-reduced-motion: reduce) { .cart-drawer { transition: none; } }

/* Policy + utility pages (contact, shipping, …) */
.page { padding: 64px 0 80px; }
.page h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
.page h2 { font-size: 1.15rem; margin-top: 2em; }
.page p, .page li { color: var(--muted); }
.page strong { color: var(--text); }
.page ul { padding-left: 1.2em; }
.review { color: var(--bottom) !important; border: 1px dashed rgb(255 181 71 / .5); background: rgb(255 181 71 / .06); padding: 8px 12px; font-size: .8rem; border-radius: var(--radius); }
.review::before { content: "[review] "; font-weight: 700; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 12px !important; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }
