/* Jeltee's one stylesheet: design B, "Signal". Built for low vision first: big type, thick lines,
   large targets, meaning never carried by colour alone. Themes, text size and bold text are set on
   <html> (data-theme, data-size, data-bold) from the "view" cookie; "auto" follows the device.
   Every size is in rem/em so the text-size setting and browser zoom scale the whole page. */

@font-face {
  font-family: "Lexend";
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/fonts/lexend-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: "Lexend";
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/fonts/lexend-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;
}

/* ---- themes ------------------------------------------------------------------------------ */

:root,
:root[data-theme="day"] {
  color-scheme: light;
  --bg: #ffffff; --surface: #f3f3f1; --fg: #0a0a0a; --muted: #3d3d3d; --accent: #c8101f;
  --bar: #f3f3f1; --bar-fg: #0a0a0a; --bar-line: #d9d9d4; --btn: #0a0a0a; --btn-fg: #ffffff;
  --focus: #0a0a0a; --halo: #ffd400; --mark: #ffe500; --mark-fg: #0a0a0a;
}
:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #0a0a0a; --surface: #1a1a1a; --fg: #fafafa; --muted: #d0d0d0; --accent: #ff6b73;
  --bar: #1a1a1a; --bar-fg: #fafafa; --bar-line: #333333; --btn: #fafafa; --btn-fg: #0a0a0a;
  --focus: #ffd400; --halo: #0a0a0a; --mark: #ffe500; --mark-fg: #0a0a0a;
}
:root[data-theme="yb"] {
  color-scheme: dark;
  --bg: #000000; --surface: #000000; --fg: #ffe500; --muted: #ffe500; --accent: #ffffff;
  --bar: #000000; --bar-fg: #ffe500; --bar-line: #ffe500; --btn: #ffe500; --btn-fg: #000000;
  --focus: #ffffff; --halo: #000000; --mark: #ffffff; --mark-fg: #000000;
}
:root[data-theme="by"] {
  color-scheme: light;
  --bg: #ffe500; --surface: #ffe500; --fg: #000000; --muted: #000000; --accent: #000000;
  --bar: #ffe500; --bar-fg: #000000; --bar-line: #000000; --btn: #000000; --btn-fg: #ffe500;
  --focus: #000000; --halo: #ffffff; --mark: #000000; --mark-fg: #ffe500;
}
/* "auto": the device decides. Increased contrast wins over dark mode. */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0a0a0a; --surface: #1a1a1a; --fg: #fafafa; --muted: #d0d0d0; --accent: #ff6b73;
    --bar: #1a1a1a; --bar-fg: #fafafa; --bar-line: #333333; --btn: #fafafa; --btn-fg: #0a0a0a;
    --focus: #ffd400; --halo: #0a0a0a; --mark: #ffe500; --mark-fg: #0a0a0a;
  }
}
@media (prefers-contrast: more) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #000000; --surface: #000000; --fg: #ffe500; --muted: #ffe500; --accent: #ffffff;
    --bar: #000000; --bar-fg: #ffe500; --bar-line: #ffe500; --btn: #ffe500; --btn-fg: #000000;
    --focus: #ffffff; --halo: #000000; --mark: #ffffff; --mark-fg: #000000;
  }
}

/* ---- text size and weight ---------------------------------------------------------------- */

:root { --s: 1; --w-body: 400; --w-strong: 700; --w-head: 800; }
:root[data-size="1"] { --s: 1.25; }
:root[data-size="2"] { --s: 1.5; }
:root[data-size="3"] { --s: 1.75; }
:root[data-size="4"] { --s: 2; }
:root[data-bold="1"] { --w-body: 600; --w-strong: 800; }

/* A percentage of the browser's own default, so the reader's browser setting still counts. */
html { font-size: calc(100% * var(--s)); -webkit-text-size-adjust: 100%; }

/* ---- base -------------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Lexend", system-ui, sans-serif;
  font-size: 1.3125rem; /* 21px at 100% */
  font-weight: var(--w-body);
  line-height: 1.55;
  overflow-wrap: break-word;
}
b, strong, th, dt, legend, summary { font-weight: var(--w-strong); }
h1, h2, h3, h4 { font-weight: var(--w-head); line-height: 1.15; margin: 1.2em 0 0.4em; letter-spacing: -0.015em; }
h1 { font-size: 3.5rem; letter-spacing: -0.03em; line-height: 1.05; margin-top: 0; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
p, ul, ol, dl, table, figure, blockquote, details, fieldset { margin: 0 0 1em; }
small { font-size: 0.86em; }
hr { border: 0; border-top: 0.1875rem solid var(--fg); margin: 1.5rem 0; }
img, video { max-width: 100%; height: auto; }
mark { background: var(--mark); color: var(--mark-fg); padding: 0 0.2em; }
blockquote { margin-left: 0; padding-left: 1rem; border-left: 0.375rem solid var(--fg); }
code, kbd { font-size: 0.9em; padding: 0 0.25em; border: 0.125rem solid var(--fg); border-radius: 0.25rem; }
address { font-style: normal; }
hgroup p { font-size: 1.15em; max-width: 44ch; }
[hidden] { display: none !important; }

a { color: var(--accent); font-weight: var(--w-strong); text-decoration: underline; text-decoration-thickness: 0.1875rem; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.3125rem; }

:focus-visible { outline: 0.25rem solid var(--focus); outline-offset: 0.1875rem; box-shadow: 0 0 0 0.625rem var(--halo); }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--btn); color: var(--btn-fg); padding: 0.75rem 1.25rem; border-radius: 999px; }

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

button, input, select, textarea { font: inherit; color: inherit; }
button {
  min-height: 3rem; padding: 0.35rem 1.25rem;
  border: 0.1875rem solid var(--fg); border-radius: 999px;
  background: transparent; color: var(--fg);
  font-weight: var(--w-strong); cursor: pointer;
}
button:hover:not(:disabled) { text-decoration: underline; text-decoration-thickness: 0.1875rem; }
button[type="submit"] { background: var(--btn); color: var(--btn-fg); border-color: var(--btn); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input:not([type="checkbox"], [type="radio"], [type="range"], [type="hidden"]), select, textarea {
  min-height: 3rem; max-width: 100%; padding: 0.4rem 0.75rem;
  border: 0.1875rem solid var(--fg); border-radius: 0.5rem;
  background: var(--bg);
}
input[type="checkbox"], input[type="radio"] { width: 1.5rem; height: 1.5rem; accent-color: var(--fg); vertical-align: -0.3em; margin: 0 0.5rem 0 0; }
label { cursor: pointer; }
fieldset { border: 0.1875rem solid var(--fg); border-radius: 1rem; padding: 1rem 1.25rem 0.25rem; }
legend { padding: 0 0.5rem; font-size: 1.1em; }
::placeholder { color: var(--muted); opacity: 1; }

details > summary { cursor: pointer; display: list-item; min-height: 2.75rem; padding: 0.25rem 0; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 0.125rem solid var(--fg); }
thead th { border-bottom-width: 0.25rem; }
caption { text-align: left; padding-bottom: 0.5rem; }

/* Native meters and progress bars, drawn as outlined tracks with a solid fill. */
meter, progress {
  -webkit-appearance: none; appearance: none;
  width: 8rem; height: 0.9rem; vertical-align: -0.05em; margin: 0 0.3rem;
  border: 0; border-radius: 0; background: var(--bg);
  outline: 0.1875rem solid var(--fg); outline-offset: 0.15rem; /* the track; the fill sits inside it */
}
/* Chrome sizes the inner bar on its own: give it the meter's height explicitly. */
meter::-webkit-meter-bar { background: var(--bg); border: 0; border-radius: 0; block-size: 0.9rem; }
meter::-webkit-meter-optimum-value, meter::-webkit-meter-suboptimum-value, meter::-webkit-meter-even-less-good-value { background: var(--fg); block-size: 0.9rem; border-radius: 0; }
meter::-moz-meter-bar { background: var(--fg); }
progress::-webkit-progress-bar { background: var(--bg); }
progress::-webkit-progress-value { background: var(--fg); }
progress::-moz-progress-bar { background: var(--fg); }

dialog { max-width: min(36rem, calc(100vw - 2rem)); padding: 1.5rem; border: 0.25rem solid var(--fg); border-radius: 1.25rem; background: var(--bg); color: var(--fg); }
dialog::backdrop { background: rgb(0 0 0 / 0.7); }
dialog h2 { margin-top: 0; }

/* ---- the view bar ------------------------------------------------------------------------ */

.viewbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0.75rem 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 3.5rem);
  background: var(--bar); color: var(--bar-fg);
  border-bottom: 0.125rem solid var(--bar-line);
  font-size: 1rem;
}
.viewbar-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.75rem; }
/* Folded: the bar is gone and a "View settings" button in the masthead brings it back. */
:root[data-bar="0"] .viewbar { display: none; }
.viewbar .fold { grid-column: 2; padding-inline: 0.75rem 1rem; }
button.unfold { background: transparent; color: var(--fg); border-color: var(--fg); }
.unfold { display: none; align-items: center; gap: 0.5rem; min-height: 3.25rem; padding-inline: 0.75rem 1.1rem; font-size: 1.1rem; }
.unfold svg { width: 1.4rem; height: 1.4rem; }
:root[data-bar="0"] .unfold { display: inline-flex; }
.masthead-end { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.viewbar .group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.viewbar .label { font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; margin-right: 0.25rem; }
.viewbar button {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 3.25rem; padding: 0.25rem 1rem 0.25rem 0.5rem;
  border-color: var(--bar-fg); color: var(--bar-fg); background: transparent;
}
.viewbar button[aria-pressed="true"] { background: var(--bar-fg); color: var(--bar); }
.viewbar button[aria-pressed="true"]::after { content: "✓" / ""; font-weight: 800; }
.viewbar .round { width: 3.25rem; padding: 0; justify-content: center; }
.viewbar output { min-width: 4.5rem; text-align: center; font-weight: 800; font-size: 1.2em; }
.viewbar svg { width: 1.4rem; height: 1.4rem; }

.sw {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 0.125rem solid currentColor;
  font-size: 0.9rem; font-weight: 800; letter-spacing: 0;
  forced-color-adjust: none;
}
.sw-auto { background: linear-gradient(135deg, #ffffff 50%, #0a0a0a 50%); color: #0a0a0a; border-color: #0a0a0a; }
.sw-auto span { background: #ffffff; padding: 0 0.1rem; border-radius: 0.2rem; }
.sw-day { background: #ffffff; color: #0a0a0a; border-color: #0a0a0a; }
.sw-night { background: #0a0a0a; color: #fafafa; border-color: #fafafa; }
.sw-yb { background: #000000; color: #ffe500; border-color: #ffe500; }
.sw-by { background: #ffe500; color: #000000; border-color: #000000; }

.switch { display: inline-flex; width: 4rem; height: 2.1rem; padding: 0.2rem; border: 0.1875rem solid currentColor; border-radius: 999px; }
.switch::before { content: ""; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: currentColor; }
.viewbar [aria-checked="true"] { background: var(--bar-fg); color: var(--bar); }
.viewbar [aria-checked="true"] .switch { justify-content: flex-end; }

/* ---- page frame -------------------------------------------------------------------------- */

.masthead, main, .site-footer { padding-inline: clamp(1rem, 4vw, 3.5rem); }
.masthead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; padding-block: 2rem 0; }
.brand { display: inline-flex; align-items: center; gap: 0.85rem; color: var(--fg); text-decoration: none; }
.brand img { width: 3.5rem; height: 3.5rem; }
.brand .name { font-size: 2.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.brand .tagline { display: block; font-size: 1rem; font-weight: var(--w-body); color: var(--muted); letter-spacing: 0; }
.masthead nav { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.masthead nav a {
  display: inline-flex; align-items: center; min-height: 3.25rem; padding: 0 1.1rem;
  border-radius: 999px; color: var(--fg); text-decoration: none; font-size: 1.1rem;
}
.masthead nav a:hover { text-decoration: underline; text-decoration-thickness: 0.1875rem; }
.masthead nav a[aria-current="page"] { background: var(--btn); color: var(--btn-fg); }

main { max-width: 64rem; padding-block: 2.5rem 1.5rem; }
.site-footer { margin-top: 2rem; padding-block: 1.75rem 3.5rem; border-top: 0.25rem solid var(--fg); font-size: 1.1rem; }
.site-footer p { margin: 0 0 0.5rem; }

/* Link-looking actions that are really the main next step. */
.button {
  display: inline-flex; align-items: center; gap: 0.6rem; min-height: 3.5rem; padding: 0 1.75rem;
  border-radius: 999px; background: var(--btn); color: var(--btn-fg); text-decoration: none;
}
.button:hover { text-decoration: underline; text-decoration-thickness: 0.1875rem; }

/* ---- feed -------------------------------------------------------------------------------- */

.cards { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 1.75rem; }
.card {
  border: 0.25rem solid var(--fg); border-radius: 1.25rem; background: var(--surface);
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 3vw, 2.25rem);
}
.card > :last-child { margin-bottom: 0; }
.card h2 { margin-top: 0; font-size: 2.1rem; }
.card-score { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.4rem; margin-bottom: 1rem; }
.card-score .pct { font-size: 3.5rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.card-score .word { display: block; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.35rem; }
.card-score .where { margin-left: auto; font-weight: var(--w-strong); display: inline-flex; align-items: center; gap: 0.4rem; }
.card-score .where svg { width: 1.6rem; height: 1.6rem; }
.card figure { margin: 0 0 1rem; }
.card details { border-top: 0.1875rem solid var(--fg); padding-top: 0.75rem; }
.card details summary { font-weight: 800; }
.card .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* Countable blocks: "8 of 10 filled" reads without colour, contrast or a legend. */
.blocks { display: inline-flex; gap: 0.3rem; vertical-align: middle; }
.blocks i { width: 1.35rem; height: 1.35rem; border: 0.1875rem solid var(--fg); border-radius: 0.25rem; }
.blocks i.on { background: var(--fg); }
.blocks.small i { width: 1.1rem; height: 1.1rem; }
.reasons { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.reasons li { display: grid; grid-template-columns: minmax(0, 1fr) auto 10rem; gap: 0.5rem 1rem; align-items: center; }
@media (max-width: 40em) {
  .reasons li { grid-template-columns: 1fr auto; }
  .reasons li > :first-child { grid-column: 1 / -1; }
}
.weaker { border: 0.25rem dashed var(--fg); border-radius: 1.25rem; padding: 1rem 1.75rem; }
.weaker > summary { font-weight: 800; }
.weaker .cards { margin-top: 1.25rem; }

/* ---- editor, coach, map, pages ----------------------------------------------------------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.toolbar button { min-height: 2.75rem; padding: 0.2rem 0.85rem; font-size: 1rem; }
#editor {
  min-height: max(15rem, 50vh); padding: 1rem 1.25rem; margin-bottom: 1rem; /* opens at half the window */
  border: 0.1875rem solid var(--fg); border-radius: 0.75rem; background: var(--bg);
}
#editor > :first-child, .page > :first-child { margin-top: 0; }
.coach { border: 0.25rem solid var(--fg); border-radius: 1.25rem; padding: 1.25rem 1.5rem; margin-top: 2rem; }
.coach h2 { margin-top: 0; }
.coach ul { list-style: none; padding: 0; }
.coach li { margin-bottom: 0.5rem; }
.coach meter { margin-right: 0.5rem; }
canvas { display: block; max-width: 100%; margin-bottom: 0.75rem; box-shadow: 0 0 0 0.1875rem var(--fg); border-radius: 0.25rem; }
canvas:focus-visible { box-shadow: 0 0 0 0.1875rem var(--fg), 0 0 0 0.625rem var(--halo); }
.page { border: 0.25rem solid var(--fg); border-radius: 1.25rem; padding: clamp(1.25rem, 3vw, 2.25rem); }

/* ---- small screens ----------------------------------------------------------------------- */

@media (max-width: 40em) {
  body { font-size: 1.1875rem; }
  h1 { font-size: 2.6rem; }
  h2, .card h2 { font-size: 1.6rem; }
  .brand .name { font-size: 2.1rem; }
  .card-score .pct { font-size: 2.6rem; }
  .card-score .where { margin-left: 0; }
  .viewbar { gap: 0.6rem 1rem; grid-template-columns: minmax(0, 1fr); }
  .viewbar .fold { grid-column: 1; grid-row: 1; justify-self: end; }
  .masthead-end { column-gap: 0.25rem; }
  .masthead nav a { padding-inline: 0.7rem; }
  .unfold { padding-inline: 0.6rem 0.9rem; }
}

/* ---- the system is in charge ------------------------------------------------------------- */

@media (forced-colors: active) {
  .blocks i.on, .switch::before { background: CanvasText; }
  .viewbar button[aria-pressed="true"], .viewbar [aria-checked="true"] { border-style: double; border-width: 0.4rem; }
  .masthead nav a[aria-current="page"] { border: 0.25rem solid CanvasText; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .viewbar, .masthead nav, .skip { display: none; }
  :root { --bg: #fff; --surface: #fff; --fg: #000; --muted: #000; --accent: #000; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
main:focus { outline: none; box-shadow: none; }
/* A progress bar with no value ("still working"): still stripes, no animation. */
progress:not([value]) { background: repeating-linear-gradient(90deg, var(--fg) 0 0.5rem, transparent 0.5rem 1rem); }
progress:not([value])::-webkit-progress-bar { background: transparent; }
progress:not([value])::-moz-progress-bar { background: transparent; }
