:root {
  --paper: #fff7ed;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #ead9c8;
  --field-line: #7a6556;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-ink: #9a3412;
  --accent-wash: #fde9d9;
  --night: #0f172a;
  --focus: #2563eb;
  --radius: 14px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "Iowan Old Style", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

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

/* Masthead */

.masthead {
  background: var(--night);
  color: var(--paper);
}

.masthead-inner,
.page,
.site-footer {
  width: min(1120px, 100% - 40px);
  margin-inline: auto;
}

.masthead-inner {
  padding: 40px 0 36px;
}

.eyebrow {
  color: #fdba74;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font: 700 clamp(2rem, 5vw, 3.25rem) / 1.05 var(--serif);
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  color: #fdba74;
}

.lede {
  max-width: 58ch;
  margin-top: 14px;
  color: #e2e8f0;
  font-size: 1.0625rem;
}

/* Controls */

.events {
  padding: 32px 0 56px;
}

#events-heading {
  font: 700 1.75rem / 1.2 var(--serif);
}

.controls {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

@media (min-width: 720px) {
  .controls {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
    align-items: end;
  }
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.9375rem;
  font-weight: 600;
}

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

.button,
.toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--field-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button:hover,
.toggle:hover {
  background: #fdf0e6;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.button.ghost {
  background: transparent;
}

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

.results-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

/* Event list */

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

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

@media (min-width: 1000px) {
  .event-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.event {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.event:hover {
  border-color: #d6b99c;
}

.event-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip,
.saved-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.chip {
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.saved-badge {
  background: var(--night);
  color: #ffffff;
}

.event-title {
  font: 700 1.25rem / 1.25 var(--serif);
}

.event-open {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.event-open:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Stretches the title button over the whole card so the card is one click target */
.event-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.event-when,
.event-place,
.event-summary {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.event-meta {
  font-size: 0.9375rem;
  font-weight: 600;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 14px;
  margin-top: 24px;
  padding: 24px;
  border: 1px dashed var(--field-line);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Detail dialog */

.detail {
  width: min(680px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  overflow: auto;
}

.detail::backdrop {
  background: rgba(15, 23, 42, 0.6);
}

.sheet {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.detail-title {
  font: 700 1.75rem / 1.2 var(--serif);
}

.facts {
  display: grid;
  gap: 10px 16px;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
}

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

.facts div {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--paper);
}

.facts dt {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  font-weight: 600;
}

.detail-subhead {
  font: 700 1.125rem / 1.3 var(--serif);
}

.detail-body {
  max-width: 65ch;
}

.detail-body p + p {
  margin-top: 12px;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.save-note {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

@media (max-width: 599px) {
  .detail {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
}

/* Footer */

.site-footer {
  padding: 20px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.875rem;
}

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