/*
 * Sayuk EVDS — the shared look for every page outside the app.
 *
 * One stylesheet for the landing page, the help guide and the download page, so they
 * cannot drift apart. They are the product's public face and were three separately
 * styled documents before this.
 *
 * The palette is the app's own, not a marketing variant: someone arriving from the
 * landing page should recognise the thing they open. Cyan carries structure, amber is
 * reserved for the one idea it means everywhere in this product — the cell that is not
 * like the others — and is never spent on decoration.
 *
 * IBM Plex because it was drawn for engineering documentation and reads as competent
 * rather than fashionable, which is the correct register for a tool that tells someone
 * their battery is failing. Plex Mono carries every number, so measurements line up in
 * columns and never look like prose.
 */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --ink: #f8fafc;
  --body: #b8c4d4;
  --dim: #7d8ba1;
  --faint: #4a5568;
  --bg: #07090e;
  --card: #0d121f;
  --raised: #141b2d;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --cyan: #00e5ff;
  --amber: #f59e0b;
  --green: #10b981;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 62ch;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: 400 16.5px/1.68 var(--sans);
  /* A single cool wash from the top left, so a long page is not a flat black field. */
  background-image: radial-gradient(900px 520px at 12% -8%, rgba(0, 229, 255, 0.07), transparent 70%);
  background-repeat: no-repeat;
}

.wrap { max-width: 60rem; margin: 0 auto; padding: 0 1.25rem 6rem; }
.narrow { max-width: var(--measure); }

/* ── masthead ─────────────────────────────────────────────────────────────── */
.masthead {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 1.5rem 0 0; margin-bottom: 3.5rem;
}
.masthead svg { width: 34px; height: 34px; flex: none; }
.masthead .name { font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.masthead nav { margin-left: auto; display: flex; gap: 1.4rem; font-size: 0.9rem; }
.masthead nav a { color: var(--dim); text-decoration: none; }
.masthead nav a:hover { color: var(--cyan); }

/* ── type ─────────────────────────────────────────────────────────────────── */
h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.4rem);
  line-height: 1.08; letter-spacing: -0.03em; font-weight: 600;
  color: var(--ink); margin: 0 0 1.1rem; text-wrap: balance;
}
h2 {
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  line-height: 1.2; letter-spacing: -0.02em; font-weight: 600;
  color: var(--ink); margin: 4.5rem 0 1rem; text-wrap: balance;
}
h3 {
  font-size: 1.02rem; font-weight: 600; color: var(--ink);
  margin: 2.1rem 0 0.45rem; letter-spacing: -0.01em;
}
p { margin: 0.85rem 0; max-width: var(--measure); }
.lede { font-size: clamp(1.05rem, 2.1vw, 1.25rem); color: var(--dim); max-width: 52ch; }
strong { color: var(--ink); font-weight: 600; }
a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 3px; }

.eyebrow {
  font: 600 0.76rem/1 var(--mono);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--cyan); margin-bottom: 1.1rem;
}
.rule { height: 1px; background: var(--line); border: 0; margin: 4rem 0 0; }

/* ── surfaces ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.35rem 1.45rem;
}
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.grid { display: grid; gap: 1rem; }
@media (min-width: 720px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
}

/* A quiet aside for a caveat that must be read but must not shout. */
.note {
  border-left: 2px solid var(--cyan); padding: 0.15rem 0 0.15rem 1.1rem;
  margin: 1.6rem 0; color: var(--dim);
}
.note.warn { border-left-color: var(--amber); }
.note p { margin: 0.4rem 0; }

/* ── provenance badges, the same three classes the app uses ───────────────── */
.tag {
  display: inline-block; font: 600 0.68rem/1.6 var(--mono);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.1rem 0.5rem; border-radius: 999px;
  border: 1px solid currentColor; vertical-align: 0.08em; white-space: nowrap;
}
.tag.measured { color: var(--green); }
.tag.derived  { color: #60a5fa; }
.tag.modelled { color: var(--amber); }

/* ── buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  font: 600 1rem/1 var(--sans); text-decoration: none;
  padding: 0.95rem 1.5rem; border-radius: 11px; border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--cyan); color: #04121a; }
.btn.primary:hover { background: #5cefff; }
.btn.ghost { border-color: var(--line-strong); color: var(--ink); }
.btn.ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn.block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.9rem 0 0.6rem; }

/* ── data ─────────────────────────────────────────────────────────────────── */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.72rem 0.8rem 0.72rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font: 600 0.72rem/1.4 var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); white-space: nowrap;
}
td.num, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
code {
  font: 400 0.88em/1.5 var(--mono);
  background: var(--raised); border: 1px solid var(--line);
  border-radius: 5px; padding: 0.08rem 0.34rem;
}

/* ── numbered steps ───────────────────────────────────────────────────────── */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 1.4rem 0; }
.steps li {
  counter-increment: s; position: relative;
  padding-left: 2.6rem; margin: 1.15rem 0; max-width: var(--measure);
}
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 0.05rem;
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: rgba(0, 229, 255, 0.1); border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--cyan); font: 600 0.82rem/1.68rem var(--mono); text-align: center;
}

footer {
  margin-top: 5rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
  font-size: 0.88rem; color: var(--faint);
  display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center;
}
footer a { color: var(--dim); text-decoration: none; }
footer a:hover { color: var(--cyan); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ── hero ─────────────────────────────────────────────────────────────────── */
/*
 * One column until there is genuinely room for two. Below that width the readout would
 * be squeezed to the point where its numbers wrap, which defeats the only reason it is
 * there.
 */
.hero { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.05fr 0.95fr; gap: 3.5rem; }
  /* Smaller here than a full-width headline would be: beside the readout the column is
     roughly half as wide, and the unreduced size broke the last line onto its own,
     leaving "sags." orphaned under it. */
  .hero h1 { font-size: clamp(2.1rem, 3.5vw, 2.85rem); }
}

.readout {
  background: linear-gradient(165deg, #111a2b, #0a0f1a);
  border: 1px solid var(--line-strong); border-radius: 16px;
  padding: 1.1rem 1.25rem 1.25rem;
  box-shadow: 0 24px 60px -30px rgba(0, 229, 255, 0.35);
}
.readout-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding-bottom: 0.85rem; border-bottom: 1px solid var(--line);
  font-size: 0.9rem; font-weight: 600; color: var(--ink);
}
.readout-head .num { font-size: 0.76rem; color: var(--faint); font-weight: 400; }

.readout dl { margin: 0; }
.readout dl > div {
  display: grid; grid-template-columns: 1fr auto auto;
  align-items: baseline; gap: 0.85rem;
  padding: 0.8rem 0; border-bottom: 1px solid var(--line);
}
.readout dt { color: var(--dim); font-size: 0.92rem; }
.readout dd { margin: 0; }
.readout dd.num { font-size: 1.22rem; font-weight: 600; letter-spacing: -0.02em; }
.readout dd.num small { font-size: 0.66rem; color: var(--faint); margin-left: 0.28rem; font-weight: 400; }

.readout-foot {
  margin: 0.95rem 0 0; font-size: 0.84rem; line-height: 1.55; color: var(--dim);
}
.readout-foot strong { color: var(--amber); font-weight: 600; }


/* ═══════════════════════════════════════════════════════════════════════════
   THE MANUAL
   A table of contents that stays put, and one column of content beside it.

   A manual is not read front to back. It is opened at a question, so the shape
   that serves it is one where every section is one click away and you can see
   where you are — not a long scroll with the map only at the top.
   ═══════════════════════════════════════════════════════════════════════════ */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 9, 14, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 78rem; margin: 0 auto; padding: 0.8rem 1.25rem;
  display: flex; align-items: center; gap: 0.7rem;
}
.topbar svg { width: 28px; height: 28px; flex: none; }
.topbar .name { font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.topbar .spacer { margin-left: auto; }
.topbar .cta {
  font-size: 0.86rem; font-weight: 600; text-decoration: none;
  color: #04121a; background: var(--cyan); padding: 0.5rem 0.9rem; border-radius: 8px;
}

/* The hamburger exists only where the sidebar does not. */
.menu-btn {
  display: none; background: none; border: 1px solid var(--line-strong);
  border-radius: 8px; color: var(--ink); padding: 0.45rem 0.6rem; cursor: pointer;
  line-height: 0;
}
.menu-btn svg { width: 20px; height: 20px; }

.manual { max-width: 78rem; margin: 0 auto; padding: 0 1.25rem; display: block; }

.toc {
  /* Sticky under the topbar, scrolling independently when the list is long. */
  position: sticky; top: 4.1rem; align-self: start;
  max-height: calc(100vh - 5.5rem); overflow-y: auto;
  padding: 2rem 1rem 2rem 0; font-size: 0.9rem;
}
.toc-group { margin-bottom: 1.5rem; }
.toc-group > span {
  display: block; font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint);
  margin-bottom: 0.7rem;
}
.toc a {
  display: block; color: var(--dim); text-decoration: none;
  padding: 0.32rem 0 0.32rem 0.75rem; border-left: 2px solid transparent;
  line-height: 1.4;
}
.toc a:hover { color: var(--ink); }
.toc a.here { color: var(--cyan); border-left-color: var(--cyan); }

.manual-body { padding: 2.2rem 0 6rem; min-width: 0; }

@media (min-width: 960px) {
  .manual { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); gap: 3rem; }
}
@media (max-width: 959px) {
  .menu-btn { display: inline-flex; }
  .topbar .cta { display: none; }
  /* Off-canvas, not a squeezed column: a 15rem sidebar on a phone leaves neither
     the contents nor the content readable. */
  .toc {
    position: fixed; inset: 3.9rem 0 0 auto; width: min(20rem, 82vw);
    max-height: none; height: calc(100vh - 3.9rem);
    background: var(--card); border-left: 1px solid var(--line);
    padding: 1.5rem 1.4rem 4rem; z-index: 45;
    transform: translateX(100%); transition: transform 0.18s ease;
  }
  .toc[data-open="true"] { transform: translateX(0); }
  .scrim {
    position: fixed; inset: 3.9rem 0 0; background: rgba(3, 5, 9, 0.6);
    z-index: 44; opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
  }
  .scrim[data-open="true"] { opacity: 1; pointer-events: auto; }
}

/* ── manual sections ──────────────────────────────────────────────────────── */
.sec { scroll-margin-top: 4.6rem; padding-top: 1rem; }
.sec + .sec { margin-top: 4rem; padding-top: 2.6rem; border-top: 1px solid var(--line); }
.sec > h2 { margin-top: 0; display: flex; align-items: baseline; gap: 0.7rem; }
/* Numbered because a manual IS a sequence, and the number is how someone refers
   to a section out loud. */
.sec > h2 .n {
  font: 600 0.8rem/1 var(--mono); color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.32); border-radius: 6px;
  padding: 0.3rem 0.42rem; flex: none;
}
.sub { scroll-margin-top: 4.6rem; }

/* ── a definition, which a manual needs a lot of ──────────────────────────── */
.def {
  display: grid; gap: 0.3rem 1.1rem; margin: 1.1rem 0;
  padding: 0.9rem 1.05rem; border-radius: 11px;
  background: var(--card); border: 1px solid var(--line);
}
.def dt { font-weight: 600; color: var(--ink); }
.def dd { margin: 0; color: var(--dim); font-size: 0.95rem; }
@media (min-width: 640px) { .def { grid-template-columns: 11rem minmax(0, 1fr); } }

.callout-cta {
  background: linear-gradient(150deg, #10243a, #0a1018);
  border: 1px solid var(--line-strong); border-radius: 14px;
  padding: 1.4rem 1.5rem; margin: 2rem 0;
}
.callout-cta h3 { margin-top: 0; }

figure.diagram {
  margin: 1.4rem 0; padding: 1.2rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; overflow-x: auto;
}
figure.diagram pre {
  margin: 0; font: 400 0.82rem/1.7 var(--mono); color: var(--dim); white-space: pre;
}
figure.diagram figcaption {
  margin-top: 0.9rem; font-size: 0.84rem; color: var(--faint);
}
