:root {
  --ink: #101826;
  --ink-2: #1c2638;
  --paper: #fbfaf6;
  --bone: #f3efe6;
  --rule: #101826;
  --muted: #566070;
  --muted-on-ink: #aab3c2;
  --tang: #ff6a13;
  --focus: #1a45e0;
  --sans: "Helvetica Neue", Helvetica, Arial, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button, select, input { touch-action: manipulation; }
button { cursor: pointer; -webkit-tap-highlight-color: rgba(255, 106, 19, .25); }
h1, h2, h3 { text-wrap: balance; }
.price, .d-price, .day, .facts dd, .meta, .sl-open span, .shortlist-total { font-variant-numeric: tabular-nums; }
.main { scroll-margin-top: 16px; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.panel { --focus: #ffb27a; }

.sr, .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: 12px; top: -60px; z-index: 100;
  background: var(--tang); color: var(--ink); padding: 10px 16px; font-weight: 700;
}
.skip:focus { top: 12px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 440px minmax(0, 1fr); min-height: 100vh; }

.panel {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  background: var(--ink); color: var(--bone);
  padding: 32px 36px 36px;
  display: flex; flex-direction: column; gap: 22px;
}
.panel-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.brand {
  margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.05em; line-height: 1;
}
.brand span { color: var(--tang); font-size: 14px; vertical-align: super; margin-left: 2px; font-weight: 400; letter-spacing: 0; }
.kicker { margin: 0; font-size: 12px; text-transform: uppercase; color: var(--muted-on-ink); }

h1 {
  margin: 0; font-weight: 800; font-size: clamp(44px, 4.2vw, 58px);
  line-height: 0.95; letter-spacing: -0.05em;
}
h1 em { font-style: normal; color: var(--tang); }

.panel-img {
  width: 100%; height: 150px; object-fit: cover; object-position: 50% 60%;
  border-top: 6px solid var(--tang);
}

/* ---------- controls ---------- */
.controls { display: grid; gap: 14px; }
.field label {
  display: block; margin-bottom: 6px;
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted-on-ink);
}
.field input, .field select {
  width: 100%; height: 48px; padding: 0 14px;
  background: var(--bone); color: var(--ink);
  border: 2px solid var(--bone); border-radius: 0;
  font-size: 16px; /* prevents iOS zoom */
  appearance: none; -webkit-appearance: none;
}
.field input::placeholder { color: #6a7385; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.field input:focus-visible, .field select:focus-visible { outline-offset: 2px; }

.toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 14px;
  background: transparent; color: var(--bone); border: 2px solid var(--bone); border-radius: 0; text-align: left;
  font-weight: 600;
}
.toggle:hover { background: var(--ink-2); }
.toggle-box {
  width: 20px; height: 20px; border: 2px solid currentColor; flex: none; position: relative;
}
.toggle-label { flex: 1; }
.toggle-count {
  min-width: 28px; padding: 1px 8px; text-align: center; font-size: 13px;
  background: var(--bone); color: var(--ink);
}
.toggle[aria-pressed="true"] { background: var(--tang); border-color: var(--tang); color: var(--ink); }
.toggle[aria-pressed="true"] .toggle-box { background: var(--ink); border-color: var(--ink); }
.toggle[aria-pressed="true"] .toggle-box::after {
  content: ""; position: absolute; left: 4px; top: 0px; width: 6px; height: 11px;
  border-right: 2px solid var(--tang); border-bottom: 2px solid var(--tang); transform: rotate(40deg);
}
.toggle[aria-pressed="true"] .toggle-count { background: var(--ink); color: var(--bone); }

/* ---------- shortlist ---------- */
.shortlist { border-top: 2px solid var(--bone); padding-top: 16px; }
.shortlist h2 {
  margin: 0 0 10px; font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-on-ink);
}
.shortlist-empty { margin: 0; font-size: 14px; color: var(--muted-on-ink); max-width: 36ch; }
.shortlist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.shortlist-list li {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
  border-bottom: 1px solid #38445a; padding: 8px 0;
}
.sl-open {
  background: none; border: 0; padding: 4px 0; text-align: left; display: grid; gap: 0; border-radius: 0;
}
.sl-open strong { font-size: 16px; letter-spacing: -0.01em; }
.sl-open span { font-size: 12px; color: var(--muted-on-ink); font-family: var(--mono); }
.sl-open:hover strong { text-decoration: underline; text-decoration-color: var(--tang); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.sl-remove {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: none; border: 1px solid #55627a; color: var(--bone); border-radius: 0; font-size: 18px; line-height: 1;
}
.sl-remove:hover { background: var(--bone); color: var(--ink); }
.shortlist-total { margin: 12px 0 0; font-size: 13px; color: var(--bone); }
.shortlist-total b { color: var(--tang); font-weight: 700; }

/* ---------- main list ---------- */
.main { padding: 32px 56px 40px; min-width: 0; }
.list-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  border-bottom: 4px solid var(--ink); padding-bottom: 14px;
}
.list-head h2 {
  margin: 0; font-size: 44px; line-height: 1; font-weight: 800; letter-spacing: -0.05em;
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
}
.list-head h2 .mono { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.count { margin: 0; font-size: 13px; color: var(--muted); text-align: right; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 2px solid var(--ink); }

.item {
  position: relative;
  display: grid;
  grid-template-columns: 88px 190px minmax(0, 1fr) 150px;
  gap: 28px; align-items: start;
  padding: 24px 0 24px 14px;
  transition: background-color .15s;
}
.item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--tang);
  transition: width .15s;
}
.item.is-saved::before { width: 6px; }
.item:hover { background: #f4f1e8; }

.date { display: grid; gap: 2px; align-content: start; }
.day { font-size: 64px; font-weight: 800; line-height: .85; letter-spacing: -0.06em; font-variant-numeric: tabular-nums; }
.mon { font-size: 12px; text-transform: uppercase; color: var(--muted); line-height: 1.35; }

.thumb { width: 190px; height: 130px; object-fit: cover; background: #dcd8cc; }

.main-col { min-width: 0; }
.cat {
  display: inline-block; margin: 0 0 8px; padding: 2px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--chip, #ddd); color: var(--ink);
}
[data-cat="Ceramics"] { --chip: #a9cdee; }
[data-cat="Painting"] { --chip: #87d8c6; }
[data-cat="Floristry"] { --chip: #ffb45c; }
[data-cat="Baking"] { --chip: #f0d58a; }

.item h3 { margin: 0 0 6px; font-size: 30px; line-height: 1.05; font-weight: 800; letter-spacing: -0.04em; }
.desc { margin: 0 0 12px; max-width: 56ch; color: #2d3748; }
.meta { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); }
.meta li::before { content: "—"; margin-right: 6px; color: var(--tang); font-weight: 700; }

.side { display: grid; gap: 10px; justify-items: stretch; text-align: right; }
.price { margin: 0; font-size: 36px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.price small { display: block; margin-top: 4px; font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .04em; color: var(--muted); }

.btn, .btn-ghost {
  min-height: 44px; padding: 0 16px; border: 2px solid var(--ink); border-radius: 0;
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn { background: var(--ink); color: var(--paper); }
.btn:hover { background: var(--tang); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-ghost[aria-pressed="true"] { background: var(--tang); }
.btn-ghost[aria-pressed="true"]:hover { background: var(--ink); color: var(--paper); }
.mark {
  width: 12px; height: 16px; border: 2px solid currentColor; border-bottom: 0; position: relative; flex: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}
[aria-pressed="true"] > .mark { background: currentColor; }

.empty { padding: 56px 0; border-bottom: 2px solid var(--ink); max-width: 560px; }
.empty-title { margin: 0 0 8px; font-size: 36px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.empty-text { margin: 0 0 20px; color: #2d3748; }

.foot { margin-top: 28px; font-size: 12px; color: var(--muted); max-width: 70ch; }
.foot p { margin: 0; }

/* ---------- detail dialog ---------- */
dialog.detail {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(680px, 100%); max-width: 100%; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh;
  border: 0; border-left: 6px solid var(--tang);
  background: var(--paper); color: var(--ink);
  overflow: hidden;
}
dialog.detail[open] { display: flex; flex-direction: column; }
dialog.detail::backdrop { background: rgba(16, 24, 38, .66); }

.d-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex: none;
  padding: 12px 20px 12px 28px; background: var(--ink); color: var(--bone);
  --focus: #ffb27a;
}
.d-bar p { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.d-close {
  min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; gap: 10px;
  background: transparent; border: 2px solid var(--bone); color: var(--bone); border-radius: 0; font-weight: 700;
}
.d-close:hover { background: var(--bone); color: var(--ink); }
.x { position: relative; width: 14px; height: 14px; }
.x::before, .x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 2px; background: currentColor; }
.x::before { transform: translate(-50%, -50%) rotate(45deg); }
.x::after { transform: translate(-50%, -50%) rotate(-45deg); }

.d-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.d-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.d-cap { margin: 6px 28px 0; font-size: 12px; color: var(--muted); }
.d-body { padding: 20px 28px 28px; }
.d-body h2 { margin: 12px 0 14px; font-size: clamp(38px, 5vw, 56px); line-height: .95; font-weight: 800; letter-spacing: -0.05em; }
.d-text { margin: 0 0 24px; font-size: 18px; line-height: 1.55; max-width: 52ch; }

.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 2px solid var(--ink); }
.facts > div { padding: 12px 0; border-bottom: 1px solid #c9c5b8; }
.facts > div:nth-child(odd) { padding-right: 16px; }
.facts dt { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.seats { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.seats i { width: 10px; height: 10px; background: var(--ink); }

.d-foot {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px calc(14px + env(safe-area-inset-bottom)); border-top: 2px solid var(--ink); background: var(--bone);
}
.d-price { font-size: 34px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.d-price small { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .04em; color: var(--muted); margin-top: 3px; }
.d-foot .btn-ghost { min-height: 52px; padding: 0 22px; font-size: 17px; background: var(--tang); }
.d-foot .btn-ghost[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.d-foot .btn-ghost:hover { background: var(--paper); color: var(--ink); }

@media (prefers-reduced-motion: no-preference) {
  dialog.detail[open] { animation: slide .24s cubic-bezier(.2,.8,.2,1); }
  dialog.detail[open]::backdrop { animation: fade .24s ease-out; }
  @keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 380px minmax(0, 1fr); }
  .main { padding: 28px 32px; }
  .item { grid-template-columns: 72px minmax(0, 1fr) 130px; }
  .thumb { display: none; }
  .day { font-size: 52px; }
}

@media (max-width: 860px) {
  .shell { display: block; }
  .panel { position: static; height: auto; overflow: visible; padding: 20px 18px 24px; gap: 16px; }
  h1 { font-size: 40px; }
  .panel-img { height: 84px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .controls .toggle { grid-column: 1 / -1; }
  .main { padding: 20px 18px 32px; }
  .list-head h2 { font-size: 34px; }
  .item {
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-areas: "thumb thumb" "date main" "side side";
    gap: 14px; padding: 18px 0 20px 0;
  }
  .item.is-saved { padding-left: 14px; }
  .thumb { display: block; grid-area: thumb; width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .date { grid-area: date; }
  .main-col { grid-area: main; }
  .side { grid-area: side; grid-template-columns: auto 1fr 1fr; align-items: center; text-align: left; gap: 8px; }
  .price { font-size: 30px; }
  .price small { display: none; }
  .item h3 { font-size: 26px; }
  .day { font-size: 48px; }
  dialog.detail { width: 100%; border-left: 0; }
  .d-bar { padding: 8px 14px 8px 18px; }
  .d-cap { margin-left: 18px; margin-right: 18px; }
  .d-body { padding: 16px 18px 24px; }
  .d-foot { padding: 12px 18px; }
  .d-price { font-size: 28px; }
}

@media (max-width: 340px) {
  .controls { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .side { grid-template-columns: auto 1fr; }
  .side .btn { grid-column: 1 / -1; }
  .side .btn-ghost { grid-column: 2; grid-row: 1; }
  .side .price { grid-row: 1; grid-column: 1; }
  .d-foot .btn-ghost { padding: 0 14px; font-size: 16px; }
}
