/* ── Seating plan (/seating) — builds on the Midnight Keepsake tokens ────
   CSS-3D hall: a tilted floor, cylinder tables, chairs and billboard labels.
   No libraries. Mobile-first: the hall fills the width, the guest list slides
   up as a bottom sheet. */

.seating-page { overflow-x: hidden; }
.seating-wrap { padding-bottom: 0; max-width: 520px; }
.seating-foot { margin-top: 18px; padding-top: 0; padding-bottom: 32px; }

/* ── Search ─────────────────────────────────────────────────── */
.search { position: relative; margin-top: 22px; }
.search input {
  width: 100%;
  padding: 15px 46px 15px 18px;
  border: 1.5px solid rgba(200, 150, 47, 0.55);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.06);
  color: #f3e9d6;
  font: inherit;
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: rgba(205, 181, 143, 0.7); }
.search input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: rgba(200, 150, 47, 0.18); color: var(--gold-light);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; min-height: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(200, 150, 47, 0.5);
  background: rgba(200, 150, 47, 0.12); color: #f3e9d6; font: inherit; font-size: 0.86rem; cursor: pointer;
}
.chip b { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; color: var(--gold-light); }
.chip small { color: var(--muted-dark); }
.chips .none { color: var(--muted-dark); font-size: 0.85rem; }

/* ── View toggle ────────────────────────────────────────────── */
.viewbar { display: flex; align-items: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.pill {
  padding: 8px 16px; border-radius: 999px; font: inherit; font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.04em; cursor: pointer;
  border: 1px solid rgba(200, 150, 47, 0.45); background: transparent; color: var(--gold-light);
}
.pill.active { background: linear-gradient(100deg, var(--gold), var(--gold-deep)); color: #fff; border-color: transparent; }
.viewbar-hint { margin-left: auto; font-size: 0.66rem; letter-spacing: 0.04em; color: var(--muted-dark); }

/* ── The hall (3D viewport) ─────────────────────────────────── */
.hall {
  position: relative;
  width: 100%;
  height: 60vh; /* overridden by seating.js to fill the screen */
  min-height: 360px;
  margin-top: 12px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  perspective: 1200px;
  perspective-origin: 50% 40%;
  background:
    radial-gradient(80% 60% at 50% 30%, rgba(232, 194, 106, 0.08), transparent 70%),
    linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.25) 100%);
  border-top: 1px solid rgba(200, 150, 47, 0.18);
  border-bottom: 1px solid rgba(200, 150, 47, 0.18);
}
.hall.dragging { cursor: grabbing; }

.cam {
  position: absolute; left: 50%; top: 52%;
  width: 0; height: 0;
  transform-style: preserve-3d;
}
.floor {
  --rz: 0deg;
  --tilt: 58deg;
  --s: 1;
  position: absolute;
  left: 0; top: 0;
  transform-style: preserve-3d;
  transform: scale(var(--s)) rotateX(var(--tilt)) rotateZ(var(--rz)) translate(-50%, -50%);
  transform-origin: 0 0;
  background:
    repeating-linear-gradient(0deg, rgba(232, 194, 106, 0.05) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(232, 194, 106, 0.05) 0 1px, transparent 1px 40px),
    linear-gradient(180deg, #4a2f1d, #2b1b11);
  border-radius: 28px;
  box-shadow: 0 0 0 2px rgba(200, 150, 47, 0.35), 0 40px 80px rgba(0, 0, 0, 0.6);
  will-change: transform;
}
.floor.smooth, .cam.smooth { transition: transform 0.35s ease; }

/* Anything placed on the floor. */
.obj { position: absolute; transform-style: preserve-3d; }

/* Stage slab at the front */
.stage {
  transform-style: preserve-3d;
  border-radius: 14px;
  background: linear-gradient(180deg, #7f2c18, #5f2012);
  box-shadow: 0 0 0 1px rgba(232, 194, 106, 0.4), 0 0 40px rgba(162, 59, 34, 0.35);
}
.stage .layer { position: absolute; inset: 0; border-radius: 14px; background: #4a180e; }

/* Round table = stacked discs (cylinder) */
.table { transform-style: preserve-3d; cursor: pointer; }
.table .disc {
  position: absolute; inset: 0; border-radius: 50%;
  background: #cdb58f;
}
.table .disc.top {
  background:
    radial-gradient(60% 60% at 50% 40%, #fffdf6 0%, #f3e9d6 60%, #e2d3b4 100%);
  box-shadow: 0 0 0 1.5px rgba(200, 150, 47, 0.7), 0 0 0 6px rgba(200, 150, 47, 0.08);
}
.table .disc.top::after {
  /* little gold centrepiece */
  content: ""; position: absolute; left: 50%; top: 50%; width: 22%; height: 22%;
  transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(circle at 40% 35%, #f3ddab, var(--gold-deep));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.table .disc.side { background: #b39a72; }
.table .shadow {
  position: absolute; inset: -8%; border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));
  transform: translateZ(0.5px);
}
/* Head tables are long rectangles */
.table.head .disc { border-radius: 14px; }
.table.head .shadow { border-radius: 18px; }

.chair {
  position: absolute; border-radius: 50%;
  background: #7d5a37;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  transform-style: preserve-3d;
}
.chair::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #a9781f, #6a4a2a);
  transform: translateZ(9px);
}

/* Billboard label that always faces the camera */
.tag {
  position: absolute; left: 50%; top: 50%;
  transform-origin: 50% 100%;
  transform:
    translate(-50%, -100%)
    translateZ(var(--lift, 26px))
    rotateZ(calc(var(--rz) * -1))
    rotateX(calc(var(--tilt) * -1));
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  pointer-events: none;
  white-space: nowrap;
  padding-bottom: 6px;
}
.tag .num {
  font-family: var(--serif); font-weight: 700; font-size: 34px; line-height: 1;
  color: var(--gold-light);
  text-shadow: 0 2px 0 #3a2517, 0 4px 14px rgba(0, 0, 0, 0.8);
}
.tag .name {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: #f3e9d6; background: rgba(23, 16, 11, 0.75);
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid rgba(200, 150, 47, 0.45);
}
.tag .stagename {
  font-family: var(--serif); font-style: italic; font-size: 26px; color: #f3ddab;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.8);
}

/* Search states */
/* Dim non-matching tables by colour (opacity would flatten the 3D transforms). */
.floor.searching .table:not(.hit) .disc.top { background: #6d5a44; box-shadow: 0 0 0 1px rgba(200, 150, 47, 0.2); }
.floor.searching .table:not(.hit) .disc.top::after { opacity: 0.25; }
.floor.searching .table:not(.hit) .disc.side { background: #4f4030; }
.floor.searching .table:not(.hit) .chair, .floor.searching .table:not(.hit) .chair::before { background: #4a3826; }
.floor.searching .table:not(.hit) .tag { opacity: 0.35; }
.table.hit .disc.top {
  box-shadow: 0 0 0 3px var(--gold-light), 0 0 30px 10px rgba(232, 194, 106, 0.6);
  animation: tablepulse 1.4s ease-in-out infinite;
}
.table.hit .tag .num { color: #fff; text-shadow: 0 0 18px var(--gold-light), 0 2px 0 #3a2517; }
.table.selected .disc.top { box-shadow: 0 0 0 3px #fff, 0 0 24px 6px rgba(255, 255, 255, 0.35); }
@keyframes tablepulse {
  from { box-shadow: 0 0 0 3px var(--gold-light), 0 0 18px 4px rgba(232, 194, 106, 0.45); }
  to   { box-shadow: 0 0 0 3px #fff,             0 0 40px 14px rgba(232, 194, 106, 0.75); }
}

/* On-screen controls */
.controls {
  position: absolute; right: 10px; bottom: 10px;
  display: flex; flex-direction: row; gap: 6px;
}
.controls button {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(200, 150, 47, 0.5);
  background: rgba(23, 16, 11, 0.8); color: var(--gold-light);
  font-size: 1.1rem; line-height: 1; cursor: pointer; backdrop-filter: blur(4px);
}
.controls button:active { transform: translateY(1px); }

/* ── List view ──────────────────────────────────────────────── */
.list { padding-top: 12px; }
.list details {
  border: 1px solid rgba(200, 150, 47, 0.3); border-radius: 16px;
  background: rgba(255, 253, 246, 0.04); margin-bottom: 10px; overflow: hidden;
}
.list details.hit { border-color: var(--gold-light); background: rgba(200, 150, 47, 0.14); }
.list summary {
  list-style: none; cursor: pointer; padding: 14px 16px;
  display: flex; align-items: baseline; gap: 12px;
}
.list summary::-webkit-details-marker { display: none; }
.list summary b { font-family: var(--serif); font-size: 1.35rem; color: var(--gold-light); }
.list summary span { color: var(--muted-dark); font-size: 0.85rem; }
.list summary .cnt { margin-left: auto; font-size: 0.72rem; letter-spacing: 0.08em; }
.list .guests { padding: 0 16px 14px; }

/* ── Guest list (shared by sheet + list view) ───────────────── */
.guests { list-style: none; margin: 0; padding: 0; }
.guests li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-top: 1px solid rgba(200, 150, 47, 0.18);
}
.guests li:first-child { border-top: 0; }
.guests .gname { font-weight: 600; }
.guests .gname mark { background: rgba(232, 194, 106, 0.45); color: inherit; border-radius: 3px; padding: 0 2px; }
.guests .gnote { font-size: 0.78rem; color: var(--muted-dark); }
.guests .gmem { font-size: 0.8rem; color: var(--muted-dark); margin-top: 2px; }
.guests .gsize {
  margin-left: auto; flex: 0 0 auto;
  font-size: 0.66rem; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px;
  border: 1px solid rgba(200, 150, 47, 0.4); color: var(--gold-light);
}

/* ── Bottom sheet ───────────────────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 10, 7, 0.55); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-height: 72vh; overflow-y: auto;
  margin: 0 auto; max-width: 520px;
  background: linear-gradient(180deg, var(--card-a), var(--card-b));
  color: var(--ink);
  border-radius: 24px 24px 0 0;
  padding: 12px 22px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--card-shadow);
  animation: sheetup 0.28s ease;
}
.sheet .guests .gnote, .sheet .guests .gmem { color: var(--muted); }
.sheet .guests li { border-top-color: var(--line); }
.sheet .guests .gsize { color: var(--gold-deep); border-color: var(--line); }
.sheet-grip { width: 42px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
.sheet-close {
  position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(43, 32, 24, 0.08); color: var(--ink); font-size: 1.3rem; cursor: pointer;
}
.sheet-title { font-family: var(--serif); font-size: 2rem; text-align: center; margin: 4px 0 0; color: var(--terra-deep); }
.sheet-sub { margin: 2px 0 14px; text-align: center; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
@keyframes sheetup { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 700px) {
  .hall { border-radius: 24px; max-width: 980px; margin-left: auto; margin-right: auto; border: 1px solid rgba(200, 150, 47, 0.18); }
}

@media (prefers-reduced-motion: reduce) {
  .table.hit .disc.top { animation: none; }
  .floor.smooth, .cam.smooth { transition: none; }
  .sheet { animation: none; }
}
