/* ============================================================================
   IGW-NET Users' Reference Manual — Shared Stylesheet
   Deploy at: /magnet/docs/igwnet/users-manual/assets/manual.css

   Visual identity: warm cream hero, deep indigo accent — teaching tone,
   authoritative without being intimidating. Distinct from the other pillars.
   ============================================================================ */

:root {
  --bg: #ffffff;
  --bg2: #fafaf7;
  --bg-warm: #fdf9f0;
  --bg-cool: #f3f6fa;
  --t1: #1a1f2e;          /* deep ink */
  --t2: #3d4454;
  --t3: #7a8292;
  --t-muted: #a8b2c3;
  --accent: #3730a3;      /* deep indigo */
  --accent2: #1e1b4b;
  --accent-light: #818cf8;
  --accent-soft: #e0e7ff;
  --accent-glow: rgba(55, 48, 163, 0.08);
  --warm-accent: #c2410c;  /* burnt orange — for callouts */
  --warm-accent-soft: #fff7ed;
  --success: #047857;
  --success-soft: #ecfdf5;
  --caution: #b45309;
  --caution-soft: #fef3c7;
  --bdr: #e5e7eb;
  --bdr-soft: #f3f4f6;
  --se: 'Charter', 'Georgia', serif;  /* book-style serif */
  --sa: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: #e8ecf0;
}

body {
  background: #e8ecf0;
  color: var(--t2);
  font-family: var(--sa);
  font-size: 16px;
  line-height: 1.75;
  padding: 28px 44px;
  overflow-x: hidden;
  margin: 0;
  box-sizing: border-box;
}

.page-wrap {
  max-width: 1200px;
  margin: 0 auto 40px;
  background: var(--bg);
  min-height: calc(100vh - 48px);
  box-shadow: 0 0 60px rgba(0,0,0,0.08);
  border-radius: 4px;
}

/* ============================================================================
   NAVIGATION (sticky top bar)
   ============================================================================ */
.nav {
  background: var(--t1);
  padding: 14px 48px;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nav a.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.3px;
}
.nav .breadcrumb { font-size: 14px; color: var(--t-muted); flex: 1; }
.nav .breadcrumb a { color: var(--accent-light); text-decoration: none; }
.nav .breadcrumb a:hover { text-decoration: underline; }
.nav .chapter-nav {
  display: flex;
  gap: 12px;
  font-size: 14px;
}
.nav .chapter-nav a {
  color: var(--t-muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 4px;
  transition: all 0.15s;
}
.nav .chapter-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* ============================================================================
   HERO (chapter opening)
   ============================================================================ */
.hero {
  background: linear-gradient(180deg, var(--bg-warm) 0%, #ffffff 100%);
  padding: 56px 92px 8px 352px;
  border-bottom: 1px solid var(--bdr);
  box-sizing: border-box;
}
.hero .chapter-marker {
  display: inline-block;
  color: #fff;
  background: var(--accent);
  font-size: 15px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 22px;
  padding: 7px 18px;
  border-radius: 4px;
  font-family: var(--sa);
  box-shadow: 0 2px 6px var(--accent-glow);
}
.hero .chapter-marker em {
  font-style: normal;
  color: var(--accent-soft);
  font-weight: 600;
  padding-left: 4px;
}
.hero h1 {
  font-family: var(--se);
  font-size: clamp(32px, 4vw, 44px);
  color: var(--t1);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 18px;
  letter-spacing: -0.5px;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lead {
  font-family: var(--se);
  font-size: 19px;
  color: var(--t2);
  line-height: 1.6;
  max-width: 756px;
  font-style: italic;
}

.hero .chapter-meta {
  display: flex;
  gap: 24px 40px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--bdr);
  font-size: 14px;
  color: var(--t3);
}
.hero .chapter-meta .meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hero .chapter-meta .label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--t-muted);
  font-weight: 700;
}
.hero .chapter-meta .value { color: var(--t2); font-weight: 500; }

/* ============================================================================
   LAYOUT (sidebar TOC + content)
   ============================================================================ */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  min-width: 0;
}
.layout > * { min-width: 0; }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 40px 48px 72px; }
  .hero { padding: 44px 48px 36px; }
  .nav { padding: 12px 32px; }
  .footer { padding: 22px 32px; }
}
@media (max-width: 640px) {
  body { padding: 20px 24px; }
  .page-wrap { border-radius: 4px; }
  .content { padding: 32px 28px 48px; }
  .hero { padding: 32px 28px 28px; }
  .nav {
    padding: 12px 22px;
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .nav .brand { font-size: 13px; }
  .nav .breadcrumb { font-size: 13px; flex: 1 1 100%; order: 2; }
  .nav .chapter-nav { display: none; }
  .footer { padding: 20px 24px; font-size: 12px; }
  .hero h1 { font-size: 26px !important; }
  .hero .lead { font-size: 15px; }
  .hero .chapter-marker { font-size: 13px; padding: 6px 14px; letter-spacing: 1.5px; }
  .hero .chapter-meta { gap: 12px 24px; font-size: 13px; }
  h2.section { font-size: 22px; margin: 40px 0 12px; padding-top: 6px; padding-bottom: 10px; }
  h2.section .section-num { font-size: 14px; margin-right: 10px; padding: 2px 8px; }
  h3.subsection { font-size: 17px; margin: 28px 0 10px; padding-left: 10px; }
  h3.subsection .section-num { font-size: 11px; margin-right: 8px; }
  .decision-table { font-size: 13px; }
  .decision-table th, .decision-table td { padding: 10px 12px; }
  .quick-read { padding: 16px 14px; }
}

/* Ultra-narrow (≤400px) — still maintain visible gutter */
@media (max-width: 400px) {
  body { padding: 14px 16px; }
  .content { padding: 28px 22px 44px; }
  .hero { padding: 28px 22px 24px; }
  .nav { padding: 10px 18px; }
  .footer { padding: 18px 18px; }
}

/* Sidebar (chapter TOC — "on this page" navigation) */
.sidebar {
  position: sticky;
  top: 58px;
  align-self: start;
  padding: 32px 20px 40px 36px;
  border-right: 1px solid var(--bdr);
  max-height: calc(100vh - 58px);
  overflow-y: auto;
  background: var(--bg2);
  font-size: 14px;
}
.sidebar h4 {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bdr);
  font-family: var(--sa);
}
.sidebar h4:first-of-type { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar > ul > li { padding: 2px 0; }
.sidebar a {
  color: var(--t2);
  text-decoration: none;
  display: block;
  padding: 5px 10px;
  border-radius: 4px;
  transition: all 0.1s;
  line-height: 1.45;
}
.sidebar a:hover {
  background: var(--accent-soft);
  color: var(--accent2);
}
.sidebar a.sub {
  padding-left: 22px;
  color: var(--t3);
  font-size: 13px;
}
.sidebar a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */
.content {
  padding: 16px 72px 96px;
  max-width: 900px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Section headers — the "you are here" markers */

/* Part heading (appears in-chapter as the Part label above a section, rarely used within chapter body) */
h2.part {
  font-family: var(--se);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 8px;
}

/* H2 — Section level (§X.Y) — primary scanning anchor within a chapter */
h2.section {
  font-family: var(--se);
  font-size: 30px;
  font-weight: 400;
  color: var(--t1);
  margin: 56px 0 16px;
  padding-bottom: 14px;
  padding-top: 8px;
  border-bottom: 2px solid var(--accent);
  border-top: 1px solid var(--bdr-soft);
  scroll-margin-top: 80px;
  line-height: 1.25;
}
h2.section:first-of-type {
  margin-top: 20px;
  border-top: none;
  padding-top: 0;
}
h2.section em { font-style: italic; color: var(--accent); }
h2.section .section-num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 18px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 1px;
  margin-right: 18px;
  padding: 2px 10px;
  background: var(--accent-soft);
  border-radius: 6px;
  vertical-align: middle;
  position: relative;
  top: -2px;
}
h2.section .section-num::after {
  content: "\00a0";  /* non-breaking space in text flow for copy-paste fidelity */
}

/* H3 — Subsection level (§X.Y.Z) — clearly nested under H2 but lighter weight */
h3.subsection {
  font-family: var(--sa);
  font-size: 20px;
  font-weight: 700;
  color: var(--t1);
  margin: 36px 0 12px;
  padding-left: 14px;
  border-left: 3px solid var(--accent-light);
  scroll-margin-top: 80px;
  line-height: 1.3;
}
h3.subsection .section-num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent2);
  font-weight: 600;
  margin-right: 12px;
  letter-spacing: 1px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}
h3.subsection .section-num::after {
  content: "\00a0";
}

/* H4 — Rarely used; minor inline heading */
h4.subsubsection {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  font-weight: 700;
  margin: 26px 0 8px;
  font-family: var(--sa);
}
/* Step headings (inside .steps blocks) */
.steps .step h5 {
  font-family: var(--sa);
  font-size: 15px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 6px;
}

/* ============================================================================
   BODY TEXT
   ============================================================================ */
.content {
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.content p {
  color: var(--t2);
  font-size: 16px;
  line-height: 1.75;
  margin-bottom: 20px;
  overflow-wrap: break-word;
}
.content p strong { color: var(--t1); font-weight: 600; }
.content p em { color: var(--t1); font-style: italic; }

.content .lead-in {
  font-family: var(--se);
  font-size: 18px;
  color: var(--t2);
  line-height: 1.6;
  margin-bottom: 22px;
  font-style: italic;
  padding-left: 20px;
  border-left: 3px solid var(--accent-soft);
}

/* Inline code — interface terminology */
.content code,
code {
  background: var(--bg2);
  border: 1px solid var(--bdr-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent2);
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Interface-name emphasis — buttons, menus, tabs */
.content .ui {
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 600;
  color: var(--accent2);
  font-size: 0.96em;
  white-space: nowrap;
}

/* Nav path — "Menu → Submenu → Item" */
.content .nav-path {
  font-family: var(--mono);
  background: var(--bg2);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent2);
  border: 1px solid var(--bdr-soft);
  display: inline-block;
  line-height: 1.4;
}

/* Lists */
.content ul, .content ol {
  margin: 0 0 20px 24px;
  padding: 0;
}
.content li {
  color: var(--t2);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 10px;
}
.content ul ul, .content ol ol, .content ul ol, .content ol ul {
  margin: 8px 0 8px 20px;
}

/* ============================================================================
   QUICK-READ SUMMARY (top of each chapter)
   ============================================================================ */
.quick-read {
  margin: 0 -16px 32px -16px;
  padding: 16px 16px 24px 16px;
  background: var(--bg-cool);
  border-radius: 12px;
  border-left: 4px solid var(--accent);
}
.content > .quick-read:first-child { margin-top: 0; }
.quick-read h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--accent);
  font-weight: 800;
  margin: 0 0 14px;
  font-family: var(--sa);
}
.quick-read ul { list-style: none; margin: 0; padding: 0; }
.quick-read > ul > li {
  padding: 10px 0 10px 26px;
  position: relative;
  font-size: 15px;
  line-height: 1.6;
  color: var(--t1);
  margin-bottom: 14px;
}
.quick-read > ul > li:last-child {
  margin-bottom: 0;
}
.quick-read > ul > li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 10px;
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
}
/* Nested ordered lists inside quick-read bullets (e.g., the top-11 list,
   the pitfall-hierarchy map) — use normal numbering, add breathing room */
.quick-read ol {
  margin: 10px 0 6px 22px;
  padding: 0;
  list-style: decimal;
}
.quick-read ol li {
  padding: 0;
  margin-bottom: 12px;
  line-height: 1.65;
  font-size: 15px;
  color: var(--t1);
}
.quick-read ol li::before {
  content: none;
}
.quick-read ol li:last-child {
  margin-bottom: 0;
}

/* ============================================================================
   FIGURES
   ============================================================================ */
figure {
  margin: 24px 0;
  padding: 14px;
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-radius: 10px;
  text-align: center;
}
figure img, figure svg {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}
figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--t3);
  font-style: italic;
  line-height: 1.6;
  padding: 0 16px;
  font-family: var(--se);
}
figcaption .fig-label {
  font-style: normal;
  font-weight: 700;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-right: 8px;
  font-family: var(--sa);
}

/* Figure placeholders (for images not yet captured) */
figure.placeholder {
  background: repeating-linear-gradient(45deg, #fdfcf8, #fdfcf8 10px, #faf8f0 10px, #faf8f0 20px);
  padding: 40px 32px;
  border: 2px dashed var(--caution);
}
figure.placeholder .placeholder-label {
  color: var(--caution);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 800;
  margin-bottom: 8px;
}
figure.placeholder .placeholder-desc {
  font-family: var(--se);
  font-style: italic;
  color: var(--t2);
  font-size: 15px;
  line-height: 1.5;
}

/* ============================================================================
   DECISION TABLES
   ============================================================================ */
.decision-table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--bdr);
  display: block;
  max-width: 100%;
  overflow-x: auto;
}
.decision-table thead, .decision-table tbody {
  display: table;
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
}
.decision-table th {
  background: linear-gradient(180deg, #242e42 0%, #1e293b 100%);
  color: #f1f5f9;
  padding: 14px 24px;
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 700;
  font-family: var(--sa);
  border-right: 1px solid rgba(255,255,255,0.10);
  border-bottom: 2px solid var(--accent);
}
.decision-table th:last-child { border-right: none; }
.decision-table td {
  padding: 14px 24px;
  border-top: 1px solid var(--bdr);
  border-right: 1px solid var(--bdr-soft);
  vertical-align: top;
  color: var(--t2);
  line-height: 1.55;
}
.decision-table td:last-child { border-right: none; }
.decision-table tr:nth-child(even) td { background: var(--bg2); }
.decision-table td:first-child {
  font-weight: 700;
  color: var(--t1);
}
/* Allow narrow first columns to wrap naturally (e.g., in 4-col reference tables) */
.decision-table.wrap-first td:first-child { white-space: normal; }
.decision-table td code {
  font-size: 12px;
  padding: 1px 4px;
  background: var(--bg2);
  border-radius: 3px;
}

/* ============================================================================
   CALLOUTS
   ============================================================================ */
.callout {
  margin: 22px 0;
  padding: 16px 22px;
  border-radius: 0 10px 10px 0;
  border-left: 4px solid;
  font-size: 15px;
  line-height: 1.65;
}
.callout .callout-label {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 6px;
  font-family: var(--sa);
}
.callout.caution {
  background: var(--caution-soft);
  border-left-color: var(--caution);
}
.callout.caution .callout-label { color: var(--caution); }
.callout.tip {
  background: var(--success-soft);
  border-left-color: var(--success);
}
.callout.tip .callout-label { color: var(--success); }
.callout.key {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.callout.key .callout-label { color: var(--accent); }
.callout.concept {
  background: var(--warm-accent-soft);
  border-left-color: var(--warm-accent);
}
.callout.concept .callout-label { color: var(--warm-accent); }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--t1); }

/* ============================================================================
   STEP-BY-STEP BLOCKS
   ============================================================================ */
.steps {
  counter-reset: step-counter;
  margin: 22px 0;
}
.step {
  margin: 14px 0;
  padding: 18px 24px 18px 60px;
  background: var(--bg2);
  border-radius: 10px;
  position: relative;
  counter-increment: step-counter;
}
.step::before {
  content: counter(step-counter);
  position: absolute;
  left: 18px;
  top: 18px;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sa);
}
.step h5 {
  font-size: 14px;
  font-weight: 700;
  color: var(--t1);
  margin: 0 0 4px;
}
.step p { font-size: 14px; margin-bottom: 6px; color: var(--t2); }
.step p:last-child { margin-bottom: 0; }

/* ============================================================================
   CROSS-REFERENCES (see-also sidebars)
   ============================================================================ */
.see-also {
  margin: 28px 0;
  padding: 16px 22px;
  background: var(--bg-cool);
  border-radius: 8px;
  border: 1px solid var(--bdr);
  font-size: 14px;
}
.see-also h5 {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 8px;
  font-family: var(--sa);
}
.see-also ul { list-style: none; margin: 0; padding: 0; }
.see-also li { padding: 3px 0; line-height: 1.5; font-size: 14px; }
.see-also a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-light);
}
.see-also a:hover { border-bottom-style: solid; }

/* Chapter-end nav */
.chapter-footer {
  margin: 72px 0 0;
  padding: 32px 0 0;
  border-top: 2px solid var(--bdr);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.chapter-footer a {
  flex: 1;
  padding: 20px 24px;
  background: var(--bg2);
  border-radius: 10px;
  text-decoration: none;
  color: var(--t2);
  transition: all 0.15s;
  border: 1px solid var(--bdr);
}
.chapter-footer a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.chapter-footer a .arrow {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
  font-family: var(--sa);
}
.chapter-footer a.next { text-align: right; }
.chapter-footer a .title {
  font-family: var(--se);
  font-size: 17px;
  color: var(--t1);
  font-weight: 500;
  line-height: 1.3;
}

.footer {
  background: var(--t1);
  color: var(--t-muted);
  padding: 26px 48px;
  text-align: center;
  font-size: 13px;
  border-top: 1px solid var(--bdr);
}
.footer a { color: var(--accent-light); text-decoration: none; }

@media print {
  .nav, .sidebar, .footer, .chapter-footer { display: none; }
  body { background: #fff; }
  .layout { grid-template-columns: 1fr; }
  .page-wrap { box-shadow: none; max-width: none; }
  .hero { background: none; padding: 0 0 24px; }
}
