:root {
  --paper: #f5eddc;
  --paper-2: #fbf6ea;
  --card: #fffdf7;
  --ink: #1c2336;
  --ink-2: #474e62;
  --line: #d9ccb0;
  --accent: #c2371b;
  --accent-ink: #a42c13;
  --lamp: #f2b53c;
  --night: #1c2336;
  --teal: #1d6a66;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  --c-Art: #b4492c;
  --c-Film: #5b3f8c;
  --c-Food: #a4640e;
  --c-Literature: #8a2f55;
  --c-Music: #1d5f8f;
  --c-Outdoors: #2f7a3a;
  --c-Walks: #1d6a66;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body.lock { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px;
}
.skip:focus { top: 8px; }

/* ---------- masthead ---------- */
.masthead {
  background: var(--night);
  color: #f7efdc;
  background-image: radial-gradient(circle at 88% -20%, rgba(242,181,60,.35), transparent 45%);
}
.masthead__inner, .hero {
  max-width: 1240px; margin: 0 auto; padding-inline: 32px;
}
.masthead__inner {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding-block: 18px; border-bottom: 1px solid rgba(247,239,220,.18);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--lamp); text-decoration: none; }
.brand__name { font: 700 1.6rem/1 var(--serif); letter-spacing: -.01em; color: #f7efdc; }
.masthead__dates { font-size: .9rem; color: #d9d1bd; }
.masthead__dates strong { color: #fff; font-weight: 600; }
.hero { padding-block: 44px 52px; }
.hero h1 {
  font: 700 clamp(2rem, 4.4vw, 3.6rem)/1.05 var(--serif);
  letter-spacing: -.02em; max-width: 18ch;
}
.hero p { margin-top: 16px; max-width: 52ch; color: #ddd5c0; font-size: 1.1rem; }

/* ---------- layout ---------- */
.layout {
  max-width: 1240px; margin: 0 auto; padding: 28px 32px 56px;
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start;
}

/* ---------- controls ---------- */
.controls {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px 16px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; border: 0; margin: 0; padding: 0; }
.field label, .field legend {
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
  padding: 0;
}
input[type="search"], select {
  width: 100%; height: 46px; padding: 0 12px;
  border: 1.5px solid #9a8f77; border-radius: 10px; background: #fff;
}
input[type="search"]:focus-visible, select:focus-visible { outline-offset: 1px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%231c2336' stroke-width='2'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center;
}
.seg { display: flex; height: 46px; border: 1.5px solid #9a8f77; border-radius: 10px; overflow: hidden; background: #fff; }
.seg__btn { flex: 1; border: 0; background: transparent; padding: 0 10px; font-weight: 600; border-right: 1px solid var(--line); }
.seg__btn:last-child { border-right: 0; }
.seg__btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg__btn:focus-visible { outline-offset: -4px; }
.toggles { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px;
  border: 1.5px solid #9a8f77; border-radius: 999px; background: #fff; font-weight: 600;
}
.chip__box { width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: 4px; display: inline-block; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .chip__box { background: var(--lamp) ; border-color: var(--lamp); }
.chip--saved svg { color: var(--accent); }
.chip--saved[aria-pressed="true"] svg { color: var(--lamp); }
.chip__count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: inline-grid; place-items: center;
  background: var(--ink); color: #fff; font-size: .78rem;
}
.chip[aria-pressed="true"] .chip__count { background: var(--lamp); color: var(--ink); }

.status { display: flex; justify-content: space-between; align-items: center; margin: 18px 2px 4px; min-height: 28px; color: var(--ink-2); font-size: .95rem; }
.link { background: none; border: 0; padding: 4px; color: var(--accent-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- list ---------- */
.list:focus { outline: none; }
.day { margin-top: 18px; }
.day__head {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 14px;
}
.day__head h3 { font: 700 1.7rem/1.1 var(--serif); letter-spacing: -.01em; }
.day__head span { color: var(--ink-2); font-size: .92rem; }
.day__items { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.card {
  position: relative; display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; gap: 8px 20px;
  background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--cat, var(--ink));
  border-radius: var(--radius); padding: 16px 16px 16px 18px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -10px rgba(28,35,54,.45); }
.card:has(.card__open:focus-visible) { outline: 3px solid var(--accent-ink); outline-offset: 2px; }
.card.is-saved { background: #fff8e4; }
.card__time { font: 700 1.5rem/1.1 var(--serif); }
.card__time small { display: block; margin-top: 4px; font: 500 .82rem/1.3 var(--sans); color: var(--ink-2); }
.card__main { min-width: 0; }
.card__cat { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--cat); }
.card__open {
  display: block; text-align: left; background: none; border: 0; padding: 0; margin: 2px 0 4px;
  font: 700 1.3rem/1.2 var(--serif); letter-spacing: -.005em;
}
.card__open::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card__open:focus-visible { outline: none; }
.card__open:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.card__where { color: var(--ink-2); font-size: .95rem; }
.card__sum { margin-top: 8px; color: var(--ink); font-size: .96rem; max-width: 62ch; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eee3c8; color: var(--ink); }
.tag--free { background: #d8ecd9; color: #1b5a27; }
.card__side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 10px; }
.price { font: 700 1.3rem/1 var(--serif); }
.price--free { color: #1b5a27; }

.qsave {
  position: relative; z-index: 2;
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1.5px solid #9a8f77; border-radius: 50%; background: #fff; color: var(--ink);
}
.qsave:hover { background: #fff0c7; }
.qsave[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.qsave svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.qsave[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 56px 20px; border: 2px dashed var(--line); border-radius: var(--radius); margin-top: 16px; color: var(--ink-2); }
.empty[hidden] { display: none; }
.empty h3 { font: 700 1.6rem/1.2 var(--serif); color: var(--ink); margin-top: 12px; }
.empty p { margin: 8px auto 20px; max-width: 40ch; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--ink); color: #fff; font-weight: 700;
}
.btn:hover { background: #2b3550; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: #efe3c3; }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn[aria-pressed="true"]:hover { background: var(--accent-ink); }

/* ---------- shortlist ---------- */
.shortlist {
  position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto;
  background: var(--night); color: #f7efdc; border-radius: 18px; padding: 22px 20px 20px;
}
.shortlist__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.shortlist h2 { font: 700 1.5rem/1.1 var(--serif); }
.shortlist__n { background: var(--lamp); color: var(--ink); font-weight: 800; min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 15px; padding: 0 8px; }
.sl-empty { color: #cfc6b0; font-size: .95rem; }
.sl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sl-day { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--lamp); font-weight: 700; margin: 14px 0 6px; }
.sl-day:first-child { margin-top: 0; }
.sl-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; background: rgba(247,239,220,.08); border-radius: 10px; padding: 10px 10px 10px 12px; }
.sl-item__time { grid-column: 1 / -1; font-size: .82rem; color: #d9d1bd; }
.sl-item__open { text-align: left; background: none; border: 0; padding: 0; color: #fff; font: 700 1.02rem/1.25 var(--serif); text-decoration: underline; text-decoration-color: rgba(255,255,255,.35); text-underline-offset: 3px; }
.sl-item__open:hover { text-decoration-color: var(--lamp); }
.sl-item__rm { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(247,239,220,.4); background: transparent; color: #f7efdc; font-size: 1.1rem; line-height: 1; }
.sl-item__rm:hover { background: rgba(247,239,220,.15); }
.sl-item__warn { grid-column: 1 / -1; font-size: .82rem; color: #ffd27a; }
.shortlist :focus-visible { outline-color: var(--lamp); }
.sl-total { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(247,239,220,.25); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sl-total strong { font: 700 1.5rem/1 var(--serif); }
.sl-total span { color: #d9d1bd; font-size: .9rem; }
.sl-actions { margin-top: 14px; }
.sl-actions .btn { width: 100%; background: var(--lamp); border-color: var(--lamp); color: var(--ink); }
.sl-actions .btn[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--ink); }

.foot { border-top: 1px solid var(--line); padding: 24px 32px 90px; text-align: center; color: var(--ink-2); font-size: .88rem; }
.dock { display: none; }

/* ---------- detail dialog ---------- */
dialog.detail {
  width: min(680px, calc(100vw - 48px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: 20px; background: var(--paper-2); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); overflow: auto; margin: auto;
}
dialog.detail::backdrop { background: rgba(20,26,42,.65); }
.detail__bar {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px 14px 24px; background: var(--paper-2); border-bottom: 1px solid var(--line);
}
.detail__cat { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--cat); display: flex; align-items: center; gap: 8px; }
.detail__cat::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--cat); }
.detail__close { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--ink); background: transparent; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.detail__close:hover { background: #efe3c3; }
.detail__content { padding: 22px 24px 28px; }
.detail h2 { font: 700 clamp(1.8rem, 4vw, 2.5rem)/1.08 var(--serif); letter-spacing: -.015em; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 22px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.facts div { padding: 12px 14px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.facts div:nth-child(2n) { border-right: 0; }
.facts div:nth-last-child(-n+2) { border-bottom: 0; }
.facts dt { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.detail__body p { max-width: 60ch; font-size: 1.05rem; }
.detail__body p + p { margin-top: 14px; }
.detail__h { font: 700 1.1rem/1.2 var(--serif); margin: 22px 0 6px; }
.detail__body > .detail__h:first-child { margin-top: 0; }
.detail__note { margin-top: 18px; padding: 10px 14px; border-radius: 10px; background: #ffe9b8; font-size: .93rem; }
.detail__foot { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.detail__foot .hint { color: var(--ink-2); font-size: .9rem; }

/* ---------- mobile ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 20px 20px 40px; }
  .shortlist { position: static; max-height: none; scroll-margin-top: 12px; }
  .masthead__inner, .hero { padding-inline: 20px; }
  .dock {
    position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 18px;
    background: var(--night); color: #fff; border-radius: 999px; text-decoration: none; font-weight: 700;
    box-shadow: 0 10px 30px -8px rgba(0,0,0,.55);
  }
  .dock:focus-visible { outline-color: var(--lamp); }
  .dock__n { background: var(--lamp); color: var(--ink); min-width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; padding: 0 7px; font-size: .88rem; }
  .dock__sum { margin-left: auto; font-weight: 500; color: #d9d1bd; font-size: .9rem; }
}

@media (max-width: 640px) {
  .masthead__dates { display: none; }
  .hero { padding-block: 28px 32px; }
  .hero p { font-size: 1rem; }
  .brand__name { font-size: 1.4rem; }
  .controls { grid-template-columns: minmax(0, 1fr); padding: 14px; gap: 12px; }
  .toggles > .chip { flex: 1 1 auto; justify-content: center; padding: 0 12px; }
  .day__head h3 { font-size: 1.45rem; }
  .card { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 12px 14px 14px; gap: 8px 10px; }
  .card__time { grid-column: 1; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 1.2rem; }
  .card__time small { display: inline; margin: 0; }
  .card__main { grid-column: 1 / -1; grid-row: 2; }
  .card__side { grid-column: 2; grid-row: 1; flex-direction: row; align-items: center; }
  .card__open { font-size: 1.2rem; }

  dialog.detail {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0;
  }
  .detail__bar { padding-left: 16px; }
  .detail__content { padding: 18px 16px 32px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .detail__foot .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
  .card:hover { transform: none; }
}
