/* morse.is — the pages in the new look: base, cards, tiles, charts.
   Colours, faces, the wordmark and the header are in ui/grunnur.css, which
   loads first. After the ElÝsa brand book ("Reykjanes").

   Text is pure black on light and pure white on dark: never grey, never a
   colour. Hierarchy comes from size and weight. Colour is for marks — lines,
   bars, the dashes in the wordmark — and Ljós (amber) is used sparingly, for
   what should stand out: the newest point, the chosen item, the main button.

   Chart marks were checked for contrast against the card: Kísill itself is
   too light for bars on white (1.9:1), so light mode draws with a deeper
   step of it; Ljós is only ever a marked point with its value beside it. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--body);
  overflow-x: hidden;
}
/* Michroma comes in one weight and runs wide: headings are set a size or two
   smaller than a grotesque would be, and never faux-bold. They are in
   capitals, like the wordmark — and because Michroma draws a small ð as ∂,
   which reads as a misprint in Icelandic; its capital Ð is right. */
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.3; text-wrap: balance; font-weight: 400;
             letter-spacing: .04em; text-transform: uppercase; }
p { margin: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ljos); outline-offset: 2px; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: var(--gutter); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* -------------------------------------------------------------- page ---- */
.page-head { padding: 32px 0 22px; display: grid; gap: 10px; }
.page-head h1 { font-size: clamp(1.15rem, 2.6vw, 1.65rem); }
.page-head .lead { font-size: 1.08rem; max-width: 68ch; }
.site-foot { padding-block: 36px 48px; font-size: .85rem; display: grid; gap: 6px; }

/* -------------------------------------------------------------- cards ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 20px; }
.card h2 { font-size: .9rem; }
.card .sub { font-size: .9rem; margin-top: 6px; max-width: 76ch; }
.card .sub.strong { font-weight: 600; }
.card .sub:empty { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .85rem; margin-top: 10px; }
.legend:empty { display: none; }
.legend .key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; margin-right: 7px; vertical-align: 4px; }
.more { font-weight: 600; font-size: .9rem; white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; margin-top: 16px; }

/* ------------------------------------------------------- stat tiles ---- */
/* six tiles: one row, two rows of three, or three rows of two — never five and one */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1140px) { .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* four tiles: two rows of two, or one row of four */
@media (min-width: 720px) { .tiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.tile .label { font-weight: 600; font-size: .88rem; }
.tile .value { font-weight: 700; font-size: 1.85rem; letter-spacing: -.02em; line-height: 1.1; margin-top: 4px; }
.tile .unit { font-weight: 500; font-size: .85rem; letter-spacing: 0; margin-left: 4px; white-space: nowrap; display: inline-block; }
.tile .note { font-size: .82rem; line-height: 1.4; }
.tile .delta { font-size: .82rem; font-weight: 600; }
.tile svg { display: block; width: 100%; height: 30px; margin-top: 6px; }
@media (max-width: 520px) {
  .tile { padding: 12px 12px; }
  .tile .value { font-size: 1.5rem; }
  .tile .label { font-size: .84rem; }
  .card { padding: 16px 14px; }
}

/* ------------------------------------------------------------ tabs ---- */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 99px; }
.tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 99px; cursor: pointer; font-weight: 600; font-size: .9rem; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--text-inv); }
.tabs button:not([aria-selected="true"]):hover { background: var(--kisill-soft); }
@media (max-width: 600px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; }
}

/* ----------------------------------------------------------- charts ---- */
.chart { margin: 14px 0 0; }
.chart figcaption { font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.chart .plot { position: relative; height: 220px; }
.chart .plot.short { height: 150px; }
.chart canvas { display: block; }
.linkish { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .88rem; font-weight: 600; }
/* a picked row in a table that drives a chart: no underline, a mark before it */
table.data .linkish { font: inherit; color: inherit; text-align: left; }
table.data .linkish[aria-pressed="true"] { text-decoration: none; font-weight: 700; }
table.data .linkish[aria-pressed="true"]::before { content: "▸ "; }
.tablewrap { overflow-x: auto; margin-top: 12px; max-height: 360px; overflow-y: auto; border-top: 1px solid var(--line); }
table.data { border-collapse: collapse; width: 100%; font-size: .85rem; }
table.data th, table.data td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { font-family: var(--mono); font-weight: 500; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; position: sticky; top: 0; background: var(--surface); }
table.data td { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------- meters ---- */
.meter { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.meter:last-of-type { border-bottom: 0; }
.meter .top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.meter .name { font-weight: 600; }
.meter .big { font-weight: 700; font-size: 1.35rem; }
.meter .track { position: relative; height: 10px; border-radius: 5px; background: var(--track); }
.meter .fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--mark-volume); }
.meter .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--mark-price); border-radius: 1px; box-shadow: 0 0 0 2px var(--surface); }
.meter .note { font-size: .82rem; }

.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 0 32px; }
.meters .meter { border-bottom: 0; }

/* ------------------------------------------------ maintenance rows ----
   Lined up under the hourly chart: the left margin is the chart's y-axis,
   so an hour sits at the same x in both. */
.gantt { position: relative; margin: 4px 8px 0 58px; }
.gantt .glines { position: absolute; inset: 0; pointer-events: none; }
.gantt .gl { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grid); }
.gantt .grow { position: relative; padding: 6px 0 4px; border-bottom: 1px solid var(--grid); }
.gantt .glabel { font-size: .8rem; line-height: 1.3; margin-bottom: 4px; }
.gantt .glabel b { font-weight: 600; }
.gantt .track { position: relative; height: 18px; }
.gantt .bar { position: absolute; bottom: 0; min-width: 3px; background: var(--mark-volume); border-radius: 3px 3px 0 0; cursor: default; }
.gantt .bar:hover, .gantt .bar:focus-visible { background: var(--mark-price); outline: none; }

.list { list-style: none; margin: 12px 0 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; line-height: 1.35; }
.list li:last-child { border-bottom: 0; }
.list b { font-weight: 600; }
.list small { font-size: .82rem; }
.list .r { font-weight: 600; white-space: nowrap; }
.pill { display: inline-block; font-size: .8rem; padding: 4px 10px; border-radius: 99px; background: var(--ljos-soft); margin-top: 12px; }

/* ---------------------------------------------------------- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 99px; padding: 10px 20px; font-weight: 700; cursor: pointer; background: var(--ljos); color: #000000; text-decoration: none; }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .6; cursor: default; }
input[type="password"], input[type="text"] { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
input:focus-visible { outline: 2px solid var(--ljos); outline-offset: 1px; }

/* ------------------------------------------------- loading / empty ---- */
.waiting { opacity: .55; transition: opacity .2s; }
.empty { padding: 28px 0; font-size: .95rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------- additions, v5 ---- */
.chart .plot.tall { height: 440px; }
@media (max-width: 600px) { .chart .plot.tall { height: 300px; } }
.actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; margin-top: 10px; }

/* The values at the point the pointer or finger is on, above the chart
   rather than over it; the hairline in the chart marks the spot */
.readout { font: 500 .82rem/1.45 var(--mono); min-height: 2.9em; margin-top: 10px; padding: 6px 10px; border-left: 3px solid var(--ljos); background: var(--bg); border-radius: 0 6px 6px 0; }

/* ------------------------------------------------------ Jöfnunarorka ---- */
.daynav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 18px; margin: -6px 0 16px; }
.daynav b { font-weight: 700; }
.daynav button:disabled { text-decoration: none; opacity: 1; cursor: default; border: 0; }
/* the five-minute states: a cell each, lined up under the hourly chart */
.strip { display: grid; grid-template-columns: repeat(288, minmax(0, 1fr)); height: 18px; margin: 4px 8px 0 58px; }
.strip span { display: block; }
.strip .up { background: var(--mark-accent); }
.strip .down { background: var(--mark-volume); }
.strip .none { background: var(--grid); }
.strip .na { background: transparent; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .sw.up { background: var(--mark-accent); }
.legend .sw.down { background: var(--mark-volume); }
.legend .sw.none { background: var(--grid); }
.legend .sw.na { border: 1px dashed var(--line); }
/* the next hour: the one number the desk reads at HH:35 */
.nexthour { margin-bottom: 16px; }
.nexthour .nh-hour { font-weight: 700; font-size: 1.05rem; }
.nexthour .nh { display: grid; gap: 8px; margin-top: 10px; }
.nexthour .nh-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.nexthour .nh-p { font-weight: 700; font-size: clamp(2.4rem, 7vw, 3.2rem); letter-spacing: -.02em; line-height: 1; }
.nexthour .nh-l { font-weight: 600; font-size: 1.02rem; }
.nexthour .nh-say { font-size: 1rem; font-weight: 500; margin: 2px 0 0; max-width: 76ch; }
.split { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--track); }
.split .up { background: var(--mark-accent); }
.split .down { background: var(--mark-volume); }
.split-key { display: flex; justify-content: space-between; gap: 12px; font: 500 .8rem var(--mono); }
.nexthour.none .split { visibility: hidden; }
h3.minor { font-size: .8rem; margin-top: 18px; }
h3.minor:first-of-type { margin-top: 14px; }

/* ------------------------------------------------------- Reiknivélar ---- */
/* four series that must be told apart: a validated categorical set */
:root { --cat-1: #4A3AA7; --cat-2: #00907E; --cat-3: #C98500; --cat-4: #2A78D6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cat-1: #9085E9; --cat-2: #1FA596; --cat-3: #C98500; --cat-4: #3987E5; } }
:root[data-theme="dark"] { --cat-1: #9085E9; --cat-2: #1FA596; --cat-3: #C98500; --cat-4: #3987E5; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px 16px; margin-top: 14px; }
.field { display: grid; gap: 6px; align-content: start; }
.field label, .field .lbl { font-weight: 600; font-size: .88rem; }
.field small { font-size: .8rem; }
.field select, .field input[type="number"], .field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.field textarea { font: .82rem/1.4 var(--mono); min-height: 140px; resize: vertical; }
.field select:focus-visible, .field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--ljos); outline-offset: 1px; }
.drop { display: grid; place-items: center; gap: 6px; text-align: center; padding: 26px 16px; margin-top: 14px; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; }
.drop.over, .drop:focus-visible { border-color: var(--ljos); outline: none; }
.drop b { font-weight: 700; }
.drop small { font-size: .82rem; }
.panes > [hidden] { display: none; }
.status { margin-top: 12px; font-size: .9rem; font-weight: 500; }
.status:empty { display: none; }
table.data td.wrap { white-space: normal; text-align: left; min-width: 14rem; }
.runrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 16px; }

/* the calculators share one page head: a row of links, one per calculator */
.tabs a { padding: 6px 14px; border-radius: 99px; font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--text); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--text-inv); }
.tabs a:not([aria-current="page"]):hover { background: var(--kisill-soft); }
.subnav { margin: 0 0 16px; }
/* pickers: a row of small buttons, the chosen one filled */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-weight: 600; font-size: .86rem; min-width: 2.6rem; }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--text-inv); }
.chips button:disabled { cursor: default; border-style: dashed; }
.chips button:not([aria-pressed="true"]):not(:disabled):hover { background: var(--kisill-soft); }
.chips[hidden] { display: none; }
.chips.months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
@media (max-width: 640px) { .chips.months { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.chips.months button { min-width: 0; padding: 6px 2px; }
.pick { display: grid; gap: 14px; margin-top: 12px; }
.pick .row { display: grid; gap: 6px; }
.pick .lbl { font-weight: 600; font-size: .88rem; }
/* a volume slider across the page, its steps written underneath */
.slide input[type="range"] { width: 100%; accent-color: var(--ljos); margin: 4px 0 0; }
.slide .ticks { display: flex; justify-content: space-between; font: 500 .72rem var(--mono); }
.slide output { font-weight: 700; font-size: 1.1rem; }
/* seven weekdays need seven colours: the categorical set, then ink */
:root { --cat-5: #E34948; --cat-6: #008300; --cat-7: #15202B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cat-5: #E66767; --cat-6: #008300; --cat-7: #E6EDEB; } }
:root[data-theme="dark"] { --cat-5: #E66767; --cat-6: #008300; --cat-7: #E6EDEB; }

/* ------------------------------------------------------- Vonarskarð ---- */
.chips.months button small { display: block; font-weight: 500; font-size: .7rem; font-family: var(--mono); }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.stack { display: grid; gap: 16px; margin-top: 16px; }
.events { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 0; }
.events li { display: grid; grid-template-columns: 30px 7.5rem 1fr auto; gap: 4px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.events li:last-child { border-bottom: 0; }
.events .no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font: 600 .72rem var(--mono); color: #000000; }
.events .no.out { background: var(--cat-5); } .events .no.back { background: var(--cat-6); } .events .no.ahead { background: var(--cat-4); }
.events .when { font: 500 .8rem var(--mono); }
.events .what b { display: block; font-weight: 600; }
.events .what span { font-size: .9rem; }
.events .what .src { display: block; font-size: .78rem; margin-top: 3px; }
.events .what .src a { text-decoration: underline; }
.events .tag { font: 500 .7rem var(--mono); letter-spacing: .06em; text-transform: uppercase; border: 1px solid currentColor; border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
@media (max-width: 640px) { .events li { grid-template-columns: 26px 1fr; } .events .when { grid-column: 2; } .events .what { grid-column: 1 / -1; } .events .tag { grid-column: 1 / -1; justify-self: start; } }
.calls { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin-top: 14px; }
.calls .call { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 6px; align-content: start; background: var(--bg); }
.calls h3 { font-size: .78rem; }
.calls .dir { font-weight: 700; font-size: .95rem; }
.calls p { margin: 0; font-size: .9rem; line-height: 1.45; }
.risks { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); margin-top: 16px; }
.risks h3 { font-size: .78rem; margin-bottom: 6px; }
.risks ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: .92rem; line-height: 1.45; }
table.data td.up, table.data td.down { font-weight: 600; }

/* Vonarskarð's categories: a bar under the site header that stays at the top
   of the window while the page scrolls under it */
.catbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.catbar .in { max-width: 1180px; margin: 0 auto; padding: 8px var(--gutter); display: flex; align-items: center; gap: 8px 16px; }
.catbar .tabs { border: 0; padding: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.catbar .tabs::-webkit-scrollbar { display: none; }
.catbar .tabs button { white-space: nowrap; }
.catbar .ctx { font: 500 .76rem var(--mono); margin-left: auto; white-space: nowrap; }
@media (max-width: 640px) { .catbar .ctx { display: none; } }
[data-tabs][hidden] { display: none !important; }

/* Helstu upplýsingar: the facts in words, why the price moves, what is ahead */
.brief p { font-size: 1.1rem; line-height: 1.6; max-width: 74ch; margin: 6px 0 0; }
.brief b { font-weight: 700; }
.tile .alt { font: 500 .76rem var(--mono); }
.why { list-style: none; margin: 8px 0 0; padding: 0; display: grid; }
.why li { display: grid; grid-template-columns: 12rem 1fr; gap: 4px 16px; padding: 11px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.why li:last-child { border-bottom: 0; }
.why li > b { font-weight: 600; }
.gloss { display: grid; grid-template-columns: 11rem 1fr; gap: 8px 16px; margin: 8px 0 0; font-size: .92rem; line-height: 1.45; }
.gloss dt { font-weight: 600; }
.gloss dd { margin: 0; }
.events.mini li { grid-template-columns: 30px 7.5rem 1fr; padding: 7px 0; }
.events.mini .what b { font-weight: 500; }
@media (max-width: 640px) {
  .why li, .gloss { grid-template-columns: 1fr; }
  .gloss dd { margin-bottom: 6px; }
  .events.mini li { grid-template-columns: 26px 1fr; }
}
/* the detail's own row under the bar's tabs */
.catbar .in { flex-wrap: wrap; }
.catbar .tabs[hidden] { display: none; }
.catbar .tabs.sub { order: 3; flex-basis: 100%; }
.catbar .tabs.sub button { font-size: .82rem; padding: 4px 12px; }
.catbar .tabs.sub button[aria-selected="true"] { background: var(--kisill-soft); color: var(--text); }
