/* Home, mortality, cardiac, videos and about pages.
   Same colours and type as the sodium calculators page (sodium/index.html has its own copy inline). */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
:root {
  color-scheme: light dark;
  --header: #0b5f91;
  --bg: #edf4f7;
  --surface: #ffffff;
  --surface-soft: #f5f9fb;
  --text: #10242f;
  --muted: #536a76;
  --line: #cbd9df;
  --blue: #0b5f91;
  --blue-strong: #064a71;
  --blue-soft: #dbeef7;
  --on-blue: #ffffff;
  --input-bg: #e7f4fa;
  --input-line: #94c7de;
  --result: #ffe26d;
  --result-text: #392e00;
  --warning-bg: #fff4c8;
  --warning-line: #e7ca56;
  --warning-text: #4a3a00;
  --error: #a6271f;
  --shadow: 0 12px 32px rgba(21, 61, 82, .10);
}
@media (prefers-color-scheme: dark) {
  :root {
    --header: #082d46;
    --bg: #071923;
    --surface: #0e2633;
    --surface-soft: #132f3e;
    --text: #edf7fb;
    --muted: #afc4cd;
    --line: #2a4a59;
    --blue: #68bee7;
    --blue-strong: #96d8f6;
    --blue-soft: #173d50;
    --on-blue: #052233;
    --input-bg: #12394b;
    --input-line: #347998;
    --result: #e7c94c;
    --result-text: #2e2600;
    --warning-bg: #392f0d;
    --warning-line: #7a671e;
    --warning-text: #ffe998;
    --error: #ff9a91;
    --shadow: 0 16px 36px rgba(0, 0, 0, .32);
  }
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; }
a { color: var(--blue-strong); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.shell { width: min(100%, 1080px); margin: 0 auto; padding: 0 18px 28px; }
.band { background: var(--header); }
.band .shell { padding-bottom: 0; }
.page-body { padding-top: 22px; }
.intro { color: #fff; padding: 22px 4px 30px; }
.intro .eyebrow { margin: 0; font-size: .9rem; font-weight: 600; opacity: .85; }
.intro h1 { margin: 5px 0 0; max-width: 780px; font-size: clamp(1.65rem, 5vw, 2.4rem); line-height: 1.12; letter-spacing: -.025em; font-weight: 700; }
.intro .lede { margin: 10px 0 0; max-width: 640px; font-size: 1rem; opacity: .92; line-height: 1.5; }
.intro a { color: #fff; }
.backlink { display: inline-block; margin: 0 0 10px; color: #fff; font-size: .86rem; font-weight: 600; text-decoration: none; opacity: .9; }
.backlink:hover { text-decoration: underline; opacity: 1; }
.backlink:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 22px; }
.panel-pad { padding: 20px; }
.panel h2 { margin: 0 0 8px; font-size: 1.3rem; letter-spacing: -.015em; line-height: 1.2; }
.panel p { margin: 0 0 12px; color: var(--muted); line-height: 1.55; }
.panel p:last-child { margin-bottom: 0; }
.section-title { margin: 28px 4px 12px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .075em; }

/* Home: choose a calculator */
.cards { display: grid; gap: 14px; }
.card {
  display: flex; flex-direction: column; gap: 6px; padding: 22px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  color: var(--text); text-decoration: none;
}
.card:hover { border-color: var(--blue); }
.card .tag { color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.card h2, .card h3 { margin: 0; font-size: 1.2rem; line-height: 1.22; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); line-height: 1.5; font-size: .95rem; }
.card .go { margin-top: 6px; color: var(--blue-strong); font-weight: 700; font-size: .92rem; }
.cards.quiet .card { padding: 16px 18px; box-shadow: none; }
@media (min-width: 760px) {
  .shell { padding: 0 28px 40px; }
  .intro { padding: 34px 4px 38px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .cards .wide { grid-column: 1 / -1; }
}

/* Calculator layout (mortality) */
.calc-layout { display: grid; gap: 16px; align-items: start; }
.calc-section-heading { margin: 8px 2px 0; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .075em; }
.calc-section-heading:first-child { margin-top: 0; }
.fields { display: grid; gap: 10px; }
.field {
  min-height: 68px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(132px, 42%); gap: 12px; align-items: center;
  padding: 10px 12px 10px 15px; background: var(--input-bg); border: 1px solid var(--input-line); border-radius: 12px;
}
.field > label, .field > .field-label { font-size: .9rem; font-weight: 600; line-height: 1.25; }
.input-wrap { position: relative; }
.input-wrap input {
  width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text);
  padding: 4px 54px 4px 10px; text-align: right; font-size: 1.05rem; font-variant-numeric: tabular-nums; font-weight: 600; outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
.input-wrap input::-webkit-inner-spin-button, .input-wrap input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-wrap input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); }
.input-wrap .unit { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); font-size: .72rem; font-weight: 600; }
.seg { display: inline-flex; justify-self: end; border: 1px solid var(--input-line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg-opt { position: relative; margin: 0; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span { display: block; min-width: 64px; padding: 10px 16px; text-align: center; font-weight: 600; font-size: .95rem; color: var(--muted); }
.seg-opt + .seg-opt span { border-left: 1px solid var(--input-line); }
.seg-opt input:checked + span { background: var(--blue); color: var(--on-blue); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--blue-strong); outline-offset: -3px; }
.form-error { margin: 4px 2px 0; min-height: 1.1em; color: var(--error); font-size: .84rem; font-weight: 600; }

.result-card {
  background: var(--result); color: var(--result-text); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.result-card .result-label { font-size: .9rem; font-weight: 700; line-height: 1.25; }
.result-card output { font-size: clamp(2.1rem, 9vw, 3rem); line-height: .95; font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.result-card .result-unit, .gauge { display: none; }
.calc-aside { position: sticky; bottom: 10px; z-index: 5; }
@media (min-width: 900px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; }
  .calc-aside { bottom: auto; top: 16px; }
  .result-card { display: block; padding: 22px; }
  .result-card output { display: block; margin: 10px 0 2px; font-size: 3.6rem; }
  .result-card .result-unit { display: block; font-size: .8rem; font-weight: 700; }
  .gauge { display: block; margin-top: 18px; }
}
.gauge-track { position: relative; height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--result-text) 22%, transparent); }
.gauge-pin { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--result-text); border: 3px solid var(--result); }
.gauge-ticks { position: relative; height: 1.3em; margin-top: 6px; font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.gauge-ticks span { position: absolute; transform: translateX(-50%); }
.gauge-ticks span:first-child { transform: none; }
.gauge-ticks span:last-child { transform: translateX(-100%); }
.model-note { margin: 18px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--line); color: var(--muted); font-size: .8rem; line-height: 1.55; }

.disclaimer { margin: 18px 0 0; padding: 15px 16px; background: var(--warning-bg); border: 1px solid var(--warning-line); border-radius: 12px; color: var(--warning-text); }
.disclaimer summary { cursor: pointer; font-weight: 700; font-size: .86rem; }
.disclaimer summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.disclaimer p { margin: 10px 0 0; font-size: .76rem; line-height: 1.52; color: inherit; }

/* Buttons, external links */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border-radius: 12px;
  font-weight: 700; font-size: .95rem; text-decoration: none; border: 1px solid var(--blue);
}
.button.primary { background: var(--blue); color: var(--on-blue); }
.button.secondary { background: var(--surface); color: var(--blue-strong); }
.button:hover { filter: brightness(1.06); }

/* Videos */
.video-grid { display: grid; gap: 16px; }
.video-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.video-frame { aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.video-card h3 { margin: 0; padding: 14px 16px 16px; font-size: .95rem; line-height: 1.35; }
.channel-card { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--blue-soft); }
.channel-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.channel-card p { margin: 0; color: var(--muted); }
@media (min-width: 700px) { .video-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1020px) { .video-grid { grid-template-columns: 1fr 1fr 1fr; } }

.about-copy { max-width: 720px; font-size: 1.05rem; line-height: 1.65; margin: 0 0 20px; }
.noscript { margin: 16px 0; padding: 14px; background: var(--warning-bg); color: var(--warning-text); border-radius: 10px; }
@media (max-width: 390px) {
  .shell { padding-left: 12px; padding-right: 12px; }
  .field { grid-template-columns: minmax(0, 1fr) 132px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
