/* ------------------------------------------------------------------ *
 * Wedding photo-sharing — mobile-first styles, no framework.
 * ------------------------------------------------------------------ */

:root {
  /* ================================================================ *
   *  BRAND PALETTE — edit these three to restyle the whole page.
   *  Every color below is derived from them.
   * ================================================================ */
  --primary:   #e22797;   /* main accent: buttons, links, highlights, underlines */
  --secondary: #fce9d2;   /* page background (soft cream) */
  --third:     #f3c8f3;   /* light pink: hairlines, tile/placeholder fills */
  --fourth:    #f3c8fc;   /* soft lilac-pink: photo-count badge */

  /* ---- Semantic tokens (mapped to the palette above) ---- */
  --bg: var(--secondary);
  --surface: #ffffff;
  --text: #34302c;
  --muted: #8a817a;
  --accent: var(--primary);
  --accent-dark: #b51f79;                                   /* fallback for old browsers */
  --accent-dark: color-mix(in srgb, var(--primary) 80%, #000);
  --line: var(--third);
  --shadow: 0 6px 22px rgba(60, 46, 35, 0.10);
  --radius: 16px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  /* Pink glow across the top of the whole page, fading down into the cream. */
  background-color: var(--bg);
  background-image: radial-gradient(130% 70vh at 50% 0%, var(--third) 0%, rgba(243, 200, 243, 0) 100%);
  background-repeat: no-repeat;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: transparent;
  line-height: 1.5;
}

/* ---------------------------- Hero ---------------------------- */
.hero {
  text-align: center;
  padding: clamp(1rem, 4vw, 1.75rem) 1.25rem clamp(0.9rem, 2.5vw, 1.25rem);
}

/* Headline row: runner — names — runner, all on one line. */
.hero-headline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.2rem, 2vw, 1rem);
  max-width: 44rem;
  margin: 0 auto;
}

.hero-runner {
  width: clamp(44px, 13vw, 120px);
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 14px rgba(226, 39, 151, 0.22));
}

.hero-names {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 5.5vw, 2.8rem);
  color: var(--text);
  margin: 0;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex: 0 1 auto;
}

/* Date flanked by two short rules, in the brand accent. */
.hero-date {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: clamp(0.78rem, 3.2vw, 1rem);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
  margin: 0.4rem 0 0;
}

.hero-date::before,
.hero-date::after {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--accent);
  opacity: 0.55;
}

/* ---------------------------- Layout -------------------------- */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

/* ------------------- Upload call-to-action card --------------- */
.cta {
  max-width: 34rem;
  margin: 0 auto 2rem;
  padding: clamp(1.25rem, 4vw, 1.75rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.cta-text {
  margin: 0 0 1.1rem;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.55;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 46px;
  padding: 0 1.25rem;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, transform 0.05s ease;
}

.upload-btn::before {
  content: "";
  width: 18px; height: 18px;
  background: currentColor;
  -webkit-mask: var(--camera-icon) center / contain no-repeat;
  mask: var(--camera-icon) center / contain no-repeat;
}

.upload-btn:active { transform: scale(0.99); }
.upload-btn:hover { background: var(--accent-dark); }
.upload-btn.is-disabled { opacity: 0.6; pointer-events: none; }

/* Make the upload card + button less dominant on phones. */
@media (max-width: 460px) {
  .cta { padding: 1rem 0.9rem; margin-bottom: 1.5rem; }
  .cta-text { font-size: 0.95rem; margin-bottom: 0.8rem; }
  .upload-btn { min-height: 42px; font-size: 0.92rem; padding: 0 1.05rem; gap: 0.4rem; }
  .upload-btn::before { width: 16px; height: 16px; }
}

/* camera glyph (inline SVG via mask, no extra request) */
:root {
  --camera-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 3l-1.8 2H4a2 2 0 00-2 2v11a2 2 0 002 2h16a2 2 0 002-2V7a2 2 0 00-2-2h-3.2L15 3H9zm3 5a5 5 0 110 10 5 5 0 010-10zm0 2a3 3 0 100 6 3 3 0 000-6z'/%3E%3C/svg%3E");
}

.upload-status { margin-top: 1rem; }

.progress {
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.upload-status.is-active .progress-bar {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.35) 25%, transparent 25%,
    transparent 50%, rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0.35) 75%, transparent 75%, transparent);
  background-size: 28px 28px;
  animation: stripes 0.8s linear infinite;
}

@keyframes stripes { from { background-position: 0 0; } to { background-position: 28px 0; } }

.status-text { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.95rem; text-align: center; }

.upload-success {
  margin-top: 1rem;
  text-align: center;
}

.success-text { margin: 0 0 0.4rem; font-weight: 600; color: var(--accent-dark); }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.3rem;
}

.closed-notice {
  text-align: center;
  color: var(--text);
}

/* ---------------------------- Gallery ------------------------- */
.gallery-section { margin-top: 1.5rem; }

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.55rem;
  margin-bottom: 1.1rem;
}

.gallery-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.25rem, 5vw, 1.9rem);
  text-align: left;
  margin: 0;
}

/* Soft lilac count pill, right-aligned in the header row (distinct from the button). */
.gallery-count {
  flex: 0 0 auto;
  color: var(--accent-dark);
  background: var(--fourth);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.3px;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  white-space: nowrap;
}

.gallery-empty { text-align: center; color: var(--muted); padding: 1.5rem 0; }

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 768px)   { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 1024px)  { .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  padding: 0;
  margin: 0;
  background: var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tile img.loaded { opacity: 1; }

/* --------------------------- Lightbox ------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 16, 12, 0.92);
  padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom);
}

.lightbox[hidden] { display: none; }

.lightbox-img {
  max-width: 100%;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 0.5rem);
  right: 1rem;
  width: 46px; height: 46px;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
