/* ============ Sundial — weekend event planner ============ */

@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: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paper: #faf5ec;
  --paper-2: #f2e9d8;
  --ink: #211a12;
  --ink-soft: #5c5344;
  --line: #e2d6bf;
  --accent: #b4531f;
  --accent-deep: #8f3f14;
  --accent-tint: #f6e3d4;
  --card: #fffdf8;

  --font-serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --font-sans: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(33, 26, 18, 0.06), 0 10px 28px -14px rgba(33, 26, 18, 0.22);
  --shadow-lift: 0 2px 4px rgba(33, 26, 18, 0.08), 0 18px 40px -16px rgba(33, 26, 18, 0.3);

  --c-Art: #b4531f;        --c-Art-bg: #f6e3d4;
  --c-Film: #35566e;       --c-Film-bg: #dde8ef;
  --c-Food: #a05a12;       --c-Food-bg: #f7e7c8;
  --c-Literature: #3e6b4f; --c-Literature-bg: #dfeee2;
  --c-Music: #6b4fa0;      --c-Music-bg: #e8e1f4;
  --c-Outdoors: #4a7c3f;   --c-Outdoors-bg: #e2efda;
  --c-Walks: #8a5a44;      --c-Walks-bg: #f0e2da;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(180, 83, 31, 0.07), transparent 60%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

.shell {
  width: min(1180px, 100% - 48px);
  margin-inline: auto;
}
@media (max-width: 640px) {
  .shell { width: calc(100% - 32px); }
}

.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: -48px;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

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

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 245, 236, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-deep);
  text-decoration: none;
  margin-right: auto;
}
.brand-mark { flex: none; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.saved-toggle:hover { border-color: var(--accent); }
.saved-toggle[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.saved-toggle[aria-pressed="true"] .saved-count { background: var(--accent); color: #fff; }
.saved-count {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  background: var(--paper-2);
  border-radius: 999px;
  padding: 4px 8px;
}

/* ---------- Hero ---------- */

.hero {
  padding: 56px 0 8px;
  max-width: 640px;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  margin: 0 0 14px;
}
.hero h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.08;
  margin: 0 0 14px;
  text-wrap: balance;
}
.lede {
  font-size: 17.5px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 54ch;
}

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  padding: 32px 0 26px;
  border-bottom: 1px solid var(--line);
  margin-top: 26px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}
.field input,
.field select {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 44px;
}
.field input { width: min(340px, 72vw); }
.field select { width: 200px; cursor: pointer; }
.field input:focus-visible,
.field select:focus-visible { outline-offset: 0; }
.field input::placeholder { color: #a89a83; }

.result-count {
  margin: 0 0 2px auto;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .toolbar { gap: 12px; padding-block: 22px 20px; }
  .field input { width: 100%; }
  .field-search, .field-cat { width: 100%; }
  .field select { width: 100%; }
  .result-count { margin-left: 0; }
}

/* ---------- Card grid ---------- */

.card-grid {
  list-style: none;
  margin: 0;
  padding: 34px 0 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}
@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; padding-top: 22px; gap: 16px; }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: #d3c2a3;
}
.card.is-saved { border-color: var(--accent); }

.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--paper-2);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-media .chip {
  position: absolute;
  top: 12px; left: 12px;
  box-shadow: 0 2px 8px rgba(33, 26, 18, 0.25);
}
.saved-flag {
  position: absolute;
  top: 12px; right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 20px;
  flex: 1;
}
.card-when {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-deep);
  letter-spacing: 0.02em;
}
.card h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 22.5px;
  line-height: 1.18;
  margin: 0;
  text-wrap: balance;
}
.card-summary {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  flex: 1;
}
.card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 13.5px;
  color: var(--ink-soft);
}
.card-foot .price {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  margin-left: auto;
  white-space: nowrap;
}
.price-free { color: #3e6b4f; font-weight: 700; }

.btn-card {
  margin-top: 12px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-deep);
  background: none;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-card:hover { background: var(--accent); color: #fff; }
.btn-card .arrow { transition: transform 0.15s ease; }
.btn-card:hover .arrow { transform: translateX(2px); }

/* ---------- Chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  white-space: nowrap;
}
.chip-ghost { background: transparent; border: 1px solid var(--line); }

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  padding: 72px 24px 80px;
  color: var(--ink-soft);
  max-width: 480px;
  margin-inline: auto;
}
.empty-state svg { color: var(--line); margin-bottom: 14px; }
.empty-state h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 26px;
  color: var(--ink);
  margin: 0 0 8px;
}
.empty-state p { margin: 0 0 22px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  min-height: 46px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-solid {
  background: var(--accent);
  border: 1.5px solid var(--accent);
  color: #fff;
}
.btn-solid:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-solid[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
}
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- Detail dialog ---------- */

.detail {
  border: none;
  padding: 0;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(33, 26, 18, 0.5);
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  overflow: visible;
}
.detail::backdrop {
  background: rgba(28, 20, 10, 0.55);
  backdrop-filter: blur(3px);
}
.detail[open] { animation: pop 0.22s ease; }
@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.detail-inner {
  display: grid;
  grid-template-columns: 1fr;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: 18px;
}

.detail-media {
  margin: 0;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  background: var(--paper-2);
}
.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-body { padding: 26px 32px 30px; }
.detail-topline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.detail-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.12;
  margin: 0 0 20px;
  text-wrap: balance;
  padding-right: 40px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin: 0 0 22px;
  padding: 18px 20px;
  background: var(--paper-2);
  border-radius: 12px;
}
.meta-grid dt {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
  margin-bottom: 3px;
}
.meta-grid dd { margin: 0; font-size: 14.5px; line-height: 1.5; }
@media (max-width: 560px) { .meta-grid { grid-template-columns: 1fr; } }

.detail-text p { margin: 0 0 14px; font-size: 15.5px; line-height: 1.65; }
.detail-text p:last-child { margin-bottom: 0; }

.detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
@media (max-width: 560px) {
  .detail-actions .btn { flex: 1 1 100%; }
}

.detail-x {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(250, 245, 236, 0.92);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(33, 26, 18, 0.3);
  transition: background 0.15s ease, transform 0.15s ease;
}
.detail-x:hover { background: #fff; transform: scale(1.06); }

@media (max-width: 560px) {
  .detail {
    width: 100vw;
    max-height: 100vh;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
  }
  .detail-inner { max-height: 100dvh; border-radius: 0; }
  .detail-media { aspect-ratio: 16 / 9; }
  .detail-body { padding: 20px 20px 28px; }
  .detail-x { position: fixed; top: 12px; right: 12px; z-index: 5; }
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 56px;
  padding: 26px 0 40px;
  font-size: 13px;
  color: var(--ink-soft);
}
.site-footer p { margin: 0; max-width: 72ch; }
