@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --bg: #eef0f3;
  --surface: #f9fafb;
  --ink: #12161c;
  --muted: #4a5360;
  --line: #d0d6dd;
  --accent: #1c47c9;
  --accent-ink: #ffffff;
  --accent-soft: #dfe6fb;
  --scrim: rgb(14 18 26 / 0.55);
  --shadow: 0 18px 48px rgb(20 30 60 / 0.16);
  --r: 10px;
  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --text: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1217;
    --surface: #171b22;
    --ink: #eceff3;
    --muted: #a6afbc;
    --line: #2b323d;
    --accent: #8aa6ff;
    --accent-ink: #0a1030;
    --accent-soft: #212b4d;
    --scrim: rgb(0 0 0 / 0.65);
    --shadow: 0 18px 48px rgb(0 0 0 / 0.5);
  }
  .intro-img { filter: brightness(0.8) saturate(0.9); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.locked { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding-inline: var(--gutter); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 14px;
  border-radius: var(--r);
  z-index: 30;
}
.skip:focus { top: 12px; }

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--r);
}
.brand-mark {
  width: 22px;
  height: 22px;
  background:
    linear-gradient(var(--accent), var(--accent)) left / 9px 100% no-repeat,
    linear-gradient(var(--accent), var(--accent)) right / 9px 62% no-repeat;
  border-radius: 3px;
  background-position: left bottom, right bottom;
}
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.top-dates { color: var(--muted); font-size: 0.95rem; }

/* Intro */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: end;
  padding-block: clamp(28px, 5vw, 56px) clamp(24px, 3vw, 36px);
}
.intro h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.1rem, 4.4vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  max-width: 14ch;
}
.intro p {
  margin-top: 16px;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.125rem;
}
.intro-img {
  width: 100%;
  height: clamp(190px, 21vw, 280px);
  object-fit: cover;
  object-position: 50% 40%;
  border-radius: var(--r);
  display: block;
}

/* Tools */
.tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px auto;
  gap: 16px;
  align-items: end;
  padding-block: 20px;
  border-top: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}
input[type="text"], select, .toggle, .btn {
  font: inherit;
  min-height: 48px;
  border-radius: var(--r);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
input[type="text"], select { padding: 0 14px; width: 100%; }
input[type="text"]::placeholder { color: var(--muted); opacity: 1; }
select {
  appearance: none;
  -webkit-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) 21px, calc(100% - 15px) 21px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input[type="text"]:hover, select:hover { border-color: var(--muted); }
input[type="text"]:focus-visible, select:focus-visible { border-color: var(--accent); }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, transform 0.12s;
}
.toggle:hover { border-color: var(--muted); }
.toggle:active, .btn:active { transform: translateY(1px) scale(0.99); }
.toggle-count {
  min-width: 26px;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.875rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.toggle[aria-pressed="true"] .toggle-count { background: var(--accent-ink); color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, transform 0.12s;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn:hover { border-color: var(--ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-primary[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--accent);
}

/* Shortlist summary */
.shortlist {
  margin-bottom: 8px;
  padding: 14px 18px;
  border-radius: var(--r);
  background: var(--accent-soft);
  font-size: 0.975rem;
}
.shortlist strong { font-family: var(--display); font-weight: 700; }
.shortlist .clash { margin-top: 4px; }

.count {
  padding-block: 8px 4px;
  color: var(--muted);
  font-size: 0.925rem;
  min-height: 2em;
}

/* List */
.day { margin-top: 20px; }
.day-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}
.day-head h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.day-date { color: var(--muted); font-size: 1rem; }
.day-n { margin-left: auto; color: var(--muted); font-size: 0.925rem; }

.row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) 230px 128px;
  gap: 8px 28px;
  align-items: start;
  padding: 22px 12px 22px 16px;
  border-bottom: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
}
.row:hover { background: var(--surface); }
.row.is-saved::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.when { font-family: var(--display); }
.when .start { display: block; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.when .end { display: block; margin-top: 4px; color: var(--muted); font-family: var(--text); font-size: 0.875rem; }
.cat { font-size: 0.875rem; font-weight: 600; color: var(--accent); }
.what h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-top: 2px;
}
.what .sum {
  margin-top: 6px;
  color: var(--muted);
  max-width: 62ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta { display: grid; gap: 2px; font-size: 0.95rem; }
.meta .venue { font-weight: 600; }
.meta .sub { color: var(--muted); }
.meta .cost { margin-top: 6px; font-variant-numeric: tabular-nums; }
.act { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.act .btn { min-height: 44px; }
.saved-flag {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  min-height: 1.2em;
}

.reveal { animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.skeleton {
  height: 96px;
  margin-top: 14px;
  border-radius: var(--r);
  background: linear-gradient(100deg, var(--line) 30%, var(--surface) 50%, var(--line) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Empty */
.empty {
  margin-block: 24px 48px;
  padding: 36px clamp(20px, 4vw, 40px);
  border: 1.5px dashed var(--muted);
  border-radius: var(--r);
  display: grid;
  gap: 10px;
  justify-items: start;
}
.empty h2 { font-family: var(--display); font-size: 1.6rem; letter-spacing: -0.02em; line-height: 1.15; }
.empty p { color: var(--muted); max-width: 52ch; }
.empty .btn { margin-top: 8px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.foot { border-top: 1px solid var(--line); margin-top: 40px; padding-block: 24px; color: var(--muted); font-size: 0.9rem; }

/* Detail dialog */
.detail {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  padding: 0;
  width: min(580px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.detail[open] { display: flex; flex-direction: column; animation: slide 0.32s cubic-bezier(0.16, 1, 0.3, 1); }
.detail::backdrop { background: var(--scrim); animation: fade 0.25s ease-out; }
@keyframes slide { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 14px 24px;
  border-bottom: 1px solid var(--line);
}
.detail-bar .cat { font-size: 0.95rem; }
.detail-scroll { flex: 1; overflow-y: auto; padding: 24px 24px 32px; }
.detail h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  margin-top: 24px;
  padding-block: 20px;
  border-block: 1px solid var(--line);
}
.facts dt { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.facts dd { margin-top: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.facts dd small { display: block; font-weight: 400; color: var(--muted); font-size: 0.925rem; }
.detail .body { margin-top: 24px; display: grid; gap: 16px; }
.detail .body p { max-width: 60ch; }
.detail .body p:first-child { font-size: 1.125rem; }
.detail .body h3 { font-family: var(--display); font-size: 1.05rem; margin-top: 8px; letter-spacing: -0.01em; }
.clash-note {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--accent-soft);
  font-size: 0.95rem;
}
.detail-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.detail-foot .btn { flex: none; min-width: 190px; }
.detail-foot .status { color: var(--muted); font-size: 0.925rem; min-height: 1.4em; }

/* Tablet and down */
@media (max-width: 1000px) {
  .row { grid-template-columns: 100px minmax(0, 1fr) 128px; }
  .meta { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; gap: 2px 14px; }
  .meta .cost { margin-top: 0; }
  .act { grid-column: 3; grid-row: 1 / span 2; }
}

/* Mobile */
@media (max-width: 720px) {
  .top-dates { display: none; }
  .intro { grid-template-columns: 1fr; gap: 20px; padding-top: 20px; }
  .intro h1 { max-width: 16ch; }
  .intro p { font-size: 1.025rem; margin-top: 12px; }
  .intro-img { order: -1; height: 130px; }
  .tools { grid-template-columns: 1fr 1fr; gap: 12px; }
  .field-search { grid-column: 1 / -1; }
  .field-saved .toggle { width: 100%; justify-content: space-between; }
  .row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 18px 4px 18px 14px;
  }
  .when { display: flex; align-items: baseline; gap: 10px; }
  .when .start { font-size: 1.2rem; }
  .when .end { margin-top: 0; }
  .meta, .act { grid-column: auto; grid-row: auto; }
  .meta { margin-top: 4px; }
  .act { flex-direction: row; align-items: center; margin-top: 8px; }
  .act .btn { flex: 1; }
  .saved-flag { order: 2; flex: none; }
  .detail { width: 100vw; border-left: 0; }
  .detail-bar { padding: 10px 14px 10px 18px; }
  .detail-scroll { padding: 20px 18px 24px; }
  .facts { gap: 16px 14px; }
  .detail-foot { flex-direction: column-reverse; align-items: stretch; gap: 8px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
  .detail-foot .btn { width: 100%; }
  .detail-foot .status { text-align: center; min-height: 1.2em; }
}

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