:root {
  --bg: #ffffff;
  --fg: #1d1d1f;
  --fg-muted: #6e6e73;
  --accent: #0071e3;
  --border: #d2d2d7;
  --card-bg: #f5f5f7;
  --track: #e3e3e8;
  --ok: #248a3d;
  --bad: #d70015;
  --max-width: 980px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
.section[id] { scroll-margin-top: 70px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(10px);
  z-index: 10;
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand:hover { text-decoration: none; }
.brand .logo-mark { width: 22px; height: 22px; flex-shrink: 0; }

.hero-mark { display: flex; justify-content: center; margin-bottom: 18px; }
.hero-mark .logo-mark { width: 58px; height: 58px; }

.nav-links { display: flex; gap: 20px; }
.nav-links a { color: var(--fg); font-size: 0.92rem; }

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
}

.hero {
  text-align: center;
  padding: 90px 20px 60px;
}
.hero h1 { font-size: 2.6rem; margin-bottom: 12px; letter-spacing: -0.02em; }
.hero-sub { color: var(--fg-muted); font-size: 1.15rem; max-width: 640px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.section { padding: 48px 0; border-top: 1px solid var(--border); }
.section:first-of-type { border-top: none; }
.section h1 { font-size: 2rem; margin-bottom: 8px; }
.section h2 { font-size: 1.6rem; margin-bottom: 8px; }
.section-sub { color: var(--fg-muted); margin-bottom: 28px; }

.grid { display: grid; gap: 20px; margin-top: 20px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

.card {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 20px;
}
.card h3 { margin-top: 0; }
.card-link { color: inherit; display: block; transition: transform 0.2s ease; }
.card-link:hover { text-decoration: none; transform: translateY(-3px); transition: transform 0.18s ease; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  background: #e8e8ed;
  padding: 3px 9px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.spec-list { list-style: none; padding: 0; margin: 12px 0 0; color: var(--fg-muted); font-size: 0.92rem; }
.spec-list li { padding: 3px 0; }

.price-tag { font-weight: 600; font-size: 1.1rem; margin-top: 10px; }

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 980px;
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 0.95rem;
  background: white;
}
.btn:hover { text-decoration: none; background: var(--card-bg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: #0077ed; }

.product-hero { text-align: center; border-top: none; padding-top: 20px; }
.illustration-wrap { margin: 0 auto 10px; max-width: 380px; }
.illustration-wrap svg { width: 100%; height: auto; }

.card-art { display: flex; justify-content: center; margin: -6px 0 10px; }
.card-art svg { width: 100%; max-width: 200px; height: auto; }

.recommend-art { max-width: 230px; margin-bottom: 6px; }
.recommend-art svg { width: 100%; height: auto; }

.product-photo {
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #000;
  object-fit: contain;
}
.card-art .product-photo { max-width: 230px; }
.recommend-art .product-photo { max-width: 240px; }
.illustration-wrap:has(.product-photo) { max-width: 480px; }

.term-card h3 { font-size: 1.05rem; }
.practices-title { margin-top: 36px; }

.count-field { display: flex; flex-direction: column; gap: 6px; color: var(--fg-muted); font-size: 0.92rem; margin: 4px 0 10px; }
.count-field input { width: 130px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 1rem; color: var(--fg); }
.quote-picker h2 { margin-top: 28px; }

.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 24px; margin: 20px 0 40px; }
.spec h4 { margin: 0 0 6px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--fg-muted); }
.spec-value { font-size: 1.5rem; font-weight: 600; margin: 0 0 8px; }
.spec-value-small { font-size: 1.1rem; }
.spec-note { color: var(--fg-muted); font-size: 0.88rem; }

.everyday-numbers, .source-box, .math-box, .recommend-box, .cluster-note {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 24px 28px;
  margin: 24px 0;
}

.formula { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95rem; color: var(--fg-muted); }
.formula-worked { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; line-height: 1.8; }

.callout {
  border-left: 3px solid var(--accent);
  padding: 12px 18px;
  color: var(--fg-muted);
  background: var(--card-bg);
  border-radius: 0 12px 12px 0;
  margin: 20px 0;
}

.cta-row { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.choose-form, .quote-form { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.radio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
}
.radio-card input { flex-shrink: 0; }

.quote-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; color: var(--fg-muted); }
.quote-form input[type="text"] {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 1rem;
  color: var(--fg);
}

.error { color: #d70015; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--fg-muted); font-weight: 500; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 30px 24px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* ------------------------------------------------- scroll reveal ------- */
/* Hidden state is gated on html.js so content stays visible without JS.   */

html.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.65s ease, transform 0.5s ease;
}
html.js .reveal.in-view { opacity: 1; transform: none; }

/* ------------------------------------------------- wiki ---------------- */

.wiki-copy { max-width: 640px; }
.wiki-copy p { margin: 0 0 14px; }

.wiki-scene { margin: 28px 0; }
.scene-note { color: var(--fg-muted); font-size: 0.92rem; max-width: 640px; }

/* memory: proportional bars */
.mem-scene { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 20px; }
.mem-panel { background: var(--card-bg); border-radius: 18px; padding: 24px 28px; }
.mem-panel h4 { margin: 0 0 16px; }
.bar-label { font-size: 0.88rem; color: var(--fg-muted); margin-bottom: 5px; }
.bar {
  height: 30px;
  background: var(--track);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}
.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 8px;
  transition: width 1.2s cubic-bezier(0.25, 0.8, 0.3, 1) 0.2s;
}
.in-view .bar-fill { width: var(--w); }
.bar-fill.model-ok { background: var(--ok); }
.bar-fill.model-bad { background: var(--bad); }
.bar-fill.capacity { background: #b9b9c0; }
.verdict { font-weight: 600; margin: 4px 0 0; }
.verdict.ok { color: var(--ok); }
.verdict.bad { color: var(--bad); }

/* watts: houses and batteries light up */
.homes-row, .battery-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 10px; }
.house { width: 36px; color: var(--accent); opacity: 0.22; }
.house path, .house rect { stroke: currentColor; fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.battery { width: 56px; color: var(--fg-muted); }
.battery rect { stroke: currentColor; fill: none; stroke-width: 2; }
.battery .batt-fill {
  fill: var(--ok);
  stroke: none;
  transform: scaleX(0);
  transform-box: fill-box;
  transform-origin: left center;
}
.big-number { font-size: 2rem; font-weight: 600; margin: 4px 0; letter-spacing: -0.02em; }
.big-number .count { font-variant-numeric: tabular-nums; }

/* clusters: two panels, animated links */
.cluster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; }
.cluster-panel { background: var(--card-bg); border-radius: 18px; padding: 20px 24px; }
.cluster-panel svg { width: 100%; height: auto; color: var(--fg-muted); }
.cluster-panel svg text { fill: var(--fg); font-size: 14px; font-family: inherit; }
.wiki-scene .box rect, .wiki-scene .box circle { stroke: currentColor; fill: none; stroke-width: 2; }
.wiki-scene .pool { fill: none; stroke-width: 2.5; }
.wiki-scene .pool-real { stroke: var(--accent); }
.wiki-scene .pool-broken { stroke: var(--bad); stroke-dasharray: 7 7; opacity: 0.75; }
.wiki-scene .link { stroke-dasharray: 4 8; stroke-width: 2.5; fill: none; }
.wiki-scene .link.fast { stroke: var(--accent); }
.wiki-scene .link.slow { stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 3 9; }
.wiki-scene .link.dead { stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 3 9; opacity: 0.6; }
.wiki-scene .xmark { stroke: var(--bad); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.wiki-scene.in-view .link.fast { animation: flow 0.5s linear infinite; }
.wiki-scene.in-view .link.slow { animation: flow 3s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -24; } }

/* parts: who does what */
.parts-scene { max-width: 560px; }
.parts-scene svg { width: 100%; height: auto; color: var(--fg-muted); }
.parts-scene svg text { fill: var(--fg); font-size: 15px; font-weight: 600; font-family: inherit; }
.parts-scene svg .small-label { font-size: 11px; font-weight: 400; fill: var(--fg-muted); }
.parts-scene .wire { stroke: currentColor; stroke-width: 2; }
.parts-scene .wire.main { stroke-width: 2.5; }
.parts-scene .arrowhead { stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.parts-scene .model-blocks { opacity: 0.55; }
.parts-scene .task-dot, .parts-scene .ram-dot { fill: var(--accent); opacity: 0; }
.parts-scene.in-view .task-dot { animation: travel-x 2s ease-in-out infinite; }
.parts-scene.in-view .ram-dot { animation: travel-y 2s ease-in-out infinite 1s; }
.parts-scene.in-view .gpu-box { animation: gpu-pulse 2s ease-in-out infinite; }
@keyframes travel-x {
  0% { transform: translateX(0); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateX(160px); opacity: 0; }
}
@keyframes travel-y {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(60px); opacity: 0; }
}
@keyframes gpu-pulse {
  0%, 100% { stroke-opacity: 0.6; }
  55% { stroke-opacity: 1; stroke: var(--accent); }
}

.parts-legend { list-style: none; padding: 0; max-width: 640px; }
.parts-legend li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.parts-legend li:last-child { border-bottom: none; }

/* cooling: animated air and liquid panels */
.cooling-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; }
.cooling-panel { background: var(--card-bg); border-radius: 18px; padding: 20px 24px; }
.cooling-panel h3 { margin-top: 0; }
.cooling-panel svg { width: 100%; height: auto; color: var(--fg-muted); }
.cooling-panel .fan-ring { fill: none; stroke: currentColor; stroke-width: 2.5; }
.cooling-panel .fan-rotor path { fill: currentColor; opacity: 0.55; stroke: none; }
.cooling-panel .fan-rotor { transform-box: fill-box; transform-origin: center; }
.wiki-scene.in-view .fan-rotor { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cooling-panel .fan-hub { fill: currentColor; }
.cooling-panel .airflow { stroke-width: 2.5; stroke-dasharray: 5 9; fill: none; }
.cooling-panel .airflow.cool { stroke: #4d8dff; }
.cooling-panel .airflow.warm { stroke: #ff8a5b; }
.wiki-scene.in-view .airflow { animation: flow 0.9s linear infinite; }
.cooling-panel .fins line { stroke: currentColor; stroke-width: 3; }
.cooling-panel .chip-block { fill: none; stroke: var(--bad); stroke-width: 2.5; }
.cooling-panel .plate { fill: currentColor; opacity: 0.4; stroke: none; }
.cooling-panel .loop-pipe { fill: none; stroke: currentColor; stroke-width: 3; opacity: 0.5; }
.cooling-panel .radiator rect { fill: none; stroke: currentColor; stroke-width: 2.5; }
.cooling-panel .radiator line { stroke: currentColor; stroke-width: 2; }
.cooling-panel .pump { fill: none; stroke: currentColor; stroke-width: 2.5; }
.cooling-panel .smil-dot { fill: #ff5b4d; }
.cooling-panel .small-label, .parts-scene svg .small-label { font-size: 11px; font-weight: 400; fill: var(--fg-muted); }

/* model logos */
.model-card { position: relative; overflow: hidden; }
.model-logo-bg {
  position: absolute;
  right: -24px;
  bottom: -24px;
  width: 130px;
  height: 130px;
  opacity: 0.08;
  border-radius: 24px;
  pointer-events: none;
}
.model-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  margin-bottom: 10px;
  display: block;
}
.model-hero { position: relative; }
.model-hero .model-logo-bg { width: 220px; height: 220px; right: 0; bottom: auto; top: -30px; opacity: 0.07; }
.model-hero .model-logo { width: 56px; height: 56px; margin-bottom: 14px; }

/* color preview (Racks & Mounts) */
.color-block { display: flex; gap: 20px; align-items: flex-start; margin: 16px 0; }
.mockup-wrap { flex-shrink: 0; width: 92px; }
.mockup { width: 100%; height: auto; }
.mock-body { fill: var(--mock, #1d1d1f); stroke: rgba(0,0,0,0.22); stroke-width: 1.5; transition: fill 0.25s ease; }
.mock-inner { fill: rgba(0,0,0,0.24); }
.mock-detail { fill: rgba(255,255,255,0.28); }
.mock-glass { fill: rgba(255,255,255,0.30); stroke: rgba(0,0,0,0.12); }
.swatch-row { display: flex; gap: 8px; margin: 6px 0 10px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.swatch span {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sw);
  border: 2px solid var(--border);
  box-sizing: border-box;
}
.swatch input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,113,227,0.22); }

/* auto-linked terms */
a.term-link {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-color: #b9b9c2;
  text-underline-offset: 3px;
}
a.term-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ------------------------------------------------- mobile -------------- */
/* The hamburger menu is a pure-CSS checkbox toggle so it works without JS,
   matching the no-JS-required rule used everywhere else on the site. */

.nav-toggle-box { display: none; }
.nav-toggle { display: none; }

@media (max-width: 900px) {
  .nav { padding: 12px 20px; }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    margin: -6px -10px -6px auto;
    cursor: pointer;
  }
  .nav-toggle::before,
  .nav-toggle::after,
  .nav-toggle span {
    content: "";
    display: block;
    height: 2px;
    background: var(--fg);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }
  .nav-toggle-box:checked + .nav-toggle::before { transform: translateY(7px) rotate(45deg); }
  .nav-toggle-box:checked + .nav-toggle span { opacity: 0; }
  .nav-toggle-box:checked + .nav-toggle::after { transform: translateY(-7px) rotate(-45deg); }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding: 4px 0 8px;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }
  .nav-toggle-box:checked ~ .nav-links { display: flex; }
  .nav-links a {
    padding: 13px 4px;
    font-size: 1rem;
    border-top: 1px solid var(--border);
  }
  .nav-links a:first-child { border-top: none; }
}

@media (max-width: 700px) {
  main { padding: 0 18px 60px; }

  .hero { padding: 52px 8px 40px; }
  .hero h1 { font-size: 2rem; }
  .hero-sub { font-size: 1.05rem; }
  .hero-mark .logo-mark { width: 48px; height: 48px; }

  .section { padding: 36px 0; }
  .section h1 { font-size: 1.65rem; }
  .section h2 { font-size: 1.35rem; }

  .card { padding: 20px; }
  .everyday-numbers, .source-box, .math-box, .recommend-box, .cluster-note,
  .mem-panel, .cluster-panel, .cooling-panel { padding: 18px 20px; }

  .spec-grid { gap: 16px; margin-bottom: 28px; }
  .spec-value { font-size: 1.3rem; }
  .big-number { font-size: 1.6rem; }
  .formula-worked { font-size: 0.92rem; }
  .formula { font-size: 0.85rem; }

  .model-hero .model-logo-bg { width: 130px; height: 130px; top: -10px; }

  th, td { padding: 8px 10px; font-size: 0.85rem; }
}

/* ------------------------------------------------- reduced motion ------ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  .bar-fill { transition: none; }
  .wiki-scene.in-view .link.fast,
  .wiki-scene.in-view .link.slow,
  .parts-scene.in-view .task-dot,
  .parts-scene.in-view .ram-dot,
  .parts-scene.in-view .gpu-box { animation: none; }
  .parts-scene .task-dot, .parts-scene .ram-dot { opacity: 0.8; }
}

/* Light theme only, by owner's choice — the site ignores the visitor's
   OS dark-mode setting so it always shows the clean white look. */
