/* ──────────────────────────────────────────────────────────────────────────
   Onramp · Codelab skin — "Field notes" design ethos
   Engineering field notes, not an AI landing page. See references/design-ethos.md.
   Paper + ink · one deliberate accent · monospace metadata · hairline rules,
   no pastel cards, no pills, no shadows, no glass, no emoji. Step-by-step:
   a light panel of steps + one focused step in the content pane.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  /* paper + ink */
  --paper:        #FAF9F6;   /* warm off-white */
  --panel:        #F2F0EA;   /* slightly deeper paper — sidebar, sunk surfaces */
  --surface:      #FFFFFF;
  --ink:          #1A1A18;   /* near-black, warm */
  --ink-2:        #55534C;   /* secondary */
  --ink-3:        #8B8880;   /* muted — labels, metadata */
  --rule:         #E2DFD7;   /* hairline */
  --rule-strong:  #D2CEC3;

  /* one deliberate accent — blueprint ink-blue, NOT Tailwind indigo */
  --accent:       #2B5C8A;
  --accent-press: #1F4566;

  /* tag colors — muted inks, used only as labels + 2px rules (no fills) */
  --decision:     #2B5C8A;
  --convention:   #3F7A57;
  --gotcha:       #A4502E;
  --history:      #6A4A7A;
  --open:         #9A7B2E;

  /* code — warm near-black, not cool slate */
  --code-bg:      #211E1A;
  --code-bg-2:    #1A1714;
  --code-fg:      #E6E2D9;
  --code-line:    #322E28;

  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'IBM Plex Mono', 'SF Mono', 'Consolas', monospace;

  --side-w: 280px;
  --bar-h:  54px;
  --content-w: 740px;
  --r-sm: 3px;  --r-md: 5px;          /* small radii — intentional, not pillowy */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* ── Top bar — solid, hairline, no glass ─────────────────────────────────── */
.bar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.bar-brand { font-weight: 700; letter-spacing: -0.01em; font-size: 15px; color: var(--ink); }
.bar-title { font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.bar-spacer { flex: 1; }
.bar-meta { font-family: var(--mono); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar-progress-wrap { width: 110px; height: 3px; background: var(--rule); overflow: hidden; }
.bar-progress { height: 100%; width: 0%; background: var(--accent); transition: width .4s var(--ease); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; padding-top: var(--bar-h); min-height: 100vh; }

/* ── Sidebar (steps) — paper panel, hairline divider ─────────────────────── */
.side {
  position: sticky; top: var(--bar-h); align-self: start;
  height: calc(100vh - var(--bar-h));
  background: var(--panel); border-right: 1px solid var(--rule);
  padding: 22px 14px; overflow-y: auto;
}
.side-label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); padding: 0 12px 12px; }
.step-link {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; cursor: pointer; position: relative;
  color: var(--ink-2); text-decoration: none; transition: color .15s;
  border: none; background: none; width: 100%; text-align: left; font-family: inherit; font-size: 14px;
  border-left: 2px solid transparent;
}
.step-link:hover { color: var(--ink); }
.step-link .num {
  flex: 0 0 21px; height: 21px; border-radius: 50%; font-family: var(--mono); font-size: 11px;
  display: grid; place-items: center; border: 1px solid var(--ink-3); color: var(--ink-3);
}
.step-link .lbl { padding-top: 1px; line-height: 1.35; }
.step-link .lbl small { display: block; color: var(--ink-3); font-family: var(--mono); font-size: 11px; }
.step-link.active { color: var(--ink); border-left-color: var(--accent); }
.step-link.active .num { border-color: var(--accent); background: var(--accent); color: #fff; }
.step-link.active .lbl { font-weight: 600; }
.step-link.done .num { border-color: var(--convention); color: var(--convention); }
.step-link.done .num span { display: none; }
.step-link.done .num::after { content: "\2713"; }

/* ── Content ─────────────────────────────────────────────────────────────── */
.main { padding: 48px 48px 120px; }
.step { display: block; max-width: var(--content-w); margin: 0 auto 64px; }
.js .step { display: none; margin-bottom: 0; }
.js .step.active { display: block; animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.step-kicker { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); }
.step h1 { font-size: 31px; line-height: 1.16; letter-spacing: -0.02em; margin: 8px 0 6px; font-weight: 600; }
.step-goal { color: var(--ink-2); font-style: italic; margin: 0 0 26px; }
.step h2 { font-size: 18px; margin: 34px 0 10px; letter-spacing: -0.01em; font-weight: 600; }
.step p { margin: 14px 0; }
.step a { color: var(--accent); }
.step ol, .step ul { padding-left: 22px; } .step li { margin: 7px 0; }

/* tables */
.step table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.step th, .step td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.step th { font-family: var(--mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); }
.step tr:last-child td { border-bottom: none; }

/* inline code */
code { font-family: var(--mono); font-size: 0.85em; background: var(--panel); padding: 1px 5px; border-radius: var(--r-sm); }

/* ── Code blocks ─────────────────────────────────────────────────────────── */
.code { margin: 18px 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--code-line); background: var(--code-bg); }
.code-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--code-bg-2); border-bottom: 1px solid var(--code-line); }
.code-path { font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-decoration: none; }
a.code-path::after { content: " \2197"; opacity: .7; }
a.code-path:hover { color: #8FB4D6; text-decoration: underline; }
.code-head .copy { margin-left: auto; background: transparent; color: var(--ink-3); border: 1px solid var(--code-line); border-radius: var(--r-sm); font-size: 12px; padding: 3px 10px; cursor: pointer; font-family: var(--mono); transition: color .15s; }
.code-head .copy:hover { color: var(--code-fg); }
.code-head .copy.copied { color: #7FB58E; border-color: #3F7A57; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.code code { background: none; padding: 0; color: var(--code-fg); font-size: 13px; line-height: 1.65; white-space: pre; border-radius: 0; }
.code .cm { color: #8A8475; }   /* comment */
.code .kw { color: #C99AC4; }   /* keyword */
.code .fn { color: #88AFD1; }   /* function */
.code .st { color: #9DBE8A; }   /* string */
.code .nu { color: #D6A472; }   /* number */

/* inline file reference link */
a.ref { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--rule-strong); }
a.ref:hover { border-bottom-color: var(--accent); }
a.ref code { color: inherit; }

/* ── Callouts (tagged facts) — hairline rule + mono label, NO fill, NO pill ── */
.callout { margin: 22px 0; padding: 2px 0 2px 18px; border-left: 2px solid var(--ink-3); }
.callout .tag { display: block; font-family: var(--mono); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 5px; }
.callout p:first-of-type { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout.decision   { border-color: var(--decision); }   .callout.decision   .tag { color: var(--decision); }
.callout.convention { border-color: var(--convention); } .callout.convention .tag { color: var(--convention); }
.callout.gotcha     { border-color: var(--gotcha); }     .callout.gotcha     .tag { color: var(--gotcha); }
.callout.history    { border-color: var(--history); }    .callout.history    .tag { color: var(--history); }
.callout.open       { border-color: var(--open); }       .callout.open       .tag { color: var(--open); }
.callout .code { margin: 12px 0 4px; }

/* ── Mermaid diagram ─────────────────────────────────────────────────────── */
.diagram { position: relative; margin: 24px 0; padding: 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); text-align: center; cursor: zoom-in; }
.diagram .mermaid { display: inline-block; }
.diagram-cap { font-size: 13px; color: var(--ink-3); margin-top: 10px; font-style: italic; }
.diagram .expand-hint { position: absolute; top: 10px; right: 12px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 1px 7px; pointer-events: none; }
.diagram:hover .expand-hint { color: var(--accent); border-color: var(--accent); }

/* ── Diagram lightbox (click to expand) ──────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 4vh 4vw; background: rgba(26,26,24,0.82); opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); cursor: zoom-out; }
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox-inner { background: var(--surface); border-radius: var(--r-md); padding: 28px; border: 1px solid var(--rule-strong); max-width: 96vw; max-height: 92vh; overflow: auto; }
.lightbox svg { width: auto !important; height: auto !important; max-width: none !important; min-width: 70vw; }
.lightbox-close { position: fixed; top: 18px; right: 26px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,.15); }

/* ── Checklist ───────────────────────────────────────────────────────────── */
.checklist { list-style: none; padding: 0; margin: 16px 0; }
.checklist li { padding: 8px 0 8px 28px; position: relative; border-bottom: 1px solid var(--rule); }
.checklist li::before { content: ""; position: absolute; left: 0; top: 12px; width: 13px; height: 13px; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); }

/* ── Step footer nav ─────────────────────────────────────────────────────── */
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--rule); }
.btn { font-family: var(--sans); font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: var(--r-md); cursor: pointer; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); transition: border-color .15s, color .15s; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-press); border-color: var(--accent-press); color: #fff; }
.btn:disabled { opacity: .35; cursor: default; }
.btn.primary:disabled { background: var(--ink-3); border-color: var(--ink-3); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; display: flex; gap: 4px; overflow-x: auto; padding: 10px; border-right: none; border-bottom: 1px solid var(--rule); }
  .side-label { display: none; }
  .step-link { flex: 0 0 auto; flex-direction: column; align-items: center; width: auto; min-width: 54px; border-left: none; border-bottom: 2px solid transparent; }
  .step-link.active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .step-link .lbl { font-size: 11px; text-align: center; } .step-link .lbl small { display: none; }
  .main { padding: 30px 20px 100px; }
  .step h1 { font-size: 25px; }
  .bar-title { display: none; }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 99px; }
