/* Irish Load Forecast — "Living Instrument", the Android app's design language on the web.
   Surfaces and ink are the app's theme roles (Theme.kt); the four line colours are
   validated with the dataviz palette checks against each theme's panel (all pairs:
   CVD separation, normal-vision floor, lightness band, chroma, 3:1 contrast). */

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #F1F4F7; --panel: #FFFFFF; --control: #F7F9FB; --control-on: #EEF2F6;
  --line: #E2E8F0; --grid: #EDF1F5; --ink: #1A2530; --ink-2: #5A6B7A;
  --accent: #007F79; --on-accent: #FFFFFF; --link: #00706B; --focus: #007F79;
  --s-actual: #0F9488; --s-ours: #B45309; --s-eg: #4F6BED; --s-eg2: #7C3AAD;
  --s-band: rgba(180, 83, 9, 0.13); --future: rgba(180, 83, 9, 0.035);
  --pos: #D9480F; --neg: #3B5BDB;
  --marker: rgba(26, 37, 48, 0.42); --pill: #1A2530; --on-pill: #FFFFFF;
  --chip-amber: rgba(180, 83, 9, 0.1); --on-chip-amber: #92400E;
  --chip-teal: rgba(0, 161, 154, 0.12); --on-chip-teal: #00635F;
  --good: #1F8A5E; --warn: #9A6200; --crit: #C93434;
  --glow-a: rgba(251, 191, 36, 0.30); --glow-b: rgba(0, 161, 154, 0.15);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0D1B24; --panel: #152433; --control: #111F2B; --control-on: #24384A;
    --line: #243949; --grid: #1E3242; --ink: #DDE6EC; --ink-2: #8BA8BB;
    --accent: #4FD1C5; --on-accent: #003734; --link: #7FE3D6; --focus: #4FD1C5;
    --s-actual: #3EA896; --s-ours: #C68427; --s-eg: #6E8BF5; --s-eg2: #9558A3;
    --s-band: rgba(198, 132, 39, 0.2); --future: rgba(198, 132, 39, 0.05);
    --pos: #F08C4A; --neg: #7B96F5;
    --marker: rgba(221, 230, 236, 0.45); --pill: #DDE6EC; --on-pill: #0D1B24;
    --chip-amber: rgba(251, 191, 36, 0.13); --on-chip-amber: #F8CB72;
    --chip-teal: rgba(79, 209, 197, 0.13); --on-chip-teal: #7FE3D6;
    --good: #3DD68C; --warn: #F5B83D; --crit: #FF8A80;
    --glow-a: rgba(251, 191, 36, 0.2); --glow-b: rgba(79, 209, 197, 0.13);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D1B24; --panel: #152433; --control: #111F2B; --control-on: #24384A;
  --line: #243949; --grid: #1E3242; --ink: #DDE6EC; --ink-2: #8BA8BB;
  --accent: #4FD1C5; --on-accent: #003734; --link: #7FE3D6; --focus: #4FD1C5;
  --s-actual: #3EA896; --s-ours: #C68427; --s-eg: #6E8BF5; --s-eg2: #9558A3;
  --s-band: rgba(198, 132, 39, 0.2); --future: rgba(198, 132, 39, 0.05);
  --pos: #F08C4A; --neg: #7B96F5;
  --marker: rgba(221, 230, 236, 0.45); --pill: #DDE6EC; --on-pill: #0D1B24;
  --chip-amber: rgba(251, 191, 36, 0.13); --on-chip-amber: #F8CB72;
  --chip-teal: rgba(79, 209, 197, 0.13); --on-chip-teal: #7FE3D6;
  --good: #3DD68C; --warn: #F5B83D; --crit: #FF8A80;
  --glow-a: rgba(251, 191, 36, 0.2); --glow-b: rgba(79, 209, 197, 0.13);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden;
}
a { color: var(--link); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 760px) { .wrap { padding: 0 32px; } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace; font-size: 0.88em; }

/* ---- ambient glow: the subject's colour, brighter when the data says so ---- */
.aura { position: absolute; inset: 0 0 auto 0; height: 760px; overflow: hidden; pointer-events: none; z-index: 0; opacity: var(--aura, 0.7); transition: opacity 900ms ease; }
.aura span { position: absolute; border-radius: 50%; filter: blur(30px); }
.aura .aura-a { left: -12%; top: -360px; width: 78%; height: 780px; background: radial-gradient(closest-side, var(--aura-a, var(--glow-a)), transparent); animation: breathe 9s ease-in-out infinite alternate; }
.aura .aura-b { right: -16%; top: -280px; width: 62%; height: 660px; background: radial-gradient(closest-side, var(--aura-b, var(--glow-b)), transparent); }
@keyframes breathe { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.08); opacity: 1; } }
.top, main, .foot { position: relative; z-index: 1; }

/* ---- header ---- */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 10px; padding-top: 22px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 13px; color: var(--ink); text-decoration: none; margin-right: auto; }
.top nav { order: 2; }
.top #theme { order: 3; }
@media (max-width: 640px) {
  .top #theme { order: 2; }                   /* beside the brand on phones, the menu below */
  .top nav { order: 3; width: 100%; justify-content: space-between; }
}
.mark { width: 40px; height: 40px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; flex: none; }
.mark svg { width: 26px; height: 26px; fill: none; stroke: var(--s-ours); stroke-width: 2.8; stroke-linecap: round; }
.brand-name { display: block; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub { display: block; font-size: 13px; color: var(--ink-2); }

/* ---- controls ---- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.seg a, .seg button {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none;
  border: 0; background: transparent; padding: 8px 15px; border-radius: 12px; cursor: pointer; min-height: 36px;
  display: inline-flex; align-items: center; gap: 7px;
}
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg a[aria-current="page"], .seg button[aria-pressed="true"] { background: var(--control-on); color: var(--ink); font-weight: 700; }
.seg.accent button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg.sm { border-radius: 14px; padding: 3px; }
.seg.sm button { font-size: 13px; padding: 5px 11px; min-height: 30px; border-radius: 11px; }
.icon-btn {
  font: inherit; width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn.round { border-radius: 999px; background: var(--control); }
.icon-btn:hover { background: var(--control-on); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); background: var(--control); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px; min-height: 40px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--control-on); }
.btn.sm { font-size: 13px; padding: 5px 12px; min-height: 32px; }
label.field { display: inline-flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
input[type="date"], select {
  font: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; min-height: 44px; max-width: 100%;
}

/* ---- page ---- */
main { padding-top: 18px; padding-bottom: 40px; outline: none; display: flex; flex-direction: column; gap: 16px; transition: opacity 160ms ease; }
.page-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
h1 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.12; font-weight: 800; letter-spacing: -0.025em; margin: 0; text-wrap: balance; }
h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; margin: 0; }
h3 { font-size: 14px; font-weight: 700; margin: 0; }
.sub { color: var(--ink-2); margin: 6px 0 0; max-width: 70ch; }
.meta { color: var(--ink-2); font-size: 13.5px; margin: 0; }
.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.loading, .empty { color: var(--ink-2); }
.notice { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 18px; max-width: 72ch; }
.notice strong { display: block; }
.notice p { margin: 4px 0 0; color: var(--ink-2); }
.notice.crit { border-color: color-mix(in srgb, var(--crit) 55%, var(--line)); }

/* ---- panels, eyebrows, readings, chips ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 20px 22px; min-width: 0; }
.eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); margin: 0; }
.reading { font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.reading.xl { font-size: clamp(52px, 9vw, 78px); letter-spacing: -0.035em; }
.reading.lg { font-size: 34px; }
.reading.md { font-size: 28px; }
.reading.sm { font-size: 24px; }
.unit { font-weight: 700; color: var(--ink-2); }
.reading-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-top: 8px; }
.reading-row .unit { font-size: 15px; }
.reading-row .reading.xl + .unit { font-size: 24px; }
.reading-row .reading.lg + .unit { font-size: 16px; }
.note { font-size: 13px; color: var(--ink-2); margin: 4px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 800; white-space: nowrap; }
.chip.amber { background: var(--chip-amber); color: var(--on-chip-amber); }
.chip.teal { background: var(--chip-teal); color: var(--on-chip-teal); }
.chip.neutral { background: var(--control-on); color: var(--ink-2); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.live .dot { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--control-on); color: var(--ink-2); }
.badge.warn { color: var(--warn); }
.rule { height: 1px; background: var(--grid); border: 0; margin: 14px 0; }

.hero { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 860px) { .hero { grid-template-columns: 2fr 1fr; } }
.hero-sub { margin: 10px 0 0; font-size: 15px; color: var(--ink-2); }
.hero-sub b { color: var(--ink); font-weight: 700; }
.side-block .reading-row { margin-top: 6px; }
.side-block .reading-row .chip { margin-left: auto; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 2px; }
.tile .reading-row { margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 920px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* ---- figures: heading + headline reading, chart or table, readouts that switch lines ---- */
.fig-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px; }
.headline { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 0; flex-wrap: wrap; }
.headline .unit { font-size: 14px; }
.fig-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fig-note { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.fig-body { margin-top: 12px; }
.readouts {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--grid);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 10px;
}
.readout {
  font: inherit; color: var(--ink); text-align: left; background: none; border: 1px solid transparent; border-radius: 14px;
  padding: 7px 10px; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px;
}
button.readout { cursor: pointer; }
button.readout:hover { background: var(--control); }
.readout[aria-pressed="false"] { border-color: var(--line); }
.readout[aria-pressed="false"] .sw { opacity: 0.25; }
.readout[aria-pressed="false"] .rv, .readout[aria-pressed="false"] .rl { color: var(--ink-2); }
.readout[aria-pressed="false"] .rv { font-weight: 600; font-size: 13px; }
.rl { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.rv { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; }
.sw { flex: none; width: 18px; height: 0; border-top: 3px solid; border-radius: 2px; }
.sw.band { height: 10px; border: 0; }
.sw.box { width: 11px; height: 11px; border: 0; border-radius: 3px; }
.sw.none { border-color: transparent; }
.fig-hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-2); }
.no-values .rv { display: none; }

/* ---- charts ---- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; }
.chart svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 12px; }
.gl { stroke: var(--grid); stroke-width: 1; }
.ax { stroke: var(--line); stroke-width: 1; }
.tk { fill: var(--ink-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tk.day { font-weight: 700; }
.ln { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.future { fill: var(--future); }
.band { stroke: none; }
.now-halo { opacity: 0.22; }
.mk-line { stroke: var(--marker); stroke-width: 1.5; }
.mk-pill { fill: var(--pill); }
.mk-text { fill: var(--on-pill); font-size: 12px; font-weight: 800; }
.ring { fill: var(--panel); stroke-width: 3; }
.hit { fill: transparent; cursor: crosshair; }
.bar { transition: opacity 160ms ease; }
.bar.dim { opacity: 0.45; }
.mini-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mini-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.mini-val small { font-weight: 600; color: var(--ink-2); font-size: 12px; margin-left: 6px; }

/* ---- tables ---- */
.tw { overflow-x: auto; }
.table-view { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); border-bottom-color: var(--line); background: var(--panel); position: sticky; top: 0; z-index: 1; }
td.wrap-cell { white-space: normal; text-align: left; }
details.more { margin-top: 12px; }
details.more summary { cursor: pointer; color: var(--ink-2); font-size: 13.5px; font-weight: 700; width: max-content; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; font-size: 14px; margin: 12px 0 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { font-size: 12px; font-weight: 700; }
.prose { max-width: 70ch; }
.prose h2 { margin: 22px 0 6px; }
.prose p { margin: 0 0 12px; color: var(--ink); }

/* ---- footer ---- */
.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 12.5px; padding-top: 6px; padding-bottom: 36px; }
.foot a { color: var(--ink-2); }

@media (max-width: 560px) {
  .top { padding-top: 16px; }
  .brand-sub { display: none; }
  .panel { padding: 16px; border-radius: 20px; }
  .readouts { grid-template-columns: 1fr 1fr; }
  .seg a, .seg button { padding: 8px 11px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
