/* Zero Step brand. Tokens documented in docs/DESIGN.md. */

/* Self-hosted fonts (latin subset, SIL OFL; see fonts/README.md). */
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/fonts/montserrat-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: 'Caveat'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/caveat-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;
}
/* Metric-matched fallbacks: local system faces scaled/shifted to Montserrat's and Caveat's widths and vertical
   metrics, so the swap to the web font does not reflow text (CLS). Values measured against the font files. */
@font-face {
  font-family: 'Montserrat Fallback'; font-weight: 400 500;
  src: local('Arial'), local('ArialMT'), local('Helvetica'), local('Liberation Sans'), local('LiberationSans'), local('Arimo');
  size-adjust: 114%; ascent-override: 84.9%; descent-override: 22%; line-gap-override: 0%;
}
@font-face {
  font-family: 'Montserrat Fallback'; font-weight: 600 700;
  src: local('Arial Bold'), local('Arial-BoldMT'), local('Helvetica Bold'), local('Liberation Sans Bold'), local('LiberationSans-Bold'), local('Arimo Bold');
  size-adjust: 110%; ascent-override: 88%; descent-override: 22.8%; line-gap-override: 0%;
}
@font-face {
  font-family: 'Caveat Fallback'; font-weight: 400;
  src: local('Arial'), local('ArialMT'), local('Helvetica'), local('Liberation Sans'), local('LiberationSans'), local('Arimo');
  size-adjust: 74.5%; ascent-override: 128.8%; descent-override: 40.3%; line-gap-override: 0%;
}

:root {
  --font: 'Montserrat', 'Montserrat Fallback', system-ui, sans-serif;
  --hand: 'Caveat', 'Caveat Fallback', cursive;
  --bg: #F7F2E8;
  --surface: #FFFFFF;
  --ink: #141E24;
  --muted: #545A5B;
  --line: rgba(20,30,36,.15);
  --chip: #C7D1BE;
  --mark-bg: rgba(218,145,48,.32);
  --accent: #DA9130;
  --on-accent: #141E24;
  --thumb-ph: #B5C7C3;
  --pill: rgba(255,255,255,.92);
  --focus: #141E24;
  --danger: #B42318;
  --on-danger: #FFFFFF;
  --shadow: 0 14px 40px rgba(20,30,36,.10);
  --radius-card: 20px;
  --dur: 180ms;
  --ease: cubic-bezier(.2,.7,.3,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141E24;
    --surface: #1D2A32;
    --ink: #F7F2E8;
    --muted: #B7B7B1;
    --line: rgba(247,242,232,.14);
    --chip: #2A3A44;
    --mark-bg: rgba(218,145,48,.38);
    --thumb-ph: #2F4A4F;
    --pill: rgba(29,42,50,.92);
    --focus: #DA9130;
    --danger: #F97066;
    --on-danger: #141E24;
    --shadow: 0 14px 40px rgba(0,0,0,.40);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141E24;
  --surface: #1D2A32;
  --ink: #F7F2E8;
  --muted: #B7B7B1;
  --line: rgba(247,242,232,.14);
  --chip: #2A3A44;
  --mark-bg: rgba(218,145,48,.38);
  --thumb-ph: #2F4A4F;
  --pill: rgba(29,42,50,.92);
  --focus: #DA9130;
  --danger: #F97066;
  --on-danger: #141E24;
  --shadow: 0 14px 40px rgba(0,0,0,.40);
  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: 400 16px/1.55 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 16px 24px 64px; }
a { color: inherit; }
button, select { font: inherit; color: inherit; cursor: pointer; }
.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; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.zs-mark { stroke: none; }

/* focus: never removed */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- nav pill ---------- */
.nav-wrap { padding: 20px 16px 0; }
.nav {
  max-width: 720px; margin: 0 auto; padding: 6px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  background: var(--pill); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.brand-mark { justify-self: start; display: grid; place-items: center; width: 44px; height: 44px; color: var(--ink); text-decoration: none; border-radius: 50%; transition: transform 100ms ease-out; }
.brand-mark:active { transform: scale(.97); }
.brand-mark:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-radius: 50%; }
.brand-mark svg { width: 32px; height: 32px; }
.logo {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; border-radius: 999px;
  font-size: 15px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
}
.theme-btn {
  justify-self: end; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  background: var(--chip); color: var(--ink); border: 0; border-radius: 50%;
  transition: transform 100ms ease-out;
}
.theme-btn:active { transform: scale(.97); }
.theme-btn svg { width: 20px; height: 20px; }
.theme-btn[aria-pressed="true"] .i-moon, .theme-btn[aria-pressed="false"] .i-sun { display: none; }

/* ---------- hero ---------- */
.hero { padding: 80px 16px 40px; text-align: center; }
.hand { margin: 0; font: 400 30px/1.2 var(--hand); color: var(--ink); }
.hero h1 { text-wrap: balance; margin: 4px 0 12px; font-size: 48px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.disclaimer { text-wrap: balance; margin: 0 0 32px; font-size: 13px; font-weight: 500; letter-spacing: .04em; color: var(--muted); }

/* ---------- unified search bar ---------- */
.search {
  position: relative; max-width: 860px; margin: 0 auto; padding: 6px; text-align: left;
  display: flex; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
}
.sf-main { display: flex; align-items: center; gap: 10px; flex: 999 1 320px; min-width: 0; height: 52px; padding: 0 12px 0 14px; border-radius: 14px; }
.sf-main:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.search-ico { width: 20px; height: 20px; flex: none; color: var(--muted); }
.search input[type="search"] {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--ink);
  font: 500 17px var(--font); outline: none; padding: 0; -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.clear-btn {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 100ms ease-out;
}
.clear-btn[hidden] { display: none; }
.clear-btn:active { transform: scale(.97); }
.clear-btn:hover { background: var(--line); color: var(--ink); }
.clear-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
.clear-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.sf-group { display: flex; flex: 1 1 auto; align-items: center; justify-content: flex-end; gap: 0; min-width: 0; }

.sel, .date-btn {
  position: relative; height: 52px; border-left: 1px solid var(--line); display: flex; align-items: center;
}
.sel select {
  -webkit-appearance: none; appearance: none; height: 100%; border: 0; background: transparent; color: var(--ink);
  font: 500 15px var(--font); padding: 0 34px 0 40px; border-radius: 0;
}
.sel select option { background: var(--surface); color: var(--ink); }
.sel select:focus-visible { outline-offset: -3px; border-radius: 12px; }
.sel-ico { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.sel-chev { position: absolute; right: 12px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.date-btn {
  gap: 8px; padding: 0 14px; background: transparent; border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0;
  font: 500 15px var(--font); color: var(--ink); white-space: nowrap; min-width: 0;
}
.date-btn:focus-visible { outline-offset: -3px; border-radius: 12px; }
.date-btn svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.date-btn { transition: transform 100ms ease-out; }
.date-btn:active { transform: scale(.97); }
.date-btn .chev { width: 14px; height: 14px; transition: transform var(--dur) var(--ease); }
.date-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.date-btn.active svg:first-child { color: var(--ink); }
.date-btn span { overflow: hidden; text-overflow: ellipsis; }
.date-wrap { min-width: 0; display: flex; }
.find {
  height: 52px; padding: 0 28px; margin-left: 6px; border: 0; border-radius: 14px;
  background: var(--accent); color: var(--on-accent); font: 700 15px var(--font); white-space: nowrap;
  transition: filter var(--dur) var(--ease), transform 100ms ease-out;
}
.find:active { transform: scale(.97); }
.find:hover { filter: brightness(1.07); }

.popover {
  position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: 260px; max-width: calc(100vw - 32px); padding: 16px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  display: grid; gap: 12px;
}
.popover[hidden] { display: none; }
.field { display: grid; gap: 4px; }
.field label { font-size: 14px; font-weight: 600; }
.field input {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  font: 500 16px var(--font); color: var(--ink); background: var(--bg);
}
.link-btn { justify-self: start; min-height: 44px; padding: 0 4px; background: none; border: 0; color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- result type tabs ---------- */
.tabs {
  display: flex; width: fit-content; max-width: 100%; margin: 20px auto 32px; padding: 4px; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.tabs.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); }
.tabs.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.tabs[hidden] { display: none; }
.tab {
  flex: none; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--ink);
  font: 600 14px var(--font); white-space: nowrap; position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 100ms ease-out;
}
.tab:active:not(:disabled) { transform: scale(.97); }
.tab::before { content: ''; position: absolute; inset: -2px 0; }
.tab[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.tab:disabled { color: var(--muted); opacity: .7; cursor: not-allowed; }

/* ---------- sections & grid ---------- */
.section { margin-bottom: 48px; }
#results[data-type="quotes"] .section[data-kind="stories"],
#results[data-type="stories"] .section[data-kind="quotes"] { display: none; }
.section h2 { margin: 0 0 16px; font-size: 13px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.note { margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: stretch; }
.grid[hidden], .note[hidden] { display: none; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  height: 100%; min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.card.story.best, .card.story.best:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .card:hover { transform: translateY(-2px); }
  .card.enter { animation: rise var(--dur) var(--ease) both; }
}
/* Orange border trace (SVG injected by render.js). Calm draw 880ms (slow start, full speed by top-middle); leave = 220ms fade, then dashoffset resets. */
.card { position: relative; }
.card-trace {
  position: absolute; top: -1px; left: -1px; width: calc(100% + 2px); height: calc(100% + 2px);
  overflow: visible; pointer-events: none; fill: none;
}
.card-trace path {
  stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0;
  transition: opacity 220ms ease-out, stroke-dashoffset 0s linear 220ms;
}
@media (hover: hover) {
  .card:not(.best):hover .card-trace path {
    opacity: 1; stroke-dashoffset: 0;
    transition: opacity 0s, stroke-dashoffset 880ms cubic-bezier(.45,0,.25,1);
    /* slow start, accelerating to cruise speed by top-middle (~25% of the path), then a soft landing */
    transition: opacity 0s, stroke-dashoffset 880ms linear(0, .0152 9.1%, .0606 18.2%, .1363 27.4%, .25 37%, .9 85.2%, .975 92.6%, 1);
  }
}
.card:not(.best):has(:focus-visible) .card-trace path {
  opacity: 1; stroke-dashoffset: 0;
  transition: opacity 0s, stroke-dashoffset 880ms cubic-bezier(.45,0,.25,1);
  transition: opacity 0s, stroke-dashoffset 880ms linear(0, .0152 9.1%, .0606 18.2%, .1363 27.4%, .25 37%, .9 85.2%, .975 92.6%, 1);
}
@media (prefers-reduced-motion: reduce) {
  .card-trace path, .card:not(.best):hover .card-trace path, .card:not(.best):has(:focus-visible) .card-trace path { transition: none; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 14px; background: var(--thumb-ph); overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.play {
  position: absolute; top: 50%; left: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  display: grid; place-items: center; border-radius: 50%; background: rgba(20,30,36,.72); color: #F7F2E8;
  opacity: .85; transition: opacity var(--dur) var(--ease); pointer-events: none;
}
.play svg { width: 22px; height: 22px; margin-left: 3px; fill: currentColor; stroke: none; }
.card:hover .play { opacity: 1; background: rgba(20,30,36,.92); }
.tchip, .best-chip {
  position: absolute; left: 10px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.5; letter-spacing: .06em; text-transform: uppercase;
}
.tchip { top: 10px; background: #F7F2E8; color: #141E24; }
.best-chip { bottom: 10px; background: var(--accent); color: var(--on-accent); }
.dur { position: absolute; right: 10px; bottom: 10px; padding: 1px 7px; border-radius: 6px; background: #141E24; color: #F7F2E8; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.card-body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 0 8px 10px; min-width: 0; }
.card-title {
  margin: 0; font-size: 16px; font-weight: 700; line-height: 1.35; min-height: 2.7em;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.story .card-title { font-size: 17px; }
.title-from { margin: 0 0 -10px; font-size: 12px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.meta { margin: 0; font-size: 13px; color: var(--muted); }
.meta a { color: var(--ink); font-weight: 600; text-underline-offset: 2px; }
.meta.also { display: flex; gap: 0.3em; min-width: 0; white-space: nowrap; }
.also-lead, .also-times { flex: none; }
.also-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.snip { margin: 0; font-size: 15px; line-height: 1.55; }
.quote-snip { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gist { margin: 0; font-size: 15px; line-height: 1.55; }
mark { background: var(--mark-bg); color: var(--ink); font-weight: 700; border-radius: 4px; padding: 0 3px; }

/* timestamp chips & story action chips */
.ts-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ts-list { flex: 1; min-width: 0; display: flex; gap: 4px; overflow: hidden; }
.ts-list > .tsc[hidden] { display: none; }
.ts-row .tsc { flex: 0 1 auto; min-width: 0; padding: 0 9px; gap: 4px; justify-content: center; }
.ts-arrow {
  position: relative; flex: none; width: 32px; height: 32px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--chip); color: var(--ink); cursor: pointer;
  transition: filter var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.ts-arrow::before { content: ''; position: absolute; inset: -4px; }
.ts-arrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ts-arrow:hover:not(:disabled) { filter: brightness(.95); }
.ts-arrow:disabled { opacity: .4; cursor: default; }
/* quote cards: accent pill + accent timestamp chips (same as story BEST MATCH) */
.card.quote .tchip { background: var(--accent); color: var(--on-accent); }
/* quote timestamps match the story range pill (cream on ink), with a hairline so they read on a white card */
.card.quote .tsc { background: #F7F2E8; color: #141E24; box-shadow: inset 0 0 0 1px var(--line); }
/* arrows pinned to the card edges; chips centred between them */
.card.quote .ts-row { align-self: stretch; width: 100%; min-width: 0; }
.card.quote .ts-row:has(.ts-arrow) .ts-list { gap: 2px; }
.ts-row:has(.ts-arrow) .ts-list { justify-content: center; }
.card.quote .ts-row:has(.ts-arrow) .tsc { padding: 0 7px; gap: 3px; }
/* narrowest cards (4 columns, 1100-1279px): tighter chips so two still fit between the arrows */
@media (min-width: 1100px) and (max-width: 1279px) {
  .card.quote .ts-row:has(.ts-arrow) .tsc { padding: 0 4px; gap: 2px; font-size: 13px; }
}
.tsc, .abtn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 0; border-radius: 999px; background: var(--chip); color: var(--ink);
  font: 600 14px var(--font); font-variant-numeric: tabular-nums; text-decoration: none; white-space: nowrap;
  transition: filter var(--dur) var(--ease);
}
.tsc::before, .abtn::before { content: ''; position: absolute; inset: -4px 0; }
a.tsc:hover, button.tsc:hover, .abtn:hover { filter: brightness(.95); }
.tri { width: 10px; height: 10px; flex: none; fill: var(--accent); stroke: none; }
.abtn.primary { background: var(--accent); color: var(--on-accent); }
.abtn.primary .tri { fill: currentColor; }

.card-foot { margin-top: auto; padding-top: 4px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.card.quote .card-foot { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; justify-content: flex-start; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.pager { display: flex; justify-content: center; margin-top: 32px; }
.pager:empty { display: none; }
.show-more {
  min-height: 44px; padding: 0 24px; background: var(--surface); color: var(--ink); border: 1px solid var(--ink);
  border-radius: 999px; font-weight: 600; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 100ms ease-out;
}
.show-more:active { transform: scale(.97); }
.show-more:hover { background: var(--ink); color: var(--bg); }
.show-more[disabled] { opacity: .6; cursor: progress; }

/* ---------- banners & states ---------- */
.banner { margin: 0 0 24px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; font-size: 15px; }
.banner a { color: var(--ink); font-weight: 700; }
.state { max-width: 640px; margin: 24px auto 0; text-align: center; }
.state h2 { margin: 0 0 8px; font-size: 24px; font-weight: 700; }
.state p { margin: 0 0 12px; color: var(--muted); }
.state ul { list-style: none; padding: 0; margin: 0 0 16px; color: var(--muted); }
.state .eg-label { font-size: 13px; font-weight: 600; letter-spacing: .04em; margin: 24px 0 8px; }
html.has-q #results > .state[data-static] { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  min-height: 44px; padding: 0 18px; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; font-weight: 600; font-size: 15px;
  transition: border-color var(--dur) var(--ease), transform 100ms ease-out;
}
.chip:active { transform: scale(.97); }
.chip:hover { border-color: var(--ink); }
.alert {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 18px; margin: 0 0 24px;
  background: var(--surface); color: var(--danger); border: 1px solid var(--danger); border-radius: 12px; font-weight: 600;
}
.alert span { flex: 1 1 240px; }
.alert button { min-height: 44px; padding: 0 20px; background: var(--danger); color: var(--on-danger); border: 0; border-radius: 999px; font-weight: 700; }

#results.dim .grid, #results.dim .banner { opacity: .5; transition: opacity var(--dur) var(--ease); }

.skeleton { min-height: 330px; }
.sk {
  background: linear-gradient(90deg, var(--chip) 25%, color-mix(in srgb, var(--chip) 55%, var(--surface)) 50%, var(--chip) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 8px;
}
.sk.t { aspect-ratio: 16 / 9; border-radius: 14px; }
.sk.l { height: 16px; margin: 0 8px; }
.sk.l.s { width: 55%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.foot { max-width: 1240px; width: calc(100% - 48px); margin: 0 auto; padding: 24px 0 32px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 13px; }
.foot p { margin: 0 auto; max-width: 80ch; }
.foot .about { margin: 0 auto 16px; }
.foot .about h2 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.foot .about p { color: var(--muted); line-height: 1.55; text-wrap: pretty; }

button, select, a { -webkit-tap-highlight-color: transparent; }

/* ---------- about page ---------- */
.letter { max-width: 600px; width: calc(100% - 48px); margin: 0 auto; padding: 56px 0 72px; }
.back-link { display: inline-block; margin-bottom: 28px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.back-link:hover { text-decoration-thickness: 2px; }
.letter-hi { font-family: var(--hand); font-weight: 400; font-size: 44px; line-height: 1.1; margin: 0 0 24px; color: var(--ink); letter-spacing: 0; }
.letter p { font-size: 17px; line-height: 1.75; color: var(--ink); margin: 0 0 18px; text-wrap: pretty; }
.letter p.letter-sign { font-family: var(--hand); font-size: 34px; line-height: 1.1; margin-top: 12px; }
.sign-row { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.letter .sign-row p.letter-sign { margin: 0; }
.ig-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  background: var(--chip); color: var(--ink); border-radius: 50%; text-decoration: none;
  transition: transform 100ms ease-out;
}
.ig-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ig-btn:active { transform: scale(.97); }
.ig-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }

/* ---------- mobile ---------- */
@media (max-width: 639px) {
  .letter { width: calc(100% - 32px); padding-top: 32px; }
  .letter-hi { font-size: 36px; }
  .letter p { font-size: 16px; }
  .hero { padding-top: 56px; padding-bottom: 24px; }
  .hand { font-size: 26px; }
  .hero h1 { font-size: 34px; }
  .sf-main { flex-basis: 100%; }
  .sf-group {
    flex: 1 1 100%; flex-wrap: wrap; gap: 8px; justify-content: stretch;
    margin-top: 2px; padding-top: 8px; border-top: 1px solid var(--line);
  }
  .sel, .date-wrap { flex: 1 1 0; min-width: 0; }
  .sel, .date-btn { height: 44px; border-left: 0; border-radius: 12px; background: var(--bg); }
  .sel select { width: 100%; font-size: 16px; padding: 0 28px 0 12px; }
  .sel-ico { display: none; }
  .sel-chev { right: 10px; }
  .date-btn { width: 100%; padding: 0 8px 0 10px; gap: 4px; font-size: 15px; text-align: left; }
  .date-btn .chev { width: 12px; height: 12px; margin-left: auto; }
  .find { flex: 1 1 100%; height: 48px; padding: 0 16px; margin: 0; border-radius: 12px; }
  .tabs { width: 100%; }
}
@media (max-width: 479px) {
  main { padding-left: 16px; padding-right: 16px; }
  .foot { width: calc(100% - 32px); }
  .tab { padding: 0 12px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
