/* ==========================================================================
   SnapBooth - shared styles
   Visual direction: a photo booth's own interior. Deep aubergine shell,
   tungsten bulb light, and the paper photo strip as the hero object.
   Typefaces are ones iPadOS ships, so the booth looks right offline.
   ========================================================================== */

:root {
  /* Overridable from the admin panel at runtime */
  --ink: #17121d;
  --velvet: #241a2e;
  --tungsten: #ffc46b;
  --rouge: #ff4d6d;
  --cream: #fbf3e6;
  --mint: #5ce1c6;

  --bg: var(--ink);
  --panel: var(--velvet);
  --accent: var(--rouge);
  --accent2: var(--tungsten);
  --text: var(--cream);
  --muted: color-mix(in srgb, var(--text) 58%, transparent);
  --line: color-mix(in srgb, var(--text) 14%, transparent);
  --radius: 22px;

  --display: "Avenir Next Condensed", "Helvetica Neue Condensed",
             "Arial Narrow", "Haettenschweiler", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
          system-ui, sans-serif;
  --paper: Didot, "Hoefler Text", "Playfair Display", Georgia, serif;

  --step: clamp(16px, 1.6vmin, 22px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: var(--step);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body.booth {
  height: 100vh;
  height: -webkit-fill-available;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--accent2) 16%, transparent), transparent 60%),
    var(--bg);
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .005em; margin: 0; }
h1 { font-size: clamp(2.6rem, 7vmin, 5rem); line-height: .95; }
h2 { font-size: clamp(1.7rem, 4.2vmin, 3rem); line-height: 1.02; }
p { margin: 0; max-width: 62ch; }
.muted { color: var(--muted); }
img, video, canvas { display: block; max-width: 100%; }

/* --------------------------------------------------------------- buttons */
.btn {
  appearance: none;
  border: 1.5px solid transparent;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: .85em 1.6em;
  border-radius: 999px;
  cursor: pointer;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  transition: transform .12s ease, background-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--accent2); outline-offset: 3px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--text); }
.btn.quiet { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.small { min-height: 44px; padding: .55em 1.1em; font-size: .92em; }

/* Shutter: the one loud element in the booth */
.shutter {
  width: min(42vmin, 290px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #fff;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.6vmin, 2.4rem);
  background:
    radial-gradient(circle at 50% 32%, color-mix(in srgb, var(--accent) 78%, #fff), var(--accent) 62%,
      color-mix(in srgb, var(--accent) 70%, #000) 100%);
  box-shadow:
    0 0 0 10px color-mix(in srgb, var(--accent) 16%, transparent),
    0 0 90px color-mix(in srgb, var(--accent2) 42%, transparent),
    inset 0 -8px 24px rgba(0, 0, 0, .3);
  transition: transform .15s ease;
}
.shutter:active { transform: scale(.95); }
.shutter:focus-visible { outline: 4px solid var(--accent2); outline-offset: 8px; }

/* ---------------------------------------------------------- screen stack */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vmin, 30px);
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  text-align: center;
}
.screen.active { display: flex; }

/* Marquee bulbs frame the start screen the way a booth frames its door */
.marquee {
  position: relative;
  padding: clamp(26px, 5vmin, 56px) clamp(26px, 6vmin, 72px);
  border-radius: calc(var(--radius) + 10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2.2vmin, 26px);
}
.marquee::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  background:
    repeating-linear-gradient(90deg, var(--accent2) 0 7px, transparent 7px 26px) top/100% 3px no-repeat,
    repeating-linear-gradient(90deg, var(--accent2) 0 7px, transparent 7px 26px) bottom/100% 3px no-repeat,
    repeating-linear-gradient(180deg, var(--accent2) 0 7px, transparent 7px 26px) left/3px 100% no-repeat,
    repeating-linear-gradient(180deg, var(--accent2) 0 7px, transparent 7px 26px) right/3px 100% no-repeat;
  opacity: .72;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent2) 60%, transparent));
  pointer-events: none;
}

/* ------------------------------------------------------------- capture */
#capture { padding: 0; justify-content: stretch; }
.stage {
  position: relative;
  flex: 1;
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
}
.stage video, .stage canvas.live {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.stage video.mirror, .stage canvas.mirror { transform: scaleX(-1); }

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: min(46vmin, 420px);
  line-height: 1;
  color: var(--cream);
  text-shadow: 0 0 60px color-mix(in srgb, var(--tungsten) 85%, transparent);
  pointer-events: none;
}
.countdown.pulse { animation: tick .9s ease-out; }
@keyframes tick {
  from { opacity: 0; transform: scale(1.35); }
  40%  { opacity: 1; transform: scale(1); }
  to   { opacity: .85; transform: scale(.98); }
}
.cue {
  position: absolute;
  bottom: clamp(18px, 4vmin, 48px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: clamp(1.4rem, 3.4vmin, 2.4rem);
  background: color-mix(in srgb, var(--ink) 72%, transparent);
  padding: .35em 1.1em;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.flash.fire { animation: pop .45s ease-out; }
@keyframes pop { from { opacity: .95; } to { opacity: 0; } }

/* The film rail doubles as the shot counter: filled slots = shots taken */
.rail {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: clamp(92px, 13vmin, 150px);
  background: var(--ink);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 0;
}
.rail::before, .rail::after {
  content: "";
  position: absolute;
  top: 0;
  width: 10px;
  height: 100%;
  background: repeating-linear-gradient(180deg,
    color-mix(in srgb, var(--text) 26%, transparent) 0 9px, transparent 9px 22px);
  border-radius: 2px;
}
.rail::before { left: 7px; }
.rail::after { right: 7px; }
.slot {
  width: calc(100% - 38px);
  aspect-ratio: 4 / 3;
  border: 1px dashed color-mix(in srgb, var(--text) 24%, transparent);
  border-radius: 4px;
  overflow: hidden;
  background: color-mix(in srgb, var(--text) 5%, transparent);
}
.slot img { width: 100%; height: 100%; object-fit: cover; }
.slot.filled { border-style: solid; border-color: var(--accent2); animation: land .4s cubic-bezier(.2, .9, .2, 1); }
@keyframes land { from { transform: translateY(-14px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------- review and output */
.paper {
  background: var(--cream);
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .55), 0 2px 0 rgba(255, 255, 255, .35) inset;
  transform: rotate(-1.2deg);
  max-height: 58vh;
}
.paper img { max-height: calc(58vh - 20px); width: auto; border-radius: 2px; }
.paper.flat { transform: none; }

.tray { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.chip {
  border: 1.5px solid var(--line);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
  font: inherit;
  padding: .5em 1.1em;
  border-radius: 999px;
  cursor: pointer;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: .5em;
}
.chip[aria-pressed="true"], .chip.on {
  border-color: var(--accent2);
  background: color-mix(in srgb, var(--accent2) 20%, transparent);
}
.chip:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }

.thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 4px; max-width: 100%; }
.thumbs button {
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0;
  background: none;
  cursor: pointer;
  flex: 0 0 auto;
}
.thumbs button[aria-pressed="true"] { border-color: var(--accent2); }
.thumbs img, .thumbs canvas { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; display: block; }
.thumbs figcaption { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* QR delivered as a cloakroom ticket, perforated edge and all */
.ticket {
  background: var(--cream);
  color: #241a2e;
  border-radius: 12px;
  padding: 18px;
  display: grid;
  gap: 10px;
  justify-items: center;
  position: relative;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
}
.ticket::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: -1px;
  height: 6px;
  background: radial-gradient(circle at 5px 0, transparent 0 4px, var(--cream) 4px) repeat-x;
  background-size: 12px 6px;
}
.ticket canvas { border-radius: 6px; }
.ticket .label { font-family: var(--paper); font-size: 15px; letter-spacing: .02em; }

.sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vmin, 32px);
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  text-align: left;
}
.field { display: grid; gap: 6px; }
label { font-size: .9em; color: var(--muted); }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: color-mix(in srgb, var(--text) 7%, transparent);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: .7em .9em;
  min-height: 52px;
  width: 100%;
}
input:focus, select, textarea:focus { outline: 3px solid var(--accent2); outline-offset: 1px; }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"] { width: 28px; height: 28px; min-height: 0; accent-color: var(--accent); }
input[type="range"] { min-height: 0; padding: 0; }
input[type="color"] { padding: 4px; height: 52px; }

.stars { display: flex; gap: 6px; justify-content: center; }
.stars button {
  background: none;
  border: none;
  font-size: 42px;
  line-height: 1;
  cursor: pointer;
  color: color-mix(in srgb, var(--text) 30%, transparent);
  padding: 4px;
}
.stars button.on { color: var(--accent2); }

.corner-admin {
  position: fixed;
  top: 0;
  left: 0;
  width: 86px;
  height: 86px;
  background: none;
  border: none;
  z-index: 40;
  opacity: 0;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: .8em 1.3em;
  border-radius: 999px;
  z-index: 60;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  max-width: 90vw;
}
.toast[hidden] { display: none; }
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.offline-note {
  position: fixed; top: 12px; right: 12px; z-index: 50;
  background: color-mix(in srgb, var(--accent2) 22%, var(--panel));
  border: 1px solid var(--accent2);
  color: var(--text);
  padding: .4em .9em; border-radius: 999px; font-size: .85em;
}
.offline-note[hidden] { display: none; }

/* ------------------------------------------------------- operator pages */
body.app { overflow-y: auto; padding: 0; }
.wrap { width: min(1100px, 100%); margin: 0 auto; padding: 28px 20px 80px; }
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); z-index: 20;
}
.topbar h1 { font-size: 1.6rem; }
.topbar .grow { flex: 1; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px; margin-bottom: 18px;
}
.card h2 { font-size: 1.35rem; margin-bottom: 4px; }
.card > .muted:first-of-type { margin-bottom: 12px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stat { display: grid; gap: 2px; }
.stat b { font-family: var(--display); font-size: 2.4rem; line-height: 1; }
.gallery-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
}
.tile {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.tile img, .tile video { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #000; }
.tile .meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 6px; padding: 8px 10px; font-size: 12px; color: var(--muted);
}
.tile .del {
  position: absolute; top: 8px; right: 8px; border: none; cursor: pointer;
  background: color-mix(in srgb, var(--ink) 80%, transparent); color: var(--text);
  width: 36px; height: 36px; border-radius: 50%; font-size: 16px;
}
.lightbox {
  position: fixed; inset: 0; background: rgba(10, 8, 14, .94);
  display: grid; place-items: center; gap: 16px; z-index: 70; padding: 20px;
}
.lightbox[hidden] { display: none; }
.lightbox img, .lightbox video { max-width: min(900px, 94vw); max-height: 74vh; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .92em; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

/* ------------------------------------------------------------- printing */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  #print-area img { width: 100%; height: auto; display: block; }
  html, body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media (max-width: 520px) {
  .rail { width: 78px; }
  .paper { max-height: 46vh; }
  .paper img { max-height: calc(46vh - 20px); }
}
