/* ============================================================
   FORTY·EIGHT — dark weekend program
   Type: Space Grotesk (display/body) + IBM Plex Mono (data)
   ============================================================ */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink-0: #101216;        /* page */
  --ink-1: #16191e;        /* rail */
  --ink-2: #1d2127;        /* cards */
  --ink-3: #262b33;        /* hover */
  --line: #31373f;
  --text: #edeff2;
  --text-dim: #a6adb8;
  --text-faint: #737b87;
  --accent: #d8f34e;       /* acid chartreuse */
  --accent-ink: #14161a;
  --art: #ff5ea8;
  --film: #a07dff;
  --food: #ff8a3d;
  --literature: #4fd6ff;
  --music: #b8f135;
  --outdoors: #43d98a;
  --walks: #ffd23d;
  --radius: 0px;
  --gutter: clamp(20px, 3vw, 44px);
}

* { box-sizing: border-box; }

html { background: var(--ink-0); }

body {
  margin: 0;
  background: var(--ink-0);
  color: var(--text);
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(216, 243, 78, 0.25);
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

::selection { background: var(--accent); color: var(--accent-ink); }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  text-decoration: none;
  transition: top 160ms ease;
}
.skip-link:focus { top: 12px; }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  min-height: 100dvh;
}

/* ---------- rail ---------- */
.rail {
  background: var(--ink-1);
  border-right: 1px solid var(--line);
  padding: 28px var(--gutter) 32px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand { border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.brand-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.28em;
}
.brand-name {
  margin: 0;
  font-size: clamp(34px, 2.6vw, 42px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.brand-sub { margin: 12px 0 10px; color: var(--text-dim); font-size: 14.5px; line-height: 1.5; }
.brand-dates { margin: 0; color: var(--text); font-size: 12px; letter-spacing: 0.1em; }
.brand-dates .mono { color: var(--accent); font-size: 12px; }

/* ---------- controls ---------- */
.controls { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { color: var(--text-faint); text-transform: uppercase; }

input[type="search"],
select {
  width: 100%;
  background: var(--ink-0);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  transition: border-color 140ms ease, background-color 140ms ease;
}
input[type="search"]::placeholder { color: var(--text-faint); }
input[type="search"]:hover, select:hover { border-color: #4a525d; }
input[type="search"]:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
select { appearance: none; cursor: pointer; }
.field-select-wrap { position: relative; }
.field-select-wrap::after {
  content: "";
  position: absolute;
  right: 14px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.saved-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.saved-toggle:hover { border-color: #4a525d; background: var(--ink-2); }
.saved-dot {
  width: 10px; height: 10px;
  border: 2px solid var(--text-faint);
  flex: none;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.saved-toggle[aria-pressed="true"] { border-color: var(--accent); }
.saved-toggle[aria-pressed="true"] .saved-dot { background: var(--accent); border-color: var(--accent); }
.saved-toggle-text { flex: 1; text-align: left; }
.saved-count { color: var(--text-faint); }
.saved-toggle[aria-pressed="true"] .saved-count { color: var(--accent); }

.reset-link {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 2px 0;
  touch-action: manipulation;
  transition: color 140ms ease;
}
.reset-link:hover { color: var(--accent); }

/* ---------- rail foot ---------- */
.rail-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 8px; }
.count { color: var(--accent); margin: 0; }
.day-counts { color: var(--text-faint); margin: 0; line-height: 1.9; }
.colophon { margin: 10px 0 0; color: var(--text-faint); font-size: 11.5px; line-height: 1.5; }

/* ---------- program ---------- */
.program {
  padding: 34px var(--gutter) 90px;
  min-width: 0;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
}
.program-head { margin-bottom: 26px; }
.program-title {
  margin: 0 0 8px;
  font-size: clamp(26px, 2.4vw, 34px);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-wrap: balance;
  scroll-margin-top: 24px;
}
.program-note { margin: 0; color: var(--text-dim); font-size: 15px; max-width: 56ch; text-wrap: pretty; }

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

/* ---------- category accent wiring ---------- */
.art { --cat: var(--art); }
.film { --cat: var(--film); }
.food { --cat: var(--food); }
.literature { --cat: var(--literature); }
.music { --cat: var(--music); }
.outdoors { --cat: var(--outdoors); }
.walks { --cat: var(--walks); }

/* ---------- event cards (tickets) ---------- */
.item { position: relative; }

.ticket {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--ink-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-left: 4px solid var(--cat, var(--accent));
  border-radius: var(--radius);
  padding: 16px 18px 15px;
  cursor: pointer;
  font: inherit;
  touch-action: manipulation;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.ticket:hover { background: var(--ink-3); border-color: #454d58; border-left-color: var(--cat, var(--accent)); }
.ticket:active { transform: translateY(1px); }

.ticket-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.ticket-cat {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cat, var(--accent));
}
.ticket-day { color: var(--text-faint); font-size: 11px; letter-spacing: 0.14em; }

.ticket-title {
  display: block;
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.005em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.ticket-meta .sep { color: var(--text-faint); }

.ticket-price {
  flex: none;
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  white-space: nowrap;
}
.ticket-price.is-free { color: var(--accent); border-color: rgba(216, 243, 78, 0.4); }

/* ---------- empty state ---------- */
.empty {
  border: 1px dashed var(--line);
  padding: 48px 32px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 12px;
}
.empty[hidden] { display: none; }
.empty-mark { color: var(--text-faint); margin: 0; }
.empty-title { margin: 0; font-size: 24px; font-weight: 500; text-wrap: balance; }
.empty-copy { margin: 0 0 8px; color: var(--text-dim); max-width: 46ch; text-wrap: pretty; }

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  padding: 12px 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  transition: filter 140ms ease, transform 140ms ease;
}
.btn-accent:hover { filter: brightness(1.08); }
.btn-accent:active { transform: translateY(1px); }

/* ---------- detail dialog ---------- */
.detail {
  border: 1px solid var(--line);
  border-top: 4px solid var(--cat, var(--accent));
  border-radius: var(--radius);
  padding: 0;
  background: var(--ink-1);
  color: var(--text);
  width: min(680px, calc(100vw - 32px));
  max-height: min(86dvh, 900px);
  margin: auto;
  overscroll-behavior: contain;
}
.detail::backdrop {
  background: rgba(8, 9, 11, 0.72);
  backdrop-filter: blur(3px);
}
.detail[open] { animation: detail-in 200ms ease; }
@keyframes detail-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-inner { overflow-y: auto; max-height: min(86dvh, 900px); padding: 18px 26px 28px; }

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.detail-tagline { color: var(--text-faint); margin: 0; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: var(--ink-0);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.icon-btn:hover { background: var(--ink-3); border-color: #4a525d; }

.detail-media { margin: 0 -26px 18px; background: var(--ink-2); }
.detail-media img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  filter: saturate(0.9);
}

.detail-cat { color: var(--cat, var(--accent)); text-transform: uppercase; letter-spacing: 0.2em; margin: 0 0 8px; }
.detail-title { margin: 0 0 20px; font-size: clamp(26px, 3.4vw, 34px); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: break-word; }

.detail-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  margin: 0 0 22px;
}
.detail-meta > div { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-meta > div:nth-child(3n) { border-right: none; }
.detail-meta > div:nth-last-child(-n+3) { border-bottom: none; }
.detail-meta dt { color: var(--text-faint); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; margin: 0 0 4px; font-family: "IBM Plex Mono", monospace; }
.detail-meta dd { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }

.detail-body p { margin: 0 0 14px; color: var(--text); font-size: 16px; line-height: 1.65; text-wrap: pretty; }
.detail-body p:last-child { color: var(--text-dim); border-left: 3px solid var(--cat, var(--accent)); padding-left: 14px; }

.detail-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
#save-item[aria-pressed="true"] { background: var(--ink-2); color: var(--accent); border-color: var(--accent); }

.noscript { padding: 24px; color: var(--accent); font-family: "IBM Plex Mono", monospace; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .listing { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-top: max(24px, env(safe-area-inset-top));
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
  }
  .rail-foot { margin-top: 0; }
  .program { padding-top: 26px; }
}
@media (max-width: 480px) {
  .listing { gap: 10px; }
  .ticket { padding: 14px 14px 13px; }
  .ticket-title { font-size: 18px; }
  .detail { width: 100vw; max-height: 100dvh; border-left: none; border-right: none; }
  .detail-inner { max-height: 100dvh; padding: 14px 18px 24px; }
  .detail-media { margin: 0 -18px 16px; }
  .detail-media img { height: 150px; }
  .detail-meta { grid-template-columns: 1fr 1fr; }
  .detail-meta > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .detail-meta > div:nth-child(2n) { border-right: none; }
  .detail-meta > div:nth-last-child(-n+2) { border-bottom: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .skip-link:focus { top: 12px; }
}
