/* Noko, modern layout.
   Fonts: Manrope and JetBrains Mono, SIL Open Font License 1.1 (see /static/fonts/).
   Palette: the "banano modern" dark theme the PHP monitor used (warm
   near-black, Banano-yellow accent, soft glass surfaces), the default here.
   The others are small files linked after this one: app-light.css,
   app-nano.css and app-nano-light.css. Class names follow BEM
   (block__element--modifier). This page fetches nothing from third parties. */

@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --font-body: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #0d0d0f;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-raised: rgba(255, 255, 255, 0.055);
  --code: rgba(0, 0, 0, 0.32);
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8e6de;
  --heading: #f7f5ee;
  --muted: #9a9488;
  --accent: #fbdd11;
  --accent-hover: #fde75c;
  --accent-soft: rgba(251, 221, 17, 0.15);
  --on-accent: #0d0d0f;
  --good: #4cbf4b;
  --warn: #fbdd11;
  --bad: #ff7a6e;
  --key: #fbe774;
  --str: #9edc9d;
  --num: #f5b98a;
  --punct: #85847a;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --glow-1: rgba(251, 221, 17, 0.10);
  --glow-2: rgba(255, 200, 87, 0.06);
  --hover-line: rgba(251, 221, 17, 0.35);

  /* The primary button follows the accent; light palettes fix their own. */
  --primary-bg: var(--accent);
  --primary-line: var(--accent);
  --primary-text: var(--on-accent);
  --primary-hover-bg: var(--accent-hover);
  --primary-hover-line: var(--accent-hover);
  --primary-hover-text: var(--on-accent);
}

/* ── Base ─────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font: 15px/1.55 var(--font-body);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 480px at 12% -8%, var(--glow-1), transparent 60%),
    radial-gradient(800px 420px at 92% 4%, var(--glow-2), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-soft);
  color: var(--heading);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

code,
pre {
  font-family: var(--font-mono);
}

[hidden] {
  display: none !important;
}

/* ── Layout: the page beside the API panel ────────────────────────────── */

.layout {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
}

.layout__primary {
  flex: 1 1 520px;
  min-width: 0;
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Brand ────────────────────────────────────────────────────────────── */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16px;
  color: var(--heading);
}

.brand__logo {
  width: 30px;
  height: 30px;
}

/* Colour theme button (macros.html theme_toggle): the icon shown is the
   current choice, set on <html data-theme> by the head script. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.25rem 0.5rem; font: inherit; line-height: 1;
  background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle__icon { display: none; }
[data-theme="system"] .theme-toggle__icon--system,
[data-theme="light"] .theme-toggle__icon--light,
[data-theme="dark"] .theme-toggle__icon--dark { display: block; }

.brand__theme {
  margin-left: auto;
  color: var(--muted);
}

.brand__theme:hover {
  color: var(--accent);
}

/* ── Status: state, headline, last update, notices ────────────────────── */

.status__state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}

.status__state::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.status__state--good {
  color: var(--good);
}

.status__state--warn {
  color: var(--warn);
}

.status__state--bad {
  color: var(--bad);
}

.status__headline {
  margin: 8px 0 0;
  font-size: 38px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  color: var(--heading);
}

.status__updated {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.notice {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--hover-line);
  border-radius: var(--radius);
  color: var(--heading);
  font-size: 14px;
  max-width: 64ch;
}

/* ── Welcome line and links ───────────────────────────────────────────── */

.welcome {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.social__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}

.social__link:hover {
  color: var(--accent);
  border-color: var(--hover-line);
  text-decoration: none;
}

.social__icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ── Panels: KPI tiles and cards ──────────────────────────────────────────
   Glass panels, as in banano modern: a hairline border, a soft shadow, and
   an accent edge with a small lift on hover. */

.kpi,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.kpi:hover,
.card:hover {
  transform: translateY(-2px);
  border-color: var(--hover-line);
}

@media (prefers-reduced-motion: reduce) {
  .kpi,
  .card {
    transition: border-color 0.18s ease;
  }

  .kpi:hover,
  .card:hover {
    transform: none;
  }
}

.kpis {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  padding: 16px 18px;
  min-width: 0;
}

.kpi__label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi__value {
  display: block;
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere; /* wraps, never clips (WCAG 1.4.12) */
}

.card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Section labels, banano modern style: small capitals, dim, an accent bar. */
.section-title {
  margin: 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* "Delegate to …" is a call to action, not a section label. */
.section-title--cta {
  padding-left: 0;
  border-left: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  color: var(--heading);
}

.card__text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Label/value rows inside a card. */
.facts {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 18px;
  font-size: 14px;
}

.facts__term {
  color: var(--muted);
}

.facts__value {
  margin: 0;
  text-align: right;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.facts__value--address {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* Availability: the last day hour by hour, then the figures. */
.facts__value--spark {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 10px;
}

.spark {
  flex: none;
}

.spark__slot {
  fill: var(--spark-empty, var(--line));
}

.spark__bar {
  fill: var(--good);
}

.spark__bar--low {
  fill: var(--warn);
}

/* ── Delegate card: a media object ────────────────────────────────────────
   Picture beside the text while the card is wide enough, above it (centred)
   once the card itself gets narrow. A container query, so it follows the
   card, not the window (the card is narrower on tablets, where the API
   panel sits beside it). */

.card--delegate {
  container-type: inline-size;
}

.media {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.media--with-picture {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.media__picture {
  width: 140px;
  height: 140px;
  display: block;
}

.media__picture--qr {
  background: #fff;
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
}

.media__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.media__address {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.media__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@container (max-width: 460px) {
  .media--with-picture {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 14px;
  }

  .media__picture {
    width: 120px;
    height: 120px;
  }

  .media__body {
    width: 100%;
  }
}

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--heading);
}

.btn--primary {
  background: var(--primary-bg);
  border-color: var(--primary-line);
  color: var(--primary-text);
}

.btn--primary:hover {
  background: var(--primary-hover-bg);
  border-color: var(--primary-hover-line);
  color: var(--primary-hover-text);
}

.btn--small {
  min-height: 40px;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  border-radius: 8px;
}

/* ── Questions ────────────────────────────────────────────────────────── */

.faq .section-title {
  margin-bottom: 6px;
}

.faq__item {
  border-top: 1px solid var(--line);
}

.faq__question {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--heading);
}

.faq__answer {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Footer ───────────────────────────────────────────────────────────── */

.footer {
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.footer__link {
  color: var(--muted);
}

.footer__link:hover {
  color: var(--accent);
}

.footer__link--address {
  font-family: var(--font-mono);
}

/* ── API panel ────────────────────────────────────────────────────────── */

.api {
  flex: 1 1 440px;
  min-width: 0;
  background: var(--code);
  border-left: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 14px;
}

.api__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
}

.api__title {
  margin: 0;
  font: inherit;
}

.api__verb {
  color: var(--api-verb, var(--good));
  font-weight: 600;
}

.api__command {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
}

.api__json {
  margin: 0;
  line-height: 1.7;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* JSON tokens (one-letter classes keep the HTML small): key, string,
   number/bool/null, punctuation. */
.api__json .k {
  color: var(--key);
}

.api__json .s {
  color: var(--str);
}

.api__json .n {
  color: var(--num);
}

.api__json .p {
  color: var(--punct);
}

.api__note {
  margin: auto 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* Underlined: in small muted text, colour alone doesn't mark a link. */
.api__note a {
  color: var(--api-link, var(--accent));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.api__note a:hover {
  color: var(--accent-hover);
}

/* ── Smaller screens ──────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .api {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 600px) {
  .kpi {
    padding: 14px;
  }

  .kpi__value {
    font-size: 20px;
  }

  .facts__value--address {
    grid-column: 1 / -1;
    text-align: left;
    margin-top: -4px;
  }
}

@media (max-width: 480px) {
  .layout__primary,
  .api {
    padding: 24px 16px;
  }

  .status__headline {
    font-size: 29px;
  }

  .api__json {
    font-size: 12px;
  }

  .media__actions .btn {
    flex: 1 1 100%;
  }
}
