/* The visitor page: a hand of cards on a flat table, and the card opened. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.page {
  height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(10px + env(safe-area-inset-bottom));
  max-width: 1280px; margin: 0 auto;
  position: relative; z-index: 0; isolation: isolate;  /* a lifted card never climbs over the opened sheet */
}

/* ---- intro: the one line of text ---------------------------------- */
.intro { flex: none; text-align: center; padding-top: 8px; }
.intro h1 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.intro .lede { margin: 6px auto 0; max-width: 34em; padding: 0 16px; font-size: 13.5px; line-height: 1.45; color: var(--ink-dim); }
.intro .lede[hidden] { display: none; }
@media (min-width: 860px) {
  .page { padding-top: 44px; }
  .intro h1 { font-size: 28px; }
}

/* ---- the table and the hand ------------------------------------------ */
.table { position: relative; flex: 1; min-height: 260px; }
/* the fan: visitor.js places every card each frame (transform + opacity only) */
.hand { position: absolute; inset: 0; touch-action: none; -webkit-user-select: none; user-select: none; overflow: visible; cursor: grab; }
.hand.grabbing, .hand.grabbing .card { cursor: grabbing; }

.card {
  position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch); padding: 0; margin: 0;
  border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; outline: none;
  transform-origin: 50% 50%; will-change: transform, opacity; contain: layout style;
  opacity: 0;
}
.face {
  position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden;
  padding: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 24px var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.card[data-centre] .face { border-color: var(--line-strong); box-shadow: 0 24px 44px var(--shadow-hard); }
.card:focus-visible .face { border-color: var(--blue); }
/* neighbours: a black veil whose opacity the script sets by distance */
.shade { position: absolute; inset: -1px; border-radius: 8px; background: #000; opacity: 0; pointer-events: none; }
@media (hover: hover) {
  .card:not([data-centre]):hover .shade { opacity: .12 !important; transition: opacity .15s; }
}

/* set aside: grey, a small cross; a round "back" button under it when it is in the middle */
.card[data-out] .ph img { filter: grayscale(1) brightness(.62) contrast(.9); }
.card[data-out] .ph { background: var(--surface); }
.card[data-out] .name { color: var(--ink-dim); text-decoration: line-through; text-decoration-color: rgba(161,161,170,.55); text-decoration-thickness: 1px; }
.card[data-out] .meta .line, .card[data-out] .meta .line i { color: var(--ink-faint); }
.card[data-out] .face { border-color: var(--line); border-style: dashed; box-shadow: 0 8px 18px var(--shadow); }
.outmark {
  position: absolute; top: 12px; left: 12px; display: none; place-items: center; width: 22px; height: 22px;
  background: rgba(9,9,11,.78); color: var(--ink-dim); border: 1px solid var(--line-strong); border-radius: 50%;
}
.outmark svg { width: 11px; height: 11px; }
.card[data-out] .outmark { display: grid; }

.restore {
  position: absolute; left: 50%; z-index: 400; width: 44px; height: 44px; margin-left: -22px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: var(--ink-on-accent); border: 0; box-shadow: 0 8px 22px var(--shadow-hard);
  opacity: 0; transform: translateY(8px) scale(.8); pointer-events: none;
  transition: opacity .18s, transform .22s var(--ease);
}
.hand[data-calm][data-centre-out] .restore { opacity: 1; transform: none; pointer-events: auto; }

/* where you are in the hand, and the shuffle */
.fan-nav { flex: none; position: relative; height: 36px; display: flex; align-items: center; justify-content: center; }
.dots { display: flex; align-items: center; gap: 7px; max-width: calc(100% - 96px); }
.dots i { flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong);
  transition: background .2s, transform .2s var(--ease); }
.dots i.on { background: var(--ink-bright); transform: scale(1.5); }
.dots i.out { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-faint); }
.dots i.out.on { box-shadow: inset 0 0 0 1px var(--ink-bright); }
.dots.many { gap: 4px; }
.dots.many i { width: 4px; height: 4px; }
.shuffle {
  position: absolute; right: 2px; top: 0; width: 36px; height: 36px; padding: 0; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-dim); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.shuffle:hover { color: var(--ink); border-color: var(--line-strong); }
.shuffle:active { background: var(--hover); }
.shuffle[hidden] { display: none; }
.ph { position: relative; flex: 1; min-height: 0; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.ph img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.ph.none { display: grid; place-items: center; }
.meta { flex: none; display: flex; flex-direction: column; gap: 1px; padding: 7px 4px 3px; min-width: 0; }
.meta .row { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.meta .idx { flex: none; font: 600 10px/1 var(--mono); color: var(--ink-faint); }
.meta .name { min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.25; color: var(--ink-bright);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .line { font: 500 10px/1.4 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .line i { font-style: normal; color: var(--pc, var(--ink)); letter-spacing: 0; }

/* chosen: a white frame and a small check */
.flag {
  position: absolute; top: 12px; right: 12px; display: none; place-items: center; width: 22px; height: 22px;
  background: var(--accent); color: var(--ink-on-accent); border-radius: 50%; box-shadow: 0 2px 8px var(--shadow);
}
.card[data-chosen] .face { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 14px 34px var(--shadow-hard); }
.card[data-chosen] .flag { display: grid; }

/* someone else on the page is on this card: only a quiet blue ring */
.card[data-peer] .face { outline: 1px dashed var(--blue); outline-offset: 3px; }

/* ---- the choice, once made: its name and the undo ------------------ */
.status { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 8px; min-height: 44px; }
.st-pick { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.st-pick .check { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.st-pick b { font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status .btn { height: 36px; color: var(--ink-dim); }

/* ---- the opened card --------------------------------------------------- */
.detail { position: fixed; inset: 0; z-index: 50; }
.d-scrim { position: absolute; inset: 0; background: var(--scrim); }
.d-sheet {
  position: absolute; inset: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); transform-origin: 50% 50%; backface-visibility: hidden;
  -webkit-overflow-scrolling: touch;
}
.d-gallery { position: relative; flex: none; aspect-ratio: 4 / 3.3; max-height: 62vh; background: var(--surface-2); overflow: hidden; }
.d-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.d-track::-webkit-scrollbar { display: none; }
.d-track figure { flex: 0 0 100%; height: 100%; margin: 0; scroll-snap-align: center; scroll-snap-stop: always; }
.d-track img { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.d-track .none { height: 100%; display: grid; place-items: center; }
.d-dots { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.d-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.35); transition: background .2s, transform .2s; }
.d-dots i.on { background: var(--ink-bright); transform: scale(1.25); }
.d-nav { position: absolute; top: 50%; width: 36px; height: 36px; margin-top: -18px; display: none; place-items: center;
  background: var(--shade); border: 1px solid rgba(255,255,255,.12); border-radius: 4px; color: var(--ink-bright); cursor: pointer; }
.d-nav:hover { background: rgba(0,0,0,.8); }
.d-nav.prev { left: 12px; } .d-nav.next { right: 12px; }
.d-nav:disabled { opacity: .3; cursor: default; }
.d-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 3; width: 36px; height: 36px;
  display: grid; place-items: center; background: var(--shade); border: 1px solid rgba(255,255,255,.12); border-radius: 4px;
  color: var(--ink-bright); cursor: pointer;
}
.d-close:hover { background: rgba(0,0,0,.8); }

.d-side { display: flex; flex-direction: column; flex: 1; }
.d-body { flex: 1; padding: 22px 20px 28px; display: flex; flex-direction: column; gap: 22px; }
.d-head h2 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; color: var(--ink-bright); letter-spacing: -.015em; }
.d-kind { margin-top: 4px; font-size: 14px; color: var(--ink-dim); }
.d-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.price { font: 600 13px/1 var(--mono); letter-spacing: .06em; color: var(--pc, var(--ink)); margin-right: 6px; }
.price s { text-decoration: none; color: var(--hover); }
.rating { font: 600 13px/1 var(--mono); color: var(--s2); margin-right: 8px; }
.rating s { text-decoration: none; color: var(--ink-dim); font-weight: 500; }
.ptext { font: 500 12px/1 var(--mono); color: var(--ink-dim); margin-right: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 9px; border: 1px solid var(--line); border-radius: 4px;
  font-size: 12.5px; color: var(--ink); background: var(--surface-2); }
.tag::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--tc, var(--s8)); }
.facts { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.fact { display: flex; gap: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.fact + .fact { border-top: 1px solid var(--line); }
.fact > svg { flex: none; margin-top: 2px; color: var(--ink-dim); }
.fact a { display: inline-block; margin-top: 2px; font-size: 13px; color: var(--s7); }
.fact .hours { white-space: pre-line; }
.d-desc { margin: 0; font-size: 15px; line-height: 1.65; color: var(--ink); white-space: pre-line; }
.d-reviews { padding-top: 4px; }
.reviews { display: flex; flex-direction: column; gap: 10px; }
.review { padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; }
.review header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.review header b { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.review header .src { margin-left: auto; font: 500 11px/1 var(--mono); color: var(--ink-faint); }
.review p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); white-space: pre-line; }
.stars { font-size: 12px; letter-spacing: 1px; color: var(--s2); white-space: nowrap; }
.stars s { text-decoration: none; color: var(--hover); }

.d-actions {
  position: sticky; bottom: 0; z-index: 2; display: flex; flex-direction: column; gap: 6px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line);
}
.d-actions .acts { display: flex; gap: 8px; }
.d-actions .acts .main { flex: 1; }
.d-actions .back { width: 52px; padding: 0; flex: none; }


@media (min-width: 860px) {
  .d-scrim { cursor: zoom-out; }
  .d-sheet {
    inset: 5vh max(24px, calc(50vw - 560px)); flex-direction: row; overflow: hidden;
    border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 30px 80px var(--shadow-hard);
  }
  .d-gallery { flex: 1.25; aspect-ratio: auto; max-height: none; height: 100%; border-right: 1px solid var(--line); }
  .d-nav { display: grid; }
  .d-side { flex: 1; min-width: 0; min-height: 0; }
  .d-body { overflow-y: auto; padding: 28px 28px 30px; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
  .d-actions { position: static; padding: 12px 22px 14px; }
  .d-close { top: 10px; }
}

/* the admin's mirror: same page, inert */
.mirror * { pointer-events: none !important; }
.mirror-gone { position: fixed; inset: 0; z-index: 99; display: grid; place-items: center; background: var(--scrim); }

@media (prefers-reduced-motion: reduce) {
  .restore, .dots i { transition: none; }
}

/* the toast clears the footer and the sheet's action bar */
.toast { bottom: calc(132px + env(safe-area-inset-bottom)); }
@media (min-width: 860px) {
  .toast { top: 18px; bottom: auto; animation: drop .22s var(--ease); }
}
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }
