/* Arus. Palette from a smart meter's LCD: pale green-grey glass, dark green segments; amber for exported sun,
   blue for sealed data, green and red for settled and rejected. Type: Archivo, its width axis doing the work. */
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-wdth.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --paper: #edf1e8;
  --panel: #dde5d4;
  --ink: #17231c;
  --muted: #4f5e54;
  --line: #b7c3ad;
  --sun: #c98200;
  --sun-fill: #e9a92a;
  --cipher: #2f5a8f;
  --ok: #26703f;
  --bad: #ad3328;
  --bad-fill: #efc6bf;
  --focus: #2f5a8f;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1813;
    --panel: #18241d;
    --ink: #e1eada;
    --muted: #9eac9f;
    --line: #304036;
    --sun: #f0ae3c;
    --sun-fill: #c78a1d;
    --cipher: #8eaee0;
    --ok: #6cbf8a;
    --bad: #ec7b6f;
    --bad-fill: #4d241f;
    --focus: #8eaee0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1813; --panel: #18241d; --ink: #e1eada; --muted: #9eac9f; --line: #304036; --sun: #f0ae3c;
  --sun-fill: #c78a1d; --cipher: #8eaee0; --ok: #6cbf8a; --bad: #ec7b6f; --bad-fill: #4d241f; --focus: #8eaee0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 "Archivo", system-ui, sans-serif;
  font-stretch: 100%;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 9; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

h1, h2, h3 { margin: 0; font-weight: 700; }
h2 { font-size: 1.5rem; font-stretch: 72%; letter-spacing: 0.005em; line-height: 1.15; }
h3 { font-size: 1.0625rem; font-stretch: 85%; }

/* header */
.top { border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.mark { font-weight: 800; font-stretch: 62%; font-size: 1.5rem; text-decoration: none; letter-spacing: 0.01em; }
.nav { display: flex; align-items: center; gap: 20px; font-size: 0.9375rem; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.lang {
  font: inherit; font-weight: 600; font-stretch: 80%; color: var(--ink); background: none; cursor: pointer;
  border: 1px solid var(--ink); border-radius: 999px; padding: 3px 12px; min-height: 32px;
}
@media (max-width: 640px) { .nav a[href="#how"], .nav a[href="#chain"] { display: none; } }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; padding-top: 40px; padding-bottom: 40px; align-items: start; }
@media (max-width: 960px) { .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 24px; } }
h1 {
  font-size: clamp(5rem, 13vw, 9.5rem);
  font-stretch: 62%;
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.015em;
  margin: 0 0 20px -4px;
}
.lede { font-size: 1.1875rem; line-height: 1.5; margin: 0 0 10px; max-width: 34em; }
.source { margin: 0 0 24px; font-size: 0.875rem; color: var(--muted); }
.actions { display: grid; gap: 14px; }
.btn {
  font: inherit; font-weight: 650; font-stretch: 85%; cursor: pointer; border-radius: 10px; min-height: 48px;
  padding: 12px 18px; text-align: left; transition: transform 120ms ease, background-color 120ms ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { cursor: not-allowed; opacity: 0.5; }
.btn.primary { background: var(--ink); color: var(--paper); border: 0; font-size: 1.125rem; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--bad); }
.btn.ghost:hover:not([disabled]) { background: var(--bad-fill); }
.lie { border-left: 3px solid var(--bad); padding-left: 14px; }
.lie-title { margin: 0 0 8px; font-weight: 600; font-stretch: 85%; color: var(--bad); }
.lie-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.lie-btns .btn { flex: 1 1 200px; }
.note { margin: 0; font-size: 0.875rem; color: var(--muted); }
.status { margin: 0; min-height: 1.5em; font-weight: 600; font-stretch: 90%; }
.status.err { color: var(--bad); }

/* the day strip */
.day { margin: 0; background: var(--panel); border-radius: 18px; padding: 22px 22px 18px; }
@media (max-width: 640px) { .day { padding: 16px 12px 14px; border-radius: 14px; } }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.day-cap { margin: 6px 0 16px; color: var(--muted); font-size: 0.9375rem; }
.views { display: flex; flex-wrap: wrap; gap: 4px; }
.views button {
  font: inherit; font-size: 0.8125rem; font-weight: 600; font-stretch: 80%; color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer; min-height: 32px;
}
.views button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.strip { display: grid; grid-template-columns: 74px repeat(12, minmax(0, 1fr)); gap: 3px; }
@media (max-width: 640px) { .strip { grid-template-columns: 34px repeat(12, minmax(0, 1fr)); gap: 2px; } }
.strip .hh { font-size: 0.75rem; color: var(--muted); text-align: center; font-stretch: 75%; padding-bottom: 2px; }
.strip .hs { height: 6px; border-radius: 3px; margin-bottom: 4px; background: transparent; }
.strip .hs.Finalized { background: var(--ok); }
.strip .hs.Pending { background: var(--sun-fill); animation: blink 1.6s ease-in-out infinite; }
.strip .hs.Rejected { background: var(--bad); }
.strip .rl { font-size: 0.8125rem; font-weight: 600; font-stretch: 75%; align-self: center; white-space: nowrap; overflow: hidden; }
.cell {
  position: relative; height: 64px; border-radius: 5px; background: color-mix(in srgb, var(--paper) 70%, transparent);
  display: flex; align-items: flex-end; justify-content: center; gap: 1px; padding: 3px 2px; overflow: hidden;
}
@media (max-width: 640px) { .cell { height: 52px; border-radius: 3px; padding: 2px 1px; } }
.cell.sealed {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--cipher) 22%, transparent) 0 3px, transparent 3px 7px);
}
.cell.rejected { outline: 2px solid var(--bad); outline-offset: -2px; }
.cell .tot { position: absolute; inset: auto 0 4px; text-align: center; font-size: 0.75rem; font-weight: 650; font-stretch: 75%; }
@media (max-width: 760px) { .cell .tot { display: none; } }
.cell .bar { flex: 1 1 0; max-width: 9px; background: var(--sun-fill); border-radius: 2px 2px 0 0; min-height: 2px; }
.cell .bar.bad { background: var(--bad); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 14px 0 0; font-size: 0.8125rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.k { width: 14px; height: 6px; border-radius: 3px; display: inline-block; }
.k.settled { background: var(--ok); } .k.window { background: var(--sun-fill); } .k.rejected { background: var(--bad); }
.k.open { border: 1px solid var(--line); }
.day-note { margin: 10px 0 0; font-size: 0.875rem; color: var(--muted); max-width: 60em; }
@keyframes blink { 50% { opacity: 0.35; } }

/* sections */
.block { padding-top: 40px; padding-bottom: 8px; }
.block > h2 { margin-bottom: 18px; }

/* batches */
.batches { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.batch { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: color-mix(in srgb, var(--panel) 40%, transparent); }
.batch.Rejected { border-color: var(--bad); }
.b-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 10px; }
.b-head h3 { font-size: 1.25rem; font-stretch: 70%; }
.b-when { color: var(--muted); font-size: 0.9375rem; }
.chip { font-size: 0.8125rem; font-weight: 650; font-stretch: 80%; border-radius: 999px; padding: 2px 10px; }
.chip.Finalized { background: var(--ok); color: var(--paper); }
.chip.Pending { background: var(--sun-fill); color: #17231c; }
.chip.Rejected { background: var(--bad); color: var(--paper); }
.b-lie { color: var(--bad); font-weight: 600; font-stretch: 85%; font-size: 0.9375rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; font-size: 0.9375rem; }
.steps li::before { content: ""; width: 12px; height: 12px; margin-top: 6px; border-radius: 50%; border: 2px solid var(--line); }
.steps li.ok::before { background: var(--ok); border-color: var(--ok); }
.steps li.bad::before { background: var(--bad); border-color: var(--bad); }
.steps li.wait::before { border-color: var(--sun-fill); animation: blink 1.6s ease-in-out infinite; }
.sub { color: var(--muted); font-size: 0.8125rem; }
.hex { font-family: var(--mono); font-size: 0.8125rem; overflow-wrap: anywhere; }
.txs { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.empty { color: var(--muted); }

/* published data vs household view */
.da-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .da-grid { grid-template-columns: minmax(0, 1fr); } }
.pane { border-radius: 14px; padding: 16px 18px; }
.pane.pub { background: color-mix(in srgb, var(--cipher) 10%, var(--paper)); border: 1px solid color-mix(in srgb, var(--cipher) 40%, transparent); }
.pane.own { background: color-mix(in srgb, var(--sun-fill) 12%, var(--paper)); border: 1px solid color-mix(in srgb, var(--sun-fill) 55%, transparent); }
.pane h3 { margin-bottom: 6px; }
.pane p { margin: 0 0 10px; font-size: 0.9375rem; }
.cipher { font-family: var(--mono); font-size: 0.75rem; line-height: 1.45; color: var(--cipher); max-height: 9.5em; overflow: hidden; overflow-wrap: anywhere; margin: 0; }
.readings { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.readings li { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9375rem; border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.readings .ok { color: var(--ok); font-weight: 600; font-stretch: 85%; }
.readings .no { color: var(--bad); font-weight: 600; font-stretch: 85%; }

/* how */
.how { counter-reset: s; list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 960px) { .how { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 560px) { .how { grid-template-columns: minmax(0, 1fr); } }
.how li { counter-increment: s; border-top: 3px solid var(--ink); padding-top: 10px; }
.how li h3::before { content: counter(s) ". "; }
.how p { margin: 6px 0 0; font-size: 0.9375rem; color: var(--muted); }

/* chain */
.chain { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; }
@media (max-width: 640px) { .chain { grid-template-columns: minmax(0, 1fr); gap: 2px; } .chain dd { margin-bottom: 10px; } }
.chain dt { font-weight: 650; font-stretch: 85%; }
.chain dd { margin: 0; }

.foot { padding-top: 40px; padding-bottom: 48px; color: var(--muted); font-size: 0.875rem; }
.foot p { margin: 0 0 6px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
