/* Ramble — a weekend trail guide */

@font-face {
  font-family: 'Fraunces';
  src: url('assets/fraunces.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('assets/fraunces-italic.woff2') format('woff2');
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Work Sans';
  src: url('assets/work-sans.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #F5F6EE;
  --raised: #FCFCF7;
  --ink: #202E25;
  --ink-soft: #545E52;
  --line: #D9DECB;
  --gold: #A87C1A;
  --gold-bright: #C79A1F;

  --c-art: #CE4A64;        --ci-art: #A62650;
  --c-film: #6F4BB8;       --ci-film: #593695;
  --c-food: #DF7B17;       --ci-food: #A85E00;
  --c-literature: #177E8C; --ci-literature: #0E6674;
  --c-music: #3B5BDB;      --ci-music: #2E49B8;
  --c-outdoors: #528B2B;   --ci-outdoors: #3D7318;
  --c-walks: #8C5A28;      --ci-walks: #734619;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-text: 'Work Sans', 'Helvetica Neue', Arial, sans-serif;
  --shadow-panel: -24px 0 60px rgba(24, 38, 28, 0.28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

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

html.has-panel, html.has-panel body { overflow: hidden; }

.wrap {
  max-width: 1060px;
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 36px);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  line-height: 1.08;
  margin: 0;
  letter-spacing: -0.015em;
}

:focus-visible {
  outline: 2.5px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

.skip {
  position: absolute; left: 16px; top: -48px;
  background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 0 0 10px 10px;
  font-weight: 600; font-size: 14px; text-decoration: none;
  transition: top 0.15s ease-out; z-index: 60;
}
.skip:focus { top: 0; }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 60px;
}

.wordmark {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 24px;
  font-weight: 640;
  font-style: italic;
  letter-spacing: -0.01em;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wordmark__glyph { width: 24px; height: 20px; color: var(--gold-bright); flex: none; }

.site-header__dates {
  margin: 0 0 0 auto;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.saved-tally {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.saved-tally .icon { color: var(--ink); }

.bump { animation: bump 0.35s ease-out; }

/* ---------- Hero ---------- */

.hero { padding-top: clamp(40px, 7vh, 76px); }

.hero h1 {
  font-size: clamp(42px, 6.8vw, 74px);
  max-width: 13ch;
}

.hero__sub {
  margin: 20px 0 0;
  font-size: 17.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 52ch;
}

.trail {
  display: block;
  width: 100%;
  height: auto;
  margin-top: clamp(18px, 3vh, 34px);
}
.trail__path {
  stroke: var(--gold);
  stroke-width: 4.6;
  stroke-linecap: round;
  stroke-dasharray: 0.1 13.1;
}
.trail-dot {
  stroke: var(--paper);
  stroke-width: 2.5;
}
.trail__finish { opacity: 0.92; }

/* ---------- Controls ---------- */

.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  margin-top: 38px;
}

.controls__inner {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding-block: 14px 16px;
  flex-wrap: wrap;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 2px 5px;
}

.field--search { flex: 1 1 250px; max-width: 400px; }
.field--category { flex: 0 0 190px; }

.search-box { position: relative; }
.search-box .icon-search {
  position: absolute;
  left: 15px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--ink-soft);
  pointer-events: none;
}

input, select {
  font: inherit;
  color: var(--ink);
  background: var(--raised);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  width: 100%;
  height: 44px;
}
#search { padding-left: 40px; }
#search::-webkit-search-cancel-button { -webkit-appearance: none; }

select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23202E25' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
  cursor: pointer;
}

.saved-toggle {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.saved-toggle__count {
  font-size: 11.5px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  font-variant-numeric: tabular-nums;
}
.saved-toggle:hover { background: #EDEFE3; }
.saved-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.saved-toggle[aria-pressed="true"] .saved-toggle__count {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
  color: var(--ink);
}

.results {
  margin: 0 0 12px auto;
  font-size: 13.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- Day groups and events ---------- */

.day { margin-top: 46px; }

.day__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.day__title { font-size: clamp(22px, 3vw, 27px); }
.day__title small {
  font-family: var(--font-display);
  font-weight: 460;
  color: var(--ink-soft);
  margin-left: 8px;
  letter-spacing: 0;
}
.day__count { margin: 0; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.day__list { list-style: none; margin: 0; padding: 0; }

.event {
  --cat: var(--c-art);
  --cat-ink: var(--ci-art);
  display: grid;
  grid-template-columns: 88px 34px 1fr auto;
  column-gap: 14px;
  padding: 20px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.event:hover, .event:focus-within { background: rgba(32, 46, 37, 0.045); }

.event + .event { border-top: 1px solid var(--line); }

.event__when {
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.event__start { display: block; font-weight: 650; font-size: 15px; }
.event__end { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.event__rail {
  position: relative;
  align-self: stretch;
}
.event__rail::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 5px;
  transform: translateX(-50%);
  background-image: radial-gradient(circle at 50% 50%, var(--gold) 2.3px, transparent 2.9px);
  background-size: 5px 14px;
  background-repeat: repeat-y;
  background-position: center top;
}
.event__dot {
  position: relative;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--cat);
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px rgba(32, 46, 37, 0.12);
  margin-top: 5px;
  margin-inline: auto;
}

.event__main { min-width: 0; }

.event__cat {
  margin: 0 0 3px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--cat-ink);
}
.event__title { font-size: 21px; font-weight: 620; line-height: 1.15; margin: 0; }
.event__meta {
  margin: 5px 0 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.event__summary {
  margin: 7px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 58ch;
}

.event__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding-top: 2px;
}
.event__saved-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}
.event__price {
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }

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

.empty {
  margin-top: 56px;
  padding: clamp(36px, 8vh, 72px) 24px;
  text-align: center;
  border: 1.5px dashed var(--gold);
  border-radius: 22px;
  background: var(--raised);
  max-width: 560px;
  margin-inline: auto;
}
.empty h2 { font-size: 26px; }
.empty p { margin: 12px auto 22px; color: var(--ink-soft); max-width: 40ch; }
.empty .btn { background: var(--ink); color: var(--paper); }
.empty .btn:hover { background: #31452F; }

/* ---------- Detail panel ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(24, 38, 28, 0.38);
}

.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(520px, 100%);
  background: var(--raised);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--raised);
}
.panel__tags { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel__day { font-size: 13.5px; font-weight: 500; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.chip {
  --cat: var(--c-art);
  --cat-ink: var(--ci-art);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cat-ink);
  border: 1px solid color-mix(in srgb, var(--cat-ink) 35%, transparent);
  background: color-mix(in srgb, var(--cat) 9%, var(--raised));
  padding: 4px 11px;
  border-radius: 999px;
}
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat); }

.icon-btn {
  font: inherit;
  width: 40px; height: 40px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--ink); color: var(--paper); }

.panel__scroll { flex: 1; overflow-y: auto; padding: 26px 28px 30px; }

.panel__title { font-size: clamp(26px, 5vw, 31px); font-weight: 640; line-height: 1.1; }

.panel__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 22px;
  margin: 22px 0 0;
  padding: 18px 0 4px;
  border-top: 1px solid var(--line);
}
.panel__meta dt {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 2px;
}
.panel__meta dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.panel__meta .sub { font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-top: 1px; }

.panel__body { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.panel__body > p:first-child {
  font-size: 16.5px;
  line-height: 1.62;
  margin: 0 0 20px;
  max-width: 46ch;
}
.panel__body h3 {
  font-size: 18.5px;
  font-weight: 560;
  font-style: italic;
  margin: 0 0 8px;
}
.panel__body p:last-child { font-size: 15px; line-height: 1.6; color: var(--ink-soft); margin: 0; }

.panel__foot {
  border-top: 1px solid var(--line);
  background: var(--raised);
  padding: 14px 18px 18px 26px;
}

.save-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 50px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.save-btn .icon { width: 17px; height: 17px; }
.save-btn .icon-filled { display: none; }
.save-btn:hover { background: var(--ink); color: var(--paper); }
.save-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.save-btn[aria-pressed="true"] .icon-outline { display: none; }
.save-btn[aria-pressed="true"] .icon-filled { display: inline-block; color: var(--gold-bright); }
.save-btn[aria-pressed="true"]:hover { color: var(--paper); background: #31452F; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 84px;
  border-top: 1px solid var(--line);
}
.site-footer__inner { padding-block: 26px 34px; }
.site-footer p { margin: 0; font-size: 13.5px; color: var(--ink-soft); max-width: 72ch; }

.noscript-note { padding-block: 40px; font-size: 16px; }

/* ---------- Motion ---------- */

@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
@keyframes crawl { from { stroke-dashoffset: 169; } }
@keyframes bump { 40% { transform: scale(1.22); } }

.trail-dot { transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: no-preference) {
  .overlay { animation: fade-in 0.18s ease-out; }
  .panel { animation: slide-in 0.3s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .trail-dot { animation: pop 0.45s cubic-bezier(0.2, 0.7, 0.2, 1.4) backwards; animation-delay: calc(120ms + var(--i) * 70ms); }
  .trail__path { animation: crawl 1.4s ease-out both; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bump { animation: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .site-header__dates { display: none; }
  .saved-tally { margin-left: auto; }
}

@media (max-width: 720px) {
  .controls { position: static; }
  .controls__inner { align-items: stretch; flex-direction: column; gap: 12px; }
  .field--search, .field--category { max-width: none; flex-basis: auto; }
  .controls .saved-toggle { align-self: flex-start; }
  .results { margin: 2px 2px 10px; }
}

@media (max-width: 640px) {
  .event {
    grid-template-columns: 34px 1fr;
    grid-template-areas: "rail when" "rail main" "side side";
    row-gap: 6px;
    column-gap: 12px;
    padding: 18px 6px;
  }
  .event__rail { grid-area: rail; }
  .event__rail::before { top: 12px; bottom: 12px; }
  .event__dot { margin-top: 5px; }
  .event__when {
    grid-area: when;
    display: flex;
    align-items: baseline;
    gap: 7px;
    padding-top: 3px;
  }
  .event__start { font-size: 14.5px; }
  .event__end { margin-top: 0; }
  .event__main { grid-area: main; }
  .event__side {
    grid-area: side;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-top: 10px;
  }
  .event__price { order: 2; }
  .event .btn { order: 3; }
  .event__saved-flag { order: 1; }
  .event + .event { border-top: none; }
  .day { margin-top: 38px; }
  .day__list { display: flex; flex-direction: column; gap: 2px; }
  .panel__scroll { padding: 20px 20px 24px; }
  .panel__head { padding-left: 18px; }
  .panel__foot { padding-left: 18px; }
  .empty { margin-top: 40px; }
}
