/* ==========================================================================
   Peetu Keskinen — personal academic site
   Single stylesheet. No build step, no dependencies.

   Contents
     1. Tokens
     2. Base & typography
     3. Layout
     4. Header & navigation
     5. Footer
     6. Prose components (identity, portrait, facts, notes)
     7. Research entries      -> .entry  (reusable project pattern)
     8. Publication lists     -> .biblio (reusable bibliography pattern)
     9. Utilities
    10. Responsive adjustments
    11. DSA calculator       -> dsa.html
    12. Print
   ========================================================================== */


/* 1. Tokens ---------------------------------------------------------------- */

/* Source Serif 4 (SIL Open Font License, assets/fonts/OFL.txt), self-hosted so
   every browser shows the same face. Variable in weight and optical size, with
   real lining and tabular figures. Latin-ext loads only when a page uses it. */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/source-serif-4-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/source-serif-4-normal-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/source-serif-4-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/source-serif-4-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Native controls, scrollbars and the canvas follow the colour scheme too. */
  color-scheme: light dark;

  /* Warm paper palette: cream ground, warm ink, muted oxblood accent.
     Contrast on --bg: ink 15.4:1, muted 7.1:1, link 8.9:1 — all AAA.
     --rule-strong is 3.1:1, the non-text threshold for borders. */
  --bg:            #fbf9f5;
  --bg-inset:      #f2eee5;
  --ink:           #23201b;
  --ink-muted:     #5b5449;
  --rule:          #e3ddd0;
  --rule-strong:   #978d79;
  --link:          #7b2d2d;
  --link-hover:    #5c1f1f;
  --focus:         #7b2d2d;
  --accent:        #7b2d2d;

  --serif: "Source Serif 4", Georgia, "Times New Roman", Times, serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --measure:   42rem;   /* readable line length for prose            */
  --label-col: 9rem;    /* date gutter on the CV, label column of .facts */
  --gutter:    1.5rem;
  --space-sm:  0.75rem;
  --space-md:  1.75rem;
  --space-lg:  3rem;
  --space-xl:  4.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #1a1815;
    --bg-inset:    #232019;
    --ink:         #ece7dd;
    --ink-muted:   #a9a294;
    --rule:        #35312b;
    --rule-strong: #6b6458;
    --link:        #dda6a0;
    --link-hover:  #f0c8c4;
    --focus:       #dda6a0;
    --accent:      #b3736c;
  }
}


/* 2. Base & typography ----------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;      /* 17px */
  line-height: 1.65;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  border-top: 3px solid var(--accent);   /* single restrained accent */
}

::selection { background: #ecdcd6; color: #3a1616; }

@media (prefers-color-scheme: dark) {
  ::selection { background: #543430; color: #f7ebe8; }
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 var(--space-sm);
  text-wrap: balance;
}

h1 {
  font-size: 2rem;
  letter-spacing: -0.014em;
}

h2 {
  font-size: 1.3rem;
  letter-spacing: -0.006em;
  margin-top: var(--space-xl);
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--rule-strong);
}

/* Sections are numbered per page, as in a paper. Numbering is generated by
   CSS, so adding, reordering or removing a <section> needs no renumbering. */
main { counter-reset: section; }

main h2 { counter-increment: section; }

main h2::before {
  content: counter(section) ".";
  margin-right: 0.5rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* First heading after a page intro should not push down as far. */
h1 + h2,
h1 + section h2,
.page-intro + section h2,
.lead + section h2 { margin-top: var(--space-lg); }

h3 {
  font-size: 1.0625rem;
  margin-top: var(--space-md);
}

[id] { scroll-margin-top: 1.5rem; }

/* Small-caps section label, used sparingly. */
.eyebrow {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 var(--space-sm);
}

p { margin: 0 0 1.05em; text-wrap: pretty; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 42%, transparent);
  text-underline-offset: 0.16em;
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}

/* One focus ring for everything a keyboard can reach, in the site's colour
   rather than each browser's default. */
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

:where(ul, ol) { padding-left: 1.25rem; margin: 0 0 1.05em; }
li { margin-bottom: 0.35em; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--space-lg) 0;
}

abbr[title] { text-decoration: none; border-bottom: 1px dotted var(--rule-strong); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: var(--bg-inset);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}


/* 3. Layout ---------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main { padding-block: var(--space-lg) var(--space-xl); }

/* Skip link — visible only to keyboard users, on focus. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  text-decoration: none;
  z-index: 10;
}

.skip-link:focus { left: 0.5rem; top: 0.5rem; }


/* 4. Header & navigation --------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  padding-block: var(--space-md) 0;
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
}

.site-title {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  margin: 0;
}

.site-title a { color: var(--ink); text-decoration: none; }
.site-title a:hover { color: var(--link); }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li { margin: 0; }

.site-nav a {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }

/* Current page: marked with aria-current="page" in the HTML. */
.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}


/* 5. Footer ---------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: var(--space-md);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  justify-content: space-between;
}

.site-footer p { margin: 0; }
.site-footer a { color: var(--ink-muted); }
.site-footer a:hover { color: var(--link); }


/* 6. Prose components ------------------------------------------------------ */

/* Homepage name block, with optional portrait alongside. */
.identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.identity-text { flex: 1 1 15rem; }

.identity h1 {
  font-size: 2.3rem;
  margin-bottom: 0.35rem;
}

.identity .role {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0;
}

/* The links a visitor most often wants, straight under the name. Styled as
   .entry-links, which it extends. */
.identity .quick-links { margin-top: 0.85rem; font-size: 0.875rem; }

/* A short list set as one run of text, with middots between the items. The
   dot stays with the item before it, so a wrapped line never starts with one. */
.inline-list { list-style: none; padding: 0; }
.inline-list li { display: inline; margin: 0; white-space: nowrap; }
.inline-list li:not(:last-child)::after { content: "\00a0·"; color: var(--ink-muted); }

/* Project entries on the home page: the research-page pattern, tighter. */
.entries-compact .entry { padding-top: 0.9rem; }
.entries-compact .entry:first-of-type { padding-top: 0; }
.entries-compact .entry + .entry { margin-top: 0.9rem; }
.entries-compact .entry-title { margin-bottom: 0.2rem; }
.entries-compact .entry-abstract { margin-bottom: 0; }
.entries-compact + p { margin-top: var(--space-md); }

/* Portrait. Hidden automatically until assets/portrait.jpg exists — see the
   onerror attribute in index.html — so a missing file never shows as broken. */
.portrait {
  flex: 0 0 auto;
  margin: 0;
}

.portrait img {
  display: block;
  width: 155px;
  height: 155px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--rule);
}

.lead { font-size: 1.15rem; line-height: 1.6; }

.page-intro { color: var(--ink-muted); margin-bottom: var(--space-md); }

/* A closing line after the last section of a page, e.g. references on the CV. */
.cv-closing { margin-top: var(--space-lg); }

/* Label/value rows — contact details, CV facts. The label column matches the
   CV's date gutter, so every label/value pair on the site shares one axis. */
.facts {
  display: grid;
  grid-template-columns: var(--label-col) 1fr;
  gap: 0.55rem 1.25rem;
  margin: 0 0 1.05em;
}

.facts dt {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-top: 0.3em;
}

.facts dd { margin: 0; }

/* Placeholder / status note. Deliberately plain, never styled as content. */
.note {
  border-left: 3px solid var(--rule-strong);
  background: var(--bg-inset);
  padding: 0.85rem 1.1rem;
  margin: 0 0 1.05em;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.note :last-child { margin-bottom: 0; }


/* 7. Research entries ------------------------------------------------------
   Reusable pattern for a paper or project. Every part below the title is
   optional — drop the elements you do not have and the layout still holds.

   <article class="entry">
     <h3 class="entry-title">Title</h3>            (or wrap in <a> when linked)
     <p class="entry-meta">
       <span class="entry-authors">with A and B</span>
       <span class="entry-status">Work in progress</span>
     </p>
     <p class="entry-abstract">Short abstract.</p>
     <ul class="entry-links">
       <li><a href="papers/x.pdf">PDF</a></li>
       <li><a href="...">Code</a></li>
       <li><a href="...">Replication files</a></li>
     </ul>
   </article>
   -------------------------------------------------------------------------- */

.entry {
  padding-top: var(--space-md);
  border-top: 1px solid var(--rule);
}

.entry:first-of-type { border-top: 0; padding-top: 0; }

.entry-title {
  font-size: 1.0625rem;
  margin: 0 0 0.4rem;
}

.entry-title a { color: var(--ink); text-decoration-color: var(--rule-strong); }
.entry-title a:hover { color: var(--link); }

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.75rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin: 0 0 0.6rem;
}

/* Status marker. A hairline outline, not a coloured pill.
   Always sits on its own line inside .entry-meta — on research entries and,
   in the same form, on CV items. */
.entry-status {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  padding: 0.12rem 0.45rem;
  white-space: nowrap;
}

.entry-abstract { margin-bottom: 0.7rem; }

.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
}

.entry-links li { margin: 0; }

.entry-links a {
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 1px;
}

.entry-links a:hover { border-bottom-color: currentColor; }

/* Marks a resource that is announced but not yet available. */
.entry-links .pending {
  color: var(--ink-muted);
  border-bottom: 1px dotted var(--rule-strong);
  cursor: default;
}

.entry + .entry { margin-top: var(--space-md); }


/* 8. Bibliography ----------------------------------------------------------
   One entry = one <li class="biblio-item">, separated by a hairline rule so
   it is always clear where an entry starts and ends. The year hangs in a
   left gutter, as the dates do on the CV, so each list reads as a chronology.

   year   title                                  (.biblio-head)
          coauthors                              (.biblio-meta)
          outlet
          link                                   (.biblio-links)

   <li class="biblio-item">
     <p class="biblio-head">
       <span class="biblio-title">Title</span>
       <span class="biblio-year">2026</span>
     </p>
     <p class="biblio-meta">
       <span class="biblio-authors">with A and B</span><span class="biblio-outlet">Series 1/2026</span>
     </p>
     <p class="biblio-links"><a href="…">Report</a></p>
   </li>

   Omit .biblio-meta entirely when there are neither coauthors nor an outlet.
   Name the link for what it opens (Article, Report, PDF), not for its host.

   A report that comes out every year is one entry, with its editions listed
   underneath, each with its own coauthors:

     <ul class="biblio-editions">
       <li><a href="…">2025</a><span>with A and B</span></li>
     </ul>
   -------------------------------------------------------------------------- */

.biblio {
  list-style: none;
  margin: 0;
  padding: 0;
}

.biblio-item {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: baseline;
  margin: 0;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--rule);
}

/* The head's two spans become grid items: the year in the gutter, the title
   beside it on the same baseline. */
.biblio-head { display: contents; }

.biblio-year {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  white-space: nowrap;
}

.biblio-title {
  grid-column: 2;
  grid-row: 1;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.biblio-meta,
.biblio-links,
.biblio-editions { grid-column: 2; }

.biblio-item:first-child { padding-top: 0.5rem; }
.biblio-item:last-child  { border-bottom: 0; }

/* Coauthors, then the outlet on a line of its own, so the venue sits in the
   same place under every title however long the author list. */
.biblio-meta {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-muted);
  margin: 0 0 0.25rem;
}

.biblio-meta > span { display: block; }
.biblio-outlet { font-style: italic; }

.biblio-links {
  font-family: var(--sans);
  font-size: 0.8125rem;
  margin: 0;
  overflow-wrap: anywhere;
}

/* Editions of a recurring report: year, then that edition's coauthors. */
.biblio-editions {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.biblio-editions li {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  margin: 0 0 0.3rem;
}

.biblio-editions li:last-child { margin-bottom: 0; }
.biblio-editions li > :first-child { font-variant-numeric: tabular-nums; }

/* A title that is itself the link (used for short policy writing). */
.biblio-title a { color: var(--ink); }
.biblio-title a:hover { color: var(--link); }

/* Secondary writing: regular weight and a quiet underline, so it ranks below
   the reports and articles above it. */
.biblio-compact .biblio-item { padding: 0.75rem 0; }
.biblio-compact .biblio-item:first-child { padding-top: 0.4rem; }
.biblio-compact .biblio-title { font-weight: 400; margin-bottom: 0.1rem; }
.biblio-compact .biblio-title a { text-decoration-color: var(--rule-strong); }
.biblio-compact .biblio-title a:hover { text-decoration-color: currentColor; }


/* 9. Utilities ------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* CV list with the dates in a left-hand gutter, so institutions and periods
   line up vertically as in a traditional academic CV.

   <ul class="timeline">
     <li>
       <span class="when">Jun 2023 –</span>
       <div class="what">
         Economist
         <span class="meta">The National Audit Office of Finland</span>
       </div>
     </li>
   </ul>
   -------------------------------------------------------------------------- */

.timeline {
  list-style: none;
  margin: 0 0 1.05em;
  padding: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: var(--label-col) 1fr;
  column-gap: 1.25rem;
  margin-bottom: 0;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
}

.timeline li:last-child { border-bottom: 0; }

.timeline .when {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  padding-top: 0.22em;
}

.timeline .meta {
  display: block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin-top: 0.1rem;
}

/* Status marker inside a CV item, spaced to match a research entry. */
.timeline .entry-meta { margin: 0.35rem 0 0.3rem; }

/* Status marker directly under a section heading. */
h2 + .entry-meta { margin-top: 0.9rem; }


/* 10. Responsive ----------------------------------------------------------- */

@media (max-width: 34rem) {
  :root { --gutter: 1.15rem; --space-xl: 3.25rem; }

  body { font-size: 1rem; }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.2rem; }
  .identity h1 { font-size: 1.8rem; }
  .lead { font-size: 1.0625rem; }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  /* Five items as a tidy 3 + 2 grid rather than a ragged wrap. */
  .site-nav ul { display: grid; grid-template-columns: repeat(3, max-content); gap: 0 1.25rem; }

  /* Portrait above the name on narrow screens. */
  .identity { gap: var(--space-sm); }
  .portrait { order: -1; }
  .portrait img { width: 118px; height: 118px; }

  /* Stack label/value rows rather than squeezing two columns. */
  .facts { grid-template-columns: 1fr; gap: 0.15rem; }
  .facts dt { padding-top: 0.55rem; }

  /* The year keeps its gutter, a little narrower. */
  .biblio-item { grid-template-columns: 3.2rem minmax(0, 1fr); column-gap: 0.55rem; }

  /* Dates move above the entry instead of squeezing into a gutter. */
  .timeline li { grid-template-columns: 1fr; }
  .timeline .when { padding-top: 0; margin-bottom: 0.2rem; }
}


/* 11. DSA calculator -------------------------------------------------------
   Used only by dsa.html. The calculator is a workbench: on a wide screen the
   controls form a sticky rail beside the chart, on a phone the chart sticks to
   the top while the controls scroll underneath. Everything follows the site
   tokens, so light and dark mode come for free.
   -------------------------------------------------------------------------- */

:root {
  --dsa-line:        var(--accent);   /* the path under the plan       */
  --dsa-ref:         #978d79;         /* the reference (ghost) path    */
  --dsa-muted-line:  #8c8474;         /* the no-consolidation path     */
  --dsa-alt1:        #3f6b7d;         /* lower SPB                     */
  --dsa-alt2:        #8a6d1f;         /* adverse r-g                   */
  --dsa-alt3:        #5a5a8a;         /* financial stress              */
  --dsa-grid:        var(--rule);
  --dsa-axis:        var(--rule-strong);
  --dsa-band:        var(--accent);
  --dsa-shade:       #ece7da;         /* plan window backdrop          */
}

@media (prefers-color-scheme: dark) {
  :root {
    --dsa-ref:        #9a9284;
    --dsa-muted-line: #8f8677;
    --dsa-alt1:       #7fb3c4;
    --dsa-alt2:       #cba85a;
    --dsa-alt3:       #9a9ad0;
    /* The fan sits darker than the line it surrounds, so the path under the
       plan stays readable where the two overlap. */
    --dsa-line:       #dda6a0;
    --dsa-band:       #a3605a;
    --dsa-shade:      #2a2620;
  }
}

/* Wider container for the calculator page; prose sections keep the measure. */
.container-wide { max-width: 62rem; }

/* The scripts hide and show pieces with the hidden attribute; make sure no
   display rule below can override it. */
.dsa-workbench [hidden] { display: none !important; }
.container-wide .dsa-intro,
.container-wide .dsa-prose { max-width: var(--measure); }

/* --- workbench layout ---------------------------------------------------- */

.dsa-workbench { display: block; }

@media (min-width: 64rem) {
  .dsa-workbench {
    display: grid;
    grid-template-columns: 19rem minmax(0, 1fr);
    column-gap: 2.5rem;
    align-items: start;
  }
  .dsa-controls {
    grid-column: 1;
    grid-row: 1 / span 3;
    position: sticky;
    top: 1rem;
  }
  .dsa-stage { grid-column: 2; grid-row: 1; }
  .dsa-rules-panel { grid-column: 2; grid-row: 2; }
  .dsa-cap-panel { grid-column: 2; grid-row: 3; }
}

/* Narrow screens: the chart stays in view while the controls scroll. */
@media (max-width: 63.99rem) {
  .dsa-stage {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    padding: 0.25rem 0 0.4rem;
    margin-bottom: 1rem;
  }
}

@media (max-width: 63.99rem) and (max-height: 760px) {
  .dsa-stage { position: static; }
}

/* Tablets: the economy sliders in two columns, so each label sits near its
   value and all of them fit under the chart at once. */
@media (min-width: 40rem) and (max-width: 63.99rem) {
  .dsa-group-sliders {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2rem;
  }
  .dsa-group-sliders > .dsa-eyebrow { grid-column: 1 / -1; }
}

/* When the stage is too tall to stick (most phones), a slim strip with the
   result pins itself to the top while the controls are on screen, so moving
   a slider always shows what it does. app.js decides when it shows; it is
   fixed, so showing it never moves the page. */
.dsa-peek { display: none; }

@media (max-width: 63.99rem) {
  .dsa-peek {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.1rem 0.6rem;
    padding: 0.4rem var(--gutter) 0.45rem;
    background: var(--bg-inset);
    border-bottom: 1px solid var(--rule-strong);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    font-family: var(--sans);
    font-size: 0.8125rem;
    line-height: 1.35;
    transform: translateY(-110%);
    visibility: hidden;
    transition: transform 0.15s ease, visibility 0s linear 0.15s;
  }
  .dsa-peek.is-shown {
    transform: none;
    visibility: visible;
    transition: transform 0.15s ease;
  }
}

.dsa-peek-figure {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}

.dsa-peek-unit { color: var(--ink-muted); white-space: nowrap; }

.dsa-peek-binding {
  flex: 1 1 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dsa-peek-delta { color: var(--accent); font-weight: 600; white-space: nowrap; }
.dsa-peek-delta.is-neutral { color: var(--ink-muted); font-weight: 400; }

/* --- controls ------------------------------------------------------------ */

.dsa-eyebrow {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.5rem;
}

.dsa-eyebrow-note {
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  margin-left: 0.4rem;
}

.dsa-group {
  padding: 0.7rem 0 0.55rem;
  border-top: 1px solid var(--rule);
}

.dsa-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  font-family: var(--sans);
}

.dsa-presets-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-right: 0.15rem;
}

.dsa-presets button {
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  cursor: pointer;
}

.dsa-presets button:hover { border-color: var(--accent); color: var(--accent); }

.dsa-presets button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

/* Quiet trailing control: only shown once a preset is on. */
.dsa-presets .dsa-presets-clear {
  border-color: transparent;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  padding-inline: 0.3rem;
}

.dsa-presets .dsa-presets-clear:hover {
  border-color: transparent;
  color: var(--accent);
}

.dsa-presets-hint {
  margin: -0.55rem 0 0.85rem;
}

/* Says once what the dot on a changed control and the tick under a slider
   mean, so neither needs a label of its own. */
.dsa-origin {
  max-width: var(--measure);
  margin: 0 0 0.8rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--rule-strong);
}

.dsa-presets button:focus-visible,
.dsa-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.dsa-control { margin: 0.4rem 0 0.75rem; }
.dsa-control:last-child { margin-bottom: 0.2rem; }

.dsa-control-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.4;
}

.dsa-control-head output {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

/* A control that has left the baseline: accent value, dot before the label. */
.dsa-control.is-changed .dsa-control-head output { color: var(--accent); }

.dsa-control.is-changed .dsa-control-head label::before,
.dsa-control.is-changed > label::before,
.dsa-advanced.is-changed > summary::before,
#plan-control.is-changed .dsa-eyebrow::before {
  content: "";
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.4rem;
  vertical-align: 0.1em;
}

.dsa-track { position: relative; padding-bottom: 0.5rem; }

.dsa-track input[type="range"] {
  display: block;
  width: 100%;
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
}

/* Firefox draws the empty part of the track light even in dark mode, so the
   track is coloured from the tokens there. Other browsers follow
   color-scheme and accent-color on their own. */
@media (prefers-color-scheme: dark) {
  .dsa-track input[type="range"]::-moz-range-track { background: var(--rule-strong); }
  .dsa-track input[type="range"]::-moz-range-progress { background: var(--accent); }
}

/* Baseline tick under the track, at the default value's position. The
   16px accounts for the thumb's travel inside the track. */
.dsa-track::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: calc(8px + var(--base-pct, 0.5) * (100% - 16px));
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid var(--rule-strong);
  transform: translateX(-4px);
}

.dsa-control > label {
  display: block;
  font-family: var(--sans);
  font-size: 0.875rem;
  margin-bottom: 0.15rem;
}

.dsa-control select {
  font-family: var(--sans);
  font-size: 0.8125rem;
  padding: 0.3rem 0.4rem;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
}

.dsa-hint {
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ink-muted);
  margin: 0.15rem 0 0;
}

/* Segmented plan toggle: native radios kept, visually hidden. */
.dsa-seg {
  display: flex;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  overflow: hidden;
}

.dsa-seg-option { flex: 1 1 0; margin: 0; }

.dsa-seg-option span {
  display: block;
  text-align: center;
  padding: 0.4rem 0.5rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  cursor: pointer;
}

.dsa-seg-option + .dsa-seg-option span { border-left: 1px solid var(--rule-strong); }
.dsa-seg-option span:hover { color: var(--ink); }
.dsa-seg-option input:checked + span { background: var(--accent); color: var(--bg); }
.dsa-seg-option input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
/* On the filled option an accent ring would vanish into the accent fill, so
   the ring is drawn in the page colour, inset from the edge. */
.dsa-seg-option input:checked:focus-visible + span { outline-color: var(--bg); outline-offset: -4px; }

.dsa-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.3rem 0.6rem;
}

.dsa-checks label {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.dsa-checks input { accent-color: var(--accent); margin-right: 0.35rem; }

.dsa-advanced {
  border-top: 1px solid var(--rule);
  padding: 0.7rem 0 0.4rem;
}

.dsa-advanced summary,
.dsa-numbers summary {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  cursor: pointer;
}

.dsa-advanced[open] summary { margin-bottom: 0.7rem; }
.dsa-advanced .dsa-checks { margin-top: 0.5rem; }

.dsa-buttons {
  display: flex;
  gap: 0.5rem;
  margin: 0.9rem 0 0.4rem;
}

.dsa-button {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bg-inset);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}

.dsa-button:hover { border-color: var(--accent); color: var(--accent); }
.dsa-button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* The stage releases its sticky position when it would crowd the controls. */
.dsa-stage.is-too-tall { position: static; }

/* --- spending cap ---------------------------------------------------------
   The same answer in the unit a plan promises, built as a small sum: trend
   growth, minus the tightening, equals the cap. */
.dsa-cap-panel {
  margin-top: 1.6rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}

.dsa-cap-sum {
  max-width: 30rem;
  margin: 0.2rem 0 0.8rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.dsa-cap-sum > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.3rem 0;
}

.dsa-cap-sum dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dsa-cap-note {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.dsa-cap-total { border-top: 1px solid var(--rule-strong); }
.dsa-cap-total dt { font-weight: 600; }
.dsa-cap-total dd { color: var(--accent); font-size: 0.9375rem; }

#dsa-cap .dsa-chart { max-width: 34rem; }

/* The one sentence under the bars: the analysis on its own, then what the
   safeguards add. */
.dsa-rules-summary { color: var(--ink); font-size: 0.8125rem; margin-top: 0.4rem; }

/* --- headline ------------------------------------------------------------- */

.dsa-headline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 1.25rem;
  row-gap: 0.15rem;
  align-items: end;
  background: var(--bg-inset);
  border-left: 3px solid var(--accent);
  padding: 0.8rem 1rem 0.7rem;
  margin-bottom: 0.7rem;
}

.dsa-figure {
  font-size: 2.6rem;
  line-height: 1;
  font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
  margin: 0;
}

.dsa-figure-unit {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0.25rem 0 0;
  white-space: nowrap;
}

.dsa-headline-side { padding-bottom: 0.1rem; min-width: 0; }

.dsa-delta {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin: 0 0 0.3rem;
}

.dsa-binding {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.45;
  margin: 0;
}

.dsa-was { color: var(--ink-muted); }

/* At the baseline the chip reads "= baseline" in the muted colour, so the
   headline keeps its shape when a change makes it turn accent. */
.dsa-delta.is-neutral { color: var(--ink-muted); }

.dsa-floors {
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-muted);
  margin: 0.3rem 0 0;
}

.dsa-headline-main > .dsa-eyebrow { margin-bottom: 0.2rem; }

/* The euro restatement: what the adjustment is worth in the unit public
   debate uses. */
/* Explanations hang off the word they explain: a small "i" that shows its
   text on hover, and on focus, so the keyboard and a tap reach it too. */
.dsa-tip {
  position: relative;
  display: inline-block;
  vertical-align: 0.05em;
}

.dsa-i {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink-muted);
  cursor: help;
  text-transform: none;
  letter-spacing: 0;
}

.dsa-tip:hover .dsa-i,
.dsa-tip:focus-within .dsa-i {
  border-color: var(--accent);
  color: var(--accent);
}

.dsa-i:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* A larger invisible hit area than the 16px circle, larger still for a
   finger. Kept shallow so it never takes a touch meant for the slider. */
.dsa-i::after {
  content: "";
  position: absolute;
  inset: -5px;
}

@media (pointer: coarse) {
  .dsa-i::after { inset: -8px -11px; }
}

.dsa-tip-body {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: -0.6rem;
  z-index: 30;
  width: max-content;
  max-width: min(19rem, calc(100vw - 3rem));
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
}

.dsa-tip:hover .dsa-tip-body,
.dsa-tip:focus-within .dsa-tip-body {
  opacity: 1;
  visibility: visible;
}

/* Escape closes an open explanation; it stays closed until the pointer
   leaves it or focus comes back (app.js). */
.dsa-tip.is-dismissed .dsa-tip-body {
  opacity: 0;
  visibility: hidden;
}

/* On the dark ground a shadow barely shows, so the panel lifts itself with
   the inset colour and a deeper shadow instead. */
@media (prefers-color-scheme: dark) {
  .dsa-tip-body {
    background: var(--bg-inset);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  }
}

/* In the controls rail the panel spans the rail rather than hanging off the
   "i", so it never runs past either edge whatever the label's length. */
.dsa-controls .dsa-tip { position: static; }
.dsa-controls .dsa-control-head,
.dsa-controls .dsa-eyebrow,
.dsa-controls .dsa-presets,
.dsa-controls .dsa-origin { position: relative; }

.dsa-controls .dsa-tip-body,
.dsa-stats .dsa-tip-body {
  left: 0;
  right: auto;
  width: 100%;
  max-width: none;
  top: calc(100% + 0.3rem);
}

/* The figure beyond the chart's end carries its own note. */
.dsa-stats { position: relative; }
.dsa-stats .dsa-tip { position: static; margin-left: 0.1rem; }

/* Keeps the label and its "i" together while the value stays right. */
.dsa-head-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

@media (prefers-reduced-motion: reduce) {
  .dsa-tip-body { transition: none; }
}

.dsa-euro {
  grid-column: 1 / -1;
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.5;
  font-weight: 600;
  margin: 0.5rem 0 0;
  padding-top: 0.45rem;
  border-top: 1px solid var(--rule);
}

.dsa-stats {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.3rem;
  margin: 0.45rem 0 0;
  padding-top: 0.45rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.78rem;
}

.dsa-stats div { display: flex; gap: 0.4rem; align-items: baseline; }
.dsa-stats dt { color: var(--ink-muted); }
.dsa-stats dt a { color: inherit; }
.dsa-stats dt a:hover { color: var(--link); }
.dsa-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- chart ---------------------------------------------------------------- */

.dsa-chart svg { width: 100%; height: auto; display: block; }

/* Hover readout: a quiet line that is empty until the pointer is on the
   chart, so it carries no rule of its own. */
.dsa-readout {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-muted);
  min-height: 1.5em;
  margin: 0.35rem 0 0;
}

/* Why the chart looks the way it does: the binding rule, in one sentence,
   directly under the line it explains. */
.dsa-why {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  max-width: var(--measure);
  color: var(--ink);
  border-left: 2px solid var(--rule-strong);
  padding-left: 0.6rem;
  margin: 0.55rem 0 0;
}

.dsa-stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 0.8rem;
  margin-top: 0.5rem;
}

.dsa-stage-buttons {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.dsa-button-quiet {
  font-size: 0.68rem;
  padding: 0.28rem 0.55rem;
  background: transparent;
}

.dsa-refline {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-muted);
  min-height: 1.3em;
  margin: 0;
}

.dsa-key {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: -0.05em;
}

.dsa-key-ref { background: var(--dsa-ref); height: 0.2rem; vertical-align: 0.2em; }
.dsa-refline.is-off .dsa-key-ref { visibility: hidden; }

/* Nested dropdowns inside Info, and its glossary. */
.dsa-info-body > details {
  border-top: 1px solid var(--rule);
  margin-top: 0.6rem;
  padding-top: 0.5rem;
}

.dsa-info-body > details > summary {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  list-style-position: outside;
}

.dsa-info-body > details[open] > summary { margin-bottom: 0.4rem; }

.dsa-glossary { margin: 0; }
.dsa-glossary dt {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.6rem;
}
.dsa-glossary dd { margin: 0.1rem 0 0; }
.dsa-glossary dd:first-of-type { margin-top: 0.1rem; }

.dsa-sources li { margin-bottom: 0.45rem; }

/* Group labels inside "The criteria, one by one", matching the bars. */
.dsa-info-group {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0.7rem 0 0.35rem;
}

.dsa-table-ref { color: var(--ink-muted); font-weight: 400; }

.dsa-rules-panel { margin-top: 1.1rem; }
.dsa-rules svg { width: 100%; height: auto; display: block; }

/* --- numbers -------------------------------------------------------------- */

/* The explanation lives behind a toggle, so the calculator is what loads. */
/* At the top of the page Info needs air on both sides, or it reads as part of
   the calculator below it rather than as its own thing. */
.dsa-info {
  margin-top: var(--space-md);
  margin-bottom: var(--space-lg);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.dsa-info > summary {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  cursor: pointer;
}

.dsa-info[open] > summary { margin-bottom: 0.8rem; }

.dsa-info-body { max-width: var(--measure); }
.dsa-info-body h3 { margin-top: var(--space-md); }
.dsa-info-body h3:first-child { margin-top: 0.4rem; }

.dsa-disclaimer { max-width: var(--measure); margin-bottom: var(--space-md); }

.dsa-numbers { margin-top: 1.5rem; }

/* The year table gained a column; let it scroll rather than squeeze on a phone. */
.dsa-numbers .dsa-table { display: block; overflow-x: auto; }
@media (min-width: 46rem) { .dsa-numbers .dsa-table { display: table; } }
.dsa-numbers[open] summary { margin-bottom: 0.4rem; }

.dsa-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  margin: 0.4rem 0 0;
}

.dsa-table caption {
  text-align: left;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  padding-bottom: 0.45rem;
}

.dsa-table th,
.dsa-table td {
  text-align: left;
  padding: 0.4rem 0.6rem 0.4rem 0;
  border-bottom: 1px solid var(--rule);
}

.dsa-table thead th {
  font-weight: 600;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule-strong);
}

.dsa-table tbody th { font-weight: 500; }

/* --- phone ---------------------------------------------------------------- */

@media (max-width: 40rem) {
  /* One column: the figure and its unit on a line, the binding rule under it.
     Nothing goes below 12px: captions at 0.75rem, sentences at 0.8125rem. */
  .dsa-headline { display: block; padding: 0.5rem 0.75rem 0.45rem; }
  .dsa-headline-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.6rem; }
  .dsa-headline-main > .dsa-eyebrow { flex-basis: 100%; margin: 0; }
  .dsa-figure { font-size: 1.9rem; }
  .dsa-figure-unit { font-size: 0.75rem; letter-spacing: 0.03em; margin: 0; white-space: normal; }
  .dsa-headline-side { margin-top: 0.2rem; }
  .dsa-delta { font-size: 0.75rem; margin: 0 0.4rem 0.1rem 0; padding: 0.05rem 0.45rem; }
  .dsa-binding { font-size: 0.8125rem; display: inline; }
  .dsa-stats { font-size: 0.75rem; gap: 0.05rem 0.8rem; margin-top: 0.3rem; padding-top: 0.3rem; }
  .dsa-euro { font-size: 0.8125rem; margin-top: 0.4rem; padding-top: 0.35rem; }
  .dsa-readout { display: none; }
  .dsa-refline { font-size: 0.75rem; }
  .dsa-why { font-size: 0.8125rem; padding-left: 0.5rem; }
  .dsa-stage-actions { gap: 0.25rem 0.5rem; }
  .dsa-button-quiet { font-size: 0.75rem; }
  .dsa-table { font-size: 0.8125rem; }
}


/* 12. Print ---------------------------------------------------------------- */

@media print {
  :root { --bg: #fff; --ink: #000; --ink-muted: #333; --link: #000; }
  body { border-top: 0; font-size: 11pt; }
  .site-nav, .skip-link, .portrait { display: none; }
  a { text-decoration: underline; }
  .entry, .biblio-item { break-inside: avoid; }

  /* On paper the controls are dead weight; the result and chart are not. */
  .dsa-controls, .dsa-button, .dsa-readout, .dsa-presets, .dsa-presets-hint,
  .dsa-origin, .dsa-stage-buttons { display: none; }
  .dsa-stage { position: static; }
  .dsa-headline { border-left-color: #000; }
  .dsa-chart, .dsa-table { break-inside: avoid; }
}
