:root {
  --paper: #eceeea;
  --card: #f8f9f6;
  --ink: #101c33;
  --muted: #475266;
  --line: #c4cac6;
  --sat: #2b3fe0;
  --sun: #f4b52a;
  --clash: #c2262e;
  --display: "Avenir Next Condensed", "DIN Condensed", "Barlow Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --text: Charter, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --side: 372px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 var(--text);
}
h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--paper);
}

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--ink); color: #fff; padding: 8px 14px;
}
.skip:focus { top: 8px; }

.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }

/* ---------- sidebar ---------- */
.side {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  padding: 28px 24px 32px;
  border-right: 2px solid var(--ink);
  display: flex; flex-direction: column; gap: 22px;
}
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 92px;
  line-height: .82;
  letter-spacing: -.02em;
  margin-left: -3px;
}
.tagline { margin-top: 12px; color: var(--muted); font-size: 16px; line-height: 1.4; max-width: 28ch; }

.controls { display: grid; gap: 14px; }
.field label {
  display: block; margin-bottom: 4px;
  font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: .01em;
}
.field input, .field select {
  width: 100%; height: 46px; padding: 0 12px;
  background: var(--card);
  border: 2px solid var(--ink); border-radius: 0;
}
.field select { appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 20px, calc(100% - 14px) 20px;
  background-size: 6px 6px; background-repeat: no-repeat;
}

.saved-toggle {
  display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 12px;
  background: transparent; border: 2px solid var(--ink); border-radius: 0;
  font-family: var(--display); font-weight: 600; font-size: 20px; text-align: left;
}
.saved-text { flex: 1; }
.saved-mark {
  width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 50%;
  display: grid; place-items: center;
}
.saved-count {
  min-width: 28px; padding: 0 6px; text-align: center;
  background: var(--ink); color: var(--paper); font-size: 18px; line-height: 26px;
}
.saved-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.saved-toggle[aria-pressed="true"] .saved-mark { background: var(--sun); border-color: var(--sun); }
.saved-toggle[aria-pressed="true"] .saved-count { background: var(--sun); color: var(--ink); }
.saved-toggle[aria-pressed="true"]:focus-visible { outline-color: var(--ink); }

/* shortlist */
.plan { background: var(--ink); color: #f1f3f6; padding: 0; }
.plan summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
}
.plan summary::-webkit-details-marker { display: none; }
.plan-title { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1; }
.plan-n { font-size: 15px; color: #c9d0dc; }
.plan summary:focus-visible { outline-color: var(--sun); box-shadow: none; outline-offset: -4px; }
.plan-body { padding: 0 16px 18px; display: grid; gap: 18px; }
.plan-empty { color: #d3d9e3; font-size: 16px; line-height: 1.45; }

.plan-day h3 { font-family: var(--display); font-weight: 600; font-size: 19px; margin-bottom: 6px; }
.plan-day.sat h3 { color: #aab3ff; }
.plan-day.sun h3 { color: var(--sun); }
.track { position: relative; background: rgba(255,255,255,.1); margin-bottom: 4px; }
.track i {
  position: absolute; display: block; height: 14px;
  background: #aab3ff; border-right: 1px solid var(--ink);
}
.plan-day.sun .track i { background: var(--sun); }
.track i.clash {
  background: repeating-linear-gradient(135deg, var(--clash) 0 4px, #ff7a80 4px 8px);
}
.axis { display: flex; justify-content: space-between; font-size: 13px; color: #c9d0dc; margin-bottom: 8px; }
.plan-list { display: grid; gap: 2px; }
.plan-list button {
  width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid rgba(255,255,255,.2);
  padding: 8px 0 6px; color: inherit; line-height: 1.3;
}
.plan-list button:hover .pt { text-decoration: underline; }
.plan-list button:focus-visible { outline-color: var(--sun); box-shadow: none; outline-offset: 1px; }
.pt { display: block; font-size: 16px; }
.pm { display: block; font-size: 14px; color: #c9d0dc; }
.pc { display: block; font-size: 14px; color: #ffb3b7; font-weight: 700; }
.plan-total { font-size: 15px; color: #d3d9e3; border-top: 1px solid rgba(255,255,255,.2); padding-top: 10px; }

/* ---------- main list ---------- */
.main { min-width: 0; padding-bottom: 80px; }
.main:focus { outline: none; }
.status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.day { margin-bottom: 8px; }
.day-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 16px 40px 12px;
  font-family: var(--display);
}
.day.sat .day-head { background: var(--sat); color: #fff; }
.day.sun .day-head { background: var(--sun); color: var(--ink); }
.day-head h2 { font-size: 64px; line-height: .9; font-weight: 700; letter-spacing: -.01em; }
.day-head h2 span { font-weight: 500; }
.day-count { font-size: 22px; font-weight: 600; white-space: nowrap; }

.event {
  position: relative;
  display: grid; grid-template-columns: 120px minmax(0, 1fr) 150px; gap: 8px 28px;
  padding: 24px 40px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.event:hover { background: var(--card); }
.event:has(.open-item:focus-visible) { outline: 3px solid var(--ink); outline-offset: -3px; }
.start { display: block; font-family: var(--display); font-weight: 700; font-size: 56px; line-height: .9; letter-spacing: -.01em; }
.start small { font-size: 22px; font-weight: 600; margin-left: 3px; letter-spacing: 0; }
.until { display: block; margin-top: 6px; font-size: 15px; color: var(--muted); }

.open-item {
  display: inline; padding: 0; background: none; border: 0; text-align: left;
  font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1.02; letter-spacing: -.005em;
}
.open-item::after { content: ""; position: absolute; inset: 0; }
.open-item:focus-visible { outline: none; box-shadow: none; }
.event:hover .open-item { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.summary { margin-top: 8px; max-width: 58ch; }
.meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 2px 20px; color: var(--muted); font-size: 15px; }
.meta span:first-child { color: var(--ink); font-weight: 700; }

.side-info { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.price { font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1; }
.price.free { font-size: 34px; }
.tag { border: 2px solid var(--ink); padding: 0 10px; font-family: var(--display); font-weight: 600; font-size: 18px; line-height: 24px; }
.saved-flag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--display); font-weight: 700; font-size: 18px;
}
.saved-flag::before { content: ""; width: 14px; height: 14px; background: var(--ink); transform: rotate(45deg) scale(.8); }
.event.is-saved { box-shadow: inset 8px 0 0 var(--ink); }

.empty { padding: 72px 40px; max-width: 640px; }
.empty h2 { font-family: var(--display); font-size: 56px; line-height: .95; font-weight: 700; }
.empty p { margin: 12px 0 22px; color: var(--muted); max-width: 44ch; }

.btn {
  height: 46px; padding: 0 20px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper);
  font-family: var(--display); font-weight: 600; font-size: 20px; border-radius: 0;
}
.btn:hover { background: #24365a; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--card); }

/* ---------- detail ---------- */
dialog.detail {
  position: fixed; inset: 0 0 0 auto; margin: 0;
  width: min(600px, 100vw); max-width: 100vw; height: 100%; max-height: none;
  padding: 0; border: 0; border-left: 2px solid var(--ink);
  background: var(--paper); color: var(--ink);
  overflow: hidden;
}
dialog.detail[open] { display: flex; flex-direction: column; }
dialog.detail::backdrop { background: rgba(16, 28, 51, .55); }
.d-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 28px 18px;
}
.d-top.sat { background: var(--sat); color: #fff; }
.d-top.sun { background: var(--sun); color: var(--ink); }
.d-day { font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1; padding-top: 6px; }
.d-close {
  height: 44px; padding: 0 16px; background: transparent; color: inherit;
  border: 2px solid currentColor; border-radius: 0;
  font-family: var(--display); font-weight: 600; font-size: 20px;
}
.d-top.sat .d-close:focus-visible { outline-color: #fff; box-shadow: none; }
.d-scroll { flex: 1; overflow-y: auto; padding: 24px 28px 28px; }
.d-title { font-family: var(--display); font-weight: 700; font-size: 56px; line-height: .95; letter-spacing: -.01em; }
.facts { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; border-top: 2px solid var(--ink); }
.facts div { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 14px; color: var(--muted); }
.facts dd { font-family: var(--display); font-weight: 600; font-size: 24px; line-height: 1.15; }
.facts dd small { display: block; font-family: var(--text); font-weight: 400; font-size: 14px; color: var(--muted); margin-top: 2px; }
.d-body { margin-top: 24px; display: grid; gap: 16px; max-width: 56ch; }
.d-body p.access { border-left: 6px solid var(--ink); padding-left: 14px; }
.d-body p.access b { display: block; font-family: var(--display); font-size: 20px; }
.d-foot { padding: 14px 28px; border-top: 2px solid var(--ink); background: var(--card); display: flex; align-items: center; gap: 14px; }
.d-foot .btn { flex: 1; }
.d-foot .btn[aria-pressed="true"] { background: var(--sun); color: var(--ink); }
.d-foot .btn[aria-pressed="true"]:focus-visible { outline-color: var(--ink); }
.d-note { font-size: 14px; color: var(--muted); max-width: 18ch; line-height: 1.3; }

@media (prefers-reduced-motion: no-preference) {
  dialog.detail[open] { animation: slide .22s ease-out; }
  dialog.detail[open]::backdrop { animation: fade .22s ease-out; }
  @keyframes slide { from { transform: translateX(40px); opacity: 0; } }
  @keyframes fade { from { opacity: 0; } }
}

/* ---------- narrower ---------- */
@media (max-width: 1100px) {
  :root { --side: 320px; }
  .wordmark { font-size: 76px; }
  .event { grid-template-columns: 96px minmax(0, 1fr); padding: 22px 28px; }
  .side-info { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; text-align: left; }
  .day-head { padding-inline: 28px; }
  .day-head h2 { font-size: 52px; }
  .start { font-size: 46px; }
}

@media (max-width: 820px) {
  body { font-size: 16px; }
  .shell { display: block; }
  .side { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 2px solid var(--ink); padding: 20px 16px 20px; gap: 16px; }
  .wordmark { font-size: 68px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .saved-toggle { grid-column: 1 / -1; }
  .field input, .field select { height: 48px; }
  .saved-toggle { height: 48px; }
  .day-head { padding: 12px 16px 10px; }
  .day-head h2 { font-size: 42px; }
  .day-count { font-size: 18px; }
  .event { grid-template-columns: 74px minmax(0, 1fr); gap: 6px 16px; padding: 18px 16px; }
  .start { font-size: 38px; }
  .start small { font-size: 17px; }
  .until { font-size: 13px; }
  .open-item { font-size: 27px; }
  .summary { font-size: 16px; }
  .price { font-size: 28px; }
  .empty { padding: 48px 16px; }
  .empty h2 { font-size: 44px; }
  .main { padding-bottom: 40px; }

  dialog.detail { inset: 0; width: 100vw; border-left: 0; }
  .d-top { padding: 12px 16px; }
  .d-scroll { padding: 20px 16px 24px; }
  .d-title { font-size: 44px; }
  .d-foot { padding: 12px 16px; }
  .d-note { display: none; }
}

@media (max-width: 400px) {
  .field label { font-size: 17px; }
  .facts { grid-template-columns: 1fr; }
}
