/*
 * Shared styling for the 3pple A manuals.
 *
 * These are static pages under /manuals, served by the app that documents them
 * and opened in a new tab. Plain CSS on purpose: they must keep working long
 * after any build step around them has changed, and somebody updating a manual
 * should not have to run a toolchain to see the result.
 *
 * The palette is the same navy and gold as the product, restated here rather
 * than imported, because these files have no build step to import through.
 */

:root {
  --navy: #0a2240;
  --navy-700: #0e2e57;
  --gold: #c8952b;
  --gold-ink: #7a5e12;
  --gold-wash: #fffbf0;
  --gold-border: #f2e2b4;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --fill: #f1f3f7;
  --line: #e8ebf0;
  --line-soft: #edeff3;
  --line-strong: #e3e7ee;

  --ink: #0f1724;
  --text: #3e4756;
  --muted: #6b7686;
  --faint: #98a1af;

  --success: #15803d;
  --success-surface: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #b45309;
  --warning-surface: #fffbeb;
  --warning-border: #fde68a;
  --danger: #b91c1c;
  --danger-surface: #fef2f2;
  --danger-border: #fecaca;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 36, 0.05), 0 12px 30px -18px rgba(15, 23, 36, 0.25);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

/* Follows whatever the reader's system is set to. Nobody reads a manual at
   2am on a bright white page by choice. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #121b2b;
    --surface-2: #16202f;
    --fill: #1b2536;
    --line: #24304a;
    --line-soft: #1d2740;
    --line-strong: #2b3752;
    --ink: #eef2f8;
    --text: #d4dae5;
    --muted: #97a2b5;
    --faint: #6f7b90;
    --gold-wash: #221c0c;
    --gold-border: #4a3c17;
    --gold-ink: #e9be59;
    --success-surface: #0d2418;
    --success-border: #1c4a2f;
    --warning-surface: #241a08;
    --warning-border: #4d3a12;
    --danger-surface: #2a1113;
    --danger-border: #572026;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 34px -18px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; margin: 0; }
p { margin: 0; }
a { color: inherit; }

/* ---------------------------------------------------------------- chrome */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}
.mark {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.mark span { color: var(--gold); }
.role {
  margin-left: auto;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-ink);
  background: var(--gold-wash);
  border: 1px solid var(--gold-border);
  border-radius: 999px;
  padding: 5px 12px;
}

.doc main { min-width: 0; }

.doc {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 44px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}
/* minmax(0, 1fr), not 1fr. A bare 1fr track is min-content-floored, so the
   tables inside (which carry their own min-width and their own scrollbar)
   push the whole column wider than the screen instead of scrolling. */
@media (max-width: 900px) { .doc { grid-template-columns: minmax(0, 1fr); gap: 0; } }

.side {
  position: sticky;
  top: 74px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 20px 4px 40px;
}
.side .grp {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 16px 12px 6px;
}
.side a {
  display: block;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 600;
  text-decoration: none;
}
.side a:hover { background: var(--fill); color: var(--ink); }
@media (max-width: 900px) { .side { display: none; } }

/* ---------------------------------------------------------------- hero */

.hero { padding: 54px 0 20px; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--gold-wash);
  border: 1px solid var(--gold-border);
  color: var(--gold-ink);
}
.hero h1 {
  font-size: clamp(2rem, 1.3rem + 3vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 18px 0 0;
}
.hero .sub { color: var(--muted); font-size: 1.06rem; max-width: 64ch; margin-top: 14px; }

/* ---------------------------------------------------------------- sections */

.sec { padding: 44px 0; border-top: 1px solid var(--line-soft); scroll-margin-top: 76px; }
.sec:first-of-type { border-top: 0; }
.sec h2 {
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.sec .lede { color: var(--muted); font-size: 1rem; max-width: 68ch; }
.h3 { font-size: 1.08rem; font-weight: 750; margin: 30px 0 8px; color: var(--ink); }
.p { margin: 10px 0; max-width: 72ch; }
.muted { color: var(--muted); }

.grid { display: grid; gap: 16px; margin: 18px 0; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .g2, .g3 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h4 { font-size: 0.98rem; margin-bottom: 5px; }
.card p { color: var(--muted); font-size: 0.9rem; }
.card .ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 11px;
  background: var(--gold-wash);
  border: 1px solid var(--gold-border);
  font-size: 17px;
}

.steps { counter-reset: s; display: grid; gap: 14px; margin: 18px 0; }
.step { display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: start; }
.step .n {
  counter-increment: s;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.86rem;
  color: #fff;
  background: var(--navy);
}
.step .n::before { content: counter(s); }
.step .b { padding-top: 3px; }
.step .b b { color: var(--ink); font-weight: 700; }
.step .b p { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

.note {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  margin: 16px 0;
  font-size: 0.91rem;
  max-width: 72ch;
}
.note b { color: var(--ink); }
.note.tip { border-color: var(--success-border); background: var(--success-surface); }
.note.tip b { color: var(--success); }
.note.warn { border-color: var(--warning-border); background: var(--warning-surface); }
.note.warn b { color: var(--warning); }
.note.stop { border-color: var(--danger-border); background: var(--danger-surface); }
.note.stop b { color: var(--danger); }
.note.key { border-color: var(--gold-border); background: var(--gold-wash); }
.note.key b { color: var(--gold-ink); }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 18px 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.89rem; min-width: 480px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
tr:last-child td { border-bottom: 0; }
td b { color: var(--ink); }
code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--fill);
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--ink);
}

ul.plain { margin: 12px 0; padding-left: 20px; max-width: 72ch; }
ul.plain li { margin: 7px 0; }
ul.plain li b { color: var(--ink); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.71rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--fill);
  color: var(--muted);
}
.pill.green { background: var(--success-surface); border-color: var(--success-border); color: var(--success); }
.pill.amber { background: var(--warning-surface); border-color: var(--warning-border); color: var(--warning); }
.pill.red { background: var(--danger-surface); border-color: var(--danger-border); color: var(--danger); }
.pill.gold { background: var(--gold-wash); border-color: var(--gold-border); color: var(--gold-ink); }

.flow { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.flow .node {
  flex: 1;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.flow .node .k {
  font-size: 0.63rem;
  font-weight: 800;
  color: var(--gold-ink);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.flow .node .t { font-size: 0.88rem; color: var(--ink); font-weight: 700; margin-top: 3px; }
.flow .node .d { font-size: 0.79rem; color: var(--muted); margin-top: 2px; }

.docfoot {
  border-top: 1px solid var(--line-soft);
  padding: 28px 0 60px;
  color: var(--faint);
  font-size: 0.82rem;
  max-width: 1240px;
  margin: 0 auto;
}
.docfoot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Printing a manual is a reasonable thing to want. Drop the chrome. */
@media print {
  .topbar, .side { display: none; }
  .doc { display: block; padding: 0; }
  body { background: #fff; }
  .sec { page-break-inside: avoid; }
}
