/* reversibility.org — The Reversibility Institute.
 *
 * A customised copy of the stylesheet.org framework: semantic HTML, a handful of
 * utility classes, no JavaScript. Theme is light and airy — white and pale cyan
 * surfaces, a clear red accent and a cyan secondary. Only section 2 (theme
 * tokens), the body glow, and section 6 (local additions) differ from upstream.
 *
 *   1. RESET          — constant
 *   2. THEME TOKENS   — :root variables (red + very light cyan)
 *   3. LAYOUT         — constant: row, column, grid, flow, stretch
 *   4. ELEMENTS       — constant: semantic tags styled directly
 *   5. COMPONENTS     — constant: panel, card, chip, buttons, status, paging, menu
 *   6. ADDITIONS      — local: hero, eyebrow, brand, post/news cards, ref lists
 */

/* ============================================================
   1. RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 7rem; }
body { min-height: 100vh; overflow-x: hidden; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg, video { max-width: 100%; height: auto; display: block; }

/* ============================================================
   2. THEME TOKENS  — the only section a theme changes  (red + very light cyan)
   ============================================================ */
:root {
  /* colour */
  --bg: #f6fdfe;               /* near-white page base with the faintest cyan */
  --surface: #ffffff;          /* panels, cards, the intro area */
  --surface-soft: #effafc;     /* nested panels / soft fills */
  --section-bg: #e9f8fb;       /* pale cyan */
  --band: #ddf3f7;             /* slightly deeper cyan — the full-width section band */
  --pad: 28px;                 /* content side padding */
  --header-bg: #ffffff;        /* clean white menu bar */
  --header-bg-2: #eef9fb;      /* pale cyan band for a stacked sub-nav */
  --fg: #213338;               /* dark slate-cyan text */
  --heading: #0f2429;
  --muted: #5f7b80;
  --border: #d3ecf0;           /* soft cyan border */
  --border-strong: #b7dee5;
  --accent: #e11d2a;           /* clear red — buttons, links, active */
  --accent-hover: #b3141f;
  --accent-fg: #ffffff;
  --accent-tint: #fde7e9;      /* light red — hovers, focus, quotes */
  --accent-2: #0891b2;         /* cyan — for "active" chips/badges */
  --accent-2-tint: #d4f3fa;
  --code-bg: #0f2429;          /* deep slate code block */
  --code-fg: #e7f6f9;
  --ok-fg: #04603e; --ok-bg: #e9fbf2; --ok-bd: #a6e9c8;
  --err-fg: #ad1b14; --err-bg: #fdf0ef; --err-bd: #f6c9c6;
  --info-fg: #0e6f8c; --info-bg: #e8f7fb; --info-bd: #b7e4ef;
  --warn-fg: #9a5a05; --warn-bg: #fff4d6; --warn-bd: #f3df9a;
  /* type */
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* space + shape */
  --space: 18px;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --maxw: 1040px;
  --shadow-sm: 0 1px 2px rgba(12, 74, 86, 0.05), 0 1px 3px rgba(12, 74, 86, 0.07);
  --shadow-md: 0 6px 14px -4px rgba(12, 74, 86, 0.13), 0 2px 6px -2px rgba(12, 74, 86, 0.07);
  --shadow-lg: 0 20px 30px -12px rgba(12, 74, 86, 0.20);
}

/* ============================================================
   3. LAYOUT  — structure only; references --space, never colour
   ============================================================ */
.row, .column { display: flex; gap: var(--space); }
.row { flex-direction: row; }
.column { flex-direction: column; }
.row > *, .column > * { flex: 0 0 auto; min-width: 0; min-height: 0; }
.stretch { flex: 1 1 0; min-width: 0; min-height: 0; }
.stretch-2 { flex-grow: 2; }
.stretch-3 { flex-grow: 3; }
.grid { display: grid; gap: var(--space); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.flow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
@media (max-width: 860px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* ============================================================
   4. ELEMENTS  — semantic tags styled directly
   ============================================================ */
body {
  background: radial-gradient(130% 760px at 50% 120px, #e6f9ff, #ffffff);   /* airy cyan glow under the top of main, easing out to white */
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
}

/* typography */
h1, h2, h3, h4, h5, h6 { color: var(--heading); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }
h4 { font-size: 1.02rem; letter-spacing: 0; }
h5, h6 { font-size: 0.9rem; letter-spacing: 0; }
a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
strong { font-weight: 650; color: var(--heading); }
small { color: var(--muted); font-size: 0.875em; }
ul, ol { padding-left: 1.4em; }
li { margin: 5px 0; }
li::marker { color: var(--accent); }
hr { border: none; border-top: 1px solid var(--border); }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-soft); border: 1px solid var(--border); padding: 0.1em 0.4em; border-radius: 6px; }
pre { background: var(--code-bg); color: var(--code-fg); border-radius: var(--radius-sm); padding: 16px 18px; overflow-x: auto; box-shadow: var(--shadow-sm); font-size: 0.85rem; line-height: 1.6; }
pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
blockquote { padding: 10px 18px; border-left: 3px solid var(--accent); background: var(--accent-tint); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--fg); }

/* header: clean white menu, sticky, stacked bars */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 2px 10px rgba(12, 74, 86, 0.07);
}
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
nav > a, nav > span { font-weight: 700; color: var(--heading); letter-spacing: -0.01em; }
nav > a:hover { text-decoration: none; }
nav > ul { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
nav > ul > li { margin: 0; }
nav ul a { display: block; padding: 7px 13px; border-radius: 8px; white-space: nowrap; color: var(--fg); font-size: 0.95rem; font-weight: 500; text-decoration: none; transition: background 0.15s, color 0.15s; }
nav ul a:hover { background: var(--surface-soft); color: var(--heading); text-decoration: none; }
nav a[aria-current] { background: var(--accent); color: #fff; }
nav a[aria-current]:hover { background: var(--accent); color: #fff; }
header > nav { padding: 12px 28px; }
header > nav:first-of-type > a { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; line-height: 1; color: var(--heading); }   /* brand: reverse mark + wordmark */
header > nav:first-of-type > a img { width: 30px; height: 30px; display: block; }
header > nav:first-of-type > a b { color: var(--accent); font-weight: 800; }
header > nav:first-of-type > ul { margin-left: auto; }                        /* brand left, links right */
header > nav ~ nav { border-top: 1px solid var(--border); background: var(--header-bg-2); padding-top: 9px; padding-bottom: 9px; }
header > nav ~ nav > span { font-size: 0.85rem; color: var(--accent-hover); text-transform: uppercase; letter-spacing: 0.05em; }
header > nav ~ nav ul a { font-size: 0.9rem; }

/* nav dropdowns (no JS): a nested <ul> in <details> (click) or bare (hover/focus) */
nav li { position: relative; }
nav li > ul, nav details > ul {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 210px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
nav li > ul li, nav details > ul li { margin: 0; }
nav summary { display: block; padding: 7px 13px; border-radius: 8px; cursor: pointer; color: var(--fg); font-size: 0.95rem; font-weight: 500; list-style: none; }
nav summary:hover { background: var(--surface-soft); color: var(--heading); }
nav summary::-webkit-details-marker { display: none; }
nav summary::after { content: "  ▾" / ""; color: var(--muted); }
nav details[open] > summary { background: var(--surface-soft); color: var(--heading); }
nav details[open] > summary::after { content: "  ▴" / ""; }
nav li:has(> ul) > a::after { content: "  ▾" / ""; color: var(--muted); }
nav li > ul { visibility: hidden; opacity: 0; transform: translateY(-4px); transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s; }
nav li:hover > ul, nav li:focus-within > ul { visibility: visible; opacity: 1; transform: none; }

/* main: a white intro showing the body glow; sections sit on pale cyan bands */
main {
  flex: 1 0 auto;                /* grow to fill: footer sticks to the bottom */
  width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 44px var(--pad) 0;
  display: flex; flex-direction: column; gap: 0;
}
main > :not(section) + :not(section) { margin-top: 28px; }
/* darker band filler — keeps short pages banded all the way down to the footer */
main::after { content: ""; flex: 1 0 auto; margin-inline: calc(var(--pad) * -1); background: var(--band); box-shadow: 0 0 0 100vw var(--band); clip-path: inset(0 -100vw); }
main > h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); letter-spacing: -0.025em; line-height: 1.12; }
main > h1 + p { max-width: 72ch; font-size: 1.15rem; color: var(--muted); }
main > ul { padding-left: 1.3em; max-width: 70ch; }
main > ul > li { margin: 0 0 18px; }
main > ul > li:last-child { margin-bottom: 0; }
main > ul > li > strong { font-size: 1.05rem; }
main > ul > li > p { margin-top: 4px; color: var(--muted); }

/* sections: pale-cyan full-width bands; content stays centred, background bleeds */
section { display: flex; flex-direction: column; gap: 16px; }
main > section { margin: 28px calc(var(--pad) * -1) 0; padding: 30px var(--pad); background: var(--band); box-shadow: 0 0 0 100vw var(--band); clip-path: inset(0 -100vw); }
main > section + section { margin-top: 0; }   /* consecutive bands are continuous */
main > section > h2 { padding-bottom: 8px; border-bottom: 2px solid var(--border-strong); }
section section { gap: 12px; }
section section section { gap: 9px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
caption { text-align: left; padding: 8px 0; font-weight: 600; color: var(--muted); }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
thead th { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-soft); border-bottom: 1px solid var(--border-strong); }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--accent-tint); }
tbody tr:last-child td { border-bottom: none; }

/* forms */
form { display: grid; gap: 15px; }
fieldset { padding: 16px; display: grid; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
legend { font-weight: 600; padding: 0 6px; color: var(--heading); }
label > p { font-weight: 550; font-size: 0.9rem; margin-bottom: 6px; color: var(--heading); }
input, select, textarea { width: 100%; padding: 9px 12px; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: 7px; accent-color: var(--accent); }

/* buttons (the element) + link buttons */
button, input[type="submit"], input[type="reset"], input[type="button"], a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: auto; padding: 9px 18px; font: inherit; font-weight: 550; line-height: 1.4;
  cursor: pointer; text-align: center; text-decoration: none;
  background: var(--accent); color: var(--accent-fg);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
button:hover, input[type="submit"]:hover, input[type="button"]:hover, a.button:hover {
  background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg);
  box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-1px);
}
.button.secondary, input[type="reset"], button.secondary { background: var(--surface); color: var(--fg); border-color: var(--border-strong); box-shadow: none; }
.button.secondary:hover, input[type="reset"]:hover, button.secondary:hover { background: var(--surface-soft); color: var(--fg); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.button.ghost, button.ghost { background: transparent; color: var(--accent); border-color: transparent; box-shadow: none; }
.button.ghost:hover, button.ghost:hover { background: var(--accent-tint); color: var(--accent-hover); }
.button.small, button.small { padding: 5px 12px; font-size: 0.9rem; }
.button.large, button.large { padding: 12px 24px; font-size: 1.05rem; }

/* menu: a sidebar nav */
menu { display: block; margin: 0; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
menu ol, menu ul { list-style: none; margin: 0; padding: 0; }
menu li { margin: 2px 0; }
menu p { margin: 12px 8px 4px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
menu a { display: block; padding: 7px 12px; color: var(--fg); border-radius: 8px; transition: background 0.15s; }
menu a:hover { background: var(--surface-soft); text-decoration: none; }
menu a[aria-current] { background: var(--accent-tint); color: var(--accent-hover); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }

/* ============================================================
   5. COMPONENTS
   ============================================================ */
.panel, .card { display: block; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.panel .panel, .card .card { background: var(--surface-soft); box-shadow: none; }
.card { transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.12s ease; }
a.card { color: inherit; }
a.card:hover, .grid > a.card:hover { text-decoration: none; box-shadow: var(--shadow-md); border-color: var(--accent); transform: translateY(-2px); }
.card > h2, .card > h3 { color: var(--accent); }

/* chip — an inline pill label */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: 0.85rem; font-weight: 550; line-height: 1.5; color: var(--fg); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); }
button.chip, a.chip { cursor: pointer; text-decoration: none; transition: background 0.15s, border-color 0.15s, color 0.15s; }
button.chip:hover, a.chip:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-hover); text-decoration: none; }
.chip.accent { background: var(--accent-tint); border-color: transparent; color: var(--accent-hover); }
.chip.cyan { background: var(--accent-2-tint); border-color: transparent; color: var(--accent-2); }

/* buttons — a group of actions */
.buttons { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* status — a banner / live region */
.status { display: block; padding: 11px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-weight: 500; }
.status.success { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-fg); }
.status.error   { background: var(--err-bg); border-color: var(--err-bd); color: var(--err-fg); }
.status.info    { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-fg); }
.status.warning { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }

/* paging — a Pagination nav */
.paging { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.paging a, .paging span { display: inline-block; padding: 7px 13px; border-radius: 8px; color: var(--fg); text-decoration: none; }
.paging a:hover { background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none; }
.paging a[aria-current] { background: var(--accent); color: var(--accent-fg); }
.paging span { color: var(--muted); }

/* footer — full-width bar; content constrained and centred */
footer { flex-shrink: 0; background: var(--bg); border-top: 1px solid var(--border-strong); color: var(--muted); }
footer > .row { width: 100%; padding: 22px var(--pad); align-items: center; flex-wrap: wrap; }
footer a { color: var(--muted); text-decoration: underline; }

/* ============================================================
   6. ADDITIONS  — local extras the framework does not cover yet
   ============================================================ */

/* Hero — a full-bleed airy band of white-to-cyan with a soft red glow. */
.hero {
  background:
    radial-gradient(820px 460px at 82% -20%, rgba(225, 29, 42, 0.10), transparent 60%),
    radial-gradient(900px 520px at 8% 120%, rgba(8, 145, 178, 0.12), transparent 60%),
    linear-gradient(170deg, #ffffff 0%, #f1fbfd 60%, #e6f7fb 100%);
  border-bottom: 1px solid var(--border-strong);
}
.hero-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(46px, 8vw, 86px) var(--pad);
  display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center;
}
.hero h1 { font-size: clamp(2.1rem, 5.5vw, 3.3rem); letter-spacing: -0.03em; line-height: 1.06; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { color: var(--muted); max-width: 60ch; font-size: 1.2rem; }
.hero .buttons { justify-content: center; margin-top: 4px; }

/* Eyebrow — a small upper-case kicker over a page title. */
.eyebrow { font-family: var(--mono); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent); }
.eyebrow a { color: var(--accent); }

/* Brand reverse-mark fallback when no image is used. */
.glyph { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font: 800 1.1rem/1 var(--font); }

/* Coloured chips for news / topic tags. */
.chip.red    { background: var(--accent-tint); border-color: transparent; color: var(--accent-hover); }
.chip.amber  { background: #f9eecf; border-color: transparent; color: #8a5a05; }
.chip.green  { background: #e2f1e5; border-color: transparent; color: #1f6b41; }
.chip.blue   { background: var(--accent-2-tint); border-color: transparent; color: var(--accent-2); }
.chip.violet { background: #ece4f5; border-color: transparent; color: #5d3f8a; }

/* News / article cards: a tag up top, a title, a description, a meta line at the base.
   Drop these into a .column to get the requested single-column card list. */
.post-card { display: flex; flex-direction: column; gap: 10px; }
.post-card h2, .post-card h3 { margin: 2px 0; }
.post-card .excerpt { color: var(--muted); }
.post-card .meta { margin-top: auto; padding-top: 6px; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }

/* Article meta line under a post title. */
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }

/* Reference / reading lists: a column of linked cards with a description each. */
.ref-card { display: flex; flex-direction: column; gap: 6px; }
.ref-card h3, .ref-card h4 { margin: 0; }
.ref-card p { color: var(--muted); }
.ref-card .src { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }

/* Home cards with a CTA pinned to the bottom so equal-height cards line up. */
.card:has(.card-cta) { display: flex; flex-direction: column; gap: 12px; }
.card-cta { margin-top: auto; align-self: start; }

/* Long card lists flow into two columns until the card gets narrow. */
.card ul.two-col { column-count: 2; column-gap: 1.6rem; }
.card ul.two-col li { break-inside: avoid; }
@media (max-width: 480px) { .card ul.two-col { column-count: 1; } }

/* Lead paragraph for a section overview. */
.lead { font-size: 1.15rem; color: var(--muted); max-width: 72ch; }
