/* Pelita site. Locked look: warm dark, ONE amber accent, lamp glyph per contract (amber = lit, grey = dark).
   All colours live in the tokens below. No glass effects and no animated blur: they crash WebKit. */
@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader.woff2?v=0c99bf2ac23c") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans.woff2?v=0c99bf2ac23c") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/ibm-plex-mono-400.woff2?v=0c99bf2ac23c") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #14100c;
  --bg-deep: #0f0c09;
  --surface: #1c1712;
  --raised: #251e17;
  --line: #3a2f24;
  --line-soft: #2a2219;
  --text: #f1e6d6;
  --muted: #bcab94;
  --faint: #9a8a75;
  --amber: #f2a93b;
  --amber-core: #ffd38a;
  --amber-ink: #1b1207;
  --amber-glow: rgba(242, 169, 59, 0.16);
  --amber-line: rgba(242, 169, 59, 0.42);
  --ash: #6f665b;
  --ash-soft: #4a433b;
  --focus: #ffd38a;
  --radius: 14px;
  --radius-s: 9px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --measure: 68ch;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --flicker-seconds: 3.2s;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-wrap: anywhere;
  background-image: radial-gradient(70rem 36rem at 85% -12rem, var(--amber-glow), transparent 70%);
  background-repeat: no-repeat;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
a { color: var(--amber); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--amber-core); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
code, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
code { color: var(--amber-core); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.1; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.75rem); }
h3 { font-size: 1.3rem; margin-top: 2rem; margin-bottom: 0.6rem; }
p { margin: 0; }

.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--amber); color: var(--amber-ink); padding: 0.5rem 0.9rem; border-radius: var(--radius-s); z-index: 10; }
.skip:focus { left: 0.5rem; }

/* glyph: amber = lit, grey = dark */
.glyph { width: 1.6em; height: 1.6em; flex: none; }
.glyph .lamp-body { fill: var(--muted); }
.glyph .lamp-flame path { fill: var(--amber); }
.glyph .lamp-flame .lamp-core { fill: var(--amber-core); }
.glyph .lamp-wisp { fill: none; stroke: none; }
.glyph.is-dark .lamp-body { fill: var(--ash); }
.glyph.is-dark .lamp-flame { display: none; }
.glyph.is-dark .lamp-wisp { stroke: var(--ash-soft); stroke-width: 0.9; stroke-linecap: round; }
.glyph.is-lit .lamp-flame { transform-origin: 20.2px 10px; transform-box: view-box; animation: flicker var(--flicker-seconds) ease-in-out infinite; }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1); opacity: 1; }
  30% { transform: scale(0.96, 1.05); opacity: 0.92; }
  55% { transform: scale(1.03, 0.95); opacity: 1; }
  80% { transform: scale(0.98, 1.02); opacity: 0.95; }
}
@media (prefers-reduced-motion: reduce) { .glyph.is-lit .lamp-flame { animation: none; } }

/* header: solid colour, no glass */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem var(--gutter); background: var(--bg-deep); border-bottom: 1px solid var(--line-soft);
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text); text-decoration: none; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.brand .glyph { width: 1.5rem; height: 1.5rem; }
.nav { display: flex; gap: 1.25rem; margin-left: auto; font-size: 0.95rem; }
.nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.nav a:hover { color: var(--text); }
.lang {
  font: 600 0.85rem/1 var(--sans); letter-spacing: 0.06em; color: var(--text); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.55rem 0.85rem; min-height: 2.5rem; min-width: 2.75rem; cursor: pointer;
}
.lang:hover { border-color: var(--amber-line); }
@media (max-width: 860px) { .nav { display: none; } .lang { margin-left: auto; } }

main { padding: 0 var(--gutter); }
.hero, .band { max-width: 72rem; margin: 0 auto; }

/* hero */
.hero { padding: clamp(3rem, 9vw, 7rem) 0 clamp(2.5rem, 6vw, 4.5rem); display: grid; grid-template-columns: minmax(0, 1fr); }
.hero-text, .hero-art, .stats, .fresh { grid-column: 1; }
.hero-art { display: none; }
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); column-gap: 2rem; }
  .hero-text { grid-row: 1; }
  .hero-art { display: grid; place-items: center; grid-column: 2; grid-row: 1; position: relative; }
  .hero-art::before { content: ""; position: absolute; width: 26rem; height: 26rem; border-radius: 50%; background: radial-gradient(closest-side, var(--amber-glow), transparent); transform: translate(3.5rem, -3rem); }
  .hero-lamp { position: relative; width: min(100%, 20rem); height: auto; }
  .stats, .fresh { grid-column: 1 / -1; }
}
.tag { display: inline-block; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 0.9rem; padding: 0.3rem 0.8rem; }
.hero h1 { font-size: clamp(2.6rem, 1.6rem + 5.2vw, 5.6rem); font-weight: 400; margin-top: 1.4rem; max-width: 14ch; }
.lede { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem); color: var(--muted); margin-top: 1.2rem; max-width: 40ch; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin: clamp(2.5rem, 5vw, 3.5rem) 0 0; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: 1.1rem 1.2rem 1.2rem; min-width: 0; }
.stat dt { font-size: 0.82rem; color: var(--muted); letter-spacing: 0.02em; }
.stat dd { margin: 0.35rem 0 0; font-family: var(--serif); font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem); line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat-lit dd { color: var(--amber); }
.stat-dark dd { color: var(--muted); }
.stat dd .unit, .agg dd .unit { font-family: var(--sans); font-size: 0.5em; color: var(--muted); letter-spacing: 0.02em; }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:last-child { grid-column: 1 / -1; }
}
.fresh { margin-top: 0.8rem; font-size: 0.88rem; color: var(--faint); min-height: 1.4em; }
.fresh.warn { color: var(--amber-core); }

/* sections */
.band { padding: clamp(3rem, 7vw, 5rem) 0; border-top: 1px solid var(--line-soft); }
.intro { color: var(--muted); margin-top: 0.8rem; max-width: var(--measure); }
.note { color: var(--faint); font-size: 0.92rem; margin-top: 0.8rem; }

/* fleet */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); gap: 1rem; margin-top: 2rem; }
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1.2rem 1.25rem 1.3rem; min-width: 0; }
.card.is-lit { border-color: var(--amber-line); }
.card-head { display: flex; align-items: center; gap: 0.75rem; }
.card-head .glyph { width: 2.6rem; height: 2.6rem; }
.card-name { font-family: var(--serif); font-size: 1.35rem; line-height: 1.1; }
.card-chain { font-size: 0.85rem; color: var(--muted); }
.pill { margin-left: auto; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; border-radius: 999px; padding: 0.25rem 0.65rem; white-space: nowrap; }
.pill.lit { background: var(--amber); color: var(--amber-ink); }
.pill.dark { background: var(--raised); color: var(--muted); border: 1px solid var(--line); }
.role { display: inline-block; margin-top: 0.9rem; font-size: 0.8rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 0.15rem 0.5rem; }
.role.guarded { border-style: solid; border-color: var(--amber-line); color: var(--text); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; margin: 0.9rem 0 0; font-size: 0.92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 0.86rem; text-align: right; min-width: 0; }
.kv dd.soft { font-family: var(--sans); color: var(--faint); }
.addr { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); margin-top: 0.6rem; }
.loop { list-style: none; margin: 1rem 0 0; padding: 0.9rem 0 0; border-top: 1px solid var(--line-soft); font-size: 0.88rem; }
.loop-title { font-size: 0.8rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 1rem; }
.loop li { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.15rem 0; }
.loop li::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--ash); flex: none; transform: translateY(-0.1em); }
.loop li.ok::before { background: var(--amber); }
.loop a { font-family: var(--mono); font-size: 0.82rem; margin-left: auto; }
.empty { color: var(--faint); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; grid-column: 1 / -1; }

/* try */
.cmd { display: flex; align-items: stretch; gap: 0.5rem; margin-top: 1.8rem; background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.4rem 0.4rem 1.1rem; max-width: 100%; }
.cmd pre { margin: 0; padding: 0.7rem 0; overflow-x: auto; flex: 1 1 auto; min-width: 0; }
.cmd code { color: var(--text); white-space: pre; }
.cmd.pending code { color: var(--faint); white-space: normal; font-family: var(--sans); }
.btn {
  font: 600 0.95rem/1 var(--sans); color: var(--amber-ink); background: var(--amber); border: 1px solid var(--amber);
  border-radius: var(--radius-s); padding: 0.8rem 1.15rem; min-height: 2.75rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--amber-core); border-color: var(--amber-core); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.ghost { color: var(--text); background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--amber-line); background: var(--raised); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 0.9rem; max-width: var(--measure); }
.steps li { counter-increment: s; display: grid; grid-template-columns: 2rem 1fr; gap: 0.75rem; color: var(--muted); }
.steps li::before { content: counter(s); font-family: var(--serif); font-size: 1.15rem; color: var(--amber); border: 1px solid var(--amber-line); border-radius: 50%; width: 2rem; height: 2rem; display: grid; place-items: center; line-height: 1; }

/* gauge */
.gauge-form { margin-top: 1.8rem; max-width: 46rem; }
.gauge-form label { display: block; font-size: 0.92rem; color: var(--muted); margin-bottom: 0.45rem; }
.row { display: flex; gap: 0.5rem; }
.row input {
  flex: 1 1 auto; min-width: 0; font: 0.95rem/1.2 var(--mono); color: var(--text); background: var(--bg-deep);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.75rem 0.9rem; min-height: 2.75rem;
}
.row input::placeholder { color: var(--faint); }
.row input:focus-visible { outline-offset: 1px; }
.row input[aria-invalid="true"] { border-color: var(--amber); }
.msg { min-height: 1.5em; margin-top: 0.5rem; font-size: 0.92rem; color: var(--amber-core); }
.gauge-out { margin-top: 1rem; max-width: 46rem; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1.2rem 1.25rem; }
.gauge-out .kv { margin-top: 0.4rem; }
.gauge-out pre { margin: 0.5rem 0 0; background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.75rem 0.9rem; overflow-x: auto; font-size: 0.85rem; }
.gauge-out p { color: var(--muted); font-size: 0.92rem; margin-top: 1rem; }

/* dark list */
.always { margin-top: 1.2rem; font-family: var(--serif); font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.6rem); line-height: 1.3; max-width: 40ch; }
.agg { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); gap: 1.5rem 2rem; margin: 2.2rem 0 0; }
.agg div { min-width: 0; }
.agg dd { margin: 0; font-family: var(--serif); font-size: clamp(2rem, 1.6rem + 1.6vw, 2.8rem); line-height: 1; font-variant-numeric: tabular-nums; }
.agg dt { order: 2; color: var(--muted); font-size: 0.9rem; margin-top: 0.4rem; }
.agg div { display: flex; flex-direction: column; }
.lampgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2rem, 1fr)); gap: 0.35rem; margin-top: 2.2rem; }
.lampgrid .glyph { width: 100%; height: auto; aspect-ratio: 1; }
.table-wrap { margin-top: 2rem; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.darktable { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.darktable th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.75rem 1rem; background: var(--surface); }
.darktable td { padding: 0.6rem 1rem; border-top: 1px solid var(--line-soft); white-space: nowrap; }
.darktable td:first-child { font-family: var(--mono); font-size: 0.84rem; }
.darktable td.num, .darktable th.num { text-align: right; font-variant-numeric: tabular-nums; }
#dark-more { margin-top: 1rem; }

/* how */
.diagram { margin: 2rem 0 0; }
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.6rem; }
.flow li { position: relative; display: flex; flex-direction: column; gap: 0.6rem; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1rem; font-size: 0.95rem; min-width: 0; }
.flow li.accent { border-color: var(--amber-line); }
.flow li + li::before { content: "→"; position: absolute; left: -1.35rem; top: 50%; transform: translateY(-50%); color: var(--amber); font-size: 1.1rem; }
.flow .glyph, .node-ico { width: 2rem; height: 2rem; }
.node-ico { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.accent .node-ico { stroke: var(--amber); }
.diagram figcaption { margin-top: 0.9rem; color: var(--faint); font-size: 0.9rem; }
@media (max-width: 860px) {
  .flow { grid-template-columns: 1fr; gap: 1.4rem; }
  .flow li { flex-direction: row; align-items: center; }
  .flow li + li::before { content: "↓"; left: 1.5rem; top: -1.4rem; transform: none; }
}
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem; margin-top: 1rem; }
.cols p, .cols li { color: var(--muted); }
.limits, .links { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.5rem; }
.links { list-style: none; padding: 0; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; gap: 0; } }

.foot { display: flex; gap: 0.8rem; align-items: center; max-width: calc(72rem + 2 * var(--gutter)); margin: 0 auto; padding: 2.5rem var(--gutter) 3.5rem; color: var(--faint); font-size: 0.9rem; border-top: 1px solid var(--line-soft); }
.foot .glyph { width: 1.4rem; height: 1.4rem; }
