/* ── Doc-page styles ─────────────────────────────────────────────────────────
   Extends the main site design tokens. Load after the site stylesheet, or
   define the tokens here when used standalone.
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  --navy:   #1B3A6B;
  --gold:   #C8A84B;
  --gold-d: #A88A35;
  --void:   #080E1A;
  --mist:   #F0F2F5;
  --f-d: 'Century Gothic','Avant Garde','Trebuchet MS',system-ui,sans-serif;
  --f-s: system-ui,-apple-system,'Segoe UI',Helvetica,Arial,sans-serif;
  --f-m: 'Courier New',Courier,monospace;
  --r: 6px;
  --ease: .22s ease;

  /* doc-specific */
  --sidebar-w: 240px;
  --content-max: 740px;
  --doc-bg: #fff;
  --border: rgba(27,58,107,0.12);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--f-s);
  background: var(--doc-bg);
  color: #2a3244;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ── SITE HEADER (minimal) ──────────────────────────────────────────────── */
.doc-header {
  background: var(--void);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo-name {
  font-family: var(--f-d);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
}
.logo-sub {
  font-family: var(--f-m);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
  margin-top: 2px;
}
.header-back {
  font-family: var(--f-m);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color var(--ease);
}
.header-back:hover { color: var(--gold); }
.header-back svg { flex-shrink: 0; }

/* ── DOC BREADCRUMB ─────────────────────────────────────────────────────── */
.doc-breadcrumb {
  background: var(--navy);
  padding: 0.55rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--f-m);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
}
.doc-breadcrumb a { color: rgba(255,255,255,0.55); transition: color var(--ease); }
.doc-breadcrumb a:hover { color: var(--gold); }
.doc-breadcrumb span { color: rgba(255,255,255,0.2); }
.doc-breadcrumb strong { color: rgba(255,255,255,0.75); font-weight: 600; }

/* ── PAGE TITLE BAND ────────────────────────────────────────────────────── */
.doc-title-band {
  background: var(--void);
  padding: 3rem 2rem 2.75rem;
  border-bottom: 3px solid var(--gold);
}
.doc-eyebrow {
  font-family: var(--f-m);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 0.8rem;
}
.doc-title {
  font-family: var(--f-d);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
  line-height: 1.05;
  margin-bottom: 0.5rem;
}
.doc-subtitle {
  font-family: var(--f-m);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(200,168,75,0.6);
  margin-bottom: 1.1rem;
  display: block;
}
.doc-intro {
  font-size: 1rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.75;
  max-width: 580px;
}

/* ── LAYOUT: SIDEBAR + CONTENT ──────────────────────────────────────────── */
.doc-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - 56px);
  align-items: start;
}
@media (max-width: 860px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-sidebar { display: none; }
  .doc-sidebar.open { display: block; }
}

/* ── SIDEBAR ────────────────────────────────────────────────────────────── */
.doc-sidebar {
  width: var(--sidebar-w);
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--mist);
  padding: 2rem 0 3rem;
}
.toc-label {
  font-family: var(--f-m);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8896b0;
  padding: 0 1.5rem;
  margin-bottom: 0.75rem;
  display: block;
}
.toc-list {
  list-style: none;
}
.toc-item a {
  display: block;
  padding: 0.4rem 1.5rem;
  font-size: 0.875rem;
  color: #4a5a6a;
  border-left: 2px solid transparent;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
  line-height: 1.4;
}
.toc-item a:hover {
  color: var(--navy);
  border-left-color: rgba(27,58,107,0.3);
  background: rgba(27,58,107,0.04);
}
.toc-item a.active {
  color: var(--navy);
  border-left-color: var(--gold);
  font-weight: 600;
  background: rgba(200,168,75,0.06);
}

/* ── CONTENT AREA ───────────────────────────────────────────────────────── */
.doc-content {
  padding: 3rem 3rem 5rem;
  max-width: calc(var(--content-max) + 6rem);
}
@media (max-width: 640px) {
  .doc-content { padding: 2rem 1.25rem 4rem; }
}

/* ── SECTIONS ───────────────────────────────────────────────────────────── */
.doc-section {
  margin-bottom: 4rem;
  scroll-margin-top: 80px;
}
.doc-section + .doc-section {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.section-heading {
  font-family: var(--f-d);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.015em;
  margin-bottom: 1.25rem;
  text-wrap: balance;
  line-height: 1.2;
}
.section-heading a {
  color: inherit;
}
.section-heading a:hover::after {
  content: ' #';
  color: var(--gold);
  font-size: 0.8em;
}

/* ── TYPOGRAPHY WITHIN SECTIONS ─────────────────────────────────────────── */
.doc-section p {
  margin-bottom: 1rem;
  font-size: 0.97rem;
  color: #3a4a5e;
}
.doc-section p:last-child { margin-bottom: 0; }

.doc-section h3 {
  font-family: var(--f-d);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin: 1.75rem 0 0.6rem;
}
.doc-section h4 {
  font-family: var(--f-m);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7a99;
  margin: 1.25rem 0 0.4rem;
}

.doc-section ul, .doc-section ol {
  margin: 0.6rem 0 1rem 1.25rem;
}
.doc-section li {
  font-size: 0.95rem;
  color: #3a4a5e;
  margin-bottom: 0.35rem;
  line-height: 1.6;
}

.doc-section strong { color: var(--navy); }
.doc-section code {
  font-family: var(--f-m);
  font-size: 0.85em;
  background: rgba(27,58,107,0.07);
  color: var(--navy);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* ── CALLOUT BOXES ──────────────────────────────────────────────────────── */
.callout {
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  font-size: 0.92rem;
  line-height: 1.65;
}
.callout-label {
  font-family: var(--f-m);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  display: block;
  margin-bottom: 0.4rem;
}
.callout p { margin-bottom: 0.5rem; font-size: inherit; color: inherit; }
.callout p:last-child { margin-bottom: 0; }
.callout ul { margin: 0.35rem 0 0 1.1rem; }
.callout li { font-size: inherit; color: inherit; margin-bottom: 0.2rem; }

.callout.note {
  background: rgba(27,58,107,0.06);
  border: 1px solid rgba(27,58,107,0.18);
  border-left: 3px solid var(--navy);
  color: #3a4a5e;
}
.callout.note .callout-label { color: var(--navy); }

.callout.warning {
  background: rgba(200,168,75,0.08);
  border: 1px solid rgba(200,168,75,0.3);
  border-left: 3px solid var(--gold);
  color: #4a3a1a;
}
.callout.warning .callout-label { color: var(--gold-d); }

.callout.placeholder {
  background: #fff3cd;
  border: 1px solid #f0c040;
  border-left: 3px solid #e0a000;
  color: #5a4010;
}
.callout.placeholder .callout-label { color: #c07800; }

/* Unresolved placeholders stay in the source for later follow-up, but are
   hidden from the published page. */
.callout.placeholder { display: none !important; }

/* ── STEPS (numbered procedure) ─────────────────────────────────────────── */
.steps {
  list-style: none;
  counter-reset: steps;
  margin: 1rem 0 1.25rem;
}
.steps li {
  counter-increment: steps;
  position: relative;
  padding-left: 2.75rem;
  min-height: 1.6rem;
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
  color: #3a4a5e;
  line-height: 1.55;
}
.steps li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: var(--f-d);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: var(--navy);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── SPEC TABLE ─────────────────────────────────────────────────────────── */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.92rem;
}
.spec-table tr { border-bottom: 1px solid var(--border); }
.spec-table tr:last-child { border-bottom: none; }
.spec-table td {
  padding: 0.65rem 0;
  vertical-align: top;
}
.spec-table td:first-child {
  width: 42%;
  color: #6b7a99;
  font-weight: 500;
}
.spec-table td:last-child {
  color: var(--navy);
  font-weight: 600;
}

/* ── FIGURE / IMAGE ─────────────────────────────────────────────────────── */
figure {
  margin: 1.5rem 0;
  text-align: center;
}
figcaption {
  font-size: 0.82rem;
  color: #8896b0;
  margin-top: 0.5rem;
  font-style: italic;
}
.img-placeholder {
  background: var(--mist);
  border: 1px dashed rgba(27,58,107,0.2);
  border-radius: var(--r);
  padding: 3rem 2rem;
  color: #8896b0;
  font-family: var(--f-m);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}

/* ── FOOTER ─────────────────────────────────────────────────────────────── */
.doc-footer {
  background: var(--void);
  padding: 2rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.doc-footer p {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.3);
}
.doc-footer a {
  color: rgba(200,168,75,0.7);
  font-size: 0.78rem;
  transition: color var(--ease);
}
.doc-footer a:hover { color: var(--gold); }

/* ── MOBILE TOC TOGGLE ──────────────────────────────────────────────────── */
.toc-toggle {
  display: none;
  background: var(--mist);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-family: var(--f-m);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 1rem 1.25rem 0;
  width: calc(100% - 2.5rem);
  text-align: left;
  transition: background var(--ease);
}
.toc-toggle:hover { background: rgba(27,58,107,0.08); }
@media (max-width: 860px) { .toc-toggle { display: block; } }

/* ── SCROLLBAR (sidebar) ─────────────────────────────────────────────────── */
.doc-sidebar::-webkit-scrollbar { width: 4px; }
.doc-sidebar::-webkit-scrollbar-track { background: transparent; }
.doc-sidebar::-webkit-scrollbar-thumb { background: rgba(27,58,107,0.2); border-radius: 2px; }

/* ── EMBEDDED WIRING DIAGRAMS (interactive, self-contained HTML bundles) ─── */
.diagram-embed {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--mist);
}
.diagram-embed iframe {
  border: 0;
  display: block;
  transform-origin: top left;
}
.diagram-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1.5rem 0;
}
.diagram-row figure {
  flex: 1 1 220px;
  margin: 0;
}
