/**
 * Plan 9 Task 6: the self-contained "book a table in a room that does not
 * exist" demo, moved from the Worker (public/assets/marketing/marketing.css)
 * and restyled with this site's own brand tokens instead of the copied
 * `--bb-*` values guest.css lent the Worker's page.
 *
 * Every colour below is `var(--color-…)` — no literal — per the brand guard
 * (tests/template/brand.test.ts) and the vetted pairs in
 * tests/unit/contrast.test.ts: available tables pair `--color-bg` text on an
 * `--color-accent` fill ("bg text on accent button"), held tables pair
 * `--color-text` on `--color-surface` ("text on surface"), and the muted
 * states (booked, too-small) pair `--color-muted` on `--color-bg` /
 * `--color-surface` ("muted on bg" / "muted on surface") — all four are
 * asserted ≥ 4.5:1 there. A genuinely non-brand literal would need a
 * "brand-guard-allow" comment marker (see tests/template/brand.test.ts);
 * none was needed.
 *
 * The demo sits on the cream #demo section (`.surface-cream`, global.css), so
 * its own surface reads as a "device" on the page rather than a pane of the
 * cream section itself: charcoal (--color-bg) with cream text (--color-text),
 * like a phone on a table.
 *
 * Every class name below is demo.js's own — copied byte-for-byte from the
 * Worker — so this file styles them without demo.js needing any selector
 * change to move here.
 */

#demo-root [hidden] {
  display: none !important;
}

.demo {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 60px -24px color-mix(in srgb, var(--color-shadow) 70%, transparent);
  padding: 1.5rem;
  font-family: var(--font-sans);
}

.demo__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.demo__party-label {
  font-size: 0.9375rem;
  color: var(--color-text);
}

.demo__party {
  font: inherit;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--color-line);
  border-radius: 0.375rem;
  background: var(--color-surface);
  color: var(--color-text);
  min-height: 44px;
}

.demo__hint {
  font-size: 0.9375rem;
  color: var(--color-muted);
}

.demo__map {
  width: 100%;
  height: auto;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  touch-action: manipulation;
}

/* The picker's stage shape, in the demo's own dark palette. */
.demo__stage {
  fill: color-mix(in srgb, var(--color-line) 40%, transparent);
  stroke: var(--color-line);
  stroke-width: 2;
}

.demo__hatch-bg {
  fill: color-mix(in srgb, var(--color-line) 35%, var(--color-surface));
}

.demo__hatch-line {
  fill: color-mix(in srgb, var(--color-line) 70%, var(--color-surface));
}

.t {
  cursor: pointer;
}

.t[aria-disabled='true'] {
  cursor: not-allowed;
}

.t .shape {
  stroke: var(--color-bg);
  stroke-width: 3;
  transition: fill 300ms ease;
}

/* Default label colour — right for the gold "available" fill and the
   dashed, background-matched "too small" fill; overridden per state below. */
.t text {
  font-family: var(--font-sans);
  text-anchor: middle;
  pointer-events: none;
  fill: var(--color-bg);
  transition: fill 300ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .t .shape,
  .t text {
    transition: none;
  }
}

.t .num {
  font-size: 30px;
  font-weight: 750;
}

.t .cap {
  font-size: 18px;
  font-weight: 600;
}

.t .ring {
  opacity: 0;
  fill: none;
}

/* The focus ring is drawn as part of the table (the `.ring` rect above), so
   the browser's own outline is turned off for both rest and focus states. */
.t:focus,
.t:focus-visible {
  outline: none;
}

.t:focus-visible .ring {
  opacity: 1;
  stroke: var(--color-accent);
  stroke-width: 5;
  fill: none;
  stroke-dasharray: 10 6;
}

/* Available: the brand accent, the same gold a real venue's picker uses for
   an open table. Dark label for contrast on the gold fill. */
.t--available .shape {
  fill: var(--color-accent);
}

.t--available:hover .shape {
  fill: color-mix(in srgb, var(--color-accent) 88%, var(--color-bg));
}

/* Held: lifted onto the forest surface, ringed in gold, cream label — marked
   by shape (the open ring) and by colour, never colour alone. */
.t--held .shape {
  fill: var(--color-surface);
  stroke: var(--color-accent);
}

.t--held text {
  fill: var(--color-text);
}

.t.t--held .ring {
  opacity: 1;
  stroke: var(--color-accent);
  stroke-width: 4;
  fill: none;
  stroke-dasharray: none;
}

/* Booked: the hatch, and a muted label with a halo so it survives the hatch
   underneath it. Struck through as well, never colour alone. */
.t--booked .shape {
  fill: url(#demo-hatch);
  stroke: var(--color-line);
  stroke-width: 2.5;
}

.t--booked text {
  fill: var(--color-muted);
}

.t--booked .cap {
  paint-order: stroke;
  stroke: var(--color-surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.t--booked .num {
  text-decoration: line-through;
}

/* Too small for this party: an outline the colour of the device itself, so
   it reads as "not really here" rather than as a fourth fill colour. */
.t--nofit .shape {
  fill: var(--color-bg);
  stroke-dasharray: 8 7;
  stroke-width: 2.5;
  stroke: var(--color-line);
}

.t--nofit text {
  fill: var(--color-muted);
}

.demo__none {
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
  color: var(--color-muted);
}

.demo__live {
  min-height: 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0.75rem 0 0;
  color: var(--color-text);
}

.demo__panel,
.demo__done {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  padding: 1rem;
  margin-top: 0.5rem;
}

.demo__done h3 {
  font-family: var(--font-display);
  color: var(--color-text);
  margin: 0 0 0.375rem;
}

.demo__done p {
  color: var(--color-muted);
  margin: 0;
}

.demo__done h3:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.demo__countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--color-text);
}

.demo__price {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.375rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.demo__price dt {
  margin: 0;
}

.demo__price dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.demo__price .demo__price-total {
  font-weight: 700;
  border-top: 1px solid var(--color-line);
  padding-top: 0.375rem;
}

.demo__confirm,
.demo__again {
  font: inherit;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.02em;
  min-height: 44px;
  padding: 0.625rem 1.125rem;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.demo__confirm {
  background: var(--color-accent);
  color: var(--color-bg);
  border: 1px solid var(--color-accent);
}

.demo__confirm:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.demo__again {
  margin-top: 0.75rem;
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-accent);
}

.demo__again:hover {
  background: var(--color-accent);
  color: var(--color-bg);
}
