/* Downtown Strip — theme system (body.theme-*) */

/* Theme selector */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 0.75rem;
  border: 2px solid var(--border-card, #c4a574);
  border-radius: var(--radius-booth, 6px);
  background: var(--surface-card, #f5efe4);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.theme-card:hover { border-color: var(--accent, #8b6914); }
.theme-card--selected {
  border-color: var(--accent-strong, #5c4033);
  box-shadow: 0 0 0 2px var(--accent-glow, rgba(196, 165, 116, 0.5));
}

.theme-card__swatch {
  width: 100%;
  height: 36px;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(0,0,0,0.08);
}

.theme-card__swatch--oldies {
  background: linear-gradient(135deg, #e8dcc8, #c4a574 50%, #5c4033);
}
.theme-card__swatch--cyberpunk {
  background: linear-gradient(135deg, #0a0a12, #ff2a6d 40%, #00f5ff);
}
.theme-card__swatch--fantasy {
  background: linear-gradient(135deg, #f3e8ff, #e8b4d4, #c9a0dc);
}
.theme-card__swatch--simple {
  background: linear-gradient(135deg, #fff, #999, #111);
}

.theme-card__name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
}

.theme-card__desc {
  font-family: var(--font-label);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.3;
}

/* Camera setup pills */
.camera-setup {
  margin-bottom: 1.25rem;
}

.camera-setup__label {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.4rem;
}

.camera-setup__label:not(:first-child) {
  margin-top: 0.85rem;
}

.pill-group {
  display: flex;
  gap: 0.35rem;
}

.pill {
  flex: 1;
  padding: 0.55rem 0.65rem;
  border: 2px solid var(--border-card, #c4a574);
  border-radius: 999px;
  background: var(--surface-card, #f5efe4);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.pill:hover {
  border-color: var(--accent, #8b6914);
}

.pill--active {
  border-color: var(--accent-strong, #5c4033);
  background: var(--accent, #8b6914);
  color: var(--btn-primary-text, #f5efe4);
  box-shadow: 0 0 0 1px var(--accent-glow, rgba(196, 165, 116, 0.4));
}

body.theme-cyberpunk .pill--active {
  color: #0a0a12;
}

body.theme-simple .pill--active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.pill__icon {
  margin-right: 0.15rem;
}

/* Camera filter via CSS variable */
#camera-preview {
  filter: var(--camera-filter, none);
}

.viewfinder__scanlines {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  opacity: 0.35;
}

.strip-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 2px;
}

.strip-container::after { display: none; }

/* —— Oldies —— */
body.theme-oldies {
  --camera-filter: sepia(0.6) contrast(1.1) brightness(0.95);
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Libre Baskerville", Georgia, serif;
  --font-label: "IM Fell English", Georgia, serif;
  --text-heading: #5c4033;
  --text-muted: #6b5344;
  --text-body: #3d2e24;
  --paper: #efe6d6;
  --cream: #f5efe4;
  --cream-dark: #e8dcc8;
  --white-warm: #faf6f0;
  --amber-deep: #5c4033;
  --amber-mid: #8b6914;
  --amber-warm: #c4a574;
  --paper-shadow: #d4c4a8;
  --accent: #8b6914;
  --accent-strong: #5c4033;
  --accent-glow: rgba(196, 165, 116, 0.5);
  --surface-card: #f5efe4;
  --border-card: #c4a574;
  --btn-primary-bg: linear-gradient(180deg, #8b6914, #5c4033);
  --btn-primary-text: #f5efe4;
  --viewfinder-bg: #3d2e24;
  --viewfinder-ring: #e8dcc8;
  --viewfinder-ring-outer: #c4a574;
  --countdown-color: #f5efe4;
  --flash-color: #faf6f0;
  --strip-bg: #faf6f0;
  --strip-pad: 12px 22px;
  --qr-dark: #3d2e24;
  --qr-light: #faf6f0;
}

body.theme-oldies .grain-global { opacity: 0.35; display: block; }
body.theme-oldies .vignette { opacity: 1; }
body.theme-oldies .strip-container {
  padding: var(--strip-pad);
  background: var(--strip-bg);
  box-shadow: 0 12px 40px rgba(61, 46, 36, 0.2);
}
body.theme-oldies .strip-container::before,
body.theme-oldies .strip-container::after {
  display: block;
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 10px;
  pointer-events: none;
  opacity: 0.5;
  background: repeating-linear-gradient(
    180deg,
    transparent 0 6px,
    rgba(61, 46, 36, 0.15) 6px 10px,
    transparent 10px 18px
  );
}
body.theme-oldies .strip-container::before { left: 4px; }
body.theme-oldies .strip-container::after {
  right: 4px;
  left: auto;
  background: repeating-linear-gradient(
    180deg,
    transparent 0 6px,
    rgba(61, 46, 36, 0.15) 6px 10px,
    transparent 10px 18px
  );
}
body.theme-oldies .strip-overlay {
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 100px;
}

/* —— Cyberpunk —— */
body.theme-cyberpunk {
  --camera-filter: saturate(1.8) hue-rotate(160deg) contrast(1.3);
  --font-display: "Share Tech Mono", monospace;
  --font-body: "Share Tech Mono", monospace;
  --font-label: "Share Tech Mono", monospace;
  --text-heading: #00f5ff;
  --text-muted: #ff2a6d;
  --text-body: #e0e0ff;
  --paper: #050508;
  --cream: #0a0a12;
  --cream-dark: #12121f;
  --white-warm: #1a1a2e;
  --amber-deep: #ff2a6d;
  --amber-mid: #00f5ff;
  --amber-warm: #7b2cbf;
  --paper-shadow: #00f5ff;
  --accent: #00f5ff;
  --accent-strong: #ff2a6d;
  --accent-glow: rgba(0, 245, 255, 0.4);
  --surface-card: #0d0d18;
  --border-card: #00f5ff44;
  --btn-primary-bg: linear-gradient(90deg, #ff2a6d, #7b2cbf);
  --btn-primary-text: #0a0a12;
  --viewfinder-bg: #000;
  --viewfinder-ring: #ff2a6d;
  --viewfinder-ring-outer: #00f5ff;
  --countdown-color: #00f5ff;
  --flash-color: #fff;
  --strip-bg: #0a0a12;
  --strip-pad: 12px;
  --qr-dark: #00f5ff;
  --qr-light: #0a0a12;
}

body.theme-cyberpunk .grain-global { display: none; }
body.theme-cyberpunk .vignette {
  background: radial-gradient(ellipse 80% 70% at 50% 50%, transparent 30%, rgba(255, 42, 109, 0.15) 100%);
}
body.theme-cyberpunk .signage::before { border-color: #00f5ff44; }
body.theme-cyberpunk .viewfinder {
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.35), 0 0 40px rgba(255, 42, 109, 0.2);
}
body.theme-cyberpunk .viewfinder__scanlines { display: block; }
body.theme-cyberpunk .countdown--pulse {
  animation: glitchCount 0.85s steps(2) infinite;
}
@keyframes glitchCount {
  0%, 100% { transform: translate(0); text-shadow: 2px 0 #ff2a6d, -2px 0 #00f5ff; }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(1px, 2px); }
}
body.theme-cyberpunk .strip-container {
  padding: var(--strip-pad);
  background: var(--strip-bg);
  border: 2px solid #00f5ff;
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.4), inset 0 0 20px rgba(255, 42, 109, 0.1);
}
body.theme-cyberpunk .strip-overlay {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 245, 255, 0.06) 2px,
    rgba(0, 245, 255, 0.06) 4px
  );
  opacity: 0.8;
  animation: scanFlicker 4s linear infinite;
}
@keyframes scanFlicker {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.9; }
}

/* —— Fantasy —— */
body.theme-fantasy {
  --camera-filter: saturate(1.3) brightness(1.1) hue-rotate(20deg);
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Cormorant Garamond", Georgia, serif;
  --font-label: "Cormorant Garamond", Georgia, serif;
  --text-heading: #7d5a8c;
  --text-muted: #9a7da8;
  --text-body: #5c4a62;
  --paper: #f8f0fc;
  --cream: #fdf5ff;
  --cream-dark: #f3e8ff;
  --white-warm: #fffafc;
  --amber-deep: #9b6b9e;
  --amber-mid: #c9a0dc;
  --amber-warm: #e8b4d4;
  --paper-shadow: #e8b4d4;
  --accent: #c9a0dc;
  --accent-strong: #9b6b9e;
  --accent-glow: rgba(201, 160, 220, 0.6);
  --surface-card: #fdf5ff;
  --border-card: #e8b4d4;
  --btn-primary-bg: linear-gradient(165deg, #e8b4d4, #9b6b9e);
  --btn-primary-text: #fffafc;
  --viewfinder-bg: #5c4a62;
  --viewfinder-ring: #f3e8ff;
  --viewfinder-ring-outer: #e8b4d4;
  --countdown-color: #fdf5ff;
  --flash-color: #fffafc;
  --strip-bg: #fffafc;
  --strip-pad: 14px;
  --qr-dark: #5c4a62;
  --qr-light: #fffafc;
}

body.theme-fantasy .grain-global { opacity: 0.12; }
body.theme-fantasy .vignette {
  background: radial-gradient(ellipse 90% 80% at 50% 40%, transparent 50%, rgba(201, 160, 220, 0.2) 100%);
}
body.theme-fantasy .strip-container {
  padding: var(--strip-pad);
  background: var(--strip-bg);
  border: 2px solid #e8b4d4;
  box-shadow: 0 8px 32px rgba(155, 107, 158, 0.2);
}
body.theme-fantasy .strip-overlay {
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, rgba(232,180,212,0.9), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(201,160,220,0.8), transparent);
  background-size: 100% 100%;
  animation: sparkle 3s ease-in-out infinite;
}
@keyframes sparkle {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.85; }
}

/* —— Simple —— */
body.theme-simple {
  --camera-filter: grayscale(1) contrast(1.05);
  --font-display: "Instrument Sans", "DM Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-label: "DM Sans", system-ui, sans-serif;
  --text-heading: #111;
  --text-muted: #666;
  --text-body: #222;
  --paper: #f5f5f5;
  --cream: #fff;
  --cream-dark: #eee;
  --white-warm: #fff;
  --amber-deep: #111;
  --amber-mid: #333;
  --amber-warm: #999;
  --paper-shadow: #ddd;
  --accent: #333;
  --accent-strong: #000;
  --accent-glow: rgba(0, 0, 0, 0.15);
  --surface-card: #fff;
  --border-card: #ccc;
  --btn-primary-bg: #111;
  --btn-primary-text: #fff;
  --viewfinder-bg: #000;
  --viewfinder-ring: #fff;
  --viewfinder-ring-outer: #ccc;
  --countdown-color: #fff;
  --flash-color: #fff;
  --strip-bg: #fff;
  --strip-pad: 10px;
  --qr-dark: #111;
  --qr-light: #fff;
}

body.theme-simple .grain-global,
body.theme-simple .vignette { display: none; }
body.theme-simple .signage::before { display: none; }
body.theme-simple .strip-container {
  padding: var(--strip-pad);
  background: var(--strip-bg);
  border: 2px solid #111;
  box-shadow: none;
}
body.theme-simple .strip-overlay { display: none; }

/* Map legacy vars to theme tokens */
body[class*="theme-"] {
  color: var(--text-body);
  background-color: var(--paper);
  font-family: var(--font-body);
}
body[class*="theme-"] .booth-header__title,
body[class*="theme-"] .signage__title { color: var(--text-heading); font-family: var(--font-display); }
body[class*="theme-"] .booth-header__sub,
body[class*="theme-"] .hint,
body[class*="theme-"] .shot-indicator { color: var(--text-muted); font-family: var(--font-label); }
body[class*="theme-"] .btn--primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}
body[class*="theme-"] .viewfinder {
  background: var(--viewfinder-bg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), inset 0 0 0 4px var(--viewfinder-ring), inset 0 0 0 6px var(--viewfinder-ring-outer);
}
body[class*="theme-"] .countdown { color: var(--countdown-color); font-family: var(--font-display); }
body[class*="theme-"] .flash { background: var(--flash-color); }
body[class*="theme-"] .share-option__label { color: var(--text-heading); font-family: var(--font-display); }
body[class*="theme-"] .share-option { border-color: var(--border-card); background: var(--surface-card); }
