:root {
  --ink: #fffaf0;
  --muted: rgba(255, 250, 240, 0.64);
  --bg: #080808;
  --panel: #16120f;
  --accent: #f0c84b;
  --accent-dark: #c99f24;
  --line: rgba(255, 250, 240, 0.14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "DM Sans", "Avenir Next", ui-sans-serif, sans-serif;
  line-height: 1.45;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Join ---------- */

.join-shell {
  position: absolute;
  z-index: 5;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
}

.join-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.join-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(15, 14, 13, 0.25) 0%,
    rgba(15, 14, 13, 0.45) 45%,
    rgba(15, 14, 13, 0.94) 100%
  );
}

.join-content {
  position: relative;
  margin-top: auto;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 24px 24px calc(28px + var(--safe-bottom));
  text-align: center;
}

.join-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(240, 200, 75, 0.34);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(15, 14, 13, 0.55);
  backdrop-filter: blur(10px);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.join-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

#event-name {
  margin: 6px 0 0;
  font-size: clamp(2.2rem, 9vw, 3.1rem);
  font-weight: 900;
  line-height: 1.02;
}

.join-date {
  margin: 0;
  color: var(--muted);
  font-weight: 680;
}

.join-hint {
  max-width: 30ch;
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.42;
}

/* In-camera style filmstrip: a horizontal, swipeable row of live-baked
   swatches pinned to the bottom of the viewfinder. */
.cam-filmstrip {
  position: absolute;
  left: 0;
  right: 0;
  /* Sits in its own band above the torch/zoom/flip tools row, so the filter
     swatches never overlap the 1x/2x zoom controls. Hidden until the Filters
     tool is tapped. */
  bottom: calc(74px + var(--safe-bottom, 0px));
  z-index: 4;
  display: flex;
  gap: 10px;
  padding: 8px 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: linear-gradient(
    to top,
    rgba(10, 9, 8, 0.55),
    rgba(10, 9, 8, 0)
  );
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

.cam-filmstrip.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.cam-filmstrip::-webkit-scrollbar {
  display: none;
}

.photo-theme-picker button {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 250, 240, 0.72);
  scroll-snap-align: center;
}

.filter-swatch {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(15, 14, 13, 0.6);
  border: 2px solid rgba(255, 250, 240, 0.28);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: transform 140ms ease, border-color 140ms ease;
}

.filter-name {
  font-size: 0.66rem;
  font-weight: 850;
  white-space: nowrap;
}

.photo-theme-picker button.active .filter-swatch {
  border-color: var(--accent);
  transform: translateY(-2px) scale(1.06);
}

.photo-theme-picker button.active .filter-name {
  color: var(--accent);
}

.btn-primary {
  display: inline-flex;
  min-height: 54px;
  width: 100%;
  max-width: 420px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 14px 24px;
  color: #080808;
  background: var(--accent);
  font-size: 1.05rem;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
  transition: transform 140ms ease, background-color 140ms ease;
}

.btn-primary:active {
  background: var(--accent-dark);
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
}

.join-tip {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.join-how {
  max-width: 420px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: left;
}

.join-how summary {
  cursor: pointer;
  text-align: center;
  font-weight: 650;
  color: var(--muted);
}

.join-how p {
  margin: 10px 0 0;
  line-height: 1.5;
}

.join-how a {
  color: var(--ink);
  font-weight: 650;
}

.join-brand {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.join-qr {
  position: absolute;
  top: calc(var(--camful-shell-header-height, 82px) + 22px);
  right: 24px;
  display: none;
  justify-items: center;
  gap: 8px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.72);
  box-shadow: none;
}

.join-qr #join-qr-box img,
.join-qr #join-qr-box canvas {
  display: block;
  width: 122px !important;
  height: 122px !important;
  filter: invert(1);
  mix-blend-mode: screen;
}

@media (min-width: 900px) and (pointer: fine) {
  .join-qr {
    display: grid;
  }
}

.join-brand a {
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

/* ---------- Blocked ---------- */

.blocked-content {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: auto;
  max-width: 420px;
  padding: 24px;
  text-align: center;
}

.blocked-content h1 {
  margin: 0;
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  font-weight: 900;
  line-height: 1.05;
}

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

.demo-form {
  display: grid;
  width: 100%;
  max-width: 420px;
  gap: 10px;
}

.scene-pick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.scene-pick button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.88rem;
  font-weight: 800;
}

.scene-pick button.active {
  color: #080808;
  border-color: var(--accent);
  background: var(--accent);
}

.demo-form input {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 18px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  text-align: center;
}

.demo-form input:focus-visible {
  outline: 3px solid rgba(240, 200, 75, 0.62);
  outline-offset: 2px;
}

.demo-form .btn-primary {
  border: 0;
}

.demo-result {
  display: grid;
  width: 100%;
  max-width: 420px;
  justify-items: center;
  gap: 10px;
}

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

.demo-url {
  font-size: 0.82rem;
  word-break: break-all;
  opacity: 0.75;
}

.blocked-email {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.blocked-email a {
  color: var(--ink);
  font-weight: 780;
  text-decoration: none;
}

.btn-ghost-dark {
  display: inline-flex;
  min-height: 50px;
  width: 100%;
  max-width: 420px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

/* ---------- Camera ---------- */

#view-camera {
  background: var(--bg);
}

.cam-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 0 0 28px 28px;
  background: #000;
}

#cam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#cam-video.mirrored {
  transform: scaleX(-1);
}

.cam-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.cam-flash.fire {
  animation: flashfire 240ms ease-out;
}

@keyframes flashfire {
  0% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}

/* Live approximation of the baked filter effects, painted just above the
   video and below the camera UI. The captured photo and filmstrip swatches
   remain the exact source of truth; this only makes the live view honest. */
.cam-fx-overlay {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

/* Film grain: tiled procedural noise, intensity set per filter from JS. */
.cam-fx-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: var(--grain-opacity, 0);
  mix-blend-mode: overlay;
  background-size: 160px 160px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  transition: opacity 160ms ease;
}

/* Instant-film frame: a warm-white paper border with a thicker bottom lip. */
.cam-fx-overlay.has-frame {
  border: 14px solid #f7f2e7;
  border-bottom-width: 44px;
  border-radius: 8px;
}

.cam-topbar {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cam-event {
  display: grid;
  gap: 1px;
  overflow: hidden;
  max-width: calc(100% - 58px);
  border-radius: 999px;
  padding: 8px 14px 9px;
  background: rgba(8, 8, 8, 0.68);
  backdrop-filter: blur(10px);
}

.cam-event strong {
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 820;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cam-event span {
  overflow: hidden;
  color: rgba(255, 250, 240, 0.7);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cam-share {
  flex: 0 0 auto;
  background: rgba(8, 8, 8, 0.68);
}

.cam-shots {
  display: grid;
  min-width: 62px;
  min-height: 54px;
  place-content: center;
  border: 1px solid rgba(240, 200, 75, 0.28);
  border-radius: 16px;
  padding: 7px 9px;
  background: var(--panel);
  color: rgba(255, 250, 240, 0.62);
  font-size: 0.66rem;
  font-weight: 760;
  line-height: 1.05;
  text-align: center;
}

.cam-shots strong {
  color: var(--accent);
  font-size: 1.22rem;
  font-weight: 900;
  line-height: 1;
}

.cam-tools {
  position: absolute;
  right: 14px;
  bottom: 16px;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tool-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(15, 14, 13, 0.55);
  backdrop-filter: blur(10px);
}

.tool-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--ink);
}

.tool-btn.active svg {
  fill: var(--accent);
}

.zoom-seg {
  display: flex;
  gap: 4px;
  margin-inline: auto;
  border-radius: 999px;
  padding: 4px;
  background: rgba(15, 14, 13, 0.55);
  backdrop-filter: blur(10px);
}

.zoom-seg button {
  min-width: 44px;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 740;
}

.zoom-seg button.active {
  color: var(--accent);
  background: rgba(245, 241, 234, 0.14);
}

.cam-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 34px calc(18px + var(--safe-bottom));
}

.cam-save-state {
  display: flex;
  min-height: 32px;
  width: max-content;
  max-width: calc(100% - 32px);
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px auto 0;
  border: 1px solid rgba(255, 250, 240, 0.1);
  border-radius: 999px;
  padding: 7px 13px;
  background: rgba(255, 250, 240, 0.04);
  color: rgba(255, 250, 240, 0.62);
  font-size: 0.76rem;
  font-weight: 760;
}

.cam-save-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.4);
}

.cam-save-state[data-state="uploading"] {
  border-color: rgba(245, 189, 99, 0.42);
  background: rgba(245, 189, 99, 0.1);
  color: #f5bd63;
}

.cam-save-state[data-state="uploading"] .cam-save-dot {
  background: #f5bd63;
  animation: photo-status-pulse 1s ease-in-out infinite;
}

.cam-save-state[data-state="saved"] {
  border-color: rgba(240, 200, 75, 0.34);
  background: rgba(240, 200, 75, 0.08);
  color: var(--accent);
}

.cam-save-state[data-state="saved"] .cam-save-dot {
  background: var(--accent);
}

.cam-save-state[data-state="queued"] {
  border-color: rgba(245, 189, 99, 0.42);
  background: rgba(245, 189, 99, 0.1);
  color: #f5bd63;
}

.cam-save-state[data-state="queued"] .cam-save-dot {
  background: #f5bd63;
}

#btn-shutter {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  transition: transform 120ms ease;
}

#btn-shutter span {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #fff;
  transition: transform 120ms ease;
}

#btn-shutter:active span {
  transform: scale(0.86);
}

#btn-shutter:disabled {
  opacity: 0.5;
}

.side-btn {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
}

.side-btn svg {
  width: 26px;
  height: 26px;
  fill: var(--ink);
}

.thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Your photos ---------- */

#view-photos {
  overflow-y: auto;
  background: var(--bg);
  padding-bottom: calc(24px + var(--safe-bottom));
}

.photos-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: rgba(15, 14, 13, 0.92);
  backdrop-filter: blur(12px);
}

.photos-header .tool-btn {
  background: var(--panel);
}

.photos-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 900;
}

.btn-upload {
  margin-left: auto;
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--panel);
  font-size: 0.92rem;
  font-weight: 900;
  cursor: pointer;
}

.photos-meta {
  padding: 10px 18px 0;
}

.photos-meta h3 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1.05;
}

.stats {
  margin: 8px 0 0;
  color: var(--muted);
}

.stats strong {
  color: var(--ink);
}

.photos-note {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.roll-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(240, 200, 75, 0.24);
  border-radius: 15px;
  padding: 12px 13px;
  background: linear-gradient(135deg, rgba(240, 200, 75, 0.11), rgba(255, 250, 240, 0.03));
}

.roll-state-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(240, 200, 75, 0.12);
  font-size: 0.6rem;
}

.roll-state div {
  display: grid;
}

.roll-state strong {
  font-size: 0.86rem;
  font-weight: 900;
}

.roll-state div span,
.roll-state small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 680;
}

.roll-state small {
  max-width: 13ch;
  text-align: right;
}

.roll-state[data-state="open"] {
  border-color: rgba(240, 200, 75, 0.52);
  background: rgba(240, 200, 75, 0.14);
}

.photo-sync-summary {
  margin: 9px 2px 14px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 12px;
}

.photo-cell {
  position: relative;
  min-width: 0;
}

.photo-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  object-fit: cover;
  background: var(--panel);
}

.photo-grid .pending {
  opacity: 0.45;
}

.photo-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 14, 13, 0.72);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 820;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.photo-delete:disabled {
  opacity: 0.35;
}

.photo-status {
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 820;
  line-height: 1;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

.photo-status.uploading {
  color: #20160a;
  background: #f5bd63;
}

.photo-status.queued {
  color: var(--ink);
  background: rgba(15, 14, 13, 0.78);
}

.photo-status.saved {
  border: 1px solid rgba(240, 200, 75, 0.4);
  color: var(--accent);
  background: rgba(15, 14, 13, 0.82);
}

.photo-retry {
  position: absolute;
  right: 6px;
  bottom: 36px;
  border: 1px solid rgba(255, 250, 240, 0.35);
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(15, 14, 13, 0.86);
  color: var(--ink);
  font-size: 0.63rem;
  font-weight: 840;
  backdrop-filter: blur(8px);
}

.photo-retry:disabled {
  opacity: 0.65;
}

.developing-roll {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin: 12px 0 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.developing-stack {
  position: relative;
  width: 64px;
  height: 52px;
}

.developing-stack span {
  position: absolute;
  inset: 4px 10px;
  border: 2px solid rgba(255, 250, 240, 0.75);
  border-radius: 5px;
  background: linear-gradient(145deg, rgba(240, 200, 75, 0.48), rgba(255, 250, 240, 0.08));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.developing-stack span:first-child { transform: rotate(-8deg) translate(-5px, 2px); }
.developing-stack span:nth-child(2) { transform: rotate(7deg) translate(5px, 1px); }
.developing-stack span:last-child { transform: none; }

.developing-roll strong {
  font-size: 0.86rem;
  font-weight: 900;
}

.developing-roll p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.locked-roll-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: -3px 0 16px;
}

.locked-roll-tile {
  position: relative;
  display: grid;
  min-height: 112px;
  place-content: center;
  overflow: hidden;
  border: 1px solid rgba(240, 200, 75, 0.16);
  border-radius: 12px;
  padding: 14px;
  background:
    linear-gradient(rgba(8, 8, 8, 0.34), rgba(8, 8, 8, 0.78)),
    radial-gradient(circle at 25% 25%, rgba(240, 200, 75, 0.42), transparent 42%),
    linear-gradient(135deg, #39312a, #15120e 60%);
  text-align: center;
}

.locked-roll-tile:nth-child(2) {
  background:
    linear-gradient(rgba(8, 8, 8, 0.34), rgba(8, 8, 8, 0.78)),
    radial-gradient(circle at 72% 28%, rgba(128, 76, 190, 0.42), transparent 44%),
    linear-gradient(135deg, #30273b, #15120e 62%);
}

.locked-roll-tile:nth-child(3) {
  background:
    linear-gradient(rgba(8, 8, 8, 0.34), rgba(8, 8, 8, 0.78)),
    radial-gradient(circle at 30% 72%, rgba(58, 130, 115, 0.44), transparent 42%),
    linear-gradient(135deg, #213a34, #15120e 62%);
}

.locked-roll-tile:nth-child(4) {
  background:
    linear-gradient(rgba(8, 8, 8, 0.34), rgba(8, 8, 8, 0.78)),
    radial-gradient(circle at 74% 68%, rgba(190, 92, 54, 0.42), transparent 42%),
    linear-gradient(135deg, #422c25, #15120e 62%);
}

.locked-roll-lock {
  position: relative;
  width: 13px;
  height: 11px;
  margin: 7px auto 2px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(240, 200, 75, 0.24);
}

.locked-roll-lock::before {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 8px;
  left: 2px;
  height: 8px;
  border: 2px solid var(--accent);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.locked-roll-tile strong {
  margin-top: 5px;
  font-size: 0.75rem;
}

.locked-roll-tile small {
  margin-top: 3px;
  color: rgba(255, 250, 240, 0.64);
  font-size: 0.65rem;
  font-weight: 700;
}

.photo-status.uploading::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 999px;
  background: currentColor;
  vertical-align: baseline;
  animation: photo-status-pulse 1s ease-in-out infinite;
}

@keyframes photo-status-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.photos-empty {
  margin: 22px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 18px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Share sheet ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.sheet-panel {
  position: relative;
  border-radius: 16px 16px 0 0;
  padding: 20px 22px calc(26px + var(--safe-bottom));
  border-top: 1px solid rgba(240, 200, 75, 0.28);
  background: #0d0b09;
  color: var(--ink);
  box-shadow: 0 -24px 64px rgba(0, 0, 0, 0.54);
}

.sheet-panel::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.2);
  transform: translateX(-50%);
}

.sheet-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 16px;
}

.sheet-panel header > div {
  display: grid;
  gap: 2px;
}

.sheet-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.sheet-panel h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 850;
}

.btn-close {
  border-radius: 10px;
  padding: 9px 16px;
  background: rgba(255, 250, 240, 0.08);
  font-weight: 900;
}

.sheet-copy {
  margin: -7px 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.qr-event-name {
  margin: 0 auto 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: center;
}

.qr-frame {
  width: min(300px, 76vw);
  margin: 0 auto 16px;
  border: 1px solid rgba(240, 200, 75, 0.28);
  border-radius: 18px;
  padding: 12px;
  background: #fffaf0;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
}

.qr-box {
  display: grid;
  place-items: center;
  margin: 0 auto;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.qr-box img,
.qr-box canvas {
  width: 100% !important;
  height: auto !important;
  border-radius: 0;
  mix-blend-mode: multiply;
}

.sheet-actions {
  display: grid;
  gap: 10px;
}

.sheet-actions .btn-primary {
  max-width: none;
}

.sheet-panel .sheet-home-link {
  --camful-home-link-bg: rgba(255, 250, 240, 0.06);
  --camful-home-link-border: rgba(255, 250, 240, 0.14);
  --camful-home-link-color: var(--ink);
  --camful-home-link-dot: var(--accent);
  display: flex;
  width: max-content;
  margin: 14px auto 0;
}

.permission-panel {
  padding-bottom: calc(30px + var(--safe-bottom));
}

.permission-visual {
  display: flex;
  min-height: 110px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 2px 0 18px;
  border: 1px solid rgba(240, 200, 75, 0.22);
  border-radius: 18px;
  background: radial-gradient(circle at center, rgba(240, 200, 75, 0.14), transparent 68%);
}

.permission-visual .brand-mark {
  width: 54px;
  height: 42px;
}

.permission-arrow {
  color: var(--accent);
  font-size: 1.7rem;
  font-weight: 900;
}

.permission-lens {
  width: 56px;
  height: 56px;
  border: 8px solid rgba(255, 250, 240, 0.88);
  border-radius: 999px;
  box-shadow: inset 0 0 0 7px #15120e, inset 0 0 0 11px var(--accent);
}

.permission-allow {
  width: 100%;
  max-width: none;
}

.permission-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

body.modal-open {
  overflow: hidden;
}

/* ---------- Photo viewer / lightbox ---------- */

.photo-grid img,
.gallery-grid img {
  cursor: pointer;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.viewer-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}

.viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.viewer-close {
  position: absolute;
  z-index: 2;
  top: calc(12px + var(--safe-top));
  right: 14px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(20, 18, 16, 0.7);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 820;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.viewer-nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgba(20, 18, 16, 0.7);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 820;
  line-height: 1;
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
}

.viewer-prev {
  left: 12px;
}

.viewer-next {
  right: 12px;
}

.viewer-counter {
  position: absolute;
  z-index: 2;
  bottom: calc(16px + var(--safe-bottom));
  left: 50%;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(20, 18, 16, 0.7);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.btn-ghost {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(23, 22, 22, 0.22);
  border-radius: 10px;
  font-weight: 900;
}

.btn-ghost-dark {
  color: var(--ink);
  border-color: var(--line);
}

/* ---------- Gallery + publish themes ---------- */

#view-gallery {
  overflow-y: auto;
  background: var(--bg);
  padding-bottom: calc(24px + var(--safe-bottom));
}

.gallery-hero {
  position: relative;
  display: grid;
  min-height: min(58vh, 430px);
  align-items: end;
  margin: 14px 12px 16px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--panel);
}

.gallery-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 10px;
  margin: 0 18px 16px;
}

.gallery-actions .btn-primary,
.gallery-actions .btn-ghost {
  width: 100%;
  max-width: none;
  min-height: 48px;
}

.gallery-loading {
  columns: 2;
  column-gap: 6px;
  padding: 0 12px;
}

.gallery-loading span {
  display: block;
  min-height: 190px;
  margin: 0 0 6px;
  break-inside: avoid;
  border-radius: 10px;
  background: linear-gradient(105deg, var(--panel) 25%, rgba(255, 250, 240, 0.12) 42%, var(--panel) 60%);
  background-size: 220% 100%;
  animation: gallery-loading 1.25s ease-in-out infinite;
}

.gallery-loading span:nth-child(3n + 2) { min-height: 250px; }
.gallery-loading span:nth-child(4n) { min-height: 150px; }

@keyframes gallery-loading {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.gallery-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(15, 14, 13, 0.12),
    rgba(15, 14, 13, 0.86)
  );
}

.gallery-event-summary {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 24px 20px 22px;
}

.gallery-template-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-event-summary h3 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3.8rem);
  line-height: 0.96;
  text-wrap: balance;
  text-transform: uppercase;
}

.gallery-event-stats {
  margin: 9px 0 0;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.gallery-style-note {
  max-width: 46ch;
  margin: 10px 0 0;
  color: rgba(255, 250, 240, 0.76);
  font-size: 0.78rem;
  line-height: 1.45;
}

.gallery-style-note strong {
  color: #fffaf0;
}

.gallery-grid img {
  aspect-ratio: auto;
}

body.theme-classic-film #view-gallery {
  background: #f4ead8;
  color: #2b241c;
}

body.theme-classic-film #view-gallery .photos-header {
  background: rgba(244, 234, 216, 0.94);
  color: #2b241c;
}

body.theme-classic-film #view-gallery .stats {
  color: rgba(43, 36, 28, 0.6);
}

body.theme-classic-film .gallery-hero {
  box-shadow: 0 8px 26px rgba(43, 36, 28, 0.14);
}

body.theme-classic-film .gallery-grid img {
  border: 6px solid #fffdf7;
  border-bottom-width: 22px;
  border-radius: 2px;
  box-shadow: 0 6px 18px rgba(43, 36, 28, 0.18);
}

body.theme-editorial-dark #view-gallery {
  background: #000;
}

body.theme-editorial-dark #view-gallery .gallery-event-summary h3 {
  font-size: 2.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.theme-editorial-dark .gallery-grid img {
  border-radius: 0;
}

body.theme-soft-romantic #view-gallery {
  background: #faf3ef;
  color: #4a3f3c;
}

body.theme-soft-romantic #view-gallery .photos-header {
  background: rgba(250, 243, 239, 0.94);
  color: #4a3f3c;
}

body.theme-soft-romantic #view-gallery .gallery-event-summary h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}

body.theme-soft-romantic #view-gallery .stats {
  color: rgba(74, 63, 60, 0.6);
}

body.theme-soft-romantic .gallery-hero {
  box-shadow: 0 8px 26px rgba(74, 63, 60, 0.14);
}

body.theme-soft-romantic .gallery-grid img {
  border-radius: 18px;
}

body.theme-party-neon #view-gallery {
  background: #0b0714;
}

body.theme-party-neon #view-gallery .gallery-event-summary h3 {
  color: var(--accent);
}

body.theme-party-neon .gallery-grid img {
  border: 1px solid rgba(240, 200, 75, 0.55);
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(240, 200, 75, 0.25);
}

/* ---------- Toast + banner ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(110px + var(--safe-bottom));
  z-index: 20;
  max-width: 86vw;
  border-radius: 10px;
  padding: 11px 18px;
  background: rgba(255, 250, 240, 0.95);
  color: #080808;
  font-size: 0.92rem;
  font-weight: 720;
  text-align: center;
  transform: translateX(-50%);
}

/* ---------- Host / brand logo overlay ---------- */

.event-logo {
  display: block;
  width: auto;
  max-width: 45%;
  max-height: 40px;
  object-fit: contain;
}

.event-logo.hidden,
.event-logo[hidden] {
  display: none;
}

.join-logo {
  max-height: 56px;
  margin: 0 0 14px;
}

.cam-logo {
  max-height: 28px;
  max-width: 38%;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
}

/* Co-branded gallery banner: Camful mark + host logo/name + CTA. */
.gallery-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.gallery-banner .brand {
  color: var(--camful-ink, #fff8ec);
}

.gallery-cobrand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cobrand-sep {
  flex: 0 0 auto;
  width: 1px;
  height: 22px;
  background: rgba(255, 250, 240, 0.28);
}

.cobrand-logo {
  max-height: 30px;
  max-width: 150px;
  width: auto;
  object-fit: contain;
}

.cobrand-name {
  max-width: 38vw;
  overflow: hidden;
  color: var(--camful-ink, #fff8ec);
  font-size: 1rem;
  font-weight: 850;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cobrand-logo.hidden,
.cobrand-name.hidden {
  display: none;
}

.gallery-banner .nav-cta {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--camful-gold, #f0c84b);
  color: #1a1407;
  font-size: 0.92rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .gallery-banner .nav-cta {
    padding: 9px 12px;
    font-size: 0.82rem;
  }
  .cobrand-name {
    max-width: 30vw;
  }
}

/* ---------- Published gallery: masonry + motion ---------- */

.gallery-grid {
  display: block;
  column-count: 2;
  column-gap: 6px;
  padding: 0 12px;
}

@media (min-width: 720px) {
  .gallery-grid {
    column-count: 3;
  }
}

@media (min-width: 1080px) {
  .gallery-grid {
    column-count: 4;
  }
}

.gallery-grid img {
  width: 100%;
  margin: 0 0 6px;
  break-inside: avoid;
  border-radius: 10px;
  content-visibility: auto;
  contain-intrinsic-size: 360px 480px;
}

.g-reveal {
  animation: g-develop 520ms ease both;
}

@keyframes g-develop {
  from {
    transform: translateY(14px) scale(0.985);
    filter: saturate(0.7);
  }
  to {
    transform: none;
    filter: none;
  }
}

.gallery-hero img {
  animation: hero-drift 26s ease-in-out infinite alternate;
  transform-origin: center;
}

@keyframes hero-drift {
  from {
    transform: scale(1.06) translate(0, 0);
  }
  to {
    transform: scale(1.14) translate(-2%, -2%);
  }
}

/* Gallery styles are a presentation layer, independent from event scene and
   the camera filter. These selectors intentionally come after the legacy
   theme rules so old events keep working while new gallery_style values win. */
body.gallery-style-afterglow #view-gallery {
  background: #160f10;
  color: #fff7ee;
}

body.gallery-style-afterglow #view-gallery .photos-header {
  background: rgba(22, 15, 16, 0.94);
  color: #fff7ee;
}

body.gallery-style-afterglow #view-gallery .stats {
  color: rgba(255, 247, 238, 0.62);
}

body.gallery-style-afterglow .gallery-hero {
  border: 1px solid rgba(255, 230, 207, 0.18);
  border-radius: 4px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.38);
}

body.gallery-style-afterglow .gallery-grid {
  column-gap: 18px;
  padding: 12px 22px 36px;
}

body.gallery-style-afterglow .gallery-grid img {
  margin: 0 0 22px;
  border: 7px solid #f5eee4;
  border-bottom-width: 25px;
  border-radius: 2px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.42);
  rotate: -1.2deg;
}

body.gallery-style-afterglow .gallery-grid img:nth-child(3n + 2) {
  rotate: 1.5deg;
}

body.gallery-style-afterglow .gallery-grid img:nth-child(4n) {
  rotate: -0.35deg;
}

body.gallery-style-field-notes #view-gallery {
  background: #e8dfcf;
  color: #211e1a;
}

body.gallery-style-field-notes #view-gallery .photos-header {
  background: rgba(232, 223, 207, 0.95);
  color: #211e1a;
}

body.gallery-style-field-notes #view-gallery .stats {
  color: rgba(33, 30, 26, 0.62);
}

body.gallery-style-field-notes .gallery-hero {
  border-radius: 0;
  box-shadow: 10px 12px 0 rgba(33, 30, 26, 0.12);
}

body.gallery-style-field-notes .gallery-grid {
  column-gap: 10px;
  padding: 8px 16px 32px;
}

body.gallery-style-field-notes .gallery-grid img {
  margin: 0 0 10px;
  border: 8px solid #22201d;
  border-bottom-width: 18px;
  border-radius: 0;
  box-shadow: none;
}

body.gallery-style-electric-hours #view-gallery {
  background: #05070d;
  color: #fff;
}

body.gallery-style-electric-hours #view-gallery .photos-header {
  background: rgba(5, 7, 13, 0.94);
  color: #fff;
}

body.gallery-style-electric-hours #view-gallery .photos-meta h3 {
  color: #f0c84b;
  font-size: clamp(2rem, 6vw, 3.6rem);
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

body.gallery-style-electric-hours .gallery-hero {
  border: 1px solid rgba(91, 184, 255, 0.52);
  border-radius: 0;
  box-shadow:
    12px 12px 0 rgba(240, 200, 75, 0.18),
    -8px -8px 0 rgba(255, 76, 160, 0.14);
}

body.gallery-style-electric-hours .gallery-grid {
  column-gap: 12px;
  padding: 12px 16px 36px;
}

body.gallery-style-electric-hours .gallery-grid img {
  margin: 0 0 12px;
  border: 1px solid rgba(91, 184, 255, 0.58);
  border-radius: 0;
  box-shadow: 6px 6px 0 rgba(255, 76, 160, 0.16);
}

body.gallery-style-electric-hours .gallery-grid img:nth-child(3n + 2) {
  translate: 0 10px;
  border-color: rgba(240, 200, 75, 0.68);
}

@media (max-width: 620px) {
  body.gallery-style-afterglow .gallery-grid {
    column-gap: 10px;
    padding-inline: 14px;
  }

  body.gallery-style-afterglow .gallery-grid img {
    margin-bottom: 14px;
    border-width: 4px;
    border-bottom-width: 16px;
    rotate: -0.6deg;
  }

  body.gallery-style-afterglow .gallery-grid img:nth-child(3n + 2) {
    rotate: 0.7deg;
  }

  body.gallery-style-field-notes .gallery-grid img {
    border-width: 5px;
    border-bottom-width: 12px;
  }

  body.gallery-style-electric-hours .gallery-grid img:nth-child(3n + 2) {
    translate: 0 5px;
  }
}

body.mock-gallery .photos-meta,
body.mock-gallery .gallery-hero,
body.mock-gallery .gallery-grid {
  width: min(calc(100% - 24px), 1200px);
  margin-right: auto;
  margin-left: auto;
}

@media (min-width: 1080px) {
  body.mock-gallery .gallery-grid {
    column-count: 3;
  }
}

/* ---------- Lightbox polish ---------- */

.viewer:not(.hidden) {
  animation: viewer-in 200ms ease;
}

@keyframes viewer-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.viewer-backdrop {
  backdrop-filter: blur(10px);
}

.viewer-stage img {
  animation: viewer-zoom 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes viewer-zoom {
  from {
    transform: scale(0.92);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .g-reveal,
  .gallery-hero img,
  .gallery-loading span,
  .viewer:not(.hidden),
  .viewer-stage img {
    animation: none;
  }
}

.mode-banner {
  position: fixed;
  top: calc(64px + var(--safe-top));
  left: 50%;
  z-index: 5;
  width: max-content;
  max-width: 88vw;
  border-radius: 10px;
  padding: 8px 14px;
  background: rgba(240, 200, 75, 0.92);
  color: #080808;
  font-size: 0.8rem;
  font-weight: 740;
  text-align: center;
  transform: translateX(-50%);
}

#view-camera .mode-banner {
  top: auto;
}
