@font-face { font-family: "Oswald"; src: url("assets/oswald.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "Work Sans"; src: url("assets/work-sans.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --ground: #2437f5;
  --ground-deep: #1a28c4;
  --ink: #10112b;
  --ink-soft: #3b3d63;
  --paper: #fff3b0;
  --paper-2: #ffe97a;
  --punch: #ff4f8b;
  --on-ground: #f4f2ff;
  --on-ground-soft: #cfd3ff;

  --c-art: #ff9ec4;
  --c-film: #c3b0ff;
  --c-food: #ffb066;
  --c-literature: #96e8bd;
  --c-music: #ff8a78;
  --c-outdoors: #8fdc7a;
  --c-walks: #86d8ff;

  --display: "Oswald", "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
  --body: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --pad: clamp(16px, 3vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--on-ground);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  background-image: radial-gradient(rgba(255,255,255,.09) 1.2px, transparent 1.4px);
  background-size: 14px 14px;
}
::selection { background: var(--punch); color: var(--ink); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--punch); outline-offset: 3px; border-radius: 4px; }
.paper :focus-visible, .stub :focus-visible, .ticket :focus-visible, dialog :focus-visible { outline-color: var(--ink); }
.skip { position: absolute; left: 8px; top: -60px; background: var(--paper); color: var(--ink); padding: 10px 14px; z-index: 50; font-weight: 600; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
  grid-template-areas: "head head" "browse ticket";
  column-gap: clamp(24px, 4vw, 64px);
  padding: 0 var(--pad) 56px;
  max-width: 1500px;
  margin: 0 auto;
}
.masthead { grid-area: head; padding: clamp(24px, 4vw, 48px) 0 clamp(16px, 2vw, 28px); display: flex; flex-wrap: wrap; align-items: end; gap: 12px 40px; }
.wordmark { margin: 0; font-family: var(--display); font-weight: 700; text-transform: uppercase; line-height: .82; font-size: clamp(3.4rem, 9vw, 6rem); letter-spacing: -.01em; display: flex; flex-direction: column; }
.wm-punch { color: var(--on-ground); }
.wm-list {
  color: var(--paper);
  position: relative;
  width: fit-content;
}
.wm-list::after {
  content: ""; position: absolute; right: -.62em; top: .12em; width: .36em; height: .36em; border-radius: 50%;
  background: var(--ground); box-shadow: inset 2px 3px 0 rgba(0,0,0,.45), 0 0 0 2px var(--punch);
}
.tagline { margin: 0; max-width: 30ch; font-size: 1.125rem; line-height: 1.35; color: var(--on-ground-soft); text-wrap: balance; padding-bottom: 4px; }

/* ---------- controls ---------- */
.browse { grid-area: browse; min-width: 0; }
.controls {
  display: grid; gap: 14px 16px; align-items: end;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  padding: 18px 0 8px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .label { font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; font-size: .8125rem; font-weight: 500; color: var(--on-ground-soft); }
input[type="search"], select {
  width: 100%; min-height: 48px; padding: 8px 14px;
  background: var(--paper); color: var(--ink); border: 0; border-radius: 6px;
  box-shadow: 0 3px 0 rgba(0,0,0,.28);
  font-size: 1rem;
}
input::placeholder { color: var(--ink-soft); opacity: 1; }
select { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%2310112b' stroke-width='2.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.seg { display: flex; gap: 0; background: rgba(0,0,0,.22); border-radius: 6px; padding: 3px; }
.seg-btn { flex: 1; min-height: 42px; border: 0; background: transparent; border-radius: 4px; font-family: var(--display); text-transform: uppercase; letter-spacing: .06em; font-size: .9375rem; font-weight: 500; color: var(--on-ground); }
.seg-btn[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.seg-btn:not([aria-pressed="true"]):hover { background: rgba(255,255,255,.14); }

.saved-toggle {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 18px 6px 14px;
  border: 2px dashed var(--on-ground-soft); background: transparent; border-radius: 6px;
  font-family: var(--display); text-transform: uppercase; letter-spacing: .06em; font-size: 1rem; font-weight: 500; justify-self: start;
  color: var(--on-ground);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.saved-toggle:hover { background: rgba(255,255,255,.1); }
.saved-toggle[aria-pressed="true"] { background: var(--punch); color: var(--ink); border-style: solid; border-color: var(--punch); }
.hole {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2px solid currentColor;
  transition: box-shadow .25s var(--ease), background .25s var(--ease);
}
.saved-toggle[aria-pressed="true"] .hole { background: var(--ground); box-shadow: inset 2px 3px 0 rgba(0,0,0,.5); border-color: var(--ink); }
.count { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .35em; border-radius: 99px; background: var(--paper); color: var(--ink); font-size: .8125rem; font-weight: 600; font-family: var(--body); letter-spacing: 0; }

.status { margin: 14px 0 6px; font-size: .9375rem; color: var(--on-ground-soft); min-height: 1.5em; }

/* ---------- day headings + stubs ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.day-head {
  margin: 22px 0 0; display: flex; align-items: baseline; gap: 14px;
  font-family: var(--display); text-transform: uppercase; font-weight: 700; line-height: 1;
  font-size: clamp(1.75rem, 4vw, 2.5rem); color: var(--on-ground);
}
.day-head:first-child { margin-top: 6px; }
.day-head small { font-size: .9375rem; font-weight: 500; letter-spacing: .08em; color: var(--on-ground-soft); }
.day-head::after { content: ""; flex: 1; border-top: 3px dotted rgba(255,255,255,.45); transform: translateY(-.2em); }

.stub {
  --accent: var(--c-art);
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 104px;
  background: var(--paper); color: var(--ink); border-radius: 10px;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.28));
  transition: transform .3s var(--ease), filter .3s var(--ease);
  animation: stub-in .5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.stub::before, .stub::after {
  content: ""; position: absolute; right: 94px; width: 20px; height: 20px; border-radius: 50%; background: var(--ground);
  background-image: radial-gradient(rgba(255,255,255,.09) 1.2px, transparent 1.4px); background-size: 14px 14px;
}
.stub::before { top: -10px; }
.stub::after { bottom: -10px; }
.stub:hover { transform: translateY(-3px) rotate(-.25deg); filter: drop-shadow(0 7px 0 rgba(0,0,0,.28)); }
.stub-main { padding: 18px 20px 18px; min-width: 0; display: grid; gap: 8px; }
.stub-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--accent); color: var(--ink); font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; font-size: .8125rem; font-weight: 500; line-height: 1.5; }
.when { font-family: var(--display); font-weight: 600; font-size: 1.125rem; letter-spacing: .02em; }
.stub-title { margin: 0; font-family: var(--display); font-weight: 600; text-transform: none; font-size: clamp(1.4rem, 2.6vw, 1.75rem); line-height: 1.12; text-wrap: balance; }
.open-item { all: unset; cursor: pointer; }
.open-item::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.open-item:focus-visible { outline: none; }
.open-item:focus-visible::after { outline: 3px solid var(--ink); outline-offset: 3px; }
.stub-sum { margin: 0; color: var(--ink-soft); font-size: .9375rem; max-width: 62ch; }
.stub-where { margin: 0; font-size: .875rem; font-weight: 600; }
.stub-side { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 18px 8px; text-align: center; background: var(--paper-2); border-radius: 0 10px 10px 0; border-left: 0; }
.price { font-family: var(--display); font-weight: 700; font-size: 1.75rem; line-height: 1; }
.price small { display: block; font-family: var(--body); font-weight: 600; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; color: var(--ink-soft); }
.punch-spot { width: 34px; height: 34px; border-radius: 50%; border: 2px dashed var(--ink-soft); transition: all .3s var(--ease); }
.stub[data-saved="true"] .punch-spot { border: 0; background: var(--ground); box-shadow: inset 3px 4px 0 rgba(0,0,0,.5); background-image: radial-gradient(rgba(255,255,255,.09) 1.2px, transparent 1.4px); background-size: 14px 14px; }
.stub[data-saved="true"] .stub-side::after { content: "punched"; font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--punch); font-weight: 600; filter: brightness(.6); }
.stub:not([data-saved="true"]) .stub-side::after { content: "open"; font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--ink-soft); }
.stub-side { gap: 6px; }

@keyframes stub-in { from { opacity: 0; transform: translateY(18px) rotate(.8deg); } to { opacity: 1; } }

/* ---------- empty ---------- */
.empty { margin-top: 24px; padding: 32px 24px; background: var(--paper); color: var(--ink); border-radius: 10px; text-align: left; max-width: 520px; filter: drop-shadow(0 4px 0 rgba(0,0,0,.28)); transform: rotate(-.6deg); }
.empty-title { margin: 0; font-family: var(--display); text-transform: uppercase; font-weight: 700; font-size: 2.5rem; line-height: 1; }
.empty-body { margin: 10px 0 20px; max-width: 40ch; }
.btn { min-height: 46px; padding: 8px 20px; border: 0; border-radius: 6px; background: var(--ink); color: var(--paper); font-family: var(--display); text-transform: uppercase; letter-spacing: .07em; font-size: 1rem; font-weight: 500; box-shadow: 0 3px 0 rgba(0,0,0,.3); transition: transform .15s var(--ease); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn-ghost { background: transparent; color: var(--ink); border: 2px solid var(--ink); box-shadow: none; }

/* ---------- ticket ---------- */
.ticket-wrap { grid-area: ticket; min-width: 0; }
.ticket {
  position: sticky; top: 16px; margin-top: 18px;
  max-height: calc(100vh - 32px); overflow: auto;
  background: var(--paper); color: var(--ink); border-radius: 12px;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,.3));
  padding: 0 0 18px;
  scrollbar-color: var(--ink) var(--paper-2);
}
.ticket-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 18px 20px 12px; border-bottom: 3px dotted var(--ink); }
.admit { margin: 0; font-family: var(--display); text-transform: uppercase; font-weight: 700; font-size: 1.75rem; line-height: 1; letter-spacing: .01em; }
.ticket-dates { margin: 0; font-family: var(--display); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; font-size: .9375rem; text-align: right; }
.ticket-summary { padding: 12px 20px 0; font-size: .9375rem; min-height: 3.2em; }
.ticket-summary strong { font-family: var(--display); font-size: 1.125rem; font-weight: 600; }
.clash-note { display: inline-block; margin-top: 6px; padding: 3px 10px; background: var(--punch); color: var(--ink); font-family: var(--display); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; font-size: .875rem; transform: rotate(-1.2deg); border-radius: 3px; }

.timeline { display: grid; grid-template-columns: 40px 1fr 1fr; gap: 0 8px; padding: 14px 16px 0 12px; }
.tl-col { position: relative; height: calc(var(--hours) * var(--hh)); --hh: 34px; --hours: 14; }
.tl-colhead { font-family: var(--display); text-transform: uppercase; font-weight: 600; letter-spacing: .06em; font-size: .9375rem; padding: 0 0 6px; min-height: calc(1.5em + 6px); }
.tl-gutter { position: relative; }
.tl-hour { position: absolute; left: 0; right: 0; transform: translateY(-50%); font-size: .6875rem; font-weight: 600; color: var(--ink-soft); }
.tl-grid {
  background-image: repeating-linear-gradient(to bottom, rgba(16,17,43,.22) 0 1px, transparent 1px var(--hh));
  background-color: rgba(255, 233, 122, .55); border-radius: 4px;
}
.tl-block {
  --accent: var(--c-art);
  position: absolute; display: block; text-align: left; overflow: hidden;
  padding: 3px 6px; border: 2px solid var(--ink); border-radius: 5px; background: var(--accent); color: var(--ink);
  font-size: .75rem; line-height: 1.15; font-weight: 600; min-height: 22px;
  transition: transform .2s var(--ease);
  animation: punch-in .5s var(--ease) both;
}
.tl-block:hover { transform: scale(1.03); z-index: 3; }
.tl-block .t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-block .tm { display: block; font-weight: 500; opacity: .85; font-size: .6875rem; }
.tl-block[data-clash="true"] { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255,79,139,.75) 6px 9px); }
.tl-block[data-clash="true"]::after { content: "!"; position: absolute; right: 4px; top: 1px; font-family: var(--display); font-weight: 700; font-size: .9375rem; }
@keyframes punch-in { from { transform: scale(.7); opacity: 0; } }
.ticket-empty { margin: 14px 20px 0; padding: 16px; border: 2px dashed var(--ink-soft); border-radius: 8px; font-size: .9375rem; }
.ticket-empty p { margin: 0; }
.ticket-empty p:first-child { font-family: var(--display); text-transform: uppercase; font-weight: 600; font-size: 1.25rem; }
.stub-list { list-style: none; margin: 16px 0 0; padding: 0 20px; display: grid; gap: 8px; }
.stub-list li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding-top: 8px; border-top: 1px dotted var(--ink-soft); font-size: .875rem; }
.stub-list button { all: unset; cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.stub-list button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.stub-list .tm { color: var(--ink-soft); display: block; font-weight: 400; text-decoration: none; }
.stub-list .pr { font-family: var(--display); font-weight: 600; }
.ticket-foot { padding: 14px 20px 0; }

/* ---------- tab bar (mobile) ---------- */
.tabbar { display: none; }

/* ---------- detail dialog ---------- */
dialog.detail-dialog {
  border: 0; padding: 0; margin: 0 0 0 auto; height: 100vh; max-height: none; width: min(560px, 100vw); max-width: none;
  background: var(--paper); color: var(--ink); overflow: auto;
  animation: slide-in .4s var(--ease) both;
  scrollbar-color: var(--ink) var(--paper-2);
}
dialog.detail-dialog::backdrop { background: rgba(10, 12, 70, .72); animation: fade .3s ease both; }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.detail { --accent: var(--c-art); display: grid; gap: 20px; padding: 0 0 36px; position: relative; }
.detail-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: var(--accent); border-bottom: 3px dotted var(--ink); position: sticky; top: 0; z-index: 2; }
.close-detail { min-height: 44px; padding: 6px 16px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); font-family: var(--display); text-transform: uppercase; letter-spacing: .07em; font-weight: 500; font-size: .9375rem; }
.close-detail:hover { background: var(--ink); color: var(--paper); }
.detail-body { padding: 0 24px; display: grid; gap: 20px; }
.detail-title { margin: 0; font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(2.25rem, 7vw, 3.25rem); line-height: .98; text-wrap: balance; }
.detail-time { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; font-family: var(--display); }
.detail-time .big { font-size: 2rem; font-weight: 700; line-height: 1; }
.detail-time .day { font-size: 1.125rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin: 0; padding: 16px 0; border-top: 3px dotted var(--ink); border-bottom: 3px dotted var(--ink); }
.facts dt { font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; font-size: .8125rem; font-weight: 500; color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 600; font-size: 1.0625rem; }
.detail-text { display: grid; gap: 12px; max-width: 60ch; }
.detail-text p { margin: 0; }
.access { padding: 14px 16px; background: var(--paper-2); border-radius: 8px; }
.access h3 { margin: 0 0 4px; font-family: var(--display); text-transform: uppercase; letter-spacing: .06em; font-size: 1rem; font-weight: 600; }
.access p { margin: 0; }
.clash-warn { margin: 0; padding: 10px 14px; background: var(--punch); border-radius: 6px; font-weight: 600; }
.save-item {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 20px;
  border: 3px solid var(--ink); border-radius: 10px; background: var(--ink); color: var(--paper); text-align: left;
  font-family: var(--display); text-transform: uppercase; letter-spacing: .05em; font-size: 1.25rem; font-weight: 600;
  box-shadow: 0 4px 0 rgba(0,0,0,.3); transition: transform .15s var(--ease), background .25s var(--ease);
}
.save-item:hover { transform: translateY(-1px); }
.save-item:active { transform: translateY(3px); box-shadow: none; }
.save-item[aria-pressed="true"] { background: var(--punch); color: var(--ink); }
.save-item .hole { width: 28px; height: 28px; border-color: currentColor; }
.save-item[aria-pressed="true"] .hole { background: var(--paper); box-shadow: inset 3px 4px 0 rgba(0,0,0,.5); border-color: var(--ink); }
.chads { position: absolute; left: 34px; top: 50%; pointer-events: none; width: 0; height: 0; }
.chad { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); animation: chad 900ms cubic-bezier(.3,.6,.5,1) forwards; }
@keyframes chad { 0% { transform: translate(0,0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(.6); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "browse" "ticket"; padding-bottom: 96px; }
  .shell[data-view="events"] .ticket-wrap { display: none; }
  .shell[data-view="ticket"] .browse { display: none; }
  .ticket { position: static; max-height: none; margin-top: 8px; }
  .tabbar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--ink);
    border-top: 3px dotted var(--paper);
  }
  .tab { min-height: 48px; border: 2px solid var(--on-ground-soft); border-radius: 6px; background: transparent; color: var(--on-ground); font-family: var(--display); text-transform: uppercase; letter-spacing: .07em; font-size: 1.0625rem; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
  .tab[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
  .masthead { padding-top: 22px; }
  .wordmark { flex-direction: row; gap: .22em; font-size: clamp(3rem, 15vw, 4.4rem); }
  .wm-list::after { right: -.5em; }
  .tagline { font-size: 1rem; }
  .controls { grid-template-columns: 1fr; }
  .saved-toggle { justify-self: stretch; }
}
@media (max-width: 560px) {
  .stub { grid-template-columns: minmax(0, 1fr) 84px; }
  .stub::before, .stub::after { right: 74px; }
  .stub-main { padding: 14px 14px 16px; }
  .stub-side { padding: 14px 4px; }
  .price { font-size: 1.5rem; }
  dialog.detail-dialog { width: 100vw; }
  .facts { grid-template-columns: 1fr 1fr; }
  .detail-body { padding: 0 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
