/* ============================================================
   The Weekender — a printed city weekend programme
   Fonts: Space Grotesk (display), Literata (body), IBM Plex Mono (labels)
   ============================================================ */

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

:root {
  /* palette — warm paper, deep green-ink, one brick-vermilion accent */
  --paper:      #E9E2CF;
  --paper-soft: #F1ECDD;
  --paper-deep: #DED5BC;
  --ink:        #171C16;
  --ink-2:      #4A4938;
  --ink-3:      #565340;   /* secondary meta — darkened for ≥4.5:1 on paper */
  --accent:     #B23A22;   /* brick vermilion */
  --accent-2:   #8C2C18;
  --rule:       rgba(23, 28, 22, 0.16);
  --rule-strong:rgba(23, 28, 22, 0.34);
  --focus:      #1D4ED1;   /* visible keyboard focus, distinct from accent */

  --maxw: 1180px;
  --gutter: clamp(16px, 4vw, 40px);

  --f-display: "Space Grotesk", "Literata", Georgia, serif;
  --f-body: "Literata", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 2px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: clamp(16px, 1.05vw + 13px, 18px);
  line-height: 1.55;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 1px;
}
::selection { background: var(--accent); color: var(--paper-soft); }

/* custom scrollbars — theme the parts we didn't draw */
html { scrollbar-color: var(--ink-3) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb {
  background: var(--ink-3);
  border: 3px solid var(--paper);
  border-radius: 12px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-2); }

.skip-link {
  position: absolute; left: 8px; top: -40px;
  background: var(--ink); color: var(--paper-soft);
  padding: 8px 12px; font-family: var(--f-mono); font-size: 13px;
  text-decoration: none; z-index: 100; transition: top .18s var(--ease);
}
.skip-link:focus { top: 8px; }

.kicker {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* =====================  MASTHEAD  ===================== */
.masthead {
  position: relative;
  padding: 0 var(--gutter) 22px;
  border-bottom: 1px solid var(--ink);
  max-width: var(--maxw);
  margin-inline: auto;
}
.masthead__band {
  position: relative;
  height: clamp(120px, 22vw, 220px);
  margin: 0 calc(-1 * var(--gutter)) 0;
  overflow: hidden;
  border-bottom: 1px solid var(--ink);
}
.masthead__photo {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.35) brightness(0.62);
}
.masthead__tint {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(23,28,22,0.20), rgba(23,28,22,0.55) 70%, rgba(23,28,22,0.78)),
    linear-gradient(90deg, rgba(178,58,34,0.22), transparent 45%);
  mix-blend-mode: multiply;
}
.masthead__topline {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--rule);
}
.masthead__titleblock { padding: 14px 0 6px; }
.wordmark {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(48px, 9.5vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  margin: 0;
  color: var(--ink);
}
.wordmark::after {
  content: "";
  display: inline-block;
  width: 0.42em; height: 0.42em;
  margin-left: 0.12em; margin-bottom: 0.06em;
  background: var(--accent);
  vertical-align: baseline;
  border-radius: 50%;
}
.dateline {
  font-family: var(--f-mono);
  font-size: clamp(13px, 1.4vw, 16px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 10px 0 0;
  color: var(--ink-2);
}
.standfirst {
  font-family: var(--f-body);
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.5;
  max-width: 56ch;
  margin: 18px 0 4px;
  color: var(--ink);
}
.standfirst::first-letter {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.15em;
}

/* =====================  CONTROLS  ===================== */
.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--rule-strong);
}
.controls__form {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 12px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px clamp(14px, 2.5vw, 28px);
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field--search { flex: 1 1 280px; }
.field--filter { flex: 0 1 220px; }
.field--saved { flex: 0 0 auto; margin-left: auto; }
.field__label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.field__control {
  position: relative;
  display: flex; align-items: center;
  background: var(--paper-soft);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  height: 44px;
}
.field__icon {
  position: absolute; left: 12px;
  width: 18px; height: 18px;
  fill: none; stroke: var(--ink-2); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.field__input {
  width: 100%; height: 100%;
  padding: 0 14px 0 40px;
  background: transparent; border: none;
  font-family: var(--f-body);
  font-size: 16px;
  color: var(--ink);
  border-radius: var(--radius);
}
.field__input::placeholder { color: var(--ink-3); font-style: italic; }
.field__input:focus-visible { outline: none; }
.field__control:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.field__control--select { padding: 0 10px 0 0; }
.field__select {
  width: 100%; height: 100%;
  padding: 0 28px 0 12px;
  background: transparent; border: none;
  font-family: var(--f-body);
  font-size: 16px;
  color: var(--ink);
  appearance: none; -webkit-appearance: none;
  cursor: pointer;
  border-radius: var(--radius);
}
.field__select:focus-visible { outline: none; }
.field__chevron {
  position: absolute; right: 8px;
  width: 18px; height: 18px;
  fill: none; stroke: var(--ink); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}

/* saved-filter toggle */
.toggle {
  display: inline-flex; align-items: center; gap: 10px;
  height: 44px;
  padding: 0 16px;
  background: var(--paper-soft);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--f-body);
  font-size: 15px;
  color: var(--ink);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.toggle__mark {
  width: 18px; height: 18px;
  border: 1.8px solid var(--ink);
  border-radius: 2px;
  position: relative;
  flex: none;
  background: transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.toggle__mark::after {
  content: "";
  position: absolute; left: 4px; top: 1px;
  width: 6px; height: 10px;
  border: solid var(--paper-soft);
  border-width: 0 2.4px 2.4px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s var(--ease);
}
.toggle[aria-pressed="true"] {
  background: var(--ink); color: var(--paper-soft);
}
.toggle[aria-pressed="true"] .toggle__mark {
  background: var(--accent); border-color: var(--accent);
}
.toggle[aria-pressed="true"] .toggle__mark::after { transform: rotate(45deg) scale(1); }
.toggle__count {
  font-family: var(--f-mono); font-size: 12px;
  background: var(--ink); color: var(--paper-soft);
  padding: 1px 7px; border-radius: 10px;
  line-height: 1.5;
}
.toggle[aria-pressed="true"] .toggle__count { background: var(--accent); }
.toggle:hover { background: var(--paper-deep); }
.toggle[aria-pressed="true"]:hover { background: var(--ink-2); }

/* =====================  PROGRAMME (day columns)  ===================== */
.programme {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 28px var(--gutter) 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 clamp(20px, 3.5vw, 52px);
  position: relative;
}
.programme::before {
  content: "";
  position: absolute;
  top: 28px; bottom: 12px;
  left: 50%;
  width: 1px;
  background: var(--rule-strong);
}
.programme.is-single { grid-template-columns: 1fr; }
.programme.is-single::before { display: none; }
@media (max-width: 760px) {
  .programme { grid-template-columns: 1fr; gap: 8px; }
  .programme::before { display: none; }
}

.day {
  min-width: 0;
}
.day__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 4px;
}
.day__name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(22px, 2.6vw, 30px);
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--ink);
}
.day__date {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.day__count {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.prog__list { list-style: none; margin: 0; padding: 0; }
.prog__item { border-bottom: 1px solid var(--rule); }
.prog__open {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  column-gap: 14px;
  align-items: start;
  width: 100%;
  padding: 16px 4px 16px 0;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  position: relative;
  border-radius: var(--radius);
  transition: background .14s var(--ease);
}
.prog__open:hover { background: var(--paper-soft); }
.prog__open:focus-visible { outline: none; background: var(--paper-soft); }
.prog__open:focus-visible::after {
  content: ""; position: absolute; inset: 0;
  outline: 3px solid var(--focus); outline-offset: -3px;
  border-radius: var(--radius);
  pointer-events: none;
}
.prog__time {
  font-family: var(--f-mono);
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  padding-top: 4px;
  white-space: nowrap;
}
.prog__body { min-width: 0; }
.prog__title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(18px, 1.9vw, 22px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 5px;
}
.prog__summary {
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0 0 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prog__meta {
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-transform: uppercase;
  display: flex; flex-wrap: wrap; gap: 0 10px;
}
.prog__meta .cat { color: var(--accent); font-weight: 600; }
.prog__meta .free { color: var(--accent); font-weight: 600; }
.prog__mark {
  align-self: center;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity .16s var(--ease), transform .16s var(--ease);
  flex: none;
}
.prog__item.is-saved .prog__mark { opacity: 1; transform: scale(1); }

@media (max-width: 760px) {
  .prog__open { grid-template-columns: 78px 1fr auto; }
  .prog__time { font-size: 12px; }
}

/* =====================  EMPTY STATE  ===================== */
.empty {
  max-width: var(--maxw);
  margin: 28px auto 60px;
  padding: 40px var(--gutter);
  text-align: center;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.empty[hidden] { display: none; }
.empty__title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.empty__body {
  font-family: var(--f-body);
  color: var(--ink-2);
  margin: 0 0 18px;
  max-width: 46ch;
  margin-inline: auto;
}
.empty__recover {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 16px;
  background: var(--ink); color: var(--paper-soft);
  border: none; border-radius: var(--radius);
  cursor: pointer;
}
.empty__recover:hover { background: var(--ink-2); }

/* =====================  COLOPHON  ===================== */
.colophon {
  max-width: var(--maxw);
  margin: 28px auto 0;
  padding: 24px var(--gutter) 56px;
  border-top: 1px solid var(--ink);
  display: flex; flex-wrap: wrap; gap: 6px 28px;
  justify-content: space-between;
}
.colophon__line {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--ink-2);
  margin: 0;
  max-width: 60ch;
}
.colophon__meta {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* =====================  DETAIL DIALOG  ===================== */
dialog.detail {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  position: fixed; inset: 0;
  overflow: hidden;
}
dialog.detail::backdrop {
  background: rgba(23, 28, 22, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.detail__inner {
  position: absolute;
  top: 0; right: 0;
  width: min(560px, 100%);
  height: 100%;
  background: var(--paper);
  border-left: 1px solid var(--ink);
  box-shadow: -18px 0 40px -20px rgba(23,28,22,0.5);
  display: flex; flex-direction: column;
  transform: translateX(0);
  animation: slide-in .28s var(--ease);
}
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 600px) {
  .detail__inner { width: 100%; border-left: none; }
}

.detail__head {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--rule);
  flex: none;
}
.detail__close {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.detail__close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.detail__close:hover { background: var(--ink); color: var(--paper-soft); }

.detail__scroll { overflow-y: auto; flex: 1; padding: 0 22px 24px; }
.detail__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 18px 0 12px;
}
.detail__summary {
  font-family: var(--f-body);
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0 0 18px;
  font-style: italic;
}
.detail__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 0 20px;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.detail__facts dt {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 12px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-soft);
}
.detail__facts dd {
  margin: 0;
  font-family: var(--f-body);
  font-size: 15px;
  color: var(--ink);
  padding: 12px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.detail__facts .price-free { color: var(--accent); font-weight: 700; }

.detail__body {
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 20px;
  max-width: 60ch;
}
.detail__body p { margin: 0 0 12px; }
.detail__body p + p { color: var(--ink-2); }

.detail__access {
  background: var(--paper-soft);
  border-top: 2px solid var(--accent);
  border-bottom: 1px solid var(--rule);
  padding: 14px 16px;
  margin: 0 0 24px;
}
.detail__access-label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 4px;
}
.detail__access p { margin: 0; font-size: 15px; color: var(--ink); line-height: 1.5; }

.detail__actions {
  padding: 18px 22px;
  border-top: 1px solid var(--rule);
  background: var(--paper-soft);
  flex: none;
}
.save {
  display: inline-flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--paper);
  border: 1.8px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.save__icon { width: 20px; height: 22px; flex: none; display: grid; place-items: center; }
.save__bookmark {
  width: 20px; height: 20px;
  fill: none; stroke: var(--ink); stroke-width: 1.8;
  stroke-linejoin: round;
  transition: fill .15s var(--ease), stroke .15s var(--ease);
}
.save[aria-pressed="true"] {
  background: var(--accent); color: var(--paper-soft); border-color: var(--accent);
}
.save[aria-pressed="true"] .save__bookmark { fill: var(--paper-soft); stroke: var(--paper-soft); }
.save:hover { background: var(--paper-deep); }
.save[aria-pressed="true"]:hover { background: var(--accent-2); border-color: var(--accent-2); }

/* dialog hidden state: never leave invisible layers blocking the UI */
dialog.detail:not([open]) { display: none; }

/* =====================  REDUCED MOTION  ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .detail__inner { animation: none; }
  dialog.detail::backdrop { animation: none; }
}
