/* =========================================================================
   PADI Travel — Infrastructure Guide
   Design system: "dive console" — deep-water navy frame, surface reading
   area, teal dive-water accent, coral warnings, monospace telemetry.
   ========================================================================= */

:root {
  /* Frame: blue / deep-ocean-navy */
  --navy:        #0A2A43;
  --navy-800:    #0C3251;
  --navy-700:    #13415f;
  --navy-600:    #1c5274;

  /* Surface */
  --ground:      #EDF3F7;
  --surface:     #FFFFFF;
  --surface-2:   #F4F9FB;

  /* Ink */
  --ink:         #102433;
  --ink-2:       #46586a;
  --ink-3:       #6c7d8c;
  --line:        #d8e4ec;
  --line-2:      #e8f0f5;

  /* Accents */
  --accent:      #0E8C9A;   /* dive-water teal */
  --accent-700:  #096974;
  --accent-50:   #e2f3f5;
  --warn:        #D8632E;   /* coral */
  --warn-50:     #fbeadf;
  --good:        #1B9E6F;
  --good-50:     #e2f5ee;

  /* Service taxonomy */
  --aws:         #E08A1E;
  --aws-50:      #fcefd9;
  --native:      #3568AE;
  --native-50:   #e5edf8;
  --container:   #16996A;
  --container-50:#e1f4ec;
  --saas:        #64768A;
  --saas-50:     #ebeef2;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --sidebar-w: 290px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16,36,51,.04), 0 6px 22px rgba(16,36,51,.06);
  --shadow-lg: 0 18px 48px rgba(10,42,67,.16);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 28px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--ground);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ----------------------------------------------------------------- Layout */
.layout { display: flex; min-height: 100vh; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1 1 auto;
  min-width: 0;
  padding: 56px clamp(22px, 5vw, 76px) 120px;
}
.wrap { max-width: 940px; margin: 0 auto; }

/* --------------------------------------------------------------- Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  background: var(--navy);
  color: #b9cedd;
  padding: 26px 18px 36px;
  z-index: 50;
  border-right: 1px solid #082237;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.brand-gauge {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  position: relative;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 130%, var(--accent) 0%, var(--navy-600) 70%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.14), inset 0 0 0 6px rgba(255,255,255,.04);
}
.brand-gauge::after {
  content: ""; width: 3px; height: 13px; background: #eafcff; border-radius: 3px;
  transform: translateY(-3px) rotate(35deg); transform-origin: bottom center;
  box-shadow: 0 0 6px rgba(234,252,255,.7);
}
.brand-text b { display: block; color: #fff; font-size: .98rem; letter-spacing: -.01em; }
.brand-text span { font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: #6f95ac; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-eyebrow {
  font-size: .64rem; letter-spacing: .2em; text-transform: uppercase;
  color: #5e84a0; padding: 18px 10px 7px; font-weight: 700;
}
.nav-page {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  color: #cfe0ec; text-decoration: none; font-weight: 600; font-size: .92rem;
  transition: background .15s, color .15s;
}
.nav-page:hover { background: var(--navy-700); color: #fff; }
.nav-page .num {
  font: 600 .72rem/1 var(--mono); color: #6f95ac;
  border: 1px solid rgba(255,255,255,.16); border-radius: 6px;
  padding: 4px 6px; min-width: 24px; text-align: center;
}
.nav-page.active { background: linear-gradient(90deg, var(--navy-700), var(--navy-800)); color: #fff; }
.nav-page.active .num { background: var(--accent); border-color: var(--accent); color: #042428; }

.subnav { list-style: none; margin: 2px 0 8px 18px; padding: 4px 0 4px 22px; border-left: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 1px; }
.subnav a {
  display: block; padding: 6px 12px; border-radius: 7px;
  color: #93b0c5; text-decoration: none; font-size: .84rem; line-height: 1.4;
  border-left: 2px solid transparent; margin-left: -1px;
  transition: color .14s, background .14s;
}
.subnav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.subnav a.current { color: #fff; background: rgba(14,140,154,.18); box-shadow: inset 2px 0 0 var(--accent); }

.nav-refs { margin-top: 10px; padding: 16px 10px 4px; border-top: 1px solid rgba(255,255,255,.08); }
.nav-refs a {
  display: flex; align-items: center; gap: 9px; padding: 8px 8px;
  color: #a7c2d4; text-decoration: none; font-size: .83rem; border-radius: 7px;
}
.nav-refs a:hover { color: #fff; background: var(--navy-700); }
.nav-refs a .ext { margin-left: auto; color: #5e84a0; font: 600 .72rem var(--mono); }

/* --------------------------------- Narrow screens: stack nav above content */
@media (max-width: 940px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static; width: auto; height: auto;
    border-right: 0; border-bottom: 1px solid #082237;
    padding: 20px 18px 24px;
  }
  .subnav { max-width: 520px; }
  .main { margin-left: 0; padding: 38px 20px 90px; }
}

/* ----------------------------------------------------------- Page header */
.eyebrow {
  font: 700 .72rem/1 var(--mono); letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent-700); display: inline-flex; align-items: center; gap: 10px; margin: 0 0 14px;
}
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--accent); display: inline-block; }

h1 {
  font-size: clamp(2rem, 4.4vw, 2.9rem); line-height: 1.05; letter-spacing: -.025em;
  font-weight: 800; margin: 0 0 18px; color: var(--navy);
}
.lede { font-size: 1.16rem; line-height: 1.6; color: var(--ink-2); max-width: 70ch; margin: 0 0 30px; }
.lede strong { color: var(--ink); font-weight: 650; }

/* ------------------------------------------------------------- Stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 0 0 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.stat b { display: block; font: 800 1.7rem/1 var(--sans); color: var(--navy); letter-spacing: -.02em; }
.stat b.mono { font-family: var(--mono); font-size: 1.25rem; }
.stat span { display: block; font-size: .82rem; color: var(--ink-3); margin-top: 7px; line-height: 1.4; }

/* --------------------------------------------------------------- Sections */
section { scroll-margin-top: 24px; padding-top: 30px; margin-top: 30px; border-top: 1px solid var(--line-2); }
section:first-of-type { border-top: 0; margin-top: 8px; }
.sec-eyebrow { font: 700 .68rem/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; }
h2 { font-size: 1.6rem; letter-spacing: -.02em; color: var(--navy); margin: 0 0 6px; font-weight: 750; }
h3 { font-size: 1.08rem; color: var(--navy-800); margin: 26px 0 8px; font-weight: 700; }
p { margin: 0 0 14px; }
a { color: var(--accent-700); text-decoration: none; border-bottom: 1px solid rgba(9,105,116,.3); }
a:hover { border-bottom-color: var(--accent); }
.plain { color: var(--ink-2); }

/* Lead-in "in plain terms" note */
.plainly {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--accent-50); border-radius: var(--radius-sm);
  padding: 13px 16px; margin: 0 0 20px; font-size: .96rem; color: #0b4f57;
}
.plainly b { color: var(--accent-700); }
.plainly::before { content: "▸"; color: var(--accent); font-weight: 700; }

/* ----------------------------------------------------------------- Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin: 0 0 18px; }
.card h3 { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.facts li { display: grid; grid-template-columns: 168px 1fr; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line-2); font-size: .95rem; }
.facts li:first-child { border-top: 0; }
.facts li b { color: var(--ink-3); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }

/* --------------------------------------------------------------- Callouts */
.note { border-radius: var(--radius-sm); padding: 14px 18px 14px 16px; margin: 0 0 18px; font-size: .95rem; border-left: 4px solid; }
.note p:last-child { margin-bottom: 0; }
.note .t { font-weight: 700; display: block; margin-bottom: 3px; }
.note.info    { background: var(--accent-50); border-color: var(--accent); color: #0b4f57; }
.note.warn    { background: var(--warn-50);   border-color: var(--warn);   color: #8a3a14; }
.note.confirm { background: #fff7e6;          border-color: var(--aws);    color: #7a521a; }
.note.good    { background: var(--good-50);   border-color: var(--good);   color: #0c5f43; }
.note code { background: rgba(0,0,0,.05); }

/* ------------------------------------------------------------------ Code */
code, .mono { font-family: var(--mono); font-size: .88em; }
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .08em .42em; color: var(--navy-800); white-space: nowrap; }
pre {
  background: var(--navy); color: #d7e7f2; border-radius: var(--radius-sm);
  padding: 16px 18px; overflow-x: auto; font-size: .85rem; line-height: 1.6; margin: 0 0 18px;
  border: 1px solid #082237;
}
pre code { background: none; border: 0; padding: 0; color: inherit; white-space: pre; }
pre .c { color: #6f95ac; }   /* comment */
pre .k { color: #57c8d6; }   /* keyword/cmd */

/* ----------------------------------------------------------------- Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; font: 600 .76rem/1 var(--sans); padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.aws       { background: var(--aws-50);       color: #8a5610; } .chip.aws .dot       { background: var(--aws); }
.chip.native    { background: var(--native-50);    color: #244c80; } .chip.native .dot    { background: var(--native); }
.chip.container { background: var(--container-50); color: #0c6647; } .chip.container .dot { background: var(--container); }
.chip.saas      { background: var(--saas-50);      color: #455263; } .chip.saas .dot      { background: var(--saas); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }

.tag { display: inline-block; font: 700 .66rem/1 var(--mono); letter-spacing: .04em; padding: 4px 7px; border-radius: 5px; vertical-align: middle; }
.tag.confirm { background: var(--warn-50); color: var(--warn); }
.tag.new { background: var(--good-50); color: #0c6647; }
.tag.drift { background: #fff1d6; color: #97600f; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 18px; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; background: var(--surface); }
thead th { background: var(--surface-2); text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 12px 15px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody td { padding: 12px 15px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td b { color: var(--navy-800); }
td .mono, table code { font-size: .82rem; }

/* ----------------------------------------------------- Depth (architecture) */
.depthmap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 6px 0 8px; box-shadow: var(--shadow); }
.tier { padding: 16px 18px; display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: center; position: relative; }
.tier + .tier { border-top: 1px solid rgba(255,255,255,.35); }
.tier-label { font: 700 .7rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.tier-label small { display: block; font-family: var(--sans); font-size: .68rem; letter-spacing: .02em; text-transform: none; font-weight: 500; opacity: .7; margin-top: 4px; }
.tier-nodes { display: flex; flex-wrap: wrap; gap: 9px; }
/* descending depth: lighter at the surface, deeper navy toward data */
.depthmap .tier:nth-child(1) { background: #f7fbfd; }
.depthmap .tier:nth-child(2) { background: #eaf4f7; }
.depthmap .tier:nth-child(3) { background: #dcebf1; background: #dbe9f0; }
.depthmap .tier:nth-child(4) { background: #cadced; }
.depthmap .tier:nth-child(5) { background: #b7cfe2; }
.tier-label { color: var(--navy-800); }

.node {
  display: inline-flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--saas);
  border-radius: 9px; padding: 8px 12px; min-width: 96px; box-shadow: 0 1px 2px rgba(16,36,51,.06);
}
.node b { font-size: .82rem; color: var(--navy-800); line-height: 1.25; }
.node small { font-size: .68rem; color: var(--ink-3); font-family: var(--mono); }
.node.aws       { border-top-color: var(--aws); }
.node.native    { border-top-color: var(--native); }
.node.container { border-top-color: var(--container); }
.node.saas      { border-top-color: var(--saas); }

/* numbered process steps (deployments) */
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 14px; margin: 6px 0 18px; padding: 0; list-style: none; }
.steps > li { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 18px 64px; box-shadow: var(--shadow); }
.steps > li::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; left: 18px; top: 18px;
  font: 800 .9rem/1 var(--mono); color: var(--accent);
}
.steps > li::after { content: ""; position: absolute; left: 30px; top: 40px; bottom: -14px; width: 1px; background: var(--line); }
.steps > li:last-child::after { display: none; }
.steps h3 { margin: 0 0 6px; }

footer.pagefoot { margin-top: 60px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; }
.pager { display: flex; gap: 12px; }
.pager a { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 9px 14px; font-size: .85rem; font-weight: 600; color: var(--navy-800); }
.pager a:hover { border-color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.muted { color: var(--ink-3); font-size: .85rem; }
hr.soft { border: 0; border-top: 1px solid var(--line-2); margin: 22px 0; }

/* --------------------------------------------------------- Theme toggle */
.theme-toggle {
  margin-left: auto; flex: none; width: 36px; height: 36px;
  border-radius: 9px; border: 1px solid rgba(255,255,255,.18);
  background: var(--navy-700); color: #e6f0f6; font-size: 1.02rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s;
}
.theme-toggle:hover { background: var(--navy-600); color: #fff; }

/* ============================================================ DARK THEME */
[data-theme="dark"] {
  --ground:      #0a1721;
  --surface:     #0f2230;
  --surface-2:   #142a3b;
  --ink:         #dde9f1;
  --ink-2:       #a7bccb;
  --ink-3:       #8096a6;
  --line:        #21384a;
  --line-2:      #182b3a;
  --accent-50:   #0d333a;
  --warn-50:     #3a2418;
  --good-50:     #103027;
  --aws-50:      #3a2c12;
  --native-50:   #14283f;
  --container-50:#103226;
  --saas-50:     #1c2734;
  --shadow:      0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.32);
  --shadow-lg:   0 18px 48px rgba(0,0,0,.55);
}
/* headings / accents that were navy-on-light */
[data-theme="dark"] h1,
[data-theme="dark"] h2          { color: #eaf3f8; }
[data-theme="dark"] h3          { color: #cfe0ec; }
[data-theme="dark"] .eyebrow    { color: #4fc5d2; }
[data-theme="dark"] .eyebrow::before { background: #4fc5d2; }
[data-theme="dark"] a           { color: #58c6d4; border-bottom-color: rgba(88,198,212,.32); }
[data-theme="dark"] a:hover     { border-bottom-color: #58c6d4; }
[data-theme="dark"] .stat b     { color: #eaf3f8; }
[data-theme="dark"] td b        { color: #cfe0ec; }
[data-theme="dark"] .node b     { color: #dbe8f1; }
[data-theme="dark"] .node small { color: #93a8b8; }
[data-theme="dark"] .tier-label { color: #cfe0ec; }
[data-theme="dark"] .pager a    { color: #cfe0ec; }
[data-theme="dark"] .plainly    { color: #bfe6ea; }
[data-theme="dark"] .plainly b  { color: #6fd2dd; }
[data-theme="dark"] :not(pre) > code { background: #0c1c28; color: #bfe0ea; border-color: #21384a; }
[data-theme="dark"] .note code  { background: rgba(255,255,255,.08); }
/* callout text colours for dark */
[data-theme="dark"] .note.info    { color: #bfe6ea; }
[data-theme="dark"] .note.warn    { color: #f0b89a; }
[data-theme="dark"] .note.confirm { background: #2e2410; color: #e8c98c; }
[data-theme="dark"] .note.good    { color: #9fe0c6; }
/* chips: brighter text on translucent fills */
[data-theme="dark"] .chip.aws       { background: rgba(224,138,30,.16); color: #f0b765; }
[data-theme="dark"] .chip.native    { background: rgba(53,104,174,.22); color: #8fb6e8; }
[data-theme="dark"] .chip.container { background: rgba(22,153,106,.20); color: #6dd5ab; }
[data-theme="dark"] .chip.saas      { background: rgba(122,140,160,.22); color: #b3c4d3; }
[data-theme="dark"] .tag.confirm { background: rgba(216,99,46,.22); color: #f0a079; }
[data-theme="dark"] .tag.new     { background: rgba(27,158,111,.22); color: #74d6ad; }
[data-theme="dark"] .tag.drift   { background: rgba(214,150,30,.22); color: #e8bf6a; }
/* depth map: ocean-at-night gradient */
[data-theme="dark"] .depthmap .tier:nth-child(1) { background: #102532; }
[data-theme="dark"] .depthmap .tier:nth-child(2) { background: #0e2230; }
[data-theme="dark"] .depthmap .tier:nth-child(3) { background: #0c1f2d; }
[data-theme="dark"] .depthmap .tier:nth-child(4) { background: #0b1c29; }
[data-theme="dark"] .depthmap .tier:nth-child(5) { background: #0a1925; }
[data-theme="dark"] .tier + .tier { border-top-color: rgba(255,255,255,.06); }

/* ----------------------------------------------------- Mermaid diagrams */
.diagram-card { background: #ffffff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin: 8px 0 18px; }
.diagram-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.diagram-toolbar button { appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--navy-800); border-radius: 7px; padding: 6px 11px; font: 600 .82rem var(--sans); cursor: pointer; line-height: 1; }
.diagram-toolbar button:hover { border-color: var(--accent); color: var(--accent-700); }
.diagram-toolbar .zoom-in, .diagram-toolbar .zoom-out { width: 34px; font-size: 1.15rem; padding: 5px 0; }
.diagram-toolbar .zoom-level { font: 600 .8rem var(--mono); color: var(--ink-3); min-width: 50px; text-align: center; }
.diagram-toolbar .zoom-full { margin-left: auto; }
.diagram-hint { font-size: .78rem; color: var(--ink-3); width: 100%; margin: 2px 0 0; }
.diagram-viewport { overflow: auto; max-height: 72vh; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; }
.diagram-viewport .mermaid { margin: 0; text-align: left; font-family: var(--sans); color: #102433; padding: 8px; }
.diagram-viewport .mermaid:not([data-processed]) { white-space: pre-wrap; font: .8rem/1.5 var(--mono); color: var(--ink-3); }
.diagram-viewport .mermaid svg { height: auto; display: block; }
.diagram-card:fullscreen { background: #fff; padding: 18px; display: flex; flex-direction: column; }
.diagram-card:fullscreen .diagram-viewport { max-height: none; flex: 1; }
[data-theme="dark"] .diagram-card { background: #eef3f7; border-color: rgba(255,255,255,.10); }
[data-theme="dark"] .diagram-toolbar button { background: #ffffff; color: #102433; border-color: #cdd9e2; }
