/* ==========================================================================
   Weekender — editorial city guide
   ========================================================================== */

@font-face {
  font-family: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4eee2;
  --paper-2: #fdfaf3;
  --card: #fffdf8;
  --ink: #1c1a16;
  --ink-soft: #57524a;
  --ink-faint: #6b6459;
  --line: #e0d6c4;
  --line-strong: #cbbfa8;
  --accent: #bf4318;
  --accent-dark: #8f2f10;
  --accent-tint: #f8e6dc;
  --gold: #b57d12;
  --teal: #0d6e63;
  --teal-tint: #ddefe9;
  --focus: #1d4ed8;
  --shadow-sm: 0 1px 2px rgba(40, 30, 15, 0.06), 0 4px 12px rgba(40, 30, 15, 0.05);
  --shadow-lg: 0 24px 70px rgba(35, 25, 10, 0.28);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 68px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --cat-art: #bc4a12;
  --cat-film: #6d28d9;
  --cat-food: #b81e46;
  --cat-literature: #1d4ed8;
  --cat-music: #0d6e63;
  --cat-outdoors: #2f7d32;
  --cat-walks: #946200;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(circle at 12% 0%, rgba(191, 67, 24, 0.06), transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(13, 110, 99, 0.05), transparent 38%);
  color: var(--ink);
  font-family: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: "DM Serif Display", Georgia, "Times New Roman", serif;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

.shell {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 40px);
}

.icon { flex: none; }

/* ---- Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.18s var(--ease);
}
.skip-link:focus-visible { top: 0; }

/* ---- Focus -------------------------------------------------------------- */
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- Header ------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(253, 250, 243, 0.88);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}
.wordmark-mark { display: inline-flex; }
.wordmark-text {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  flex-direction: column;
}
.wordmark-sub {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 3px;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  background: var(--paper-2);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease),
    color 0.2s var(--ease), transform 0.12s var(--ease);
}
.saved-toggle:hover { border-color: var(--accent); color: var(--accent-dark); }
.saved-toggle:active { transform: scale(0.97); }
.saved-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.saved-toggle[aria-pressed="true"]:hover { background: var(--accent-dark); color: #fff; }
.saved-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}
.saved-toggle[aria-pressed="true"] .saved-count { background: rgba(255, 255, 255, 0.24); }

/* ---- Masthead ----------------------------------------------------------- */
.masthead { padding: clamp(34px, 7vw, 78px) 0 clamp(26px, 5vw, 54px); }
.masthead-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
}
.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--accent);
  display: inline-block;
}
.masthead h1 {
  font-size: clamp(2.6rem, 6.2vw, 4.6rem);
  color: var(--ink);
}
.masthead h1 em {
  font-style: italic;
  color: var(--accent);
}
.lede {
  margin-top: 20px;
  max-width: 46ch;
  font-size: clamp(1.02rem, 1.6vw, 1.18rem);
  color: var(--ink-soft);
}
.masthead-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 34px;
  margin: 30px 0 0;
}
.masthead-stats div { display: flex; flex-direction: column-reverse; }
.masthead-stats dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.masthead-stats dd {
  margin: 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.9rem;
  line-height: 1.1;
}
.masthead-figure {
  margin: 0;
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  aspect-ratio: 4 / 5;
  max-height: 460px;
}
.masthead-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(0.22) saturate(1.05) contrast(1.02);
}
.masthead-figure figcaption {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* ---- Toolbar ------------------------------------------------------------ */
.toolbar {
  position: relative;
  z-index: 20;
  background: var(--paper-2);
  border-block: 1px solid var(--line);
  padding: 18px 0;
}
.toolbar-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(180px, 0.7fr) auto;
  align-items: end;
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .icon {
  position: absolute;
  left: 13px;
  color: var(--ink-faint);
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 40px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.input-wrap input::placeholder { color: var(--ink-faint); }
.input-wrap input:hover { border-color: var(--ink-faint); }
.input-wrap input:focus-visible { outline-offset: 1px; }

.select-wrap { position: relative; display: flex; align-items: center; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 48px;
  padding: 0 40px 0 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}
.select-caret {
  position: absolute;
  right: 13px;
  color: var(--ink-soft);
  pointer-events: none;
}

.toolbar-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 6px;
  min-height: 44px;
  white-space: nowrap;
}
.result-count {
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.result-count strong { color: var(--ink); }
.ghost-btn {
  border: 0;
  background: none;
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
}
.ghost-btn:hover { color: var(--accent); }

/* ---- List / grid -------------------------------------------------------- */
.list-section { padding: clamp(30px, 5vw, 54px) 0 70px; }
.event-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: clamp(18px, 2.4vw, 26px);
}
.event-card {
  --cat: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 24px 22px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease),
    border-color 0.22s var(--ease);
}
.event-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--cat);
}
.event-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(40, 30, 15, 0.06), 0 16px 34px rgba(40, 30, 15, 0.12);
  border-color: var(--line-strong);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.cat-tag::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cat);
  flex: none;
}
.day-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.card-title {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.card-when {
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--accent-dark);
  margin-bottom: 12px;
}
.card-summary {
  color: var(--ink-soft);
  font-size: 0.96rem;
  margin-bottom: 18px;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 20px;
}
.meta-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.meta-pill.is-free { background: var(--teal-tint); border-color: transparent; color: #084f47; }
.card-foot { margin-top: auto; }
.open-item {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    transform 0.12s var(--ease);
}
.open-item .arrow { transition: transform 0.2s var(--ease); }
.open-item:hover { background: var(--ink); color: var(--paper-2); }
.open-item:hover .arrow { transform: translateX(4px); }
.open-item:active { transform: scale(0.985); }

/* ---- Empty state -------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 60px 24px 70px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink-soft);
}
.empty-mark {
  display: inline-grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-dark);
}
.empty-state h2 { font-size: 1.9rem; color: var(--ink); margin-bottom: 8px; }
.empty-state p { max-width: 42ch; margin: 0 auto 24px; }
.primary-btn {
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s var(--ease), transform 0.12s var(--ease);
}
.primary-btn:hover { background: var(--accent-dark); }
.primary-btn:active { transform: scale(0.98); }

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding: 30px 0 44px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 30px;
  color: var(--ink-faint);
  font-size: 0.82rem;
}
.footer-inner p { max-width: 60ch; }

/* ---- Detail dialog ------------------------------------------------------ */
.detail {
  width: min(720px, calc(100vw - 32px));
  max-height: min(90vh, 880px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.detail[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 0.28s var(--ease);
}
.detail::backdrop {
  background: rgba(26, 20, 10, 0.55);
  backdrop-filter: blur(2px);
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.detail-hero {
  position: relative;
  height: 190px;
  flex: none;
  background: var(--cat, var(--accent));
}
.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(0.18) saturate(1.05);
}
.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 14, 6, 0.05) 30%, rgba(20, 14, 6, 0.55));
}
.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: background 0.16s var(--ease), transform 0.12s var(--ease);
}
.detail-close:hover { background: #fff; transform: scale(1.05); }
.detail-hero-tags {
  position: absolute;
  left: 22px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  gap: 10px;
  align-items: center;
  color: #fff;
}
.detail-hero-tags .cat-tag { color: #fff; }
.detail-hero-tags .cat-tag::before { background: #fff; }

.detail-scroll {
  overflow-y: auto;
  padding: 26px clamp(20px, 4vw, 34px) 30px;
}
.detail-title { font-size: clamp(1.9rem, 4.4vw, 2.7rem); margin-bottom: 12px; }
.detail-when {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.86rem;
  color: var(--accent-dark);
  margin-bottom: 20px;
}
.detail-body p {
  color: #322e28;
  font-size: 1.02rem;
  margin-bottom: 14px;
}
.detail-body p:last-child { margin-bottom: 0; }
.detail-body p.is-access {
  background: var(--teal-tint);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: #084f47;
  font-size: 0.94rem;
  margin-top: 20px;
}
.detail-body p.is-access strong {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 24px 0;
}
.fact {
  background: var(--card);
  padding: 13px 16px;
}
.fact dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 2px;
}
.fact dd { margin: 0; font-weight: 600; font-size: 0.95rem; }

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}
.save-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), transform 0.12s var(--ease);
}
.save-item:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.save-item:active { transform: scale(0.98); }
.save-item[aria-pressed="true"] {
  background: var(--teal-tint);
  border-color: var(--teal);
  color: #084f47;
}
.save-item[aria-pressed="true"]:hover { background: #cfe8e1; }
.save-item .heart-fill { display: none; }
.save-item[aria-pressed="true"] .heart-line { display: none; }
.save-item[aria-pressed="true"] .heart-fill { display: block; }

.secondary-btn {
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.secondary-btn:hover { border-color: var(--ink); background: var(--paper); }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .masthead-inner { grid-template-columns: 1fr; }
  .masthead-figure { max-height: 260px; aspect-ratio: 16 / 9; }
  .toolbar-inner { grid-template-columns: 1fr 1fr; }
  .toolbar-status { grid-column: 1 / -1; justify-content: space-between; padding-bottom: 0; }
}

@media (max-width: 560px) {
  :root { --header-h: 62px; }
  .wordmark-sub { letter-spacing: 0.18em; }
  .toolbar-inner { grid-template-columns: 1fr; }
  .masthead-stats { gap: 8px 22px; }
  .masthead-stats dd { font-size: 1.55rem; }
  .event-grid { grid-template-columns: 1fr; }
  .event-card { padding: 22px 20px 20px; }
  .detail {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
  }
  .detail-hero { height: 150px; }
  .fact-grid { grid-template-columns: 1fr; }
  .detail-actions { flex-direction: column; }
  .save-item,
  .secondary-btn { width: 100%; justify-content: center; }
}

/* ---- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .event-card:hover { transform: none; }
}
