/* Site styles. One file, no build step.
   Colours and sizes are set once as variables at the top. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: italic; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: italic; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-700-italic.woff2") format("woff2"); }

/* Every text and background pair below meets WCAG AA (4.5:1 for text,
   3:1 for borders, buttons and focus rings) in both colour schemes. */
:root {
  --ink: #16191f;
  --ink-soft: #545b66;
  --paper: #fffcf5;      /* cream page */
  --panel: #f0f0f0;      /* release panel and closing band */
  --card: #ffffff;       /* author and chapter cards */
  --rule: #e2dfd8;
  --accent: #00717f;     /* links, pills, focus ring */
  --button-bg: #1f2b45;  /* navy primary button */
  --button-ink: #ffffff;
  --radius: 0.75rem;
  --measure: 42rem;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ecebe6;
    --ink-soft: #b0b8c6;
    --paper: #131c2e;      /* navy page */
    --panel: #1b2640;
    --card: #18223a;
    --rule: #2f3b55;
    --accent: #6fd0db;
    --button-bg: #f3efe4;  /* light button with navy text */
    --button-ink: #1f2b45;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: calc(var(--measure) + 2rem); margin-inline: auto; padding-inline: 1rem; }

.skip-link { position: absolute; left: -999rem; }
.skip-link:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 0.75rem; z-index: 10; }

/* ---------- Header and footer ---------- */

.site-header { border-bottom: 1px solid var(--rule); }
.site-header-inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1.5rem; padding-block: 0.9rem; }
.site-title { color: var(--ink); font-weight: 600; text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }

.site-footer { margin-top: 4rem; border-top: 1px solid var(--rule); padding-block: 1.5rem 2.5rem; color: var(--ink-soft); font-size: 0.9375rem; }
.site-footer p { margin: 0.35rem 0; }

/* ---------- Hero ---------- */

.hero { padding-block: 3rem 0; }
.hero-inner::after { content: ""; display: block; padding-top: 2.5rem; border-bottom: 1px solid var(--rule); }
.hero h1 { font-size: clamp(2rem, 6vw, 3.1rem); font-weight: 400; line-height: 1.12; letter-spacing: -0.015em; margin: 1rem 0 0.5rem; text-wrap: balance; }
.hero-subtitle { font-size: clamp(1.2rem, 3.2vw, 1.5rem); margin: 0; }
.hero-tagline { font-size: 1.125rem; color: var(--ink-soft); margin: 0.75rem 0 0; text-wrap: pretty; }
.hero-author { margin: 1.5rem 0 0; font-weight: 600; }

/* Cover: beside the text on wider screens, centred level with the middle of
   the text column; above the text and centred on phones. Never wider
   than the image's natural 516 px. width/height in the HTML reserve the space. */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 13rem; gap: 1rem 2.25rem; align-items: center; }
.hero-cover { grid-column: 2; grid-row: 1; margin: 0; }
.hero-text { grid-column: 1; grid-row: 1; }
.hero-cover img { display: block; width: 100%; max-width: 516px; height: auto; border: 1px solid var(--rule); border-radius: 2px; box-shadow: 0 6px 18px rgb(0 0 0 / 0.12); }
.hero-grid .hero-text h1 { font-size: clamp(2rem, 5vw, 2.6rem); margin-top: 0.9rem; }
@media (max-width: 40rem) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-cover, .hero-text { grid-column: 1; }
  .hero-cover { grid-row: 1; justify-self: center; width: min(13rem, 60%); margin: 0 0 1rem; }
  .hero-text { grid-row: 2; }
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.button { display: inline-block; padding: 0.6rem 1.35rem; border: 1.5px solid var(--ink-soft); border-radius: 999px; color: var(--ink); font-weight: 600; text-decoration: none; }
.button:hover { text-decoration: underline; }
.button-primary { background: var(--button-bg); border-color: var(--button-bg); color: var(--button-ink); }

/* ---------- Landing page panels, cards and closing band ---------- */

.feature-panel { margin-top: 2.5rem; padding: 0.25rem 1.5rem 0.5rem; background: var(--panel); border-radius: var(--radius); }
.feature-panel .update-list li { border-color: var(--rule); }
.card { margin-top: 2.75rem; padding: 0.25rem 1.5rem 0.4rem; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); }
.card h2, .feature-panel h2 { margin-top: 1.25rem; font-size: 1.2rem; }
.panel-actions { margin: 0 0 1.25rem; }

.home-contents .contents-part h3 { margin: 2.25rem 0 0.75rem; font-size: clamp(1.4rem, 4vw, 1.75rem); font-weight: 400; color: var(--ink); }
.home-contents .contents-list { display: grid; gap: 0.75rem; border-top: 0; }
.home-contents .contents-list li { padding: 1rem 1.25rem; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); }
.contents-summary { grid-column: 2 / -1; margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 0.9375rem; line-height: 1.6; }

.band { margin-top: 4rem; padding-block: 3.5rem 2.5rem; background: var(--panel); text-align: center; }
.band h2 { margin: 0 0 0.75rem; font-size: clamp(1.6rem, 5vw, 2.2rem); line-height: 1.2; }
.band p { margin: 0 auto; max-width: 36rem; }
.band .actions, .band .share-list { justify-content: center; }
.band .share { margin-top: 2.5rem; border-top-color: var(--rule); }
main:has(> .band:last-child) + .site-footer { margin-top: 0; }

@media (max-width: 34rem) {
  .feature-panel, .card { padding-inline: 1rem; }
  .home-contents .contents-list li { padding-inline: 0.9rem; }
}

/* ---------- Prose ---------- */

.prose h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); line-height: 1.18; margin: 0.4rem 0 1rem; text-wrap: balance; }
.prose h2 { font-size: 1.45rem; line-height: 1.25; margin: 2.75rem 0 0.75rem; }
.prose h3 { font-size: 1.15rem; line-height: 1.3; margin: 2rem 0 0.5rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table { margin: 0 0 1.1rem; }
.prose li { margin-bottom: 0.3rem; }
.prose img { display: block; max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 0.25rem; }
.prose blockquote { margin-inline: 0; padding: 0.75rem 1.1rem; background: var(--panel); border-left: 4px solid var(--accent); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.9em; background: var(--panel); padding: 0.1em 0.3em; border-radius: 0.2rem; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 0.9375rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 0.5rem 0.9rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
.prose th { border-bottom-width: 2px; }
.page, .chapter { padding-top: 2.5rem; }
.home section:first-child h2 { margin-top: 2.5rem; }

.small { font-size: 0.875rem; color: var(--ink-soft); }
.eyebrow { margin: 0; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.eyebrow a { color: inherit; }

.heading-anchor { margin-left: 0.4rem; color: var(--ink-soft); font-weight: 400; text-decoration: none; opacity: 0; }
h2:hover .heading-anchor, h3:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
@media (hover: none) { .heading-anchor { opacity: 0.55; } }

/* ---------- Pills and notices ---------- */

.pill { display: inline-block; padding: 0.1rem 0.6rem; border: 1px solid var(--rule); border-radius: 999px; font-size: 0.8125rem; font-weight: 600; line-height: 1.5; white-space: nowrap; color: var(--ink-soft); }
.pill-preview, .pill-published, .pill-release { border-color: var(--accent); color: var(--accent); }
.pill-draft { border-style: dashed; }
.status-line .pill { margin-right: 0.4rem; }

.notice { padding: 0.75rem 1rem; background: var(--panel); border: 1px solid var(--rule); border-radius: 0.3rem; font-size: 0.9375rem; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 1.1rem; list-style: none; padding: 0; color: var(--ink-soft); font-size: 0.9375rem; }
.meta li { margin: 0; }

/* ---------- Table of contents ---------- */

.contents-part h3 { margin-top: 1.5rem; font-size: 1rem; color: var(--ink-soft); }
.contents-list { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.contents-list li { display: grid; grid-template-columns: 1.75rem 1fr auto; gap: 0.75rem; align-items: baseline; margin: 0; padding: 0.65rem 0; border-bottom: 1px solid var(--rule); }
.contents-number { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.contents-title { font-weight: 600; }
span.contents-title { font-weight: 400; }

/* ---------- Citations and references ---------- */

.cite { font-size: 0.85em; white-space: nowrap; }
.cite a { text-decoration: none; }
.cite a:hover { text-decoration: underline; }
.cite-missing { background: #ffd9d2; color: #7a1c0b; padding: 0 0.25em; font-weight: 600; }

.chapter-references, .cite-this { margin-top: 3rem; padding-top: 0.25rem; border-top: 1px solid var(--rule); }
.chapter-references ol { padding-left: 1.5rem; }
.chapter-references li, .reference-text { overflow-wrap: anywhere; }
.chapter-references li:target, .reference-list li:target { background: var(--panel); outline: 0.6rem solid var(--panel); }
.ref-permalink { font-size: 0.875rem; white-space: nowrap; }
.chapter-references-note { font-size: 0.9375rem; color: var(--ink-soft); }
.cite-this p { overflow-wrap: anywhere; }

.reference-list { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.reference-list li { margin: 0; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.reference-list .reference-text { margin-bottom: 0.3rem; }
.reference-list-numbered { list-style: decimal; padding-left: 2rem; }
.reference-list-numbered li { padding-left: 0.25rem; }
.reference-list-numbered li::marker { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.reference-contents ol { padding-left: 1.5rem; margin-bottom: 0.5rem; }
.reference-contents li { margin-bottom: 0.15rem; }
.reference-section h2 { scroll-margin-top: 1rem; }
.reference-empty { color: var(--ink-soft); }
.reference-meta { margin: 0; font-size: 0.875rem; color: var(--ink-soft); }
.reference-title { font-size: clamp(1.4rem, 4vw, 1.8rem); }
.reference-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.25rem; margin: 1.5rem 0; overflow-wrap: anywhere; }
.reference-facts dt { color: var(--ink-soft); font-size: 0.9375rem; }
.reference-facts dd { margin: 0; }
@media (max-width: 34rem) { .reference-facts { grid-template-columns: 1fr; gap: 0.1rem; } .reference-facts dd { margin-bottom: 0.75rem; } }

/* ---------- Progress updates ---------- */

.update-list { list-style: none; padding: 0; }
.update-list li { display: grid; grid-template-columns: 9.5rem 1fr; gap: 0 1rem; margin: 0; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.update-list time { color: var(--ink-soft); font-size: 0.9375rem; }
.update-summary { grid-column: 2; color: var(--ink-soft); font-size: 0.9375rem; }
@media (max-width: 34rem) { .update-list li { grid-template-columns: 1fr; } .update-summary { grid-column: 1; } }

/* ---------- Share and chapter navigation ---------- */

.share { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.share-label { margin: 0 0 0.5rem; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.share-list { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.share-list li { margin: 0; }
.share-list li:has([hidden]) { display: none; }
.share-button { display: inline-block; padding: 0.35rem 0.8rem; border: 1px solid var(--ink-soft); border-radius: 0.3rem; background: transparent; color: var(--ink); font: inherit; font-size: 0.9375rem; line-height: 1.5; text-decoration: none; cursor: pointer; }
.share-button:hover { background: var(--panel); }
.share-status { min-height: 1.5rem; margin: 0.5rem 0 0; font-size: 0.875rem; color: var(--ink-soft); }

.chapter-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.chapter-nav-link { text-decoration: none; font-weight: 600; }
.chapter-nav-link span { display: block; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.chapter-nav-contents { text-align: center; }
.chapter-nav-next { text-align: right; }
@media (max-width: 34rem) { .chapter-nav { grid-template-columns: 1fr; } .chapter-nav-contents, .chapter-nav-next { text-align: left; } .chapter-nav > span:empty { display: none; } }

@media print {
  .site-header nav, .share, .chapter-nav, .actions, .skip-link { display: none; }
  body { font-size: 11pt; }
}
