/* Way2Soon: large, calm, high-contrast type for readers 60+. */
:root {
  color-scheme: light;
  --bg: #fbf8f2;
  --surface: #ffffff;
  --surface-2: #f3eee4;
  --ink: #1c1a17;
  --ink-2: #4a463f;
  --ink-3: #6b665c;
  --line: #ddd5c7;
  --accent: #0e5a5f;
  --accent-ink: #ffffff;
  --accent-soft: #e2efee;
  --sun: #f2b33d;
  --warn-bg: #fff4dc;
  --warn-line: #d99a1e;
  --bad-bg: #fde9e6;
  --bad-line: #c2412d;
  --good-bg: #e6f3ea;
  --good-line: #2f7d4a;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 14px rgba(40, 30, 10, .05);
  --base: 1.1875rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15171a;
    --surface: #1d2024;
    --surface-2: #24282d;
    --ink: #eeeae3;
    --ink-2: #c9c4ba;
    --ink-3: #a29d92;
    --line: #363b42;
    --accent: #6cc4c6;
    --accent-ink: #0c1a1b;
    --accent-soft: #1d3436;
    --warn-bg: #33290f;
    --warn-line: #d9a53a;
    --bad-bg: #3a1d19;
    --bad-line: #e6705c;
    --good-bg: #17301f;
    --good-line: #5cbf7e;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15171a; --surface: #1d2024; --surface-2: #24282d;
  --ink: #eeeae3; --ink-2: #c9c4ba; --ink-3: #a29d92; --line: #363b42;
  --accent: #6cc4c6; --accent-ink: #0c1a1b; --accent-soft: #1d3436;
  --warn-bg: #33290f; --warn-line: #d9a53a; --bad-bg: #3a1d19; --bad-line: #e6705c;
  --good-bg: #17301f; --good-line: #5cbf7e;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --shadow: none;
}
:root[data-size="large"] { --base: 1.375rem; }
:root[data-size="xlarge"] { --base: 1.625rem; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--base)/1.6 "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { font-family: Literata, Georgia, serif; line-height: 1.2; font-weight: 700; margin: 1.6em 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); margin-top: .3em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2.1rem); }
h3 { font-size: 1.3em; }
p, ul, ol { margin: 0 0 1em; }
li { margin-bottom: .4em; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: .08em; }
a:hover { text-decoration-thickness: .14em; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 4px; }
strong { font-weight: 700; }
small, .fine { font-size: .85em; color: var(--ink-3); }
.wrap { width: min(72rem, 100% - 2rem); margin-inline: auto; }
.prose { max-width: 44rem; }
.lead { font-size: 1.18em; color: var(--ink-2); max-width: 42rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .6em 1em; z-index: 10; }
.skip:focus { left: 1rem; }
ul.plain { list-style: none; padding: 0; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; gap: 1rem; min-height: 4.25rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 700 1.35rem/1 Literata, Georgia, serif; color: var(--ink); text-decoration: none; }
.brand-mark { width: 2rem; height: 2rem; color: var(--accent); }
.site-nav { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.site-nav a { padding: .45em .8em; border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .95em; }
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.size-control { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.size-control button { font: 700 .9rem/1 "Atkinson Hyperlegible", sans-serif; background: none; border: 0; color: var(--ink); padding: .55em .7em; min-width: 2.6rem; min-height: 2.6rem; cursor: pointer; }
.size-control button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.size-control .plus { font-size: .75em; vertical-align: super; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-block; margin-left: auto; font: 700 1rem "Atkinson Hyperlegible", sans-serif; padding: .6em 1em; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); min-height: 2.75rem; }
  .site-nav { display: none; width: 100%; flex-direction: column; padding-bottom: .75rem; margin: 0; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: .7em .9em; font-size: 1.05em; }
  .size-control { order: 2; }
}

/* Sections & cards */
section { padding-block: 1rem; }
.hero { padding: 2.5rem 0 .5rem; }
.hero + section > h2:first-child, .hero + section > .tool:first-child { margin-top: .5rem; }
.hero .eyebrow, .eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .78em; font-weight: 700; color: var(--accent); margin-bottom: .4em; }
.cards { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin: 1.5rem 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
a.card .go { color: var(--accent); font-weight: 700; }
.part-badge { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 1.25rem/1 Literata, serif; margin-bottom: .6rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: .8rem 0 0; }
.kv dt { color: var(--ink-3); font-size: .9em; }
.kv dd { margin: 0; font-weight: 700; }

.callout { border-left: 6px solid var(--accent); background: var(--accent-soft); padding: 1rem 1.25rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.25rem 0; }
.callout.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.callout.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.callout.good { border-color: var(--good-line); background: var(--good-bg); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; display: block; margin-bottom: .25em; }

.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); margin: 1.25rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.stat .num { font: 700 1.75em/1.1 Literata, serif; display: block; }
.stat .lbl { color: var(--ink-2); font-size: .9em; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .95em; }
th, td { text-align: left; padding: .7em .9em; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-2); font-weight: 700; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 1.5rem 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: .95rem; top: .4rem; bottom: .4rem; width: 3px; background: var(--line); }
.timeline li { position: relative; padding-left: 3rem; margin-bottom: 1.4rem; }
.timeline li::before { content: ""; position: absolute; left: .45rem; top: .35rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--surface); border: 4px solid var(--accent); }
.timeline .when { font-weight: 700; display: block; color: var(--accent); }

/* Forms & tools */
.tool { background: var(--surface); border: 2px solid var(--accent); border-radius: calc(var(--radius) + 4px); padding: 1.4rem; margin: 1.5rem 0 1rem; box-shadow: var(--shadow); }
.tool h3 { margin-top: 0; }
.fields { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin-bottom: 1rem; }
.field label { display: block; font-weight: 700; margin-bottom: .3rem; }
.field .hint { display: block; font-size: .85em; color: var(--ink-3); margin-top: .25rem; }
input, select { font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 10px; padding: .55em .7em; width: 100%; min-height: 3rem; }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.input-affix { display: flex; align-items: center; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); }
.input-affix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-affix input { border: 0; box-shadow: none !important; min-width: 0; }
.input-affix span { padding: 0 .7em; color: var(--ink-3); }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 700; cursor: pointer; }
.check input { width: 1.4rem; height: 1.4rem; min-height: 0; accent-color: var(--accent); flex: none; }
.btn { display: inline-block; font: 700 1em "Atkinson Hyperlegible", sans-serif; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: .7em 1.4em; cursor: pointer; text-decoration: none; min-height: 3rem; }
.btn.ghost { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.result { margin-top: 1rem; }
.result:empty { display: none; }
.result-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.result-item { background: var(--surface-2); border-radius: var(--radius); padding: .9rem 1.1rem; }
.result-item .k { font-size: .85em; color: var(--ink-3); display: block; }
.result-item .v { font-weight: 700; font-size: 1.1em; }

/* Details / FAQ */
details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: .7rem 0; }
details > summary { cursor: pointer; padding: 1rem 1.25rem; font-weight: 700; list-style: none; position: relative; padding-right: 3rem; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "+"; position: absolute; right: 1.2rem; top: .75rem; font-size: 1.5em; line-height: 1; color: var(--accent); }
details[open] > summary::after { content: "\2212"; }
details > :not(summary) { padding: 0 1.25rem; }
details[open] > :last-child { padding-bottom: 1rem; }

/* Mistakes */
.mistake { display: grid; grid-template-columns: 3rem 1fr; gap: 0 1rem; padding: 1.25rem 0; border-top: 1px solid var(--line); }
.mistake .n { font: 700 1.6rem/1 Literata, serif; color: var(--bad-line); }
.mistake h3 { margin: 0 0 .4rem; }
.mistake .fix { background: var(--good-bg); border-left: 5px solid var(--good-line); padding: .7rem 1rem; border-radius: 0 10px 10px 0; }
.mistake .fix strong { color: var(--good-line); }

/* Chart */
.chart-box { position: relative; margin: 1rem 0; }
.chart-box svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-box .axis text, .chart-box .lbl { fill: var(--ink-3); font-size: 13px; font-family: "Atkinson Hyperlegible", sans-serif; }
.chart-box .grid line { stroke: var(--line); stroke-width: 1; }
.chart-box .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .end-label { font-size: 14px; font-weight: 700; fill: var(--ink); font-family: "Atkinson Hyperlegible", sans-serif; }
.chart-box .xhair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .75rem; font-size: .85em; box-shadow: 0 4px 16px rgba(0,0,0,.15); min-width: 12rem; display: none; z-index: 2; }
.tip .row { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; list-style: none; padding: 0; margin: .5rem 0; font-size: .95em; }
.legend li { display: flex; align-items: center; gap: .45rem; margin: 0; }
.swatch { width: 1.1rem; height: .3rem; border-radius: 2px; display: inline-block; }
.s1 { background: var(--series-1); } .s2 { background: var(--series-2); } .s3 { background: var(--series-3); }

/* Tip widget (sent-tip): inherits the site's type and accent in both themes */
.tip-zone { padding: 2.5rem 0 0; }
/* #tip-prompt: the one-line ask under the header that jumps to the jar. Its height is reserved so nothing moves
   when the widget fills it; on a narrow screen the question and button wrap to two lines. */
.tip-prompt { min-height: 2.25rem; margin-top: 1rem; }
@media (max-width: 460px) { .tip-prompt { min-height: 4rem; } }
@media print { .tip-prompt, .tip-zone { display: none; } }
#support, #tip-prompt { --tip-font: inherit; --tip-accent: var(--accent); --tip-accent-fg: var(--accent-ink); --tip-max-width: 44rem; --tip-radius: var(--radius); }

/* Footer */
.site-footer { margin-top: 4rem; background: var(--surface-2); border-top: 1px solid var(--line); padding: 2.5rem 0 1.5rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 2fr 1.4fr 1fr; }
.footer-brand { font: 700 1.3rem Literata, serif; margin-bottom: .3em; }
.footer-head { font-weight: 700; margin-bottom: .4em; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

.toc { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 2rem; padding: 0; list-style: none; }
.toc a { display: inline-block; padding: .4em .9em; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .92em; }
.toc a:hover { border-color: var(--accent); }

@media print {
  .site-header, .site-footer, .size-control, .tool, .toc { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  details { border: 0; } details > :not(summary) { display: block !important; }
  a { color: #000; }
}

/* Glossary terms: dotted underline in body text; tap opens a short definition. */
a.term { color: inherit; text-decoration: underline dotted var(--accent); text-decoration-thickness: 2px; text-underline-offset: .2em; cursor: help; }
a.term:hover, a.term[aria-expanded="true"] { background: var(--accent-soft); }
.term-pop { position: absolute; z-index: 20; width: min(24rem, calc(100vw - 2rem)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 1rem 2.75rem 1rem 1.1rem; font-size: .95em; }
.term-pop:focus { outline: 3px solid var(--accent-soft); }
.term-pop p { margin: 0 0 .5em; }
.term-pop-name { font-weight: 700; }
.term-pop-aka { color: var(--ink-3); font-size: .9em; }
.term-pop-more { font-weight: 700; }
.term-pop-close { position: absolute; top: .4rem; right: .4rem; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: none; color: var(--ink-2); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.term-pop-close:hover { background: var(--surface-2); }

/* Glossary page */
.gl-confused { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.gl-confused ol, .gl-confused ul { padding-left: 1.2em; }
.gl-search { margin: 2rem 0 .5rem; }
.gl-search label { display: block; font-weight: 700; margin-bottom: .3rem; }
.gl-search input { width: 100%; max-width: 28rem; }
.gl-entry { padding: 1rem 0; border-top: 1px solid var(--line); scroll-margin-top: 5.5rem; }
.gl-entry h3 { margin: 0 0 .3rem; }
.gl-entry:target { background: var(--accent-soft); box-shadow: 0 0 0 .75rem var(--accent-soft); border-radius: 2px; }
.gl-aka, .gl-not { font-size: .92em; color: var(--ink-2); margin-bottom: .4em; }
.gl-aka span, .gl-not span { font-weight: 700; color: var(--ink); }
@media print { .term-pop, .gl-search { display: none !important; } a.term { text-decoration: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
