/* ============================================================================
   eshars-doc.css — canonical stylesheet for eSHARS rich HTML documentation.

   ONE house style for every engaging HTML doc surfaced from the eSHARS docs
   sites (ops/dev/product .myeshars.com) — explainers, estate maps, incident
   atlases, KBs, interactive tools. Ported from the org-standard seed-doc.css
   (seed_agent/.claude/skills/seed-html-docs) so Authentica docs share one
   design language; brand tokens are the PMS-referenced palette (blue 7458C,
   green 358C, orange 172C, warmGray 402C). Do NOT invent a new palette.

   Two ways to use it:
     • Collection (multi-page): copy this file beside your pages and
       <link rel="stylesheet" href="eshars-doc.css"> from each.
     • One-off portable doc: start from template.html, then paste this file's
       contents into a <style> block (replacing the <link>) — self-contained,
       renders from file://, an iframe, a PR attachment, or the Starlight
       site's public/ dir.

   Light-only by design so a doc reads identically standalone or embedded.
   ============================================================================ */

:root {
  /* — brand (PMS-referenced; same tokens as seed-doc.css) — */
  --brand-blue:        #71b2c9;  /* 7458C */
  --brand-blue-700:    #3a6d82;
  --brand-blue-800:    #2a5061;
  --brand-blue-50:     #e8f4f8;
  --brand-green:       #addc91;  /* 358C */
  --brand-green-700:   #5f9142;
  --brand-green-50:    #f4faf0;
  --brand-orange:      #fa4616;  /* 172C — the accent */
  --brand-orange-600:  #c52e0a;
  --brand-orange-50:   #fff1ed;
  --brand-warmgray:    #9d968d;  /* 402C */

  /* — neutrals — */
  --bg:            #f9f8f6;
  --surface:       #ffffff;
  --surface-2:     #f5f3f0;
  --border:        #e6e2dc;
  --border-strong: #d5cfc9;
  --ink:           #1f2937;
  --ink-strong:    #11161f;
  --ink-muted:     #6b7280;
  --ink-faint:     #9d968d;

  /* — roles — */
  --accent:        var(--brand-orange);
  --accent-ink:    var(--brand-orange-600);
  --accent-soft:   var(--brand-orange-50);
  --link:          var(--brand-blue-700);
  --link-hover:    var(--brand-blue-800);

  /* — tier accents (eSHARS: nonprod / prod / cross-cutting).
       smp/sdp kept as aliases so org-standard docs render unchanged. — */
  --nonprod:  var(--brand-blue-700);   --nonprod-soft: var(--brand-blue-50);
  --prodtier: var(--brand-green-700);  --prodtier-soft: var(--brand-green-50);
  --xcut:     #9a7b3c;                 --xcut-soft: #f5ecd6;
  --smp: var(--nonprod);  --smp-soft: var(--nonprod-soft);
  --sdp: var(--prodtier); --sdp-soft: var(--prodtier-soft);

  /* — status (semantic, not brand) — */
  --ok:       #16a34a;  --ok-bg:    #dcfce7;
  --warn:     #b45309;  --warn-bg:  #fef3c7;
  --danger:   #b91c1c;  --danger-bg:#fee2e2;
  --info:     var(--brand-blue-700); --info-bg: var(--brand-blue-50);

  /* — environment accents (the six eSHARS environments) — */
  --env-dev:        #64748b;
  --env-qa:         #8b5cf6;
  --env-regression: #0d9488;
  --env-uat:        #b45309;
  --env-training:   #3a6d82;
  --env-prod:       #16a34a;

  /* — type / shape — */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --radius-sm: 5px;
  --radius:    9px;
  --radius-pill: 999px;
  --maxw: 880px;
  --code-bg: #f4ecda;
  --code-ink: #7a3210;
  --shadow-sm: 0 1px 2px rgba(60,45,20,.06), 0 1px 3px rgba(60,45,20,.05);
  --shadow:    0 2px 8px rgba(60,45,20,.07), 0 10px 28px rgba(60,45,20,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }

body {
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.68;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding: 0 0 80px;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--accent-soft); color: var(--accent-ink); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

/* ── Masthead ─────────────────────────────────────────────────────────── */
.masthead {
  background: linear-gradient(135deg, #11161f 0%, #1f2937 55%, var(--brand-blue-800) 100%);
  color: #f1f5f9;
  padding: 34px 0 30px;
  border-bottom: 3px solid var(--accent);
}
.masthead .eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: #cfe6ef; margin-bottom: 8px;
}
.masthead h1 { font-size: 30px; font-weight: 800; line-height: 1.2; color: #fff; letter-spacing: -.01em; }
.masthead .sub { margin-top: 9px; font-size: 13.5px; color: #cbd5e1; }
.masthead .sub a { color: #bfe0ec; }

/* Provenance line — REQUIRED on every doc: when it was generated + from what. */
.provenance {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
  margin: 14px auto 0; max-width: var(--maxw); padding: 0 28px;
}
.provenance b { color: var(--ink-muted); font-weight: 600; }

/* ── KPI strip ────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px;
  margin: -26px auto 0; position: relative; z-index: 2; max-width: var(--maxw); padding: 0 28px;
}
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--ink-strong); line-height: 1.1; }
.kpi-value.danger { color: var(--danger); }
.kpi-label { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }

/* ── Sections & headings ──────────────────────────────────────────────── */
main { display: block; }
section { margin-top: 38px; }
h2.section-title {
  font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-muted); padding-bottom: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.doc-body h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 34px 0 12px; color: var(--ink-strong); scroll-margin-top: 80px; }
.doc-body h3 { font-size: 17px; font-weight: 700; margin: 24px 0 8px; color: var(--ink-strong); }
.doc-body h4 { font-size: 14.5px; font-weight: 700; margin: 18px 0 6px; color: var(--ink); }
.doc-body p { margin: 0 0 13px; }
.doc-body ul, .doc-body ol { margin: 0 0 13px 22px; }
.doc-body li { margin-bottom: 5px; }
.doc-body li::marker { color: var(--accent); }
.doc-body strong { font-weight: 700; color: var(--ink-strong); }
.lead { font-size: 17px; color: #334155; margin-bottom: 16px; }

/* ── TL;DR ────────────────────────────────────────────────────────────── */
.tldr {
  background: var(--info-bg); border: 1px solid var(--brand-blue); border-left: 4px solid var(--nonprod);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 16px 20px; margin: 0 0 22px;
}
.tldr .label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--nonprod); display: block; margin-bottom: 4px; }
.tldr p { margin: 0; }

/* ── Badges, tier tags, pills ─────────────────────────────────────────── */
.badge, .tier-tag, .env {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  border-radius: var(--radius-pill); font-weight: 700; letter-spacing: .02em;
}
.badge { padding: 2px 10px; font-size: 11.5px; text-transform: lowercase; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-current  { color: var(--ok);     background: var(--ok-bg); }
.badge-mixed    { color: var(--warn);   background: var(--warn-bg); }
.badge-proposed { color: var(--ink-muted); background: var(--surface-2); }

.tier-tag { padding: 1px 9px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.tier-tag.nonprod { color: var(--nonprod);  background: var(--nonprod-soft); }
.tier-tag.prod    { color: var(--prodtier); background: var(--prodtier-soft); }
.tier-tag.xcut    { color: var(--xcut);     background: var(--xcut-soft); }
.tier-tag.smp     { color: var(--smp);      background: var(--smp-soft); }
.tier-tag.sdp     { color: var(--sdp);      background: var(--sdp-soft); }

.env { padding: 1px 9px; font-size: 11.5px; border: 1px solid transparent; }
.env::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.env-dev        { color: var(--env-dev);        background: #f1f5f9; border-color: #e2e8f0; }
.env-qa         { color: var(--env-qa);         background: #f5f3ff; border-color: #ddd6fe; }
.env-regression { color: var(--env-regression); background: #f0fdfa; border-color: #99f6e4; }
.env-uat        { color: var(--env-uat);        background: #fffbeb; border-color: #fde68a; }
.env-training   { color: var(--env-training);   background: var(--brand-blue-50); border-color: #bfe0ec; }
.env-prod       { color: var(--env-prod);       background: #f0fdf4; border-color: #bbf7d0; }

.pill { display: inline-block; font-family: var(--font-mono); font-size: 12px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 6px; color: #5a463a; }

/* Neutral categorical chip (non-code) — for arbitrary labels: engine, kind, owner.
   Use this for categories; use .badge only for current/mixed/proposed status. */
.tag { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; background: var(--surface-2); color: var(--ink-muted); border: 1px solid var(--border); white-space: nowrap; }

/* ── Callouts (note / warn / danger / footgun) ────────────────────────── */
.callout { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-left: 4px solid var(--ink-faint); border-radius: 0 var(--radius) var(--radius) 0; padding: 13px 16px; margin: 0 0 16px; font-size: 14.5px; }
.callout .mark { font-size: 17px; line-height: 1.4; }
.callout.note   { background: var(--info-bg);   border-left-color: var(--info); }
.callout.ok     { background: var(--ok-bg);     border-left-color: var(--ok); }
.callout.warn,
.callout.footgun{ background: var(--warn-bg);   border-left-color: var(--warn); }
.callout.danger { background: var(--danger-bg); border-left-color: var(--danger); }
.callout b { color: var(--ink-strong); }

/* ── Stage flow (numbered vertical pipeline) ──────────────────────────── */
.stage-flow { margin: 16px 0 22px; counter-reset: stage; }
.stage { position: relative; padding: 0 0 20px 42px; border-left: 2px solid var(--border); margin-left: 12px; }
.stage:last-child { border-left-color: transparent; padding-bottom: 0; }
.stage::before {
  counter-increment: stage; content: counter(stage);
  position: absolute; left: -15px; top: -2px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.stage .name { font-size: 15px; font-weight: 700; color: var(--ink-strong); }
.stage .trigger { font-size: 12px; color: var(--ink-muted); margin-bottom: 6px; }

/* ── Before / after compare ───────────────────────────────────────────── */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 8px 0 22px; }
.compare .col { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.compare .before { background: #fef2f2; border-color: #fecaca; }
.compare .after  { background: #f0fdf4; border-color: #bbf7d0; }
.compare h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.compare .before h4 { color: var(--danger); }
.compare .after h4  { color: var(--brand-green-700); }
.compare ul { margin: 0 0 0 18px; } .compare li { font-size: 13.5px; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.doc-body .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--surface); margin: 0 0 18px; }
.doc-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-body thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-strong); font-weight: 700; text-align: left; padding: 10px 14px; border-bottom: 2px solid var(--border-strong); }
.doc-body tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-body tbody tr:last-child td { border-bottom: none; }
.doc-body tbody tr:hover { background: var(--surface-2); }
/* Caption / footnote that belongs to the table directly above it. */
.table-note { font-size: 12.5px; color: var(--ink-muted); margin: -10px 0 18px; }

/* ── Code & Mermaid ───────────────────────────────────────────────────── */
.doc-body code { font-family: var(--font-mono); font-size: .86em; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .12em .4em; color: var(--code-ink); word-break: break-word; }
.doc-body pre { background: #11161f; color: #e2e8f0; border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; }
.doc-body pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.doc-body pre .c { color: #64748b; }            /* comment */
.doc-body pre .p { color: #7dd3fc; }            /* prompt / path accent */
.doc-body pre.mermaid { background: var(--surface); color: inherit; border: 1px solid var(--border); padding: 22px 16px; text-align: center; font-family: var(--font-sans); display: flex; justify-content: center; }

/* ── Blockquote / hr / source map / footer ────────────────────────────── */
.doc-body blockquote { background: var(--nonprod-soft); border-left: 4px solid var(--nonprod); border-radius: 0 var(--radius) var(--radius) 0; padding: 12px 18px; margin: 0 0 14px; }
.doc-body hr { border: none; height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong) 20%, var(--border-strong) 80%, transparent); margin: 36px 0; }
.source-map { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px 6px; margin: 8px 0 18px; font-size: 13.5px; }
.source-map code { font-family: var(--font-mono); }
.doc-footer { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--ink-muted); }

/* ── Responsive / print / reduced-motion ──────────────────────────────── */
@media (max-width: 640px) {
  .wrap, .kpi-grid, .provenance { padding-left: 16px; padding-right: 16px; }
  .masthead h1 { font-size: 23px; }
  .compare { grid-template-columns: 1fr; }
}
@media print { .masthead { background: none; color: #000; border-bottom: 2px solid #000; } body { padding: 0; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; } }
