/* ============================================================
   TWO DAYS — a weekend board
   World: municipal enamel signage over printed timetable stock.
   Green enamel carries the chrome; ivory paper carries the data;
   marigold exists only as the punched-ticket color of the shortlist.
   ============================================================ */

@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype-variations");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype-variations");
  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 {
  --green: #1e4b32;
  --green-deep: #143525;
  --paper: #f5f0e1;
  --paper-2: #ece5cf;
  --ink: #1d2b21;
  --sub: #52604f;
  --line: rgba(29, 43, 33, 0.18);
  --line-strong: rgba(29, 43, 33, 0.85);
  --marigold: #f0b429;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --display: "Oswald", "Arial Narrow", sans-serif;
  --body: "Work Sans", system-ui, -apple-system, sans-serif;
  --maxw: 1120px;
}

* { box-sizing: border-box; }

html { scrollbar-color: var(--green) var(--paper-2); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--green); color: var(--paper); }

::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--green); border: 3px solid var(--paper-2); }
::-webkit-scrollbar-thumb:hover { background: var(--green-deep); }

:is(a, button, input, select, [tabindex]):focus-visible {
  outline: 2.5px solid var(--green);
  outline-offset: 2px;
}

/* Focus rings must flip to ivory on the green enamel surfaces. */
.masthead :is(a, button, input, select):focus-visible,
.ticket-band :is(a, button):focus-visible,
.skip-link:focus {
  outline-color: var(--marigold);
}

button { font-family: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 10px;
  z-index: 100;
  background: var(--green);
  color: var(--paper);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 0.8rem;
  text-decoration: none;
}
.skip-link:focus { left: 10px; }

/* ---------- Masthead: the enamel plate ---------- */

.masthead {
  position: relative;
  background: var(--green);
  color: var(--paper);
  padding: clamp(2.4rem, 5vw, 4rem) 0;
  border-bottom: 2px solid var(--ink);
}
.masthead::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1.5px solid rgba(245, 240, 225, 0.32);
  pointer-events: none;
}

.masthead-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
}

.masthead-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3.6rem, 9.5vw, 7rem);
  line-height: 0.94;
  text-transform: uppercase;
  letter-spacing: 0.015em;
  margin: 0 0 14px;
}

.masthead-dates {
  font-family: var(--mono);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--marigold);
  margin: 0 0 18px;
}

.masthead-lede {
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 46ch;
  margin: 0;
  color: rgba(245, 240, 225, 0.88);
}

/* The decorative admission stub — carries the fixed weekend dates. */
.masthead-stub {
  flex-shrink: 0;
  position: relative;
  transform: rotate(-2.5deg);
  background: var(--paper);
  color: var(--green);
  border: 2px solid var(--green-deep);
  padding: 16px 26px 14px;
  text-align: center;
  min-width: 200px;
  box-shadow: 0 14px 30px rgba(10, 24, 15, 0.35);
}
.masthead-stub::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  border-top: 2px dashed rgba(20, 53, 37, 0.45);
}
.stub-notch {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  transform: translateY(-50%);
}
.notch-top { left: -10px; }
.notch-bottom { right: -10px; }
.stub-heading {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 12px;
}
.stub-sub {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding-top: 14px;
  color: var(--sub);
}

/* ---------- Control strip: the printed form ---------- */

.controls {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}
.controls-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 24px 28px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sub);
}
.field input,
.field select {
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  padding: 9px 12px;
}
.field input { width: 262px; }
.field input::placeholder { color: rgba(82, 96, 79, 0.92); }
.field input { caret-color: var(--green); }
.field input:hover,
.field select:hover { background: rgba(30, 75, 50, 0.05); }

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%231e4b32' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 13px 8px;
  cursor: pointer;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 9px 16px;
  background: transparent;
  border: 2px solid var(--green);
  border-radius: 0;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.saved-toggle:hover { background: rgba(30, 75, 50, 0.08); }
.saved-toggle[aria-pressed="true"] {
  background: var(--marigold);
  border-color: var(--ink);
  color: var(--ink);
}

.punch-hole {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid currentColor;
  flex-shrink: 0;
}
.saved-toggle[aria-pressed="true"] .punch-hole,
.save-btn[aria-pressed="true"] .punch-hole {
  background: currentColor;
  animation: punch-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
@keyframes punch-in {
  from { transform: scale(0.2); }
  to { transform: scale(1); }
}

.saved-count::before { content: "("; }
.saved-count::after { content: ")"; }

.result-count {
  margin: 0 0 0 auto;
  align-self: flex-end;
  padding-bottom: 11px;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sub);
}

/* ---------- Timetable ---------- */

.timetable {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px 32px 76px;
}

.day-section { margin-top: 30px; }
.day-section:first-child { margin-top: 0; }

.day-header {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin: 0 0 4px;
  border-bottom: 2px solid var(--line-strong);
  padding-bottom: 10px;
}
.day-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  text-transform: uppercase;
  letter-spacing: 0.045em;
  margin: 0;
}
.day-date {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sub);
}
.day-note {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sub);
}

.row {
  display: grid;
  grid-template-columns: 122px 1fr auto;
  grid-template-areas: "time main side";
  gap: 10px 28px;
  align-items: center;
  padding: 17px 16px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s ease;
}
.row:hover { background: var(--paper-2); }
.row.is-saved { background: rgba(240, 180, 41, 0.1); }
.row.is-saved:hover { background: rgba(240, 180, 41, 0.18); }

.row-time { grid-area: time; font-family: var(--mono); }
.t-start { display: block; font-size: 1.12rem; line-height: 1.2; }
.t-end {
  display: block;
  font-size: 0.75rem;
  color: var(--sub);
  letter-spacing: 0.02em;
}

.row-main { grid-area: main; min-width: 0; }
.row-title {
  display: block;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.28rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 4px;
  text-align: left;
  cursor: pointer;
  transition: color 0.12s ease;
}
.row-title:hover { color: var(--green); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.row-meta {
  margin: 0;
  font-size: 0.86rem;
  color: var(--sub);
}
.row-meta .sep { margin: 0 6px; color: rgba(82, 96, 79, 0.5); }

.row-side { grid-area: side; display: flex; align-items: center; gap: 14px; }

.plate {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--green);
  color: var(--paper);
  padding: 5px 9px 4px;
  white-space: nowrap;
}

.price { font-family: var(--mono); font-size: 0.88rem; white-space: nowrap; }

.row-save {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.row-save:hover { background: rgba(30, 75, 50, 0.1); }
.row-save::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: transparent;
}
.row-save[aria-pressed="true"] { background: var(--marigold); border-color: var(--ink); }
.row-save[aria-pressed="true"]::before {
  background: var(--ink);
  animation: punch-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

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

.empty-state {
  margin: 64px auto 0;
  max-width: 480px;
  text-align: center;
  border: 2px dashed rgba(82, 96, 79, 0.55);
  padding: 46px 28px 42px;
}
.empty-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}
.empty-text { margin: 0 auto 22px; max-width: 38ch; color: var(--sub); font-size: 0.95rem; }
.recover-btn {
  font-family: var(--mono);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--green);
  color: var(--paper);
  border: 2px solid var(--green);
  padding: 11px 20px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.recover-btn:hover { background: var(--green-deep); border-color: var(--green-deep); }

/* ---------- Detail ticket ---------- */

dialog.ticket {
  border: none;
  padding: 0;
  background: transparent;
  width: min(660px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  overflow: visible;
}
dialog.ticket::backdrop { background: rgba(16, 33, 22, 0.62); }

.ticket-frame {
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 0 26px 64px rgba(10, 24, 15, 0.45);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
dialog.ticket[open] { animation: ticket-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes ticket-in {
  from { transform: translateY(16px) scale(0.985); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.ticket-band {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--green);
  color: var(--paper);
  padding: 16px 22px;
}
.plate-ivory {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1.5px solid rgba(245, 240, 225, 0.85);
  color: var(--paper);
  padding: 5px 9px 4px;
  white-space: nowrap;
}
.ticket-when {
  font-family: var(--mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(245, 240, 225, 0.85);
}
.ticket-close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1.5px solid rgba(245, 240, 225, 0.55);
  border-radius: 0;
  color: var(--paper);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.ticket-close:hover { background: rgba(245, 240, 225, 0.14); }
.ticket-close svg { display: block; }

.ticket-main { padding: 26px 28px 6px; }
.detail-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  line-height: 1.08;
  letter-spacing: 0.01em;
  margin: 0 0 14px;
}
.detail-summary {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.65;
  max-width: 62ch;
}

.access-note {
  margin-top: 18px;
  border: 1.5px solid var(--green);
  background: rgba(30, 75, 50, 0.06);
  padding: 14px 16px;
}
.access-heading {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--green);
  margin: 0 0 6px;
}
.access-note p { margin: 0; font-size: 0.95rem; line-height: 1.6; max-width: 60ch; }

.ticket-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5px;
  background: var(--line);
  border: 1.5px solid var(--line);
  margin: 22px 28px 0;
}
.ticket-facts > div { background: var(--paper); padding: 11px 13px 10px; }
.ticket-facts dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sub);
  margin: 0 0 3px;
}
.ticket-facts dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.4;
}

.perf {
  position: relative;
  border: none;
  border-top: 2px dashed rgba(29, 43, 33, 0.4);
  margin: 24px 0 0;
  height: 0;
}
.perf::before,
.perf::after {
  content: "";
  position: absolute;
  top: -12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-deep);
}
.perf::before { left: -13px; }
.perf::after { right: -13px; }

.ticket-stub { padding: 22px 28px 28px; }
.stub-hint {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--sub);
  margin: 0 0 10px;
}
.save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 14px 18px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.save-btn:hover { background: rgba(30, 75, 50, 0.08); }
.save-btn[aria-pressed="true"] { background: var(--marigold); }

/* ---------- Colophon ---------- */

.colophon {
  border-top: 2px solid var(--ink);
  text-align: center;
  padding: 26px 24px 52px;
}
.colophon p {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sub);
}
.colophon-type { color: var(--sub); }

.noscript-note {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 32px;
  font-size: 1rem;
}

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
  .masthead-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 26px;
    padding: 0 20px;
  }
  .masthead-stub { transform: rotate(-1.75deg); }

  /* The stacked strip is too tall to pin over a phone viewport. */
  .controls { position: static; }

  .controls-inner {
    padding: 12px 20px;
    gap: 14px 16px;
  }
  .field { flex: 1 1 100%; }
  .field input,
  .field select { width: 100%; }
  .saved-toggle { flex: 1 1 100%; justify-content: center; }
  .result-count { margin-left: 0; flex-basis: 100%; padding-bottom: 0; }

  .timetable { padding: 26px 20px 60px; }

  .row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "time side"
      "main main";
    gap: 6px 16px;
    padding: 15px 12px;
  }
  .row-time { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
  .t-start { font-size: 1rem; }
  .row-title { font-size: 1.12rem; }
  .day-note { display: none; }

  .ticket-facts { grid-template-columns: repeat(2, 1fr); margin: 20px 20px 0; }
  .ticket-main { padding: 22px 20px 4px; }
  .ticket-stub { padding: 20px 20px 24px; }
  .ticket-band { padding: 14px 18px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
