/* Sketchroll Live — booth page. Theme: Sketchroll brutalist (spec §4.1).
   Pure black, square corners everywhere, no gradients/shadows/rounded corners,
   no animations beyond toast fade + status dot. Dark mode only. */

:root {
  --bg: #000000;
  --surface: #111111;
  --border: #333333;
  --text: #FFFFFF;
  --muted: #888888;
  --accent: #FF3300;
  --green: #00FF00;
  --blue: #0088FF;
  --amber: #FFAA00;
  --red: #FF0000;

  --font-head: "DM Serif Display", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Courier New", monospace;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --status-h: 40px;
}

* {
  box-sizing: border-box;
  border-radius: 0; /* square corners everywhere */
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

/* ---- Status line: JetBrains Mono, fixed top, 40px tall ---- */
.status-line {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--status-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  font-size: 13px;
  line-height: 1;
}

/* State classes drive both dot and text color. */
.status-online { color: var(--green); }
.status-printing { color: var(--green); }
.status-printing .status-dot { animation: dot-pulse 1.2s ease-in-out infinite; }
.status-offline { color: var(--red); }
.status-connecting { color: var(--muted); }

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---- Booth body ---- */
.booth {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--status-h) + 16px) 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.1;
  margin: 4px 0 0;
  color: var(--text);
}

/* ---- Viewfinder: 3:4 portrait, overflow hidden, object-fit cover ---- */
.viewfinder {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* center-crop to the 3:4 container */
  display: block;
  background: #000;
}

/* Front camera shown mirrored (photo-booth convention). Rear: remove this class. */
.video.mirror {
  transform: scaleX(-1);
}

.flip-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  font-family: var(--font-mono);
}

.flip-btn:active {
  background: var(--border);
}

/* Themed message replacing the viewfinder when camera is unavailable. */
.camera-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--surface);
}

/* ---- SNAP button: full width, accent bg, white JetBrains Mono label ---- */
.snap-btn {
  display: block;
  width: 100%;
  padding: 20px 0;
  font-family: var(--font-mono);
  font-size: 14px; /* §4.1: JetBrains Mono labels 12–14px (prominence via weight/spacing, not size) */
  font-weight: 700;
  letter-spacing: 0.22em;
  text-indent: 0.22em; /* offset trailing letter-spacing so the label reads optically centered */
  color: var(--text);
  background: var(--accent);
  border: 1px solid var(--accent);
  cursor: pointer;
}

.snap-btn:active {
  opacity: 0.85;
}

/* Disabled ONLY while an upload is in flight (not for offline). */
.snap-btn.is-uploading {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
  pointer-events: none;
}

/* ---- Shutter flash: instant "frame captured" feedback (functional anim).
   The frame is grabbed synchronously at tap — once this fires, moving the
   phone is safe. ---- */
.shutter-flash {
  position: absolute;
  inset: 0;
  background: var(--text);
  opacity: 0;
  pointer-events: none;
}

.shutter-flash.fire {
  animation: shutter-fire 180ms ease-out;
}

@keyframes shutter-fire {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ---- Toast: white on #111, 1px border, ~1.5s then fade ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 12px 20px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
}

.toast.toast-show {
  opacity: 1;
  animation: toast-fade 1.5s ease-in forwards;
}

.toast.toast-fail {
  border-color: var(--red);
}

@keyframes toast-fade {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* Capture canvas: hidden buffer normally; during a send it becomes the
   freeze-frame overlay showing the exact captured pixels (3:4, like the
   viewfinder, so cover fills with no distortion). */
.capture-canvas {
  display: none;
}

.capture-canvas.freeze {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

[hidden] {
  display: none !important;
}
