/* Both Days — a printed weekend programme. */

@font-face {
  font-family: 'Space Grotesk';
  src: url('assets/space-grotesk.ttf') format('truetype');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Literata';
  src: url('assets/literata.ttf') format('truetype');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f3f0e8;
  --paper-bright: #fbfaf6;
  --ink: #17161a;
  --ink-2: #5c574e;
  --ink-3: #6f6a5f;
  --line: #d9d2c4;
  --blue: #1f3fcc;
  --red: #c9273a;
  --sun: #d99b1f;
  --moss: #34714b;
  --violet: #6b4bb0;
  --forest: #3e7d46;
  --clay: #b5642f;
  --toolbar-h: 74px;
  --wrap: 1160px;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

html.is-locked, html.is-locked body { overflow: hidden; }

h1, h2, h3, p, dl, dd, figure { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

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

.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;
}

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- Masthead ---------- */

.masthead {
  background: var(--ink);
  color: #f6f4ee;
  border-bottom: 1px solid #000;
}

.masthead__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  padding-block: clamp(24px, 4vw, 40px) clamp(26px, 4vw, 44px);
}

.masthead__lead { max-width: 42ch; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.mark {
  position: relative;
  width: 38px;
  height: 32px;
  flex: none;
}
.mark i {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  mix-blend-mode: screen;
}
.mark__blue { left: 0; top: 0; background: #2145e0; }
.mark__red { left: 15px; top: 10px; background: #ef3d52; }

.brand__name {
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.masthead__head {
  font-size: clamp(2rem, 5.6vw, 3.4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.masthead__sub {
  margin-top: 14px;
  color: #c9c4b6;
  font-size: clamp(0.98rem, 1.6vw, 1.08rem);
  max-width: 46ch;
}

.masthead__dates {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.masthead__dates-label {
  width: 100%;
  color: #8f8a7e;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  font-weight: 400;
}
.masthead__dates-dash { color: #8f8a7e; }

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

.toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 92%, white);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(6px)) {
  .toolbar { background: var(--paper); background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: blur(8px); }
}

.toolbar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-block: 14px;
}

.field { display: flex; align-items: center; }

.field--search {
  position: relative;
  flex: 1 1 240px;
  min-width: 0;
}
.field__icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  pointer-events: none;
}
.field--search input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--paper-bright);
  color: var(--ink);
  font-size: 0.98rem;
}
.field--search input::placeholder { color: var(--ink-3); }
.field--search input::-webkit-search-cancel-button { cursor: pointer; }

.field--select {
  gap: 9px;
  flex: 0 1 auto;
}
.field__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
}
.field--select select {
  height: 46px;
  padding: 0 38px 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background-color: var(--paper-bright);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 19px) 20px, calc(100% - 13px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--paper-bright);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.saved-toggle__icon { width: 15px; height: 15px; }
.saved-toggle__count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 700;
}
.saved-toggle[aria-pressed="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.saved-toggle[aria-pressed="true"] .saved-toggle__count {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}
@media (hover: hover) {
  .saved-toggle:hover { border-color: var(--ink-2); }
  .saved-toggle[aria-pressed="true"]:hover { background: #1833ab; }
}

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

.result-line {
  padding: 22px 0 8px;
  color: var(--ink-2);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.result-line:empty { display: none; }

/* ---------- Day layout ---------- */

.days {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 64px);
  padding-bottom: 40px;
}
.day[hidden] { display: none; }

.day__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 15px 18px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 600;
}
.day--sat .day__head { background: var(--blue); }
.day--sun .day__head { background: var(--red); }
.day__name {
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.day__date { font-size: 0.95rem; color: rgba(255, 255, 255, .92); }
.day__count {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, .92);
}

/* ---------- Event rows ---------- */

.events { display: flex; flex-direction: column; }

.event {
  position: relative;
  display: grid;
  grid-template-columns: 62px 20px 1fr;
  align-items: start;
  padding: 15px 4px 17px;
}
.event[hidden] { display: none; }

.event__time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.event__start { font-size: 0.92rem; font-weight: 600; letter-spacing: -0.01em; }
.event__end { font-size: 0.76rem; color: var(--ink-3); }

.event__rail { position: relative; align-self: stretch; }
.event__rail::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: var(--line);
}
.events .event:first-child .event__rail::before { top: 12px; }
.events .event:last-child .event__rail::before { bottom: calc(100% - 16px); }
.event__dot {
  position: absolute;
  left: 50%;
  top: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: var(--cat, var(--ink));
  box-shadow: 0 0 0 5px var(--paper);
}

.event__open {
  display: block;
  width: 100%;
  padding: 0 6px 0 12px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.event__cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.event__cat::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cat, var(--ink));
}
.event__title {
  font-family: 'Literata', Georgia, serif;
  font-size: clamp(1.06rem, 1.7vw, 1.24rem);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.event__where {
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--ink-2);
}
.event__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--ink-3);
}
.event__facts .is-free { color: var(--moss); font-weight: 600; }

.event__open::after { content: ""; position: absolute; inset: 0; }

@media (hover: hover) {
  .event:hover .event__title { color: var(--blue); }
  .event:hover .event__dot { box-shadow: 0 0 0 5px var(--paper), 0 0 0 8px color-mix(in srgb, var(--cat, var(--ink)) 30%, transparent); }
}
.event:has(.event__open:focus-visible) .event__title { color: var(--blue); }
.event:has(.event__open:focus-visible) .event__dot {
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 8px color-mix(in srgb, var(--cat, var(--ink)) 30%, transparent);
}

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

.empty-state {
  max-width: 44ch;
  margin: 8px 0 70px;
  padding: 34px clamp(22px, 4vw, 40px);
  border: 1.5px dashed var(--line);
  border-radius: 18px;
  background: var(--paper-bright);
}
.empty-state[hidden] { display: none; }
.empty-state__title {
  font-family: 'Literata', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
}
.empty-state__body { margin: 8px 0 20px; color: var(--ink-2); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  background: transparent;
  font-weight: 600;
  cursor: pointer;
}
.btn--solid { background: var(--ink); color: var(--paper); }
@media (hover: hover) {
  .btn--solid:hover { background: #000; }
}

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

.foot {
  padding-block: 26px 44px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 0.82rem;
  max-width: 70ch;
}

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

#detail {
  width: min(560px, 100%);
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: -18px 0 48px rgba(20, 18, 15, .28);
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}
#detail:not([open]) { display: none; }
#detail[open] { animation: panel-in .28s cubic-bezier(.22, .61, .36, 1); }
#detail::backdrop {
  background: rgba(23, 22, 26, .5);
  animation: fade-in .2s ease;
}

.detail__bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(18px, 4vw, 30px);
  border-bottom: 1px solid var(--line);
}
.detail__cat {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px 6px 11px;
  border-radius: 999px;
  background: var(--paper);
  background: color-mix(in srgb, var(--cat, var(--ink)) 14%, var(--paper));
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.detail__cat::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--cat, var(--ink));
}
.detail__close {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--paper-bright);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
@media (hover: hover) { .detail__close:hover { border-color: var(--ink-2); } }
.detail__close svg { width: 12px; height: 12px; }

.detail__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: clamp(22px, 4vw, 34px) clamp(18px, 4vw, 30px) 30px;
}
.detail__title {
  font-family: 'Literata', Georgia, serif;
  font-size: clamp(1.65rem, 5vw, 2.25rem);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.detail__facts {
  margin: 22px 0 26px;
  border-top: 1px solid var(--line);
}
.detail__facts > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 4px 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.detail__facts dt {
  color: var(--ink-3);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.detail__facts dd { font-size: 0.94rem; }
.detail__body {
  font-family: 'Literata', Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.72;
  color: #26242a;
  max-width: 62ch;
  white-space: pre-line;
}

.detail__foot {
  flex: none;
  padding: 16px clamp(18px, 4vw, 30px) calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper-bright);
}
.save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 0 20px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}
.save svg { width: 16px; height: 16px; }
.save[aria-pressed="true"] {
  background: var(--paper);
  color: var(--red);
  border-color: var(--red);
}
@media (hover: hover) {
  .save:hover { background: #000; }
  .save[aria-pressed="true"]:hover { background: #f7e6e8; }
}

@keyframes panel-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@media (max-width: 860px) {
  .days { grid-template-columns: 1fr; gap: 34px; }
}

@media (max-width: 560px) {
  :root { --toolbar-h: 118px; }
  .masthead__inner { gap: 20px; }
  .masthead__dates { white-space: normal; }
  .toolbar__inner { row-gap: 10px; }
  .field--search { flex: 1 1 100%; }
  .field--select { flex: 1 1 auto; }
  .field__label { display: none; }
  .saved-toggle { flex: 0 0 auto; }
  .event { grid-template-columns: 54px 18px 1fr; }
  #detail {
    width: 100%;
    margin: 0;
    box-shadow: none;
  }
  #detail[open] { animation: sheet-in .28s cubic-bezier(.22, .61, .36, 1); }
}

@keyframes sheet-in {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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