/* ============================================================
   Weekend Edit — visual identity
   Cream paper, ink text, terracotta accent, editorial serif.
   ============================================================ */

@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: "Work Sans";
  src: url("assets/work-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: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f6f1e8;
  --paper-deep: #eee6d8;
  --card: #fffdf8;
  --ink: #201d1a;
  --ink-soft: #5c554c;
  --ink-faint: #8b8177;
  --line: #e2d8c8;
  --line-strong: #d2c4ae;
  --accent: #c2542b;
  --accent-deep: #9c3f1d;
  --accent-tint: #fbe9df;
  --sage: #4f6b52;
  --shadow: 0 1px 2px rgba(32, 29, 26, 0.05), 0 12px 28px -18px rgba(32, 29, 26, 0.35);
  --shadow-lift: 0 2px 4px rgba(32, 29, 26, 0.06), 0 24px 44px -22px rgba(32, 29, 26, 0.4);
  --radius: 18px;
  --radius-sm: 12px;
  --wrap: 1180px;
  --font-display: "DM Serif Display", "Iowan Old Style", Georgia, serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 420px at 82% -8%, #fdf3e8 0%, rgba(253, 243, 232, 0) 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
  color: inherit;
}

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  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: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.18s ease;
}
.skip-link:focus {
  top: 1rem;
}

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

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(246, 241, 232, 0.86);
  backdrop-filter: saturate(140%) blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  color: var(--accent);
  width: 40px;
  height: 40px;
  flex: none;
}
.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.01em;
}

.tagline {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.weekend-stamp {
  margin: 0;
  text-align: right;
  line-height: 1.3;
}
.stamp-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.stamp-dates {
  font-size: 0.95rem;
  font-weight: 600;
}

/* ---------------- Intro ---------------- */

.intro {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 2rem;
  max-width: 46rem;
}

.intro h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  text-wrap: balance;
}

.intro-copy {
  margin: 0;
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 38rem;
}

/* ---------------- Controls ---------------- */

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr) auto;
  gap: 1rem;
  align-items: end;
  padding: 1.15rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 5.4rem;
  z-index: 15;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.control label,
.control-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.search-field,
.select-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  pointer-events: none;
}

#search {
  width: 100%;
  min-width: 0;
  padding: 0.78rem 1rem 0.78rem 2.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#search::placeholder {
  color: #a99e92;
}
#search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

#category {
  appearance: none;
  width: 100%;
  min-width: 0;
  padding: 0.78rem 2.6rem 0.78rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#category:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.select-icon {
  position: absolute;
  right: 1rem;
  width: 12px;
  height: 8px;
  color: var(--ink-soft);
  pointer-events: none;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.78rem 1.05rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.saved-toggle .heart {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}
.saved-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}
.saved-toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.saved-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.saved-toggle[aria-pressed="true"] .heart path {
  fill: #fff;
  stroke: #fff;
}
.saved-toggle[aria-pressed="true"] .heart {
  transform: scale(1.12);
}

.saved-count {
  min-width: 1.4rem;
  padding: 0 0.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1;
}
.saved-toggle[aria-pressed="true"] .saved-count {
  background: #fff;
  color: var(--accent-deep);
}

/* ---------------- Results bar ---------------- */

.results-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem 0 1rem;
}

.results-count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.text-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-deep);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  border-radius: 4px;
}
.text-button:hover {
  color: var(--accent);
}
.text-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------- Event grid ---------------- */

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding-bottom: 4rem;
}

.event-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.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.event-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--line-strong);
}
.event-card:focus-within {
  border-color: var(--accent);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--paper-deep);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.event-card:hover .card-media img {
  transform: scale(1.04);
}

.card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 16, 12, 0.02) 40%, rgba(20, 16, 12, 0.5) 100%);
}

.card-badges {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  right: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  z-index: 2;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid rgba(32, 29, 26, 0.08);
}

.card-saved-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.card-saved-flag svg {
  width: 12px;
  height: 12px;
}

.card-when {
  position: absolute;
  left: 0.8rem;
  bottom: 0.8rem;
  z-index: 2;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.15rem 1.15rem 1.25rem;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.38rem;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  text-wrap: balance;
}

.card-summary {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.94rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  margin: auto 0 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line-strong);
  font-size: 0.83rem;
  color: var(--ink-soft);
}
.card-fact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.card-fact svg {
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
  flex: none;
}
.card-fact strong {
  font-weight: 600;
  color: var(--ink);
}
.price-free {
  color: var(--sage);
  font-weight: 600;
}

.open-item {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.72rem 0.95rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, gap 0.2s ease;
}
.open-item svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}
.open-item:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.open-item:hover svg {
  transform: translateX(3px);
}
.open-item:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 4.5rem 1.5rem 5.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.6);
  margin-bottom: 4rem;
}
.empty-state[hidden] {
  display: none;
}
.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}
.empty-state h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.7rem;
  margin: 0;
}
.empty-state p {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  max-width: 34rem;
}

.primary-button {
  padding: 0.8rem 1.3rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease;
}
.primary-button:hover {
  background: var(--accent-deep);
}
.primary-button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.6rem 0 2.4rem;
  color: var(--ink-faint);
  font-size: 0.82rem;
}
.site-footer p {
  margin: 0;
}

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

.detail {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: visible;
}
.detail[open] {
  display: grid;
  place-items: center;
}
.detail::backdrop {
  background: rgba(28, 23, 18, 0.55);
  backdrop-filter: blur(3px);
}

.detail-shell {
  position: relative;
  width: min(64rem, 100% - 2rem);
  max-height: min(92vh, 60rem);
  overflow: auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr);
  margin: 1rem;
}

.detail-media {
  position: relative;
  min-height: 100%;
  background: var(--paper-deep);
}
.detail-media img {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100%;
  min-height: 20rem;
  max-height: min(92vh, 60rem);
  object-fit: cover;
}

.detail-body {
  padding: clamp(1.4rem, 3vw, 2.4rem);
}

.detail-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.95);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.5);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.detail-close svg {
  width: 15px;
  height: 15px;
}
.detail-close:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.detail-close:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.detail-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.9rem;
}
.detail-eyebrow .chip {
  background: var(--accent-tint);
  border-color: transparent;
  color: var(--accent-deep);
}
.detail-date {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.detail-body h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  line-height: 1.06;
  margin: 0 0 0.7rem;
  text-wrap: balance;
  padding-right: 4.5rem;
}

.detail-meta {
  margin: 0 0 1.3rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.detail-meta .dot {
  color: var(--line-strong);
  padding: 0 0.35rem;
}

.detail-actions {
  margin-bottom: 1.4rem;
}

.save-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.15rem;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--accent-deep);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.save-button .heart {
  width: 18px;
  height: 18px;
}
.save-button:hover {
  background: var(--accent-tint);
}
.save-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.save-button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.save-button[aria-pressed="true"] .heart path {
  fill: #fff;
  stroke: #fff;
}

.detail-content p {
  margin: 0 0 1rem;
  font-size: 1.03rem;
  color: var(--ink);
}
.detail-content p:last-child {
  margin-bottom: 0;
}

.detail-access {
  margin-top: 1.6rem;
  padding: 1rem 1.15rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.detail-access h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.detail-access p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .controls {
    position: static;
    grid-template-columns: 1fr 1fr;
  }
  .control--search {
    grid-column: 1 / -1;
  }
  .control--saved {
    grid-column: 1 / -1;
  }
  .saved-toggle {
    width: 100%;
    justify-content: center;
  }

  .detail-shell {
    grid-template-columns: 1fr;
    max-height: 92vh;
  }
  .detail-media img {
    position: static;
    min-height: 14rem;
    height: 32vh;
    max-height: 17rem;
  }
  .detail-body h2 {
    padding-right: 0;
  }
}

@media (max-width: 560px) {
  .wrap {
    width: min(100% - 1.6rem, var(--wrap));
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
  .weekend-stamp {
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
  }
  .stamp-label {
    display: inline;
  }
  .controls {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  .event-grid {
    grid-template-columns: 1fr;
    gap: 1.15rem;
  }
  .detail-shell {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .detail-media img {
    height: 26vh;
    min-height: 11rem;
  }
  .detail-close span {
    display: none;
  }
  .detail-close {
    padding: 0.55rem;
    border-radius: 999px;
  }
}

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