/* ============================================================
   Talos Linux — Architecture Deep Dive
   Shared design system  ·  mobile-first, blueprint dark
   (sibling of the COSI walkthrough; blue-forward palette)
   ============================================================ */

:root {
  --bg:        #0b0e15;
  --bg-2:      #10141d;
  --bg-3:      #161c27;
  --panel:     #121823;
  --panel-2:   #18202d;
  --line:      #233040;
  --line-2:    #2d3c4f;
  --ink:       #d7e1ec;
  --ink-soft:  #9db0c4;
  --ink-dim:   #6a7d92;
  --accent:    #4f9dff;   /* talos blue (primary) */
  --accent-2:  #34d3c4;   /* teal (secondary) */
  --amber:     #f5b94d;
  --violet:    #b388ff;
  --rose:      #ff7a93;
  --green:     #66d39a;
  --accent-soft: rgba(79,157,255,.13);
  --blue-soft:   rgba(79,157,255,.13);
  --teal-soft:   rgba(52,211,196,.12);
  --amber-soft:  rgba(245,185,77,.12);
  --shadow:    0 18px 50px -22px rgba(0,0,0,.78);
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --r: 12px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  background-image:
    radial-gradient(900px 500px at 88% -8%, rgba(79,157,255,.08), transparent 60%),
    radial-gradient(800px 480px at 5% 0%, rgba(52,211,196,.05), transparent 55%);
  background-attachment: fixed;
}

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

.sidebar {
  width: 270px;
  flex: 0 0 270px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 16px 40px;
  z-index: 40;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }

.brand { display: flex; align-items: center; gap: 11px; margin: 4px 8px 22px; text-decoration: none; }
.brand-mark { flex: 0 0 auto; }
.brand-text { line-height: 1.15; }
.brand-text b { color: var(--ink); font-size: 15px; letter-spacing: .2px; display: block; font-weight: 700; }
.brand-text span { color: var(--ink-dim); font-size: 11px; letter-spacing: .8px; text-transform: uppercase; }

.nav-group { margin-bottom: 17px; }
.nav-group h4 {
  font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--ink-dim); margin: 0 0 8px 10px; font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; margin: 1px 0;
  border-radius: 9px; color: var(--ink-soft);
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent; transition: .14s;
}
.nav-link .n { color: var(--ink-dim); font-family: var(--mono); font-size: 11px; width: 16px; text-align: right; }
.nav-link:hover { background: var(--bg-3); color: var(--ink); }
.nav-link.active {
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  color: var(--ink); border-color: var(--line);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-link.active .n { color: var(--accent); }

/* ---- main column ---- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 28px;
  background: rgba(11,14,21,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .crumb { color: var(--ink-dim); font-size: 13px; font-family: var(--mono); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb b { color: var(--ink-soft); font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .ghost-btn {
  background: var(--panel); border: 1px solid var(--line);
  color: var(--ink); border-radius: 8px; padding: 7px 10px; cursor: pointer; font-size: 15px; line-height: 1;
}
.menu-toggle { display: none; }

.content { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 30px 30px 90px; }

/* ---- typography ---- */
h1, h2, h3 { color: #fff; line-height: 1.2; font-weight: 700; }
h1 { font-size: 33px; margin: 8px 0 6px; letter-spacing: -.4px; }
h2 { font-size: 23px; margin: 52px 0 14px; padding-top: 10px; letter-spacing: -.3px; scroll-margin-top: 80px; }
h2 .hsh { color: var(--accent); font-family: var(--mono); font-size: 16px; opacity: .55; margin-right: 8px; }
h3 { font-size: 17.5px; margin: 30px 0 10px; color: #eaf1f8; }
p { margin: 12px 0; color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: #fff; font-weight: 650; }
em { color: var(--ink-soft); }
ul, ol { margin: 12px 0; padding-left: 22px; }
li { margin: 6px 0; }
li::marker { color: var(--accent); }
hr { border: none; border-top: 1px solid var(--line); margin: 40px 0; }

.lead { font-size: 18px; color: var(--ink-soft); margin: 14px 0 26px; max-width: 70ch; }
.eyebrow {
  display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 6px; font-weight: 600;
}

/* inline code */
code {
  font-family: var(--mono); font-size: .87em;
  background: var(--bg-3); border: 1px solid var(--line);
  padding: 1.5px 6px; border-radius: 6px; color: #a9d4ff;
  overflow-wrap: anywhere;
}
.kbd { color: var(--amber); }

/* code blocks */
.code {
  position: relative; background: #090d14;
  border: 1px solid var(--line); border-radius: var(--r);
  margin: 18px 0; overflow: hidden; box-shadow: var(--shadow);
}
.code-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  background: var(--bg-2); font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
}
.code-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.code-head .dot.r { background: #ff5f57; } .code-head .dot.y { background: #febc2e; } .code-head .dot.g { background: #28c840; }
.code-head .fname { margin-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-head .lang { margin-left: auto; color: var(--accent); letter-spacing: 1px; text-transform: uppercase; font-size: 10.5px; flex: 0 0 auto; }
.code pre { margin: 0; padding: 15px 16px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.62; }
.code pre::-webkit-scrollbar { height: 9px; }
.code pre::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
code.block { display: block; background: none; border: none; padding: 0; color: var(--ink); }

/* syntax highlight tokens */
.tok-kw { color: #ff7a93; }
.tok-typ { color: #6fd0c4; }
.tok-fn { color: #7fb6ff; }
.tok-str { color: #d3a86a; }
.tok-num { color: #c79bff; }
.tok-com { color: #5a6b7d; font-style: italic; }
.tok-key { color: #7fb6ff; }       /* yaml key */
.tok-pkg { color: #e9c46a; }
.tok-punc { color: #8aa0b6; }
.tok-flag { color: #66d39a; }       /* cli flag */

/* ---- cards & callouts ---- */
.grid { display: grid; gap: 16px; margin: 20px 0; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; transition: .16s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card p { margin: 0; font-size: 14px; color: var(--ink-soft); }
.card .ico { font-size: 19px; margin-bottom: 8px; display: block; }
a.card { text-decoration: none; color: inherit; display: block; }
a.card .go { color: var(--accent); font-size: 13px; font-family: var(--mono); margin-top: 10px; display: inline-block; }
a.card:hover { text-decoration: none; }

.note {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 10px;
  padding: 13px 16px; margin: 18px 0; font-size: 14.5px;
}
.note.blue { border-left-color: var(--accent); background: var(--blue-soft); }
.note.teal { border-left-color: var(--accent-2); background: var(--teal-soft); }
.note.amber { border-left-color: var(--amber); background: var(--amber-soft); }
.note.rose { border-left-color: var(--rose); background: rgba(255,122,147,.10); }
.note .nt { font-weight: 700; color: #fff; letter-spacing: .3px; }
.note p { margin: 4px 0 0; color: var(--ink-soft); }
.note code { background: rgba(0,0,0,.25); }

/* tables (wrapped in .tbl-wrap for horizontal scroll on mobile) */
.tbl-wrap { overflow-x: auto; margin: 18px 0; border-radius: 10px; border: 1px solid var(--line); }
.tbl-wrap::-webkit-scrollbar { height: 9px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 460px; }
.tbl-wrap .tbl { margin: 0; border: 0; }
.tbl th { background: var(--bg-2); color: var(--ink-soft); text-align: left; padding: 10px 13px; font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 13px; border-bottom: 1px solid var(--line); color: var(--ink-soft); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg-2); }
.tbl td code { font-size: 12px; }

/* pills */
.pill { display: inline-block; font-family: var(--mono); font-size: 11px; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--line-2); color: var(--ink-soft); background: var(--bg-3); white-space: nowrap; }
.pill.blue { color: var(--accent); border-color: rgba(79,157,255,.4); }
.pill.teal { color: var(--accent-2); border-color: rgba(52,211,196,.4); }
.pill.amber { color: var(--amber); border-color: rgba(245,185,77,.4); }
.pill.rose { color: var(--rose); border-color: rgba(255,122,147,.4); }
.pill.violet { color: var(--violet); border-color: rgba(179,136,255,.4); }
.pill.green { color: var(--green); border-color: rgba(102,211,154,.4); }

/* ---- figure / diagrams ---- */
figure { margin: 26px 0; }
.diagram {
  position: relative;
  border: 1px solid var(--line-2); border-radius: 14px;
  padding: 22px 18px; overflow-x: auto;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 22px 22px;
  background-color: var(--bg-2);
}
.diagram svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
/* click-to-open affordance, wired by app.js */
.diagram .zoom-hint {
  position: absolute; top: 9px; right: 11px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .5px;
  color: var(--ink-dim); background: rgba(0,0,0,.35);
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 9px;
  pointer-events: none; opacity: .75; transition: .15s;
}
.diagram.openable { cursor: zoom-in; }
.diagram.openable:hover { border-color: var(--accent); }
.diagram.openable:hover .zoom-hint { opacity: 1; color: var(--accent); border-color: var(--accent); }
figcaption { text-align: center; color: var(--ink-dim); font-size: 12.5px; margin-top: 12px; font-family: var(--mono); }

/* svg helpers */
.svg-node { transition: .18s; cursor: default; }
.svg-node:hover { filter: brightness(1.18); }
.svg-node.lit { filter: brightness(1.3); }
text { font-family: var(--sans); }
.svg-mono { font-family: var(--mono); }

/* prev / next */
.pager { display: flex; gap: 14px; margin-top: 56px; border-top: 1px solid var(--line); padding-top: 26px; }
.pager a {
  flex: 1; text-decoration: none; padding: 15px 18px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); transition: .16s; min-width: 0;
}
.pager a:hover { border-color: var(--accent); background: var(--panel-2); text-decoration: none; }
.pager .dir { font-size: 11px; font-family: var(--mono); color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1px; }
.pager .ttl { color: var(--ink); font-weight: 600; margin-top: 3px; }
.pager .next { text-align: right; }

/* hero */
.hero { padding: 18px 0 6px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 26px; margin: 24px 0 8px; }
.stat b { font-size: 26px; color: #fff; font-family: var(--mono); display: block; }
.stat span { color: var(--ink-dim); font-size: 12.5px; letter-spacing: .3px; }

/* "on this page" */
.toc-inline {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 18px; margin: 22px 0 8px;
}
.toc-inline .tt { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--ink-dim); font-weight: 700; }
.toc-inline ul { list-style: none; padding: 0; margin: 8px 0 0; columns: 2; column-gap: 26px; }
.toc-inline li { margin: 4px 0; }
.toc-inline a { color: var(--ink-soft); font-size: 13.5px; }
.toc-inline a:hover { color: var(--accent); }

/* footnote refs */
.ref { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }
.srcref { color: var(--accent); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }

/* steps */
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding: 4px 0 18px 46px; border-left: 1px dashed var(--line-2); margin-left: 16px; }
.steps > li:last-child { border-left: 1px solid transparent; }
.steps > li::before {
  content: counter(s); position: absolute; left: -16px; top: 0;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--accent);
  color: var(--accent); font-family: var(--mono); font-weight: 700; font-size: 14px;
  display: grid; place-items: center;
}
.steps > li b { color: #fff; }

.scrim { display: none; }

/* ============================================================
   responsive — mobile-first reading view
   ============================================================ */
@media (max-width: 940px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .grid.c2, .grid.c3 { grid-template-columns: 1fr; }
  .toc-inline ul { columns: 1; }
  .content { padding: 24px 18px 80px; }
  h1 { font-size: 27px; }
  h2 { font-size: 21px; margin-top: 42px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; display: none; }
  body.nav-open .scrim { display: block; }
}

@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .topbar { padding: 10px 16px; }
  .topbar .pill { display: none; }
  .content { padding: 20px 15px 70px; }
  h1 { font-size: 24px; }
  h2 { font-size: 19px; margin-top: 38px; }
  h2 .hsh { font-size: 14px; }
  .lead { font-size: 16.5px; }
  .stat-row { gap: 18px; }
  .stat b { font-size: 22px; }
  .pager { flex-direction: column; }
  .code pre { font-size: 12px; }
  .diagram { padding: 14px 10px; }
  .diagram .zoom-hint { opacity: 1; }   /* always show on touch */
}
