/* Shared "engineering lab" tokens for the live-* Workers demos.
   Copy into each app's public/ dir; keep app-specific rules in app.css. */
:root {
  --bg: #0c1726;
  --bg-2: #102035;
  --panel: #13263d;
  --rule: #23395a;
  --rule-soft: #1b2f4b;
  --text: #e4ecf5;
  --muted: #95a7bd;
  --amber: #f2a93b;
  --amber-ink: #1a1203;
  --amber-soft: rgba(242, 169, 59, 0.14);
  --teal: #5bb8c4;
  --red: #ec6a72;
  --green: #6cc28a;
  --focus: #ffd27a;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r-s: 4px;
  --r-m: 8px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef2f7; --bg-2: #e4eaf2; --panel: #ffffff; --rule: #c9d4e2; --rule-soft: #dde5ef;
    --text: #0e1a2b; --muted: #4f6077; --amber: #a86400; --amber-ink: #ffffff;
    --amber-soft: rgba(168, 100, 0, 0.1); --teal: #1f7f8c; --red: #c23a44; --green: #2f8a51;
    --focus: #a86400; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #eef2f7; --bg-2: #e4eaf2; --panel: #ffffff; --rule: #c9d4e2; --rule-soft: #dde5ef;
  --text: #0e1a2b; --muted: #4f6077; --amber: #a86400; --amber-ink: #ffffff;
  --amber-soft: rgba(168, 100, 0, 0.1); --teal: #1f7f8c; --red: #c23a44; --green: #2f8a51;
  --focus: #a86400; color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.55 var(--sans); font-feature-settings: "ss01";
}
a { color: var(--amber); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: 0.88em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Masthead: app name + provenance line, theme toggle at right */
.mast { border-bottom: 1px solid var(--rule); background: var(--bg-2); }
.mast .wrap { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.mast-id { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.mast-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; margin: 0; }
.mast-src { font: 500 0.78rem/1.3 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.theme-btn {
  flex: none; background: transparent; color: var(--text); border: 1px solid var(--rule);
  border-radius: var(--r-s); padding: 6px 10px; font: 500 0.82rem var(--sans); cursor: pointer;
}
.theme-btn:hover { border-color: var(--amber); }

h1 { font-size: clamp(1.7rem, 4.2vw, 2.6rem); line-height: 1.08; letter-spacing: -0.025em; margin: 0 0 10px; font-weight: 700; }
h2 { font-size: 1.3rem; letter-spacing: -0.015em; margin: 0 0 6px; font-weight: 650; }
h3 { font-size: 1.02rem; margin: 0 0 6px; font-weight: 650; }
.lede { color: var(--muted); max-width: 68ch; margin: 0; }

/* Panels: one level of container, square-ish, separated by rules not shadows */
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 18px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* Provenance tag: the file in the source repo a figure comes from */
.src { font: 500 0.72rem/1.3 var(--mono); color: var(--muted); border-left: 2px solid var(--amber); padding-left: 8px; overflow-wrap: anywhere; }

/* Readouts */
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-m); overflow: hidden; }
.readout { background: var(--panel); padding: 12px 14px; }
.readout .v { font: 600 1.35rem/1.15 var(--mono); letter-spacing: -0.02em; }
.readout .k { color: var(--muted); font-size: 0.82rem; }

table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule-soft); }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

button.btn, .btn {
  background: var(--amber); color: var(--amber-ink); border: 0; border-radius: var(--r-s);
  padding: 8px 14px; font: 600 0.9rem var(--sans); cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--rule); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--rule);
  border-radius: var(--r-s); padding: 7px 9px;
}
input[type="range"] { accent-color: var(--amber); padding: 0; border: 0; background: transparent; }
label { font-size: 0.9rem; }

/* Tabs */
[role="tablist"] { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); overflow-x: auto; }
[role="tab"] {
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  padding: 10px 14px; font: 600 0.95rem var(--sans); cursor: pointer; white-space: nowrap;
}
[role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--amber); }

.about { border: 1px solid var(--rule); border-left: 3px solid var(--amber); border-radius: var(--r-m); padding: 14px 18px; background: var(--amber-soft); }
.about h2 { font-size: 1.05rem; }
.about ul { margin: 6px 0 0; padding-left: 18px; }
.about li { margin: 3px 0; }

.foot { border-top: 1px solid var(--rule); margin-top: 48px; padding: 18px 0 28px; color: var(--muted); font-size: 0.85rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
