/* ---------- Fonts (local, OFL) ---------- */
@font-face {
  font-family: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --paper: #f3ede2;
  --paper-raised: #fbf8f2;
  --paper-sunk: #e9e1d2;
  --ink: #1c1a16;
  --ink-soft: #3d3830;
  --muted: #5e574b;
  --rule: #cfc4b1;
  --rule-strong: #1c1a16;
  --accent: #b23a1e;
  --accent-ink: #fff8ef;
  --forest: #1f4d3a;
  --focus: #1f4d3a;
  --clash: #8a4b00;
  --clash-bg: #fbe9c8;

  --font-display: "DM Serif Display", "Iowan Old Style", Georgia, serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 6px;
  --controls-h: 104px;
  --page-pad: clamp(1rem, 3.5vw, 3rem);
}

[data-category="Art"] { --cat: #a3305f; }
[data-category="Film"] { --cat: #2a4a8a; }
[data-category="Food"] { --cat: #a6481a; }
[data-category="Literature"] { --cat: #5b4590; }
[data-category="Music"] { --cat: #1c6656; }
[data-category="Outdoors"] { --cat: #3d6a1f; }
[data-category="Walks"] { --cat: #7a5710; }

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

html {
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--controls-h) + 1rem);
}

html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgb(31 77 58 / 0.15);
  touch-action: manipulation;
}

h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex-shrink: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
}
.skip-link:focus-visible { top: 1rem; }

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--rule);
  padding-top: env(safe-area-inset-top);
}
.masthead__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.85rem max(var(--page-pad), env(safe-area-inset-right)) 0.85rem max(var(--page-pad), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0.005em;
}
.brand__mark { color: var(--accent); }

.masthead__shortlist {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.4rem 0.45rem 0.85rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.masthead__shortlist:hover { background: var(--ink); color: var(--paper); }
.masthead__shortlist:hover .count-pill { background: var(--paper); color: var(--ink); }

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ---------- Intro ---------- */
.intro__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) var(--page-pad) clamp(1.5rem, 3vw, 2.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}
.intro__kicker {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.intro h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.3rem, 5.6vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  max-width: 17ch;
}
.intro__lede {
  max-width: 54ch;
  font-size: 1.08rem;
  color: var(--ink-soft);
}

/* ---------- Controls ---------- */
.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 2px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
}
.controls__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.85rem var(--page-pad);
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto auto;
  gap: 0.75rem 1.25rem;
  align-items: end;
}
.field { display: grid; gap: 0.3rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.field label, .field legend, .field__label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0;
}
.field legend { margin-bottom: 0.3rem; }

.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute;
  left: 0.8rem; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
input[type="search"], select {
  width: 100%;
  height: 2.75rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background-color: var(--paper-raised);
  color: var(--ink);
  font-size: 1rem;
}
input[type="search"] { padding: 0 0.8rem 0 2.4rem; }
input[type="search"]::placeholder { color: #7a7266; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 2.4rem 0 0.8rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231c1a16' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 12px 8px;
}
input[type="search"]:hover, select:hover { background-color: #fff; }
input[type="search"]:focus-visible, select:focus-visible { outline-offset: 1px; }

.segmented {
  display: inline-flex;
  height: 2.75rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-raised);
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 0 1rem;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.segmented button + button { border-left: 1.5px solid var(--ink); }
.segmented button:hover { background: var(--paper-sunk); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.segmented button:focus-visible { outline-offset: -5px; outline-color: var(--accent); }
.segmented button[aria-pressed="true"]:focus-visible { outline-color: var(--paper); }

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 0.55rem 0 0.9rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-raised);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.saved-toggle svg path { fill: transparent; transition: fill 0.15s ease; }
.saved-toggle:hover { background: var(--paper-sunk); }
.saved-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.saved-toggle[aria-pressed="true"] svg path { fill: currentColor; }
.saved-toggle[aria-pressed="true"] .count-pill { background: var(--accent-ink); color: var(--accent); }
.saved-toggle[aria-pressed="true"]:hover { background: #962f17; border-color: #962f17; }

/* ---------- Layout ---------- */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.25rem) var(--page-pad) 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
}
.program:focus-visible, .shortlist:focus-visible { outline-offset: 6px; }
.program:focus:not(:focus-visible), .shortlist:focus:not(:focus-visible) { outline: none; }

.program__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.result-count {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.program__legend { font-size: 0.85rem; color: var(--muted); }

/* ---------- Day sections ---------- */
.day + .day { margin-top: 2.75rem; }
.day__heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  padding: 1rem 0 0.75rem;
  border-bottom: 2px solid var(--rule-strong);
  font-weight: 400;
}
.day__weekday {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  line-height: 1;
}
.day__date {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.day__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

/* ---------- Event row ---------- */
.event {
  position: relative;
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr) auto;
  gap: 0.5rem 1.5rem;
  padding: 1.35rem 0.75rem 1.4rem;
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.15s ease;
}
.event::before {
  content: "";
  position: absolute;
  left: 0; top: 1.4rem; bottom: 1.4rem;
  width: 3px;
  border-radius: 3px;
  background: var(--cat);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.event:hover { background: var(--paper-raised); }
.event:hover::before, .event.is-saved::before { opacity: 1; }
.event:has(.event__open:focus-visible) {
  background: var(--paper-raised);
  outline: 3px solid var(--focus);
  outline-offset: -3px;
  border-radius: 4px;
}

.event__time {
  display: grid;
  align-content: start;
  gap: 0.2rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.event__time time { font-size: 1.15rem; line-height: 1.2; }
.event__duration { font-size: 0.8rem; color: var(--muted); }

.event__main { min-width: 0; display: grid; gap: 0.35rem; }
.event__cat {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--cat);
}
.cat-dot {
  width: 0.6rem; height: 0.6rem;
  border-radius: 50%;
  background: var(--cat);
  flex-shrink: 0;
}
.event__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.45rem, 2.2vw, 1.8rem);
  line-height: 1.12;
}
.event__open {
  all: unset;
  cursor: pointer;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.15s ease;
}
/* Stretch the open control so the whole row is a hit target. */
.event__open::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.event:hover .event__open { text-decoration-color: var(--cat); }
.event__open:focus-visible { outline: none; }

.event__summary { color: var(--ink-soft); max-width: 62ch; }
.event__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.event__price {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.event__price.is-free {
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  background: var(--forest);
  color: #f2f7f3;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.clash-tag, .plan__clash, .detail__clash {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--clash);
  font-weight: 600;
}
.clash-tag {
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  background: var(--clash-bg);
}

.event__side { position: relative; z-index: 2; align-self: start; }
.quick-save {
  display: grid;
  place-items: center;
  width: 2.75rem; height: 2.75rem;
  border: 1.5px solid var(--rule);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.quick-save svg path { fill: transparent; transition: fill 0.15s ease; }
.quick-save:hover { border-color: var(--ink); background: var(--paper-raised); }
.quick-save[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.quick-save[aria-pressed="true"] svg path { fill: currentColor; }
.quick-save[aria-pressed="true"]:hover { background: #962f17; border-color: #962f17; }

/* ---------- Empty / error ---------- */
.empty {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  border: 1.5px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--paper-raised);
}
.empty[hidden] { display: none; }
.empty svg { color: var(--accent); }
.empty__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.empty__text { color: var(--ink-soft); max-width: 48ch; }

.load-error {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: var(--paper-raised);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.9rem;
  padding: 0 1.2rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--ink-soft); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--paper-sunk); }
.btn--save { background: var(--ink); color: var(--paper); }
.btn--save svg path { fill: transparent; transition: fill 0.15s ease; }
.btn--save:hover { background: var(--ink-soft); }
.btn--save[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--save[aria-pressed="true"] svg path { fill: currentColor; }
.btn--save[aria-pressed="true"]:hover { background: #962f17; border-color: #962f17; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.75rem; height: 2.75rem;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--ink); color: var(--paper); }

/* ---------- Shortlist ---------- */
.shortlist {
  position: sticky;
  top: calc(var(--controls-h) + 1.25rem);
  max-height: calc(100vh - var(--controls-h) - 2.5rem);
  overflow: auto;
  overscroll-behavior: contain;
}
.shortlist__card {
  padding: 1.4rem 1.4rem 1.2rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
}
.shortlist__card :focus-visible { outline-color: #f0c24a; }
.shortlist__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.85rem;
  line-height: 1.1;
}
.shortlist__summary {
  margin-top: 0.35rem;
  font-size: 0.92rem;
  color: #d8cfbf;
  font-variant-numeric: tabular-nums;
}
.shortlist__note {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #4a443a;
  font-size: 0.78rem;
  color: #b9b0a0;
}

.plan__day { margin-top: 1.1rem; }
.plan__heading {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f0c24a;
  margin-bottom: 0.35rem;
}
.plan { list-style: none; margin: 0; padding: 0; }
.plan__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.25rem;
  border-top: 1px solid #3b362e;
}
.plan__open {
  all: unset;
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.6rem 0.5rem 0.6rem 0.65rem;
  border-left: 3px solid var(--cat);
  cursor: pointer;
  border-radius: 2px;
  transition: background-color 0.15s ease;
}
.plan__open:hover { background: #2c2923; }
.plan__open:focus-visible { outline: 3px solid #f0c24a; outline-offset: 0; }
.plan__time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #d8cfbf;
  font-variant-numeric: tabular-nums;
}
.plan__title { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.plan__clash { font-size: 0.78rem; color: #f5c27a; font-weight: 500; align-items: flex-start; }
.plan__clash svg { margin-top: 0.2rem; }
.plan__remove {
  display: grid;
  place-items: center;
  width: 2.25rem; height: 2.25rem;
  margin-top: 0.4rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #d8cfbf;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.plan__remove:hover { background: #3b362e; color: #fff; }

/* ---------- Footer ---------- */
.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem var(--page-pad) calc(2.5rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Detail dialog ---------- */
.detail {
  width: min(680px, calc(100% - 2rem));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: 0 30px 80px rgb(28 26 22 / 0.35);
  overflow: auto;
  overscroll-behavior: contain;
}
.detail::backdrop { background: rgb(28 26 22 / 0.55); }
.detail[open] { animation: sheet-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); }
.detail[open]::backdrop { animation: fade-in 0.22s ease; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.detail__sheet {
  display: grid;
  gap: 1.25rem;
  padding: clamp(1.25rem, 3.5vw, 2.25rem);
  border-top: 6px solid var(--cat, var(--ink));
}
.detail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.detail__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--cat);
}
.detail__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}
.facts__row { padding: 0.8rem 0.9rem 0.85rem 0; min-width: 0; }
.facts__row:nth-child(even) { padding-left: 0.9rem; border-left: 1px solid var(--rule); }
.facts__row:nth-child(n + 3) { border-top: 1px solid var(--rule); }
.facts dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.facts__sub { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }

.detail__body { display: grid; gap: 1rem; font-size: 1.05rem; }
.access {
  display: grid;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: var(--paper-sunk);
  font-size: 0.98rem;
}
.access__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest);
}

.detail__clash {
  align-items: flex-start;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: var(--clash-bg);
  font-size: 0.95rem;
}
.detail__clash[hidden] { display: none; }
.detail__clash svg { margin-top: 0.25rem; }

.detail__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  width: max-content;
  max-width: calc(100% - 2rem);
  padding: 0.65rem 0.65rem 0.65rem 1rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 12px 30px rgb(28 26 22 / 0.3);
  transform: translateX(-50%);
  animation: toast-in 0.2s ease;
}
.toast[hidden] { display: none; }
.toast__text { min-width: 0; font-size: 0.92rem; }
.toast__undo {
  flex-shrink: 0;
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border: 1.5px solid #f0c24a;
  border-radius: var(--radius);
  background: transparent;
  color: #f0c24a;
  font-weight: 700;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.toast__undo:hover { background: #f0c24a; color: var(--ink); }
.toast__undo[hidden] { display: none; }
.toast :focus-visible { outline-color: #f0c24a; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  :root { --controls-h: 170px; }
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .controls__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 860px) {
  :root { --controls-h: 0px; }
  html { scroll-padding-top: 1rem; }
  .controls { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--paper); }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .shortlist { position: static; max-height: none; overflow: visible; }
}

@media (max-width: 600px) {
  .masthead__inner { padding-top: 0.7rem; padding-bottom: 0.7rem; }
  .brand { font-size: 1.4rem; }
  .masthead__shortlist { font-size: 0.85rem; padding-left: 0.75rem; }

  .controls__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
  }
  .field--search { grid-column: 1 / -1; }
  .field--saved { grid-column: 1 / -1; }
  .field--saved .field__label { display: none; }
  .saved-toggle { width: 100%; justify-content: center; }
  .segmented button { padding: 0 0.8rem; }

  .program__legend { display: none; }

  .event {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem 0.75rem;
    padding: 1.15rem 0.25rem 1.2rem 0.6rem;
  }
  .event__time {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
  }
  .event__time time { font-size: 1rem; }
  .event__main { grid-column: 1 / -1; grid-row: 2; }
  .event__side { grid-column: 2; grid-row: 1; margin-top: -0.35rem; }
  .event__title { font-size: 1.5rem; }
  .event::before { top: 1.2rem; bottom: 1.2rem; }

  .detail {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 14px 14px 0 0;
  }
  .detail__sheet { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts__row:nth-child(even) { padding-left: 0; border-left: 0; }
  .facts__row:nth-child(n + 2) { border-top: 1px solid var(--rule); }
  .detail__actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .btn { width: 100%; }
  .empty .btn { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
