:root {
  color-scheme: light;
  --paper: #f5efe3;
  --card: #fdfaf3;
  --ink: #1e2a2c;
  --muted: #4f5a58;
  --teal: #1b5a60;
  --teal-deep: #134349;
  --teal-wash: #e7f0ee;
  --rust: #9a4a22;
  --line: #d6cbb5;
  --field-line: #7d7564;
  --focus: #6f3a00;
  --radius: 16px;
  --serif: ui-serif, "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
}

:where(a, button, input, select):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

:where(a, button, input, select) {
  touch-action: manipulation;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 12px;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px max(20px, env(safe-area-inset-right)) 64px max(20px, env(safe-area-inset-left));
}

/* Masthead */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust);
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.05;
  text-wrap: balance;
}

.dates {
  margin: 8px 0 0;
  color: var(--muted);
  text-wrap: pretty;
}

.shortlist-count {
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Toolbar */

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) auto;
  align-items: end;
  gap: 12px;
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.control {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--field-line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.control::placeholder {
  color: var(--muted);
  opacity: 1;
}

select.control {
  background-color: var(--card);
  color: var(--ink);
}

.toggle,
.btn {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--teal);
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(27, 90, 96, 0.25);
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.toggle {
  background: var(--card);
  color: var(--teal-deep);
  white-space: nowrap;
}

.toggle:hover {
  background: var(--teal-wash);
}

.toggle[aria-pressed="true"] {
  background: var(--teal);
  color: #fff;
}

.toggle[aria-pressed="true"]:hover {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
}

.btn:hover {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
}

.btn-quiet {
  background: var(--card);
  color: var(--teal-deep);
}

.btn-quiet:hover {
  background: var(--teal-wash);
  border-color: var(--teal);
}

/* Results */

.results {
  margin-top: 28px;
}

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 12px;
}

.results-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.events {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 760px) {
  .events {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 1.5rem;
}

.tag {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rust);
}

.badge {
  margin: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.card-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.summary {
  margin: 0;
  overflow-wrap: anywhere;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
}

.price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 32px 24px;
  border: 1px dashed var(--field-line);
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
}

.empty p {
  margin: 0 0 16px;
  text-wrap: balance;
}

/* Detail dialog */

.detail {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 24px 60px rgba(30, 42, 44, 0.28);
}

.detail::backdrop {
  background: rgba(30, 42, 44, 0.5);
}

.detail-inner {
  display: grid;
  gap: 16px;
  padding: 20px 24px calc(24px + env(safe-area-inset-bottom));
}

.detail-bar {
  display: flex;
  justify-content: flex-start;
}

.detail-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.facts dt {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.facts dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.detail-body p {
  max-width: 62ch;
  margin: 0 0 12px;
}

.detail-body p:last-child {
  margin-bottom: 0;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

@media (max-width: 559px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
