/* mhjb house style: base + components. Requires tokens.css first.
   <link rel="stylesheet" href="tokens.css"><link rel="stylesheet" href="house.css"> */

:root {
  /* Short aliases for everyday use */
  --buttercup: var(--color-core-buttercup);
  --ink: var(--color-core-ink);
  --white: var(--color-core-white);
  --concrete: var(--color-core-concrete);
  --muted: var(--color-core-muted);
  --faint: var(--color-core-faint);
  --receipt: var(--color-core-receipt);
  --c1: var(--color-harbour-pohutukawa);
  --c2: var(--color-harbour-kawakawa);
  --c3: var(--color-harbour-harbour);
  --c4: var(--color-harbour-sea);
  --c5: var(--color-harbour-manuka);
  --c6: var(--color-harbour-dusk);
  --sans: var(--font-sans);
  --mono: var(--font-mono);
  --serif: var(--font-serif);
}

/* ---------- Base ---------- */
html { background: var(--white); color: var(--ink); }
body { margin: 0; font-family: var(--sans); font-size: 16px; line-height: 24px; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
h1 { font-weight: 700; font-size: 34px; line-height: 40px; letter-spacing: -0.01em; }
h2 { font-weight: 700; font-size: 22px; line-height: 28px; }
h3 { font-weight: 600; font-size: 16px; line-height: 22px; }
a { color: var(--ink); text-decoration-color: var(--buttercup); text-decoration-thickness: 3px; text-underline-offset: 4px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--buttercup); }
cite, .work { font-style: italic; } /* titles of books and other works, everywhere (source lines too) */
.num, td.num, .data { font-family: var(--mono); font-variant-numeric: tabular-nums lining-nums; }

/* ---------- The band: one per page, at the top ---------- */
.band { background: var(--buttercup); color: var(--ink); padding: 40px 56px 28px; }
.band .kicker { margin-bottom: 10px; }
.band h1, .band .display { font-weight: 700; font-size: 72px; line-height: 72px; letter-spacing: -0.02em; text-transform: uppercase; }
.band .sub { margin-top: 8px; font-weight: 500; font-size: 20px; line-height: 28px; }
@media (max-width: 640px) { .band { padding: 28px 20px 20px; } .band h1, .band .display { font-size: 44px; line-height: 46px; } }

/* ---------- Labels, kickers, rules ---------- */
.kicker { font-family: var(--mono); font-size: 12px; line-height: 16px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.band .kicker { color: var(--ink); }
.label { display: inline-block; width: fit-content; align-self: flex-start; font-weight: 700; font-size: 13px; line-height: 18px; letter-spacing: 0.14em; text-transform: uppercase; } /* no underline: a buttercup underline means a link */
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 4px solid var(--buttercup); padding-bottom: 8px; }
.panel-title .meta { font-family: var(--mono); font-size: 12px; line-height: 16px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 19px; }
hr { border: 0; border-top: 1px solid var(--concrete); margin: 24px 0; }

/* ---------- Lists: square ink bullets ---------- */
ul.squares { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
ul.squares li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 4px; }
ul.squares li::before { content: ""; width: 8px; height: 8px; margin-top: 8px; background: var(--ink); }

/* ---------- Buttons, tags ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 14px/20px var(--sans); padding: 11px 18px; min-height: 44px; box-sizing: border-box; border: 1.5px solid var(--ink); background: var(--white); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--buttercup); }
.btn:hover { background: var(--ink); color: var(--white); }
.btn.primary:hover { background: var(--ink); color: var(--buttercup); }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 16px; padding: 4px 10px; background: var(--receipt); color: var(--ink); }
.tag::before { content: ""; width: 8px; height: 8px; background: var(--tag-colour, var(--ink)); }
.tag.c1 { --tag-colour: var(--c1); background: var(--color-harbour-pohutukawa-tint); }
.tag.c2 { --tag-colour: var(--c2); background: var(--color-harbour-kawakawa-tint); }
.tag.c3 { --tag-colour: var(--c3); background: var(--color-harbour-harbour-tint); }
.tag.c4 { --tag-colour: var(--c4); background: var(--color-harbour-sea-tint); }
.tag.c5 { --tag-colour: var(--c5); background: var(--color-harbour-manuka-tint); }
.tag.c6 { --tag-colour: var(--c6); background: var(--color-harbour-dusk-tint); }
.tag.hi { background: var(--buttercup); } .tag.hi::before { background: var(--ink); }

/* ---------- Status: always icon + words ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; line-height: 18px; padding: 4px 10px; border: 1.5px solid currentColor; }
.status.good { color: var(--color-status-good); }
.status.warning { color: var(--ink); }
.status.critical { color: var(--color-status-critical); }

/* ---------- Chart frame: every chart, every time ---------- */
.chart { display: flex; flex-direction: column; gap: 14px; }
.chart-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.chart-title { font-weight: 600; font-size: 18px; line-height: 24px; }
.chart-sub { font-size: 14px; line-height: 20px; color: var(--muted); margin-top: 2px; }
.chart-foot { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 11px; line-height: 16px; color: var(--muted); border-top: 1px solid var(--concrete); padding-top: 8px; }
.mark { flex: none; width: 44px; height: 44px; border-radius: 999px; background: var(--buttercup); outline: 1.5px solid var(--ink); display: flex; align-items: center; justify-content: center; font: 700 13px/16px var(--sans); color: var(--ink); }

/* ---------- Receipt ---------- */
.receipt { background: var(--receipt); padding: 18px 26px 20px; display: flex; flex-direction: column; gap: 16px; position: relative; }
.receipt::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; background: linear-gradient(-45deg, var(--receipt) 5.5px, transparent 0) left bottom / 11px 11px repeat-x, linear-gradient(45deg, var(--receipt) 5.5px, transparent 0) left bottom / 11px 11px repeat-x; }
.receipt .rule { border-top: 2px dashed var(--faint); }
.receipt .total { font: 700 50px/54px var(--sans); font-variant-numeric: lining-nums; }
.line { display: grid; grid-template-columns: auto minmax(16px, 1fr) auto; gap: 8px; align-items: baseline; font: 13px/18px var(--mono); }
.line > :first-child { font-weight: 600; }
.line .leader { border-bottom: 2px dotted var(--faint); transform: translateY(-4px); }
.line .amt { font-variant-numeric: tabular-nums; }
.ticks { height: 6px; margin-top: 6px; background: repeating-linear-gradient(90deg, var(--ink) 0 7px, transparent 7px 10px); }
.ticks.hi { background: repeating-linear-gradient(90deg, var(--buttercup) 0 7px, transparent 7px 10px); outline: 1px solid var(--ink); }

/* ---------- Long reading (Alegreya) ---------- */
.reading { max-width: 640px; }
.reading .standfirst { font: 400 20px/30px var(--sans); color: #3A3935; }
.reading .rule { width: 48px; height: 4px; background: var(--buttercup); margin: 16px 0; }
.reading .body p { font-family: var(--serif); font-size: 19px; line-height: 30px; margin: 0; }
.reading .body p + p { text-indent: 1em; }
.reading .body sup { font: 600 11px/0 var(--sans); }
.sidenote { font-size: 13px; line-height: 19px; color: var(--muted); }
.sidenote b { color: var(--ink); }
@media (min-width: 1000px) { .with-margin { display: grid; grid-template-columns: 640px 260px; gap: 48px; } }

/* =====================================================================
   Working apps (added 12 Nov 2026, from history-tree).
   Put class="app" on the root of a working tool; documents and standalone
   pages keep the page sizes above.
   ===================================================================== */

/* App band: smaller title, tighter padding, left edge lines up with the side pane */
.app .band { padding: 22px var(--space-app-pane) 18px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 32px; position: relative; }
.app .band h1 { font-size: 44px; line-height: 46px; }
.app .band.long h1 { font-size: 34px; line-height: 40px; }   /* titles over 16 characters */
.app .band .sub { font-size: 16px; line-height: 24px; }
.band .version { position: absolute; top: 16px; right: var(--space-app-pane); font-family: var(--mono); font-size: 12px; line-height: 16px; letter-spacing: 0.1em; } /* lower case: v0.1.1 */
@media (max-width: 640px) { .app .band h1, .app .band.long h1 { font-size: 22px; line-height: 28px; } .app .band .sub { font-size: 14px; line-height: 20px; } }

.app main, .app .page { padding-inline: var(--space-app-page); }
@media (max-width: 640px) { .app main, .app .page { padding-inline: 12px; } }

/* Density: 36px controls with a mouse or trackpad, 44px on touch */
.app .btn, .app input, .app select { min-height: var(--control-pointer); padding-block: 0; }
.app .icon-btn { width: var(--control-pointer); height: var(--control-pointer); }
@media (pointer: coarse) { .app .btn, .app input, .app select, .app .row-btn { min-height: var(--control-touch); } .app .icon-btn { width: var(--control-touch); height: var(--control-touch); } }
.dense { font-size: 12.5px; line-height: 18px; }

/* Chart frame inside an app */
.app .chart-title { font-size: 16px; line-height: 22px; }
.app .chart-sub { font-size: 13px; line-height: 19px; }
@media (max-width: 640px) { .app .chart-title { font-size: 14px; line-height: 20px; } .app .chart-sub { display: none; } }

/* Chart labels and gridlines (SVG) */
.chart-label { font: 400 12px/14px var(--sans); fill: var(--ink); paint-order: stroke; stroke: var(--white); stroke-width: var(--network-label-halo); stroke-linejoin: round; transition: opacity var(--network-label-fade); }
.chart-label.hi { font-weight: 600; }
.gridline { stroke: var(--color-core-grid); stroke-width: 1; }
.axis-label { font: 400 11px/16px var(--mono); fill: var(--muted); paint-order: stroke; stroke: var(--white); stroke-width: 3px; }

/* Side pane: search at top, open card, controls, foldable sections at the bottom */
.pane { width: var(--pane-width); box-sizing: border-box; display: flex; flex-direction: column; gap: 16px; padding: var(--space-app-pane); border-right: 1px solid var(--concrete); background: var(--white); overflow-y: auto; }
.pane .card { background: var(--receipt); padding: 14px var(--space-app-pane); display: flex; flex-direction: column; gap: 10px; }
.pane .fold { margin-top: auto; border-top: 1px solid var(--concrete); }
.fold > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 32px; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); margin: -4px 4px 0 0; }
.fold[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
@media (max-width: 760px) { .pane { width: 100%; height: 34vh; border-right: 0; border-top: 1px solid var(--concrete); } .pane.has-card { height: 55vh; } }

/* Vertical legend: line swatch, name, count; hidden kinds muted and struck through */
.legend-list { display: flex; flex-direction: column; }
.legend-list .row-btn { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: var(--control-pointer-compact); padding: 0 4px; border: 0; background: none; color: var(--ink); font: 400 13px/18px var(--sans); text-align: left; cursor: pointer; }
.legend-list .row-btn:hover { background: var(--receipt); }
.legend-list .row-btn .count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.legend-list .row-btn.off { color: var(--muted); text-decoration: line-through; }

/* Line swatch: stands in for a bullet when a list item belongs to a kind */
.swatch-line { display: inline-block; width: 24px; height: 0; border-top: 2px solid var(--swatch, var(--ink)); vertical-align: middle; }
.swatch-line.dashed { border-top-style: dashed; }

/* Floating panel (tooltips over a chart): white, square, ink edge, buttercup rule under the head, no shadow */
.float { background: var(--white); border: 1.5px solid var(--ink); padding: 10px 12px; max-width: 320px; }
.float .float-head { border-bottom: 4px solid var(--buttercup); padding-bottom: 6px; margin-bottom: 8px; font-weight: 600; }
