@font-face {
  font-family: "Oswald Local";
  src: url("assets/oswald.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Work Sans Local";
  src: url("assets/work-sans.ttf") format("truetype");
  font-display: swap;
}

:root {
  --blue: #2457e6;
  --red: #f04b32;
  --lime: #d7ff45;
  --ink: #151a22;
  --paper: #f9f7ef;
  --white: #fffefa;
  --muted: #69707b;
  --rule: #cbd1de;
  --display: "Oswald Local", "Arial Narrow", sans-serif;
  --sans: "Work Sans Local", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 4px solid var(--lime);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 50;
  padding: .75rem 1rem;
  color: var(--ink);
  background: var(--lime);
  font-weight: 700;
}

.skip-link:focus { top: 1rem; }

.site-header {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 4.5rem);
  color: var(--white);
  background: var(--blue);
  border-bottom: 1px solid rgba(255,255,255,.45);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: inherit;
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
}

.brand-mark {
  width: 31px;
  height: 31px;
  position: relative;
  display: block;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.brand-mark i {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 7px;
  width: 2px;
  background: currentColor;
  transform: rotate(20deg);
}

.brand-mark i + i { left: 19px; transform: rotate(-20deg); }

.edition { margin: 0; font-size: .84rem; font-weight: 550; }
.edition span { margin: 0 .45rem; opacity: .65; }

.hero {
  min-height: 440px;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 3rem;
  padding: clamp(3rem, 7vw, 6.5rem) clamp(1.25rem, 6.5vw, 7.5rem) clamp(3.25rem, 6vw, 5.5rem);
  color: var(--white);
  background: var(--blue);
}

.hero-copy { position: relative; z-index: 2; max-width: 940px; }
.intro { margin: 0 0 1.25rem; font-weight: 650; font-size: clamp(.95rem, 1.3vw, 1.15rem); }

.hero h1 {
  display: flex;
  align-items: baseline;
  gap: .18em;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(4.8rem, 11.6vw, 10.7rem);
  font-weight: 600;
  letter-spacing: -.065em;
  line-height: .77;
}

.hero h1 b {
  position: relative;
  z-index: 1;
  color: var(--lime);
  font-family: var(--sans);
  font-size: .36em;
  font-weight: 800;
  letter-spacing: 0;
  transform: translateY(-.32em) rotate(-9deg);
}

.dek {
  max-width: 590px;
  margin: 2.25rem 0 0;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  line-height: 1.4;
}

.weekend-stamp {
  z-index: 2;
  width: clamp(150px, 15vw, 220px);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: none;
  margin-bottom: .2rem;
  color: var(--ink);
  background: var(--lime);
  border-radius: 50%;
  transform: rotate(7deg);
  box-shadow: 10px 10px 0 var(--red);
  font-size: .9rem;
  font-weight: 700;
}

.weekend-stamp strong {
  font-family: var(--display);
  font-size: clamp(2rem, 3.5vw, 3.5rem);
  line-height: 1.1;
}

.route-doodle {
  position: absolute;
  right: 4%;
  top: 7%;
  width: min(37vw, 500px);
  opacity: .35;
  fill: none;
  stroke: var(--white);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 5 11;
}

.route-doodle circle { fill: var(--lime); stroke: none; }

.planner {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1.3fr .8fr auto;
  align-items: end;
  gap: 1.1rem;
  padding: 1.15rem clamp(1.25rem, 4vw, 4.5rem);
  color: var(--white);
  background: var(--ink);
  border-bottom: 5px solid var(--red);
}

.control label {
  display: block;
  margin-bottom: .35rem;
  color: #c9ced8;
  font-size: .78rem;
  font-weight: 600;
}

.input-wrap, .select-wrap { position: relative; }

.input-wrap svg {
  position: absolute;
  left: .9rem;
  top: 50%;
  width: 20px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
}

.input-wrap input,
.select-wrap select {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: var(--white);
}

.input-wrap input { padding: 0 1rem 0 2.8rem; }
.input-wrap input::placeholder { color: #6c7078; }

.select-wrap select {
  appearance: none;
  padding: 0 2.8rem 0 1rem;
  font-weight: 600;
}

.select-wrap svg {
  pointer-events: none;
  position: absolute;
  right: .9rem;
  top: 50%;
  width: 17px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.saved-toggle {
  height: 48px;
  min-width: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  border: 1px solid #7c828d;
  color: var(--white);
  background: transparent;
  font-weight: 650;
}

.saved-toggle svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.saved-toggle output {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--lime);
  border-radius: 50%;
  font-size: .78rem;
  font-weight: 750;
}

.saved-toggle[aria-pressed="true"] { color: var(--ink); background: var(--lime); border-color: var(--lime); }
.saved-toggle[aria-pressed="true"] output { color: var(--white); background: var(--ink); }

.browse {
  min-height: 680px;
  padding: clamp(3.25rem, 7vw, 6.5rem) clamp(1.25rem, 6.5vw, 7.5rem) 7rem;
}

.results-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  padding-bottom: 1.1rem;
  border-bottom: 3px solid var(--ink);
}

.results-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1;
}

.results-heading p { margin: 0; color: var(--muted); font-size: .9rem; font-weight: 600; }

.day-group {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) minmax(0, 4.1fr);
  gap: clamp(1.5rem, 4vw, 5rem);
  padding-top: 2.1rem;
}

.day-group + .day-group { margin-top: 4.75rem; }

.day-heading { align-self: start; position: sticky; top: 116px; }
.day-heading p { margin: 0 0 .25rem; color: var(--red); font-weight: 700; }
.day-heading h3 { margin: 0; font-family: var(--display); font-size: clamp(2.6rem, 4vw, 4.2rem); line-height: .95; }

.day-events { border-top: 1px solid var(--rule); }

.event-row {
  position: relative;
  display: grid;
  grid-template-columns: 105px minmax(190px, 1.4fr) minmax(160px, .85fr) 46px;
  gap: clamp(1rem, 2.2vw, 2.25rem);
  align-items: center;
  min-height: 132px;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
}

.event-row::before {
  content: "";
  position: absolute;
  left: -1.1rem;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--category-color, var(--blue));
  transform: scaleY(0);
  transition: transform 180ms ease-out;
}

.event-row:focus-within::before,
.event-row:hover::before { transform: scaleY(1); }

.event-time strong { display: block; font-family: var(--display); font-size: 1.55rem; line-height: 1; }
.event-time span { color: var(--muted); font-size: .78rem; }

.event-main h4 { margin: 0 0 .45rem; font-size: clamp(1.07rem, 1.6vw, 1.35rem); line-height: 1.2; }
.event-main p, .event-place p { margin: 0; color: var(--muted); font-size: .86rem; }
.event-place strong { display: block; margin-bottom: .2rem; font-size: .9rem; }
.event-place .category-pill { color: var(--category-color, var(--blue)); font-weight: 750; }

.open-item {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
}

.open-item svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.open-item:hover { color: var(--white); background: var(--ink); }

.saved-flag {
  position: absolute;
  right: 0;
  top: .55rem;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  color: var(--blue);
  font-size: .7rem;
  font-weight: 750;
}

.saved-flag svg { width: 13px; fill: var(--blue); stroke: var(--blue); }

.empty-state {
  max-width: 580px;
  margin: 5rem auto 0;
  text-align: center;
}

.empty-state[hidden] { display: none; }
.empty-scribble { display: block; color: var(--red); font-family: var(--display); font-size: 7rem; line-height: .9; transform: rotate(10deg); }
.empty-state h2 { margin: .5rem 0; font-family: var(--display); font-size: 2.5rem; }
.empty-state p { margin: 0 0 1.5rem; color: var(--muted); }
.empty-state button { padding: .8rem 1.25rem; border: 2px solid var(--ink); color: var(--white); background: var(--ink); font-weight: 700; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.5rem clamp(1.25rem, 4vw, 4.5rem);
  color: var(--white);
  background: var(--blue);
}

footer p { margin: 0; }

.detail-dialog {
  width: min(610px, 100%);
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: var(--lime);
  overflow: visible;
}

.detail-dialog::backdrop { background: rgba(10, 18, 38, .64); backdrop-filter: blur(2px); }
.detail-card { height: 100%; display: flex; flex-direction: column; overflow-y: auto; }

.detail-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 1rem clamp(1.25rem, 4vw, 3rem);
  border-bottom: 2px solid var(--ink);
}

.detail-header p { margin: 0; font-weight: 750; }
.close-detail { display: flex; align-items: center; gap: .55rem; padding: .5rem 0 .5rem .5rem; border: 0; color: var(--ink); background: transparent; font-weight: 700; }
.close-detail svg { width: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.detail-body { flex: 1; padding: clamp(2.5rem, 6vh, 5.25rem) clamp(1.25rem, 5vw, 4.25rem) 3rem; }
.detail-date { margin: 0 0 1.15rem; color: var(--blue); font-weight: 750; }
.detail-body h2 { margin: 0; max-width: 500px; font-family: var(--display); font-size: clamp(3.3rem, 6vw, 5.4rem); font-weight: 600; letter-spacing: -.04em; line-height: .98; }
.detail-copy { max-width: 530px; margin-top: 2rem; font-size: 1.06rem; line-height: 1.65; }
.detail-copy p { margin: 0; }
.detail-copy p + p { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(21,26,34,.3); }

.detail-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 2.5rem 0 0; border-top: 2px solid var(--ink); border-left: 2px solid var(--ink); }
.detail-facts div { min-height: 96px; padding: .8rem 1rem; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.detail-facts dt { margin-bottom: .25rem; font-size: .74rem; font-weight: 750; }
.detail-facts dd { margin: 0; font-weight: 600; }

.detail-action { position: sticky; bottom: 0; flex: none; padding: 1rem clamp(1.25rem, 5vw, 4.25rem); background: var(--lime); border-top: 2px solid var(--ink); }
#save-item { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: center; gap: .65rem; border: 2px solid var(--ink); color: var(--white); background: var(--ink); font-weight: 750; }
#save-item svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
#save-item[aria-pressed="true"] { color: var(--ink); background: transparent; }
#save-item[aria-pressed="true"] svg { fill: var(--red); stroke: var(--red); }

.load-error { position: fixed; z-index: 100; left: 1rem; right: 1rem; bottom: 1rem; max-width: 500px; margin: auto; padding: 1rem; color: white; background: #a3281b; text-align: center; font-weight: 650; }

@media (max-width: 780px) {
  .site-header { height: 58px; }
  .edition { font-size: 0; }
  .edition span { display: none; }
  .edition::after { content: "Oct 3–4"; font-size: .78rem; }

  .hero { min-height: 440px; display: block; padding-top: 4rem; }
  .hero h1 { display: block; font-size: clamp(4.5rem, 23vw, 6rem); line-height: .83; }
  .hero h1 span { display: block; }
  .hero h1 b { position: absolute; right: .1rem; top: 46%; font-size: 2.5rem; }
  .dek { max-width: 74%; margin-top: 1.7rem; font-size: .98rem; }
  .weekend-stamp { position: absolute; right: 1.3rem; bottom: 1.8rem; width: 112px; box-shadow: 6px 6px 0 var(--red); font-size: .7rem; }
  .weekend-stamp strong { font-size: 1.8rem; }
  .route-doodle { width: 76vw; right: -20%; top: 2%; }

  .planner { position: relative; grid-template-columns: minmax(0, 1fr) 56px; gap: .7rem; padding: 1rem 1.25rem; }
  .search-control { grid-column: 1 / -1; }
  .control label { margin-bottom: .3rem; }
  .saved-toggle { min-width: 56px; width: 56px; padding: 0; }
  .saved-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .saved-toggle output { position: absolute; transform: translate(18px, -18px); border: 2px solid var(--ink); }

  .browse { padding-top: 3.5rem; padding-bottom: 5rem; }
  .results-heading { display: block; }
  .results-heading h2 { font-size: 2.8rem; }
  .results-heading p { margin-top: .65rem; }
  .day-group { display: block; padding-top: 2rem; }
  .day-group + .day-group { margin-top: 3.5rem; }
  .day-heading { position: static; display: flex; align-items: baseline; gap: .7rem; margin-bottom: 1rem; }
  .day-heading p { margin: 0; }
  .day-heading h3 { font-size: 2.6rem; }
  .event-row { grid-template-columns: 70px minmax(0, 1fr) 42px; gap: .75rem; min-height: 116px; }
  .event-row::before { left: -.55rem; }
  .event-time strong { font-size: 1.25rem; }
  .event-main h4 { font-size: 1rem; }
  .event-place { grid-column: 2; margin-top: -.35rem; }
  .event-place strong { display: inline; }
  .event-place p { display: inline; }
  .open-item { grid-column: 3; grid-row: 1 / span 2; }

  footer { display: block; font-size: .86rem; }
  footer p + p { margin-top: .4rem; opacity: .8; }

  .detail-dialog { width: 100%; height: calc(100% - 18px); margin-top: 18px; }
  .detail-dialog::backdrop { backdrop-filter: none; }
  .detail-body { padding-top: 2rem; }
  .detail-body h2 { font-size: clamp(3rem, 15vw, 4.2rem); }
}

@media (max-width: 370px) {
  .hero h1 { font-size: 4.2rem; }
  .weekend-stamp { width: 100px; }
  .event-row { grid-template-columns: 62px minmax(0, 1fr) 40px; }
}

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