/* The Christmas Giving List: styles shared by every page (index.html and about.html).
   Both pages link this one file, so they always look the same. */
/* Fonts. Both are hosted on this site, never on a font service, so loading them sends no visitor data anywhere.
   Lora (headings, bold only) and DM Sans (everything else), Latin letters only. Licenses: fonts/Lora-OFL.txt and fonts/DMSans-OFL.txt (SIL Open Font License).
   While a font loads, the "Fallback" faces below stand in for it. They use Times New Roman or Arial (or their Liberation twins on Linux),
   resized so text takes up about the same space, so nothing jumps when the real font arrives.
   Line widths are set in em, not ch: a "ch" is the width of the digit 0, which changes when the font changes and would
   make lines re-wrap as the fonts load. Each em value equals the old ch width in the real font (for example, 60ch = 41.04em). */
@font-face { font-family: "Lora"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/lora-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/dm-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/dm-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/dm-sans-latin-700-normal.woff2") format("woff2"); }
@font-face {
  font-family: "Lora Fallback"; font-weight: 700;
  src: local("Times New Roman Bold"), local("TimesNewRomanPS-BoldMT"), local("Liberation Serif Bold"), local("LiberationSerif-Bold");
  size-adjust: 110.59%; ascent-override: 90.97%; descent-override: 24.78%; line-gap-override: 0%;
}
@font-face {
  font-family: "DM Sans Fallback"; font-weight: 400;
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("LiberationSans");
  size-adjust: 102.78%; ascent-override: 96.51%; descent-override: 30.16%; line-gap-override: 0%;
}
@font-face {
  font-family: "DM Sans Fallback"; font-weight: 600;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold");
  size-adjust: 99.64%; ascent-override: 99.56%; descent-override: 31.11%; line-gap-override: 0%;
}
@font-face {
  font-family: "DM Sans Fallback"; font-weight: 700;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold");
  size-adjust: 101.29%; ascent-override: 97.94%; descent-override: 30.61%; line-gap-override: 0%;
}

:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --ink: #14231d;
  --ink-soft: #40524a;
  --line: #cfd9d3;
  --line-soft: #dde5e0;
  --line-strong: #64786e;
  --brand: #0f5c45;
  --on-brand: #ffffff;
  --urgent: #9c1f2c;
  --urgent-bg: #fbe8ea;
  --note-ink: #574000;
  --note-bg: #fdf1cf;
  --calm-bg: #e3f0ea;
  --place-bg: #eef3f0;
  --place-ink: #0b4535;
  --place-line: #d4e1da;
  /* Header: a solid evergreen band, the same in light and dark mode */
  --head-bg: #0b4535;
  --head-ink: #ffffff;
  --font-display: "Lora", "Lora Fallback", Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-body: "DM Sans", "DM Sans Fallback", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1814;
    --surface: #17231e;
    --ink: #e8f0ec;
    --ink-soft: #b1c2b9;
    --line: #2e4138;
    --line-soft: #25372f;
    --line-strong: #8aa096;
    --brand: #84d8b8;
    --on-brand: #06231a;
    --urgent: #ffa3ad;
    --urgent-bg: #3b1a20;
    --note-ink: #f4dd9c;
    --note-bg: #3a3013;
    --calm-bg: #1c342a;
    --place-bg: var(--calm-bg);
    --place-ink: var(--ink);
    --place-line: var(--line);
    --head-ink: #f1f8f4;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}
h1, h2, h3, h4, p, dl, dd { margin: 0; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
a { color: var(--brand); text-underline-offset: 0.15em; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  background: var(--brand); color: var(--on-brand);
  padding: 12px 16px; border-radius: 6px; font-weight: 600;
}
.skip:focus { top: 12px; }

.wrap { max-width: 840px; margin: 0 auto; padding: 0 20px; }

/* Header: a solid evergreen band with the site's name, a short tagline, and the tree. The tree is decoration only. */
.site-head { position: relative; background: var(--head-bg); color: var(--head-ink); }
.site-head .wrap { position: relative; display: grid; gap: 6px; padding-top: 30px; padding-bottom: 32px; }
.site-title {
  font-family: var(--font-display); font-weight: 700; font-size: 2.75rem; line-height: 1.05; letter-spacing: -0.01em;
  color: #fbf6ec; text-wrap: balance;
  max-width: calc(100% - 160px); /* stops before the tree, so the title never runs under it */
}
.site-title .dot { color: #f2c14e; }
/* On the About page the title links back to the list: no underline until it is hovered or focused */
.site-title a { color: inherit; text-decoration: none; }
.site-title a:hover, .site-title a:focus-visible { text-decoration: underline; text-decoration-thickness: 0.06em; }
.tagline { font-size: 1.1875rem; line-height: 1.45; color: #e6f2ec; text-wrap: balance; }
.site-head :focus-visible { outline-color: var(--head-ink); }
/* The tree and gifts sit at the bottom right of the band */
.holiday-art { position: absolute; right: 20px; bottom: 20px; width: 124px; height: auto; }
@media (max-width: 699px) {
  .site-head .wrap { padding-top: 20px; padding-bottom: 22px; }
  /* On phones the title always breaks as "The Christmas / Giving List." */
  .site-title { font-size: 1.875rem; max-width: 7.63em; /* 12ch in Lora */ }
  /* The tagline stops before the tree, so the two never touch */
  .tagline { font-size: 1rem; max-width: min(16.42em, calc(100% - 104px)); }
  .holiday-art { width: 96px; right: 14px; bottom: 14px; }
}
/* List page, just below the green band: the page heading, a short introduction, then the "About this project" link.
   Filters, Sort and the count follow right under them. The heading starts 24px below the band (20px on phones). */
.intro { padding-top: 24px; padding-bottom: 22px; }
/* The small row just below the green band on the About page, with "Back to the list" */
.topline { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 20px; padding-top: 4px; }
/* The link keeps its 44px tap height */
.topline .page-link { font-size: 0.9375rem; }
/* The page heading on both pages: "Give a holiday gift to someone in New York City" and "About this project" */
.intro-title { font-family: var(--font-display); font-weight: 700; font-size: 2rem; line-height: 1.1; color: var(--ink); margin: 4px 0 0; }
/* On the list page the space above the heading comes from .intro */
.intro .intro-title { margin-top: 0; }
/* A short introduction under the heading on the list page, no wider than 60 characters (41.04em) */
.intro-lead { font-size: 1.0625rem; line-height: 1.5; color: var(--ink); max-width: 41.04em; margin: 8px 0 0; text-wrap: pretty; }
/* "About this project" under the introduction. It keeps its 44px tap height; moving it up 4px leaves about 6px
   between the introduction and the link's words. */
.intro > .page-link { display: block; width: fit-content; margin-top: -4px; font-size: 0.9375rem; }
@media (max-width: 699px) {
  .intro { padding-top: 20px; padding-bottom: 12px; }
  .intro-title { font-size: 1.375rem; }
  .intro-lead { font-size: 1rem; margin-top: 6px; }
}

/* Page grid. Wide screens: filters at the side, list heading and sort menu on one row above the list. */
.page {
  display: grid; grid-template-columns: 230px minmax(0, 1fr) auto; grid-template-rows: auto 1fr;
  grid-template-areas: "filters head sort" "filters results results";
  column-gap: 24px; row-gap: 12px; align-items: start; padding-bottom: 48px;
}
/* The count line and the Sort text share a baseline, so on wide screens their words line up */
.results-head { grid-area: head; align-self: baseline; }
#results { grid-area: results; min-width: 0; }

/* Filters */
/* The base look of the filter panel: a white box like the program cards, a divider between groups, and the same
   checkboxes. Further down, wide screens turn it into a quiet side rail and small screens into a tinted panel. */
.filters { grid-area: filters; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
/* The panel follows you down the page only when all of it fits on the screen,
   so it never needs its own scroll bar. The script below adds this class. */
.filters.sticky { position: sticky; top: 16px; }
/* The "Filters" button that opens the panel shows only on small screens. It has no open/closed marker. */
.filters > summary { display: none; cursor: pointer; font-weight: 700; padding: 11px 14px; min-height: 44px; list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filters-body > * { padding: 12px 14px; }
.filters-body > * + * { border-top: 1px solid var(--line); }
.filters h2 { font-size: 1rem; }
/* A legend normally sits on its group's top edge. Floating it puts it inside the padding, below the divider line. */
.filters fieldset > legend { float: left; width: 100%; padding: 0; margin-bottom: 2px; }
.filters fieldset > legend + * { clear: both; }
.filters .check { align-items: center; min-height: 44px; padding: 4px 6px; margin: 0 -6px; }
.filters .check input { width: 22px; height: 22px; margin: 0; }
/* A short hint under one option ("Anywhere in NYC"). It lines up with the option's words: checkbox width plus the 10px gap. */
.check-hint { font-size: 0.875rem; color: var(--ink-soft); line-height: 1.4; margin: -6px 0 6px; padding-left: 32px; }
/* A hint for a whole group ("How to give"). It sits right under the group's name and lines up with it, not with the options. */
.check-hint.group-hint { padding-left: 0; margin: 0 0 4px; }
.filters-body > label.check { padding: 8px 14px; margin: 0; border-radius: 0; }
/* "Reset filters" as an underlined text button: in the filter panel (#clear) and in the line above the list (#clear3) */
#clear, #clear3 { border-color: transparent; text-decoration: underline; padding: 6px 0; min-height: 44px; }
#clear:hover, #clear3:hover { background: transparent; text-decoration-thickness: 2px; }
.filters .hint { margin-top: 2px; }
legend { margin: 0 0 2px; padding: 0; font-weight: 700; }
select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 7px 10px; min-height: 40px; width: 100%;
}
.check {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer; min-height: 34px;
}
.check:hover { background: var(--calm-bg); }
.check input { width: 19px; height: 19px; margin: 3px 0 0; flex: none; accent-color: var(--brand); }
.count { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 0.875rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; line-height: 1.25; text-align: center; text-decoration: none;
  min-height: 44px; padding: 9px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--brand);
}
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.secondary { background: transparent; color: var(--brand); }
.btn:hover { filter: brightness(1.08); }
.btn.secondary:hover { background: var(--calm-bg); filter: none; }

/* Results bar */
#count { color: var(--ink-soft); font-variant-numeric: tabular-nums; font-size: 0.9375rem; }
@media (max-width: 699px) { #count { font-size: 0.875rem; } }
/* Sort control. What you see is the "face": plain text that reads "Sorted by deadline, soonest first" with a down arrow.
   "Sorted by" is in the text color; the option name (always underlined) and the arrow are in the brand color. The real menu sits on top of it
   and is see-through, so the control looks the same in every browser and still opens the phone's or computer's
   own menu. The face is 36px tall, like the Filters button beside it on phones; the menu reaches
   4px above and below it, so the tap area is 44px tall. */
.sort { grid-area: sort; align-self: baseline; position: relative; display: inline-flex; min-width: 0; }
.sort-face {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; box-sizing: border-box;
  width: 100%; min-width: 0; min-height: 36px; white-space: nowrap; font-size: 0.9375rem; font-weight: 600; color: var(--brand);
}
.sort-face svg { flex: none; }
.sort-by { color: var(--ink); font-weight: 400; }
.sort-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
/* With large text or wide letter spacing the label wraps onto a second line. It is never cut off. */
#sortText { min-width: 0; white-space: normal; line-height: 1.25; padding: 4px 0; }
.sort select {
  position: absolute; inset: -4px 0; width: 100%; height: calc(100% + 8px); min-height: 0; padding: 0; border: 0; opacity: 0;
  -webkit-appearance: none; appearance: none; font-size: 1rem; cursor: pointer;
}
.sort:focus-within .sort-face { outline: 3px solid var(--brand); outline-offset: 3px; }

/* Cards */
#list { display: grid; gap: 18px; }
/* Below the list: "Showing 10 of 46 programs." and the "Show 10 more" button, centered */
.list-more { display: grid; justify-items: center; gap: 12px; margin-top: 28px; text-align: center; color: var(--ink-soft); }
.list-more .btn { min-width: 220px; min-height: 44px; border-width: 2px; }
/* At the end of the list: a small note about full or closed programs that are hidden, with a button that looks like a link */
.list-note { margin-top: 28px; text-align: center; font-size: 0.875rem; color: var(--ink-soft); }
.link-btn {
  font: inherit; color: var(--brand); background: none; border: 0; padding: 4px 0; margin: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 0.15em;
}
.link-btn:hover { text-decoration-thickness: 2px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.card article {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 22px 22px;
}
.card-main { display: grid; gap: 13px; align-content: start; }
.card h3 { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.25; text-wrap: balance; }
@media (max-width: 699px) { .card h3 { font-size: 1.125rem; } }
.org { color: var(--ink-soft); font-weight: 400; margin-top: -7px; font-size: 0.9375rem; text-wrap: balance; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
/* Card header: name, then organization, then the deadline and who it helps on their own row */
.card-head { display: flex; flex-direction: column; gap: 6px; }
.card-title { display: grid; gap: 2px; }
.card-head .org { margin-top: 0; }
.card-head .badges { align-items: center; }
.card-head .badge { overflow-wrap: anywhere; }
.soon { color: var(--urgent); font-weight: 700; font-size: 0.875rem; }
.badge {
  display: inline-block; font-size: 0.875rem; font-weight: 700; line-height: 1.3;
  padding: 4px 10px; border: 1px solid var(--brand); border-radius: 999px; background: var(--calm-bg); color: var(--ink);
}
.badge.urgent { background: var(--urgent-bg); color: var(--urgent); border-color: var(--urgent); }
.badge.note { background: var(--note-bg); color: var(--note-ink); border-color: var(--note-ink); }
/* Where the gifts go: a quieter pill after the deadline. It is a label, not a control. */
.badge.place {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.8125rem; font-weight: 600;
  background: var(--place-bg); color: var(--place-ink); border-color: var(--place-line);
}
.badge.place svg { flex: none; }
.summary { max-width: 35.57em; }
.flag {
  background: var(--note-bg); color: var(--note-ink);
  border-left: 5px solid var(--note-ink); padding: 10px 12px; border-radius: 4px; max-width: 35.57em;
}
/* Facts at a glance, each with a small picture: the cost, and the sign-up only when one is needed */
.glance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin-top: 2px; font-size: 0.9375rem; }
/* With no sign-up, the cost has the whole row to itself */
.glance > .g:only-child { grid-column: 1 / -1; }
.g { display: grid; grid-template-columns: 20px minmax(0, 1fr); column-gap: 8px; align-content: start; }
.g .ic { grid-row: 1 / span 2; margin-top: 1px; color: var(--brand); }
.g dt { font-weight: 700; font-size: 0.8125rem; color: var(--ink-soft); }
.g.needs .ic, .g.needs strong { color: var(--note-ink); }
.ic { flex: none; }
/* Long email addresses and links wrap instead of pushing past the card on narrow phones (see also .more-body) */
.glance dd { overflow-wrap: anywhere; }
.card h4 { font-size: 0.9375rem; }
.steps { list-style: decimal; padding-left: 1.4em; display: grid; gap: 4px; max-width: 36.94em; margin-top: -6px; }
/* Choices inside a step: the giver picks one, so they are bullets, not numbers */
.steps .choices { list-style: disc; padding-left: 1.2em; display: grid; gap: 4px; margin-top: 4px; font-size: inherit; }
.goodtoknow { color: var(--ink-soft); max-width: 35.57em; }

details.more { border-top: 1px solid var(--line-soft); margin-top: -2px; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 11px 0; margin-bottom: -11px; min-height: 44px; font-size: 0.9375rem; }
details.more[open] > summary { margin-bottom: 0; }
.more-body { display: grid; gap: 10px; padding-top: 4px; font-size: 0.9375rem; overflow-wrap: anywhere; }

/* Ways to give. The card decides the layout by its own width, not the screen's.
   A way with a button shows just the button; its details are in "Steps and details".
   A way with no button shows its name and a line of help.
   Narrow card (phones): full-width buttons, one under another.
   Wide card (480px of room or more): one column of buttons on the left, as wide as the card's widest button. */
/* The "How to give" heading is there for screen readers only, so the ways to give follow the facts with the card's normal gap */
.card-action { display: grid; gap: 0; container-type: inline-size; }
.give-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.give { display: grid; gap: 6px; }
/* A way with no button gets a little more room above and below it, so it reads as its own item.
   The email help (.give-help) sits right under the buttons, so it doesn't. */
.give:not(.has-act):not(.give-help):not(:first-child), .give:not(.has-act):not(.give-help) + .give { padding-top: 8px; }
.give-text { min-width: 0; padding: 0 2px; }
.give-act { order: -1; display: grid; gap: 8px; }
.give-act .btn { width: 100%; min-height: 48px; }
/* Very narrow cards (phones about 350px wide or less): a little less padding and slightly smaller text,
   so longer labels such as "Get directions to drop-off" stay on one line */
@container (max-width: 279px) {
  .give-act .btn { padding-left: 10px; padding-right: 10px; gap: 6px; font-size: 0.9375rem; }
}
.btn-label { text-wrap: balance; }
.give-name { font-size: 0.9375rem; font-weight: 600; }
.give-detail { color: var(--ink-soft); font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; }
.give-name + .give-detail { margin-top: 2px; }
.give-detail .signup-first { color: var(--note-ink); }
@container (min-width: 480px) {
  /* All the buttons on one card share the left-hand column. It is as wide as the widest button, so they all match.
     Rows with no button line up with the buttons and wrap inside that column without making it wider
     (width 0, then stretched to the column). The email help uses the whole width. */
  .give-list { grid-template-columns: fit-content(100%) minmax(0, 1fr); }
  .give { grid-column: 1 / -1; grid-template-columns: subgrid; }
  .give-text { grid-column: 1; width: 0; min-width: 100%; padding: 0; }
  /* If a card has no button at all (every way with a button has ended), the words use the whole width instead */
  .give-list:not(:has(.give-act)) .give-text { grid-column: 1 / -1; width: auto; }
  .give > details.msg { grid-column: 1 / -1; padding: 0; }
  .give-act { grid-column: 1; }
  .give-act .btn { min-height: 44px; padding: 9px 12px; }
}
/* The copy buttons under "If your email app does not open": at the right, or full width on phones */
.action-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: flex-end; justify-self: stretch; }
.card-action .hint { max-width: 35.57em; }
.addr, .give-detail strong { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.copy-status { font-weight: 600; font-size: 0.875rem; }
details.msg > summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 10px 0; min-height: 44px; font-size: 0.9375rem; }
.msg-body { border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: grid; gap: 8px; font-size: 0.9375rem; }
.msg-body pre { margin: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.source { font-size: 0.875rem; margin: -6px 0 -10px; }
.source a { display: inline-block; padding: 12px 0; }

.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 24px; display: grid; gap: 12px; justify-items: start; }

/* About */
.about { border-top: 1px solid var(--line); padding: 24px 0 40px; font-size: 0.9375rem; }
.about .wrap { display: grid; gap: 12px; }
.about h2 { font-family: var(--font-display); font-size: 1.25rem; }
.about .wrap > p { max-width: 41.04em; }
.about .footnote { font-size: 0.875rem; font-weight: 500; color: var(--ink-soft); }
/* The fine print is four short lines. The footer's grid puts 12px between items; these sit 6px apart. */
.about .footnote + .footnote { margin-top: -6px; }
.about .form-link { justify-self: start; }
/* Feedback form: folded away, and not loaded until it is first opened */
details.feedback > summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 11px 0; min-height: 44px; }
.feedback iframe { display: block; width: 100%; height: 1000px; border: 0; }
@media (max-width: 699px) { .feedback iframe { height: 1200px; } }
.form-link { display: inline-block; padding: 12px 0; }

/* The line above the list that names the filters that are on. It is light, like the count, with "Reset filters"
   at the end of the same line. It shows only while the filter panel is closed, so only one "Reset filters" is on
   screen at a time. Wide screens always show the filters and their own "Reset filters", so it never shows there.
   The words get the same space above and below as the 44px-tall button, so the gap stays even when they wrap,
   and the line moves up 6px to sit closer to the count. */
.applied { display: flex; align-items: baseline; column-gap: 12px; margin: -6px 0 2px; font-size: 0.875rem; color: var(--ink-soft); }
.applied p { padding: 11px 0; }
.applied .btn { flex: none; }
.filters[open] ~ #results .applied { display: none; }
.btn.small { min-height: 44px; padding: 5px 12px; font-size: 0.875rem; }
#showResults { display: none; }
/* Parts of the filter panel that only show when it is folded away on small screens */
.sheet-close { display: none; }
.sheet-foot { display: block; }

/* Wide screens: the filters are a quiet side rail, not a white box like the program cards.
   Smaller, softer text keeps the list as the main thing on the page. Rows stay 44px tall. */
@media (min-width: 700px) {
  .page { grid-template-columns: 200px minmax(0, 1fr) auto; }
  .filters { background: transparent; border: 0; border-radius: 0; }
  .filters-body > * { padding: 10px 0; }
  .filters-body > * + * { border-top: 1px solid var(--line-soft); }
  .filters-body > .sheet-head { padding-top: 0; }
  .filters h2 { font-size: 0.875rem; color: var(--ink-soft); }
  /* Beside the list you can see it update, so this line is kept for screen readers only */
  .filters .sheet-head .hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .filters fieldset > legend { font-size: 0.8125rem; color: var(--ink-soft); }
  .filters .check { font-size: 0.9375rem; }
  .filters .check input { width: 18px; height: 18px; }
  .check-hint { padding-left: 28px; margin-top: -8px; }
  .filters-body > label.check { padding: 8px 0; }
}

/* Small and medium screens (under 700px): the filters fold away behind a "Filters" button that sits
   beside "Sorted by". The panel opens below both and is styled like a phone filter sheet:
   a title with Close, large rows, and a bar at the bottom that stays in view. */
@media (max-width: 699px) {
  html { scroll-padding-bottom: 96px; }
  /* The Filters button is as wide as its label, and a little wider when it shows how many filters are on */
  .page { grid-template-columns: 6.25rem minmax(0, 1fr); grid-template-rows: none; grid-template-areas: none; column-gap: 8px; }
  .page:has(.fs-count) { grid-template-columns: 7.75rem minmax(0, 1fr); }
  /* The panel spans the full width. The sort menu sits over its empty top right corner, at the right edge. */
  .filters { grid-area: auto; grid-column: 1 / -1; grid-row: 1; border: 0; border-radius: 0; background: transparent; }
  .filters.sticky { position: static; }
  .sort { grid-area: auto; grid-column: 2; grid-row: 1; align-self: start; justify-self: end; position: relative; z-index: 1; }
  #sortText { overflow-wrap: anywhere; }   /* with very large text the label breaks instead of pushing the page sideways */
  .results-head { grid-area: auto; grid-column: 1 / -1; grid-row: 2; }
  #results { grid-area: auto; grid-column: 1 / -1; grid-row: 3; }

  /* The Filters button. It looks 36px tall, like the Sort text beside it, and its tap area is 44px tall. */
  .filters > summary {
    position: relative; display: flex; align-items: center; gap: 6px; box-sizing: border-box; width: 6.25rem; min-height: 36px;
    padding: 0 12px; white-space: nowrap; font-size: 0.875rem; font-weight: 600;
    border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink);
  }
  .filters > summary::after { content: ""; position: absolute; inset: -4px 0 -5px; }
  .filters > summary:hover { border-color: var(--brand); }
  .filters > summary:has(.fs-count) { width: 7.75rem; border-color: var(--brand); }
  .filters > summary svg { flex: none; }
  .filters[open] > summary { background: var(--calm-bg); border-color: var(--brand); }
  .fs-count {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand); color: var(--on-brand); font-size: 0.8125rem; font-variant-numeric: tabular-nums;
  }

  /* The open panel: a box under the two controls, in the same tint as the open Filters button,
     so it stands apart from the list. The dividers between groups use var(--line) so they still show on the tint. */
  .filters-body { margin-top: 12px; border: 1.5px solid var(--brand); border-radius: 12px; background: var(--calm-bg); }
  .filters-body > * { padding: 10px 16px; }
  .filters-body > .sheet-head { padding-top: 12px; }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .sheet-close {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; border: 0; background: none;
    font: inherit; font-weight: 700; color: var(--brand); text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer;
  }
  .filters h2 { font-size: 0.875rem; color: var(--ink-soft); }
  .filters fieldset > legend { font-size: 0.8125rem; color: var(--ink-soft); }
  .filters .check { min-height: 48px; font-size: 0.9375rem; }
  .filters .check input { width: 20px; height: 20px; }
  .check-hint { padding-left: 30px; }
  .filters-body > label.check { padding: 8px 16px; }
  /* The usual light-green highlight would not show on the tint, so rows you tap or point at turn white */
  .filters .check:hover { background: var(--surface); }
  /* The bar with "Reset filters" and "Show programs" stays in view while you scroll the options.
     It keeps the tint, and its bottom corners follow the box's: 12px less the 1.5px border.
     With very large text the two buttons don't fit side by side, so "Show programs" moves to its own line. */
  .sheet-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; position: sticky; bottom: 0; background: var(--calm-bg); border-radius: 0 0 10.5px 10.5px; }
  #showResults { display: inline-flex; flex: 1; min-height: 44px; }
}
/* Phones: cards stack and buttons run the full width */
@media (max-width: 519px) {
  .card article { padding: 18px 16px; }
  .glance { grid-template-columns: minmax(0, 1fr); }
  .action-row .btn { width: 100%; }
}
/* Very narrow phones: no room for two controls in a row, so "Sorted by" drops below "Filters", on the left */
@media (max-width: 359px), (max-width: 22.4em) {
  .page, .page:has(.fs-count) { grid-template-columns: minmax(0, 1fr); }
  .sort { grid-column: 1; grid-row: 2; justify-self: start; }
  .results-head { grid-row: 3; }
  #results { grid-row: 4; }
}

/* A text link that leads to another page: "About this project", "Back to the list".
   Brand color, a bit bolder than body text, underlined like the other links, and at least 44px tall to tap. */
.page-link {
  display: inline-block; box-sizing: border-box; min-height: 44px; padding: 10px 0; justify-self: start;
  color: var(--brand); font-weight: 600;
}

/* About page: one column, no wider than 60 characters (41.04em). The link row and the heading use .topline and
   .intro-title. The parts after the first section are 28px apart,
   with 36px after the first section itself. */
.about-page { display: grid; grid-template-columns: minmax(0, 41.04em); padding-bottom: 48px; }
.about-page > section ~ * { margin-top: 28px; }
/* A little more room after the letter card, so it stands apart from "How the list works" */
.about-page > section:first-of-type + * { margin-top: 36px; }
/* Space between the heading and the story */
.about-page h1 { margin-bottom: 16px; }
.about-page h2 { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.3; margin-bottom: 16px; }
.about-page p, .about-page li { line-height: 1.6; }
.about-story { display: grid; gap: 12px; }
/* The letter sits in a card with a gold top edge, a small label above it, and the name in the heading font */
.about-story.letter { background: var(--surface); border: 1px solid var(--line); border-top: 5px solid #f2c14e; border-radius: 10px; padding: 24px 32px 28px; }
.about-page .letter-label { font-family: var(--font-body); font-size: 0.875rem; font-weight: 600; line-height: 1.4; letter-spacing: 0.02em; color: var(--ink-soft); margin: 0; }
.letter-sign { font-family: var(--font-display); font-weight: 700; font-size: 1.375rem; line-height: 1.2; color: var(--ink); }
/* Placed after the rule above so it wins on small screens */
@media (max-width: 699px) { .about-story.letter { padding: 20px; } }
.about-page ul { list-style: disc; padding-left: 1.3em; display: grid; gap: 8px; }
/* Small arrows drawn in the link's own color ("About this project →", "← Back to the list") */
.page-link .arrow { display: inline-block; width: 0.95em; height: 0.95em; vertical-align: -0.14em; }
/* The gap next to the arrow is a margin, not a space, so the underline stops at the words */
.page-link .arrow-after { margin-left: 0.3em; }
.page-link .arrow-before { margin-right: 0.3em; }
