@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/space-grotesk.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("./assets/work-sans.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #f6f7f3;
  --surface: #ffffff;
  --ink: #17201d;
  --muted: #4f5c57;
  --line: #cdd5ce;
  --soft-line: #e1e6df;
  --accent: #2454c5;
  --accent-dark: #153a96;
  --accent-soft: #e7edfc;
  --focus: #153a96;
  font-family: "Work Sans", Arial, sans-serif;
  background: var(--page);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.page-width { width: min(100% - 64px, 1320px); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--soft-line); background: var(--page); }
.header-inner { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.wordmark, .footer-brand { font-family: "Space Grotesk", Arial, sans-serif; font-size: 29px; font-weight: 700; letter-spacing: -.075em; text-decoration: none; line-height: 1; }
.wordmark-period, .footer-brand span, .title-period { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 44px; font-size: 13px; font-weight: 600; }
.site-nav a { text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 3px; }
.site-nav a:hover { color: var(--accent); }
.nav-date { color: var(--muted); }

.hero { display: grid; grid-template-columns: 1.06fr .94fr; gap: 48px; align-items: stretch; padding-block: 38px 44px; min-height: 405px; }
.hero-copy { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 10px 0; }
.hero-kicker { color: var(--accent-dark); font-size: 11px; font-weight: 700; letter-spacing: .16em; margin: 0 0 22px; }
.hero h1 { font-family: "Space Grotesk", Arial, sans-serif; font-size: clamp(54px, 5.35vw, 78px); line-height: 1.035; letter-spacing: -.065em; font-weight: 700; margin: 0; }
.hero-description { max-width: 520px; font-size: 16px; line-height: 1.55; margin: 21px 0 21px; color: var(--muted); }
.hero-link { display: inline-flex; align-items: center; gap: 34px; text-decoration: none; color: var(--accent-dark); font-weight: 700; font-size: 14px; border-bottom: 2px solid var(--accent); padding-bottom: 7px; }
.hero-link span { font-size: 20px; line-height: 1; }
.hero-link:hover { gap: 42px; }
.hero-image-wrap { min-height: 318px; overflow: hidden; border-radius: 12px; background: #cbd1cb; }
.hero-image { width: 100%; height: 100%; object-fit: cover; object-position: center 51%; }

.browse-section { background: #edf0ea; padding: 46px 0 82px; scroll-margin-top: 20px; }
.browse-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.browse-heading h2 { font-family: "Space Grotesk", Arial, sans-serif; font-size: clamp(28px, 3vw, 39px); letter-spacing: -.05em; line-height: 1.1; margin: 0 0 8px; }
.browse-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.browse-heading .results-count { font-weight: 700; color: var(--ink); white-space: nowrap; padding-bottom: 4px; }
.controls { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(180px, 250px) auto; align-items: end; gap: 14px; margin-bottom: 26px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 12px; font-weight: 700; color: var(--ink); }
.field input, .field select { width: 100%; height: 48px; border: 1px solid #aebbb1; background: var(--surface); color: var(--ink); border-radius: 8px; padding-inline: 14px; outline: none; }
.field input::placeholder { color: #61706a; opacity: 1; }
.field input:focus, .field select:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 3px #2454c530; }
.field select { padding-right: 32px; }
.saved-toggle { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; white-space: nowrap; border: 1px solid #aebbb1; background: var(--surface); color: var(--ink); border-radius: 8px; padding: 0 18px; font-weight: 700; font-size: 14px; }
.saved-toggle-mark { font-size: 20px; color: var(--accent); line-height: 1; }
.saved-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }
.saved-toggle:hover, .reset-button:hover { border-color: var(--accent); }
.saved-toggle:active, .reset-button:active, .save-button:active, .open-button:active { transform: scale(.98); }

.event-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.event-card { min-width: 0; display: grid; grid-template-columns: 176px minmax(0, 1fr); min-height: 217px; overflow: hidden; border: 1px solid var(--soft-line); border-radius: 12px; background: var(--surface); }
.event-card:hover { border-color: #a6b6a9; }
.card-image { width: 100%; height: 100%; min-height: 217px; object-fit: cover; }
.card-content { min-width: 0; display: flex; flex-direction: column; padding: 18px 19px 16px; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--accent-dark); font-size: 11px; line-height: 1.3; font-weight: 700; text-transform: uppercase; letter-spacing: .075em; }
.card-saved { color: var(--accent-dark); font-size: 11px; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.event-card h3 { font-family: "Space Grotesk", Arial, sans-serif; font-size: 20px; line-height: 1.16; letter-spacing: -.035em; margin: 9px 0 7px; }
.card-summary { color: var(--muted); line-height: 1.35; font-size: 12.5px; margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-bottom { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-top: auto; }
.card-facts { min-width: 0; display: grid; gap: 5px; font-size: 12px; line-height: 1.2; color: var(--muted); }
.card-facts strong { font-weight: 700; color: var(--ink); }
.card-facts span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.open-button { flex: none; align-self: end; border: 0; background: none; padding: 0 0 2px; border-bottom: 1px solid var(--accent); border-radius: 0; color: var(--accent-dark); font-weight: 700; font-size: 12px; white-space: nowrap; }
.open-button:hover { color: var(--accent); }
.loading-card { min-height: 217px; border-radius: 12px; background: linear-gradient(100deg, #dfe4dd 30%, #edf0ea 45%, #dfe4dd 60%); background-size: 200% 100%; }

.empty-state, .load-error { text-align: center; max-width: 520px; margin: 20px auto 0; padding: 52px 22px 58px; border-radius: 12px; background: var(--surface); }
.empty-symbol { color: var(--accent); font-size: 34px; }
.empty-state h3, .load-error h3 { font-family: "Space Grotesk", Arial, sans-serif; font-size: 25px; letter-spacing: -.04em; margin: 12px 0 8px; }
.empty-state p, .load-error p { color: var(--muted); line-height: 1.5; margin: 0 auto 22px; }
.reset-button { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 8px; padding: 12px 18px; font-weight: 700; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 24px; min-height: 110px; }
.footer-brand { font-size: 23px; }
.site-footer p { color: var(--muted); font-size: 12px; text-align: right; }

.detail-dialog { width: min(920px, calc(100% - 32px)); max-height: min(90dvh, 850px); padding: 0; border: 0; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px #10201740; overflow: auto; }
.detail-dialog::backdrop { background: #14221dbd; }
.detail-layout { display: grid; grid-template-columns: 39% 61%; }
.detail-media { background: #d2d8d1; min-height: 100%; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-main { min-width: 0; padding: 28px 34px 34px; }
.detail-header { display: flex; justify-content: space-between; align-items: start; gap: 15px; }
.detail-category { color: var(--accent-dark); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; font-size: 11px; padding-top: 10px; }
.close-button { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); min-height: 36px; padding: 0 12px; font-size: 12px; font-weight: 700; }
.close-button:hover { border-color: var(--accent); color: var(--accent-dark); }
.detail-main h2 { font-family: "Space Grotesk", Arial, sans-serif; font-size: clamp(29px, 3vw, 42px); line-height: 1.06; letter-spacing: -.055em; margin: 19px 0 22px; }
.detail-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; border-block: 1px solid var(--soft-line); padding-block: 22px; margin-bottom: 24px; }
.detail-fact dt { font-size: 11px; text-transform: uppercase; letter-spacing: .075em; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.detail-fact dd { margin: 0; font-weight: 650; font-size: 14px; line-height: 1.35; }
.detail-body { font-size: 14px; line-height: 1.6; color: #34413a; }
.detail-body p { margin: 0 0 14px; }
.save-button { margin-top: 12px; min-height: 47px; width: 100%; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; }
.save-button[aria-pressed="true"] { color: var(--accent-dark); background: var(--accent-soft); }
.save-button:hover { background: var(--accent-dark); color: #fff; }

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --page: #121a18; --surface: #1d2925; --ink: #f1f5ef; --muted: #c2d0c6; --line: #4a5b51; --soft-line: #35463c; --accent: #91acff; --accent-dark: #b0c2ff; --accent-soft: #26365b; --focus: #b0c2ff; }
  .browse-section { background: #17211d; }
  .hero-image-wrap, .detail-media { background: #28352d; }
  .field input, .field select, .saved-toggle { border-color: #6a7b70; }
  .field input::placeholder { color: #b9c7bc; }
  .saved-toggle[aria-pressed="true"] { border-color: var(--accent); }
  .event-card:hover { border-color: #6c8070; }
  .card-saved { color: var(--accent); }
  .detail-body { color: #dce6dc; }
  .reset-button, .save-button { color: #101b15; }
  .save-button:hover, .reset-button:hover { color: #101b15; background: #b2c4ff; }
  .loading-card { background: linear-gradient(100deg, #27372d 30%, #36483b 45%, #27372d 60%); background-size: 200% 100%; }
}

@media (max-width: 1000px) {
  .hero { gap: 26px; }
  .hero h1 { font-size: clamp(47px, 5.6vw, 65px); }
  .event-card { grid-template-columns: 140px minmax(0, 1fr); }
  .card-content { padding: 16px; }
  .card-bottom { align-items: start; flex-direction: column; gap: 10px; }
}

@media (max-width: 760px) {
  .page-width { width: min(100% - 36px, 620px); }
  .header-inner { height: 60px; }
  .wordmark { font-size: 26px; }
  .site-nav { gap: 0; }
  .site-nav a { font-size: 12px; }
  .nav-date { display: none; }
  .hero { display: flex; flex-direction: column; gap: 22px; padding-block: 28px 34px; min-height: 0; }
  .hero-copy { padding: 0; }
  .hero-kicker { font-size: 10px; margin-bottom: 13px; }
  .hero h1 { font-size: clamp(40px, 10vw, 58px); letter-spacing: -.065em; }
  .hero-description { font-size: 14px; line-height: 1.45; margin: 12px 0 15px; }
  .hero-link { font-size: 13px; gap: 24px; }
  .hero-image-wrap { height: 118px; min-height: 118px; }
  .hero-image { object-position: center 52%; }
  .browse-section { padding: 33px 0 56px; }
  .browse-heading { align-items: start; margin-bottom: 20px; }
  .browse-heading h2 { font-size: 29px; margin-bottom: 7px; }
  .browse-heading p { font-size: 12px; line-height: 1.35; }
  .browse-heading .results-count { padding-top: 6px; font-size: 12px; }
  .controls { grid-template-columns: minmax(0, 1fr) auto; gap: 11px; margin-bottom: 19px; }
  .search-field { grid-column: 1 / -1; }
  .category-field { min-width: 0; }
  .field input, .field select, .saved-toggle { height: 44px; min-height: 44px; font-size: 13px; }
  .saved-toggle { padding-inline: 13px; }
  .event-grid { grid-template-columns: 1fr; gap: 12px; }
  .event-card { grid-template-columns: 112px minmax(0, 1fr); min-height: 200px; }
  .card-image { min-height: 200px; }
  .card-content { padding: 13px; }
  .event-card h3 { font-size: 18px; margin-block: 7px 6px; }
  .card-summary { font-size: 11.5px; margin-bottom: 9px; -webkit-line-clamp: 2; }
  .card-facts { font-size: 11px; gap: 4px; }
  .open-button { font-size: 11px; }
  .site-footer { min-height: 90px; }
  .site-footer p { max-width: 220px; line-height: 1.4; }
  .detail-dialog { width: calc(100% - 22px); max-height: 94dvh; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-media { height: 145px; min-height: 145px; }
  .detail-main { padding: 17px 20px 24px; }
  .detail-main h2 { font-size: 30px; margin: 14px 0 19px; }
  .detail-facts { gap: 15px; padding-block: 18px; margin-bottom: 19px; }
  .detail-fact dd { font-size: 12.5px; }
  .detail-body { font-size: 13px; }
}

@media (max-width: 390px) {
  .browse-heading { display: block; }
  .browse-heading .results-count { margin-top: 7px; padding: 0; }
  .event-card { grid-template-columns: 100px minmax(0, 1fr); }
  .card-content { padding: 12px; }
  .card-bottom { gap: 7px; }
  .card-summary { -webkit-line-clamp: 2; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-image { animation: image-in .65s ease-out both; }
  .hero-copy { animation: copy-in .55s ease-out both; }
  .event-card { animation: card-in .3s ease-out both; }
  .loading-card { animation: skeleton 1.4s linear infinite; }
  .hero-link { transition: gap .18s ease; }
  .saved-toggle, .reset-button, .save-button, .open-button { transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease; }
  @keyframes image-in { from { opacity: 0; transform: scale(1.025); } to { opacity: 1; transform: scale(1); } }
  @keyframes copy-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes skeleton { to { background-position-x: -200%; } }
}
