/* Shared stylesheet for the small static sites. No framework. Each site's theme.css (appended after
   this file) sets the colour tokens below and may add a few site-specific rules. */
:root {
  --brand: #2f4f4f;          /* main colour: headings on light backgrounds, buttons */
  --brand-dark: #1f3838;     /* header and footer background */
  --head-ink: #e8efec;       /* header/footer text */
  --head-muted: #a9bdb7;
  --head-accent: #dff28f;    /* logo highlight, search icon, current nav item */
  --head-line: #d93025;      /* strip under the header */
  --accent: #d93025;
  --hero-bg: #f6f8f3;
  --hero-pattern: none;
  --hero-title: var(--brand);
  --bg: #ffffff;
  --surface: #f6f8f3;
  --ink: #1c2424;
  --muted: #586767;
  --line: #dde5d6;
  --link: #1f6f62;
  --link-hover: #0f4d43;
  --code-bg: #eef3e4;
  --code-ink: #23312b;
  --note-bg: #eef6f1;
  --note-line: #2f8f6f;
  --warn-bg: #fff4ec;
  --warn-line: #d9622b;
  --focus: #7fc8b4;
  --shadow: 0 1px 2px rgba(20, 40, 35, .06), 0 4px 16px rgba(20, 40, 35, .06);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--font); }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: 2px; overflow-wrap: anywhere; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; color: #000; padding: 8px 12px; z-index: 50; border-radius: 6px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* header */
.site-header { background: var(--brand-dark); color: var(--head-ink); border-bottom: 3px solid var(--head-line); position: relative; z-index: 20; }
.header-row { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.3rem; letter-spacing: -.01em; white-space: nowrap; }
.logo:hover { color: #fff; }
.logo-mark { width: 36px; height: 36px; flex: none; }
.logo-text b { color: var(--head-accent); font-weight: 800; }
.logo-text i { font-style: normal; color: var(--head-muted); font-weight: 500; }
.header-panel { display: flex; align-items: center; gap: 18px; flex: 1; justify-content: flex-end; }
.site-header nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.site-header nav a { color: var(--head-ink); text-decoration: none; padding: 8px 11px; border-radius: 8px; font-weight: 600; font-size: .96rem; display: block; }
.site-header nav a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.site-header nav a[aria-current] { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 0 -2px 0 var(--head-accent); }
.header-search { display: flex; align-items: center; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: 2px 4px 2px 14px; min-width: 220px; }
.header-search input { flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; font: inherit; font-size: .93rem; padding: 6px 0; }
.header-search input::placeholder { color: var(--head-muted); }
.header-search input:focus { outline: none; }
.header-search:focus-within { border-color: var(--head-accent); }
.header-search button { background: none; border: 0; color: var(--head-accent); width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; border-radius: 50%; }
.header-search button svg { width: 19px; height: 19px; }
.menu-toggle { display: none; margin-left: auto; background: transparent; border: 1px solid rgba(255, 255, 255, .28); color: #fff; border-radius: 8px; padding: 7px 12px; font: 600 .92rem var(--font); gap: 8px; align-items: center; cursor: pointer; }
.burger, .burger::before, .burger::after { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; transition: transform .2s; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }
.menu-open .burger { background: transparent; }
.menu-open .burger::before { transform: translateY(6px) rotate(45deg); }
.menu-open .burger::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 960px) {
  .menu-toggle { display: inline-flex; }
  .header-row { flex-wrap: wrap; gap: 12px; min-height: 58px; }
  .header-panel { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 10px; padding: 4px 0 16px; }
  .menu-open .header-panel { display: flex; }
  .header-search { order: -1; min-width: 0; padding: 4px 6px 4px 16px; }
  .header-search input { font-size: 1rem; padding: 8px 0; }
  .site-header nav ul { flex-direction: column; gap: 2px; }
  .site-header nav a { padding: 11px 12px; font-size: 1.02rem; }
}

/* hero */
.hero { background-color: var(--hero-bg); background-image: var(--hero-pattern); border-bottom: 1px solid var(--line); }
.hero-inner { padding: 54px 20px 50px; max-width: 920px; }
.hero-kicker { color: var(--accent); margin: 0 0 8px; font-size: .95rem; font-weight: 700; letter-spacing: .02em; }
.hero h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); line-height: 1.15; margin: 0 0 14px; letter-spacing: -.02em; color: var(--hero-title); }
.hero-lede { font-size: 1.15rem; color: var(--muted); max-width: 700px; margin: 0 0 24px; }
.hero-search { display: flex; gap: 8px; max-width: 640px; }
.hero-search input { flex: 1; min-width: 0; font: inherit; padding: 13px 16px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); box-shadow: var(--shadow); }
.hero-search input:focus { outline: none; border-color: var(--link); }
.hero-search button, .button { font: 700 1rem var(--font); padding: 12px 20px; border-radius: 10px; border: 0; background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
.hero-search button:hover, .button:hover { background: var(--brand-dark); color: #fff; }

/* layout */
.page { display: block; padding: 28px 20px 56px; }
.page.has-aside { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 48px; align-items: start; }
.content { min-width: 0; max-width: 800px; }
.sidebar { position: sticky; top: 16px; display: grid; gap: 18px; font-size: .93rem; }
@media (max-width: 960px) {
  .page.has-aside { display: block; }
  .sidebar { position: static; margin-top: 40px; }
  .sidebar .toc { display: none; }
}
.aside-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.aside-head { margin: 0 0 8px; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.aside-box ul, .aside-box ol { margin: 0; padding: 0 0 0 18px; }
.aside-box ul { list-style: none; padding: 0; }
.aside-box li { margin: 3px 0; line-height: 1.4; }
.aside-box a { text-decoration: none; }
.aside-box a:hover { text-decoration: underline; }
.aside-box a[aria-current] { font-weight: 700; color: var(--ink); }

/* typography */
h1 { font-size: clamp(1.75rem, 3.4vw, 2.35rem); line-height: 1.2; margin: 6px 0 10px; letter-spacing: -.015em; }
h2 { font-size: 1.45rem; line-height: 1.3; margin: 2.1em 0 .55em; padding-top: .2em; letter-spacing: -.01em; }
h3 { font-size: 1.15rem; margin: 1.7em 0 .4em; }
h2 + h3 { margin-top: .8em; }
p, ul, ol, dl, table, pre, blockquote { margin: 0 0 1.05em; }
li { margin: .25em 0; }
.lede { font-size: 1.16rem; color: var(--muted); margin-bottom: .6em; }
.page-meta { font-size: .85rem; color: var(--muted); margin: 0 0 1.6em; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { margin: 0 4px; }
dt { font-weight: 700; margin-top: .7em; }
dd { margin: .2em 0 .6em 1.2em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
blockquote { border-left: 4px solid var(--line); padding: 4px 0 4px 16px; color: var(--muted); font-family: var(--serif); font-size: 1.05rem; }
code, kbd { font-family: var(--mono); font-size: .88em; }
:not(pre) > code { background: var(--code-bg); color: var(--code-ink); padding: .1em .38em; border-radius: 5px; overflow-wrap: anywhere; }
pre { background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; font-size: .9rem; }

table { border-collapse: collapse; width: 100%; font-size: .94rem; display: block; overflow-x: auto; }
@media (min-width: 700px) { table { display: table; } }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface); font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
caption { text-align: left; font-size: .88rem; color: var(--muted); caption-side: bottom; padding-top: 6px; }

.note, .warn, .tip { border-left: 4px solid var(--note-line); background: var(--note-bg); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 1.2em; }
.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.note > :last-child, .warn > :last-child, .tip > :last-child { margin-bottom: 0; }
.note strong:first-child, .warn strong:first-child { display: block; margin-bottom: 2px; }
.check-list { list-style: none; padding: 0; }
.check-list li { position: relative; padding-left: 30px; margin: .55em 0; }
.check-list li::before { content: ""; position: absolute; left: 2px; top: .3em; width: 16px; height: 16px; border: 2px solid var(--note-line); border-radius: 4px; }
.sources { font-size: .9rem; color: var(--muted); }
.sources li { margin: .15em 0; }

/* key figures */
.figures { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 0 0 1.4em; }
.figures li { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.figures b { display: block; font-size: 1.45rem; color: var(--brand); line-height: 1.2; font-variant-numeric: tabular-nums; }
.figures span { display: block; font-size: .88rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }

/* questions and answers */
details { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; margin: 0 0 10px; background: var(--bg); }
details[open] { padding-bottom: 6px; }
summary { cursor: pointer; font-weight: 700; padding: 12px 0; list-style-position: outside; }
summary:hover { color: var(--link); }

/* verses (science songs) */
.verse { font-family: var(--serif); font-size: 1.06rem; line-height: 1.7; background: var(--surface); border-left: 4px solid var(--accent); padding: 14px 18px; border-radius: 0 var(--radius) var(--radius) 0; white-space: pre-line; }
.verse .tune { display: block; font-family: var(--font); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; white-space: normal; }

/* calculators */
.calc { border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 8px; background: var(--surface); margin: 0 0 1.6em; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; }
.calc label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.calc input, .calc select { width: 100%; font: inherit; padding: 9px 11px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); }
.calc input:focus, .calc select:focus { outline: none; border-color: var(--link); }
.calc .hint { display: block; font-size: .8rem; color: var(--muted); margin-top: 3px; }
.calc-out { margin: 16px 0 10px; padding: 14px 16px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.calc-out p { margin: 0 0 .4em; }
.calc-out .big { font-size: 1.5rem; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.calc table { margin-top: 8px; }

/* cards */
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cards li { margin: 0; }
.cards a { display: block; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); background: var(--bg); transition: border-color .15s, box-shadow .15s, transform .15s; }
.cards a:hover { border-color: var(--link); box-shadow: var(--shadow); transform: translateY(-1px); }
.cards strong { display: block; color: var(--link); margin-bottom: 4px; line-height: 1.3; }
.cards span { display: block; font-size: .9rem; color: var(--muted); line-height: 1.45; }
.related { margin-top: 3em; border-top: 1px solid var(--line); }
.links { list-style: none; padding: 0; }
.links li { padding: 9px 0; border-bottom: 1px solid var(--line); margin: 0; }
.links li > a:first-child { font-weight: 700; }

/* home */
.home-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; list-style: none; padding: 0; margin: 8px 0 30px; }
.home-sections li { margin: 0; }
.home-sections a { display: block; height: 100%; padding: 20px; border-radius: 12px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); background: var(--bg); box-shadow: var(--shadow); }
.home-sections a:hover { border-color: var(--link); }
.home-sections .icon { color: var(--accent); font-weight: 800; display: block; margin-bottom: 6px; font-size: .9rem; letter-spacing: .04em; text-transform: uppercase; }
.home-sections strong { display: block; font-size: 1.15rem; color: var(--brand); margin-bottom: 4px; }
.home-sections span.d { color: var(--muted); font-size: .94rem; line-height: 1.5; display: block; }
.sec-home .content { max-width: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* search */
.search-big { display: flex; gap: 8px; margin: 10px 0 20px; }
.search-big input { flex: 1; min-width: 0; font: inherit; padding: 11px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); }
.search-results { list-style: none; padding: 0; }
.search-results li { padding: 12px 0; border-bottom: 1px solid var(--line); margin: 0; }
.search-results a { font-weight: 700; font-size: 1.06rem; }
.search-results .sr-sec { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-left: 8px; }
.search-results p { margin: 3px 0 0; color: var(--muted); font-size: .94rem; }
.sitemap-list { columns: 2 300px; }
.sitemap-list li { break-inside: avoid; }

/* footer */
.site-footer { background: var(--brand-dark); color: var(--head-ink); margin-top: 40px; font-size: .93rem; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; padding-top: 36px; padding-bottom: 24px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 20px; } }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; font-size: 1.15rem; margin: 0 0 8px; }
.footer-brand .logo-mark { width: 30px; height: 30px; }
.footer-brand b { color: var(--head-accent); }
.footer-brand i { font-style: normal; color: var(--head-muted); font-weight: 500; }
.footer-head { font-weight: 700; color: #fff; margin: 0 0 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0 0 12px; }
.site-footer li { margin: 4px 0; }
.site-footer .muted { color: var(--head-muted); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 14px; padding-bottom: 18px; color: var(--head-muted); font-size: .85rem; }

@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .wrap { padding: 0 16px; }
  .page { padding: 20px 16px 44px; }
  .hero-inner { padding: 36px 16px 34px; }
  .hero-search { flex-direction: column; }
}
@media print {
  .site-header, .site-footer, .sidebar, .hero-search { display: none !important; }
  a { color: #000; }
}

/* rrsp.org theme: the old site's teal (#006666), peach (#ffcc99) and cream (#fffbf0), modernised. */
:root {
  --brand: #0d6464;
  --brand-dark: #0a3d3f;
  --head-ink: #e6f1ef;
  --head-muted: #9dbdb9;
  --head-accent: #ffc48c;
  --head-line: #f0a35e;
  --accent: #b5541c;
  --hero-bg: #fffaf0;
  --hero-pattern: radial-gradient(circle at 92% 18%, rgba(255, 196, 140, .45) 0, rgba(255, 196, 140, 0) 42%), radial-gradient(circle at 8% 110%, rgba(13, 100, 100, .10) 0, rgba(13, 100, 100, 0) 45%);
  --hero-title: #0a4a4b;
  --bg: #ffffff;
  --surface: #fbf7ef;
  --ink: #1d2626;
  --muted: #56615f;
  --line: #e7dfd0;
  --link: #0b6a6a;
  --link-hover: #074747;
  --code-bg: #f4efe4;
  --code-ink: #2d2a24;
  --note-bg: #edf6f4;
  --note-line: #1f8a80;
  --warn-bg: #fff3e8;
  --warn-line: #d9742b;
  --focus: #f0a35e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #6cc7c0;
    --brand-dark: #08292a;
    --hero-bg: #12201f;
    --hero-pattern: radial-gradient(circle at 92% 18%, rgba(240, 163, 94, .16) 0, rgba(240, 163, 94, 0) 42%);
    --hero-title: #ffd9b3;
    --accent: #f3a368;
    --bg: #101818;
    --surface: #172221;
    --ink: #e4ecea;
    --muted: #a3b3b0;
    --line: #2a3a38;
    --link: #79d3cb;
    --link-hover: #b5ece6;
    --code-bg: #1d2a29;
    --code-ink: #e2ddd2;
    --note-bg: #142825;
    --note-line: #4bb3a8;
    --warn-bg: #2b1e14;
    --warn-line: #e88d4b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
  .hero-search button, .button { background: #1d7a74; }
}
.hero-kicker { color: var(--accent); }
.figures b { color: var(--brand); }
