/* Guest gallery: warm charcoal + ember orange, editorial serif titles */
:root {
  --primary: #ff5c00;
  --primary-dark: #e04f00;
  --primary-soft: #fff1e8;
  --ink: #161d2a;
  --text: #1c1714;
  --muted: #776d66;
  --border: #ece6e1;
  --bg: #faf7f4;
  --card: #ffffff;
  --danger: #dc2626;
  --success: #10b981;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(22, 29, 42, 0.04), 0 12px 32px -12px rgba(22, 29, 42, 0.18);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-soft: #2b1a10;
    --text: #f4efea;
    --muted: #a69c94;
    --border: #2c2520;
    --bg: #110d0a;
    --card: #1a1512;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Hero ------------------------------------------------------------------ */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: var(--ink);
  padding: calc(56px + env(safe-area-inset-top)) 24px 88px;
  text-align: center;
}
.hero-bg {
  position: absolute;
  inset: -40px;
  background:
    radial-gradient(60% 70% at 85% 0%, rgba(255, 92, 0, 0.55), transparent 70%),
    radial-gradient(50% 60% at 0% 100%, rgba(255, 160, 80, 0.25), transparent 70%),
    var(--ink);
  transition: opacity 0.6s ease;
}
/* once the guest has photos, their first one becomes the backdrop */
.hero.has-cover .hero-bg {
  background:
    linear-gradient(180deg, rgba(22, 29, 42, 0.35) 0%, rgba(22, 29, 42, 0.85) 100%),
    var(--cover) center / cover no-repeat;
  filter: blur(18px) saturate(1.1);
  transform: scale(1.1);
}
.hero-inner { position: relative; max-width: 640px; margin: 0 auto; }
.hero h1 {
  font: 700 clamp(34px, 9vw, 52px)/1.05 var(--serif);
  letter-spacing: -0.5px;
  margin: 18px 0 10px;
  text-wrap: balance;
}
.hero-by {
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.me {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  padding: 3px;
  border-radius: 50%;
  background: conic-gradient(from 200deg, #ffb27a, var(--primary), #ffd2b0, var(--primary), #ffb27a);
  box-shadow: 0 10px 30px -8px rgba(255, 92, 0, 0.6);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.me img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--ink);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Layout ---------------------------------------------------------------- */
main {
  position: relative;
  max-width: 640px;
  margin: -56px auto 0;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
}
.view { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: var(--shadow);
}

h2 {
  font: 700 28px/1.15 var(--serif);
  letter-spacing: -0.2px;
  margin-bottom: 6px;
}
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; font-weight: 500; }
.center { display: flex; justify-content: center; padding: 56px 0; }
.center-text { text-align: center; }

/* Steps ----------------------------------------------------------------- */
.steps {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li + li::before {
  content: "";
  width: 28px;
  height: 1.5px;
  background: var(--border);
  margin-right: 2px;
}
.steps span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  border: 1.5px solid var(--border);
}
.steps .icon { width: 13px; height: 13px; stroke-width: 3; }
.steps .active { color: var(--text); }
.steps .active span { border-color: var(--primary); background: var(--primary); color: #fff; }
.steps .done span { border-color: var(--primary); color: var(--primary); }

/* Forms ----------------------------------------------------------------- */
form { display: grid; gap: 16px; margin-top: 22px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
input:not([type=checkbox]) {
  width: 100%;
  padding: 14px 16px;
  font: 16px var(--sans); /* 16px stops iOS zooming into the field */
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder { color: var(--muted); opacity: 0.7; }
input:not([type=checkbox]):focus {
  outline: none;
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 92, 0, 0.12);
}
.check {
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  font-weight: 400;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); }

.trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}
.trust .icon { width: 14px; height: 14px; }

/* Buttons --------------------------------------------------------------- */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  font: 600 16px var(--sans);
  color: #fff;
  background: linear-gradient(135deg, #ff7a2b, var(--primary) 55%, var(--primary-dark));
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px rgba(255, 92, 0, 0.6);
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
button:active, .button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
button.secondary {
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--border);
  box-shadow: none;
}
button.link {
  width: auto;
  padding: 10px;
  color: var(--muted);
  background: none;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
}
button.link.danger { display: block; margin: 32px auto 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.chip {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(22, 29, 42, 0.05);
}
.chip .icon { width: 15px; height: 15px; }
.selecting #select-toggle { color: #fff; background: var(--ink); border-color: var(--ink); }

.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Selfie ---------------------------------------------------------------- */
.selfie-stage {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 26px 0 22px;
}
.selfie-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  color: var(--primary);
  background: var(--primary-soft);
  overflow: hidden;
}
.selfie-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(255, 92, 0, 0.45);
  animation: spin 14s linear infinite;
}
.selfie-ring .icon { width: 64px; height: 64px; stroke-width: 1.5; }
.scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 2px;
  top: 20%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  box-shadow: 0 0 12px var(--primary);
  opacity: 0;
}
.scanning .scan-line { opacity: 1; animation: scan 1.4s ease-in-out infinite alternate; }
.scanning .selfie-ring::before { animation-duration: 2.5s; border-style: solid; }
@keyframes scan { to { top: 78%; } }
.selfie-status { font-size: 14px; font-weight: 600; color: var(--primary); }

/* Photos ---------------------------------------------------------------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -16px 14px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.photos-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.bar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.bar-actions button { white-space: nowrap; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 8px; } }
.tile {
  position: relative;
  width: 100%;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(110deg, var(--border) 30%, var(--card) 50%, var(--border) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
  box-shadow: none;
}
/* the best match leads, editorial-style */
.tile:first-child { grid-column: span 2; grid-row: span 2; }
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.5s ease, transform 0.6s ease;
}
.tile img.loaded { opacity: 1; transform: none; }
.tile:has(img.loaded) { animation: none; }
@keyframes shimmer { to { background-position: -300% 0; } }

.selecting .tile::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.2);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}
.tile.selected img { transform: scale(0.88); border-radius: 10px; }
.tile.selected { background: var(--primary-soft); animation: none; }
.selecting .tile.selected::after {
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.empty { text-align: center; }
.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  color: var(--primary);
  background: var(--primary-soft);
}
.empty-icon .icon { width: 28px; height: 28px; }

.select-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  gap: 8px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  animation: up 0.25s ease;
}
@keyframes up { from { transform: translateY(100%); } }
.select-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}
/* keep the last row of photos above the fixed bar */
body.selecting main { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }

.foot {
  padding: 8px 16px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.foot strong { font: italic 600 15px var(--serif); color: var(--text); letter-spacing: 0; }
.foot-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; opacity: .75; }
.foot-brand img { height: 22px; width: auto; padding: 5px 9px; border-radius: 8px; background: var(--ink); box-sizing: content-box; }

/* Viewer ---------------------------------------------------------------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: #0b0908;
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }
.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 8px;
}
.viewer-count { color: rgba(255, 255, 255, 0.7); font-size: 13px; font-weight: 500; letter-spacing: 1px; }
.viewer-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; }
.viewer-stage img { width: 100%; height: 100%; object-fit: contain; touch-action: pan-y; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); }
.nav.prev { left: 12px; }
.nav.next { right: 12px; }
.nav:disabled { opacity: 0; pointer-events: none; }
@media (hover: none) { .nav { display: none; } }
.viewer-actions { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.viewer-actions button { max-width: 480px; margin: 0 auto; display: flex; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
