/* MBG Science · shared look of the landing and index pages.
   Same tokens as the simulator: copper accent (the windings), ink for the resultant R,
   phase colours A/B/C. Layout: one readable column, wide figures, nothing hidden behind scripts. */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --line: #d5dce3;
  --ink: #15202b;
  --ink-2: #455463;
  --ink-3: #6f7c89;
  --accent: #a9561f;
  --accent-ink: #ffffff;
  --accent-soft: #f5e6da;
  --ph-A: #d9442a;
  --ph-B: #0b8a76;
  --ph-C: #2b58c9;
  --res: #15202b;
  --res-halo: #ffffff;
  --stator: #fbfcfd;
  --stator-edge: #8a97a4;
  --slot: #d3dae1;
  --trail: #b0398f;
  --shadow: rgba(21, 32, 43, 0.18);
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", system-ui, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --max: 1140px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1015;
    --surface: #131920;
    --surface-2: #18202a;
    --line: #26313c;
    --ink: #e6ecf1;
    --ink-2: #a7b3bf;
    --ink-3: #7d8a97;
    --accent: #e08a4c;
    --accent-ink: #1b0f06;
    --accent-soft: #3a2617;
    --ph-A: #ff6a4b;
    --ph-B: #2cc8ab;
    --ph-C: #5f8dff;
    --res: #f5f8fb;
    --res-halo: #0c1015;
    --stator: #10161c;
    --stator-edge: #536170;
    --slot: #27323e;
    --trail: #e77ad0;
    --shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1015;
  --surface: #131920;
  --surface-2: #18202a;
  --line: #26313c;
  --ink: #e6ecf1;
  --ink-2: #a7b3bf;
  --ink-3: #7d8a97;
  --accent: #e08a4c;
  --accent-ink: #1b0f06;
  --accent-soft: #3a2617;
  --ph-A: #ff6a4b;
  --ph-B: #2cc8ab;
  --ph-C: #5f8dff;
  --res: #f5f8fb;
  --res-halo: #0c1015;
  --stator: #10161c;
  --stator-edge: #536170;
  --slot: #27323e;
  --trail: #e77ad0;
  --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font-body);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
a:focus-visible, summary:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: max(20px, env(safe-area-inset-left, 0px)) max(20px, env(safe-area-inset-right, 0px));
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 10; background: var(--surface); padding: 8px 12px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px 6px; }
.crumbs {
  margin: 0;
  font: 600 13px/1.3 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { margin-inline: 6px; }
.langs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  flex: none;
}
.langs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  font: 600 13px/1 var(--font-display);
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-decoration: none;
}
.langs img { width: 26px; height: 19.5px; border-radius: 999px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); filter: grayscale(0.7); opacity: 0.55; }
.langs a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.langs a[aria-current="page"] img { filter: none; opacity: 1; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 56px;
  align-items: center;
  padding-block: 36px 64px;
}
.eyebrow {
  margin: 0 0 14px;
  font: 600 13px/1.3 var(--font-display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 0 0 20px;
  font: 600 clamp(38px, 5.4vw, 64px)/1.02 var(--font-display);
  letter-spacing: -0.005em;
  text-wrap: balance;
}
h1 .thin { display: block; font-weight: 500; color: var(--ink-2); }
.lead { margin: 0 0 28px; max-width: 56ch; font-size: clamp(17px, 1.55vw, 19.5px); color: var(--ink-2); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 26px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: 600 16.5px/1.1 var(--font-body);
  text-decoration: none;
  transition: filter 0.12s ease, border-color 0.12s ease;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; font-size: 15px; color: var(--ink-2); }
.facts li { display: inline-flex; align-items: center; gap: 8px; }
.facts li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.live {
  position: relative;
  display: block;
  padding: 16px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 30px 60px -40px var(--shadow);
}
.live canvas { display: block; width: 100%; aspect-ratio: 1 / 1; }
.live .chip {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font: 600 12px/1.5 var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.live .chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--ph-A); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.live .eqline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  padding: 6px 4px 0;
  border-top: 1px solid var(--line);
  margin-top: 6px;
}
.live .eq { font: 600 22px/1.3 var(--font-display); letter-spacing: 0.02em; }
.live .eq .op { color: var(--ink-3); font-weight: 500; }
.live .mag { font: 500 14px/1.3 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.live .open { position: absolute; top: 16px; right: 16px; font: 600 13px/1.5 var(--font-body); color: var(--accent); }
.live:hover .open { text-decoration: underline; }

/* ---------- sections ---------- */
.sec { padding-block: 60px; border-top: 1px solid var(--line); }
h2 { margin: 0 0 14px; font: 600 clamp(28px, 3.3vw, 40px)/1.08 var(--font-display); text-wrap: balance; }
.sec-lead { margin: 0 0 32px; max-width: 64ch; color: var(--ink-2); }

.shots { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: end; }
.shots a { display: block; color: inherit; }
.shots .desk { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 30px 60px -40px var(--shadow); background: var(--surface); }
.shots .phone {
  width: clamp(160px, 19vw, 232px);
  border: 7px solid var(--ink);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 30px 60px -36px var(--shadow);
  background: var(--surface);
}
.shots figcaption { margin-top: 10px; font-size: 14px; color: var(--ink-3); }
.after-shots { margin-top: 28px; }

.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px; }
.cols svg { width: 72px; height: 72px; display: block; }
.cols h3 { margin: 14px 0 8px; font: 600 23px/1.2 var(--font-display); }
.cols p { margin: 0; color: var(--ink-2); }

.math { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.formula {
  margin: 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font: 500 clamp(14px, 1.5vw, 16.5px)/1.85 var(--font-mono);
  overflow-x: auto;
}
.formula .c { display: inline-block; margin-top: 4px; font-size: 0.86em; }
.formula .c { color: var(--ink-3); }
.math p { margin: 0 0 14px; color: var(--ink-2); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 15.5px; }
th, td { padding: 11px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font: 600 12.5px/1.3 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 600; }
td kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  font: 500 13px/1.6 var(--font-mono);
  text-align: center;
}

.exp { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 40px; margin: 0; padding: 0; list-style: none; counter-reset: exp; }
.exp li { display: grid; grid-template-columns: 2.2ch minmax(0, 1fr); gap: 2px 14px; counter-increment: exp; }
.exp li::before { content: counter(exp); grid-row: span 2; font: 600 36px/1 var(--font-display); color: var(--accent); }
.exp h3 { margin: 2px 0 0; font: 600 19px/1.3 var(--font-body); }
.exp p { margin: 0; color: var(--ink-2); }

.faq details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; font-size: 18px; list-style-position: outside; }
.faq p { margin: 10px 0 0; max-width: 72ch; color: var(--ink-2); }

.final {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.final h2 { margin: 0; }
.final p { margin: 6px 0 0; color: var(--ink-2); }

/* ---------- index page (/science/) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 24px; margin-top: 8px; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.card > a img { aspect-ratio: 1200 / 630; object-fit: cover; width: 100%; border-bottom: 1px solid var(--line); }
.card .body { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 22px; flex: 1; }
.card h2 { margin: 0; font-size: 30px; }
.card h2 a { color: inherit; text-decoration: none; }
.card p { margin: 0; color: var(--ink-2); }
.card .links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 8px; }
.card .btn { min-height: 44px; font-size: 15.5px; }
.soon { margin: 28px 0 0; color: var(--ink-3); }

/* ---------- footer ---------- */
.foot { padding-block: 28px 44px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 40px; font-size: 14px; color: var(--ink-2); }
.foot p { margin: 0; }
.foot .org { max-width: 46ch; }
.foot .org a { color: var(--ink); font-weight: 600; text-decoration: none; }
.foot .org .note { display: block; margin-top: 6px; color: var(--ink-3); }
.foot .sig { max-width: 70ch; margin-left: auto; text-align: right; font-style: italic; }

@media (max-width: 880px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-block: 20px 44px; }
  .live { max-width: 520px; width: 100%; justify-self: center; }
  .cols, .math, .exp { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .shots { grid-template-columns: minmax(0, 1fr); }
  .shots .phone-fig { justify-self: center; }
  .sec { padding-block: 44px; }
  .foot { flex-direction: column; align-items: stretch; }
}
@media (max-width: 420px) {
  body { font-size: 16px; }
  .langs a { padding-right: 7px; }
  .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .live .chip i { animation: none; }
  .btn { transition: none; }
}
