:root {
  --ivory: #fbf7f1;
  --blush: #eccfcb;
  --blush-dark: #d9a5a0;
  --gold: #b8935a;
  --gold-light: #d9bd8b;
  --gold-dark: #8f6d3f;
  --ink: #4a3f35;
  --muted: #9c8d7d;
  --card: #fffdfa;
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--ivory);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(184, 147, 90, 0.07) 0, transparent 45%),
    radial-gradient(circle at 88% 92%, rgba(217, 165, 160, 0.10) 0, transparent 40%);
  background-attachment: fixed;
  color: var(--ink);
  padding-bottom: 40px;
}

h1, h2 { font-family: 'Playfair Display', Georgia, serif; margin: 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 44px 20px 34px;
  background: linear-gradient(160deg, var(--blush) 0%, var(--gold) 100%);
  color: #fff;
  border-radius: 0 0 40px 40px;
  box-shadow: 0 8px 24px rgba(143, 109, 63, 0.18);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1.4px);
  background-size: 26px 26px;
  opacity: 0.35;
  pointer-events: none;
}

.hero-inner { position: relative; }

.hero-eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: clamp(0.62rem, 2.6vw, 0.72rem);
  opacity: 0.92;
  font-weight: 600;
  white-space: nowrap;
}

.hero-names {
  font-family: 'Great Vibes', 'Playfair Display', cursive;
  font-weight: 400;
  font-size: clamp(2.3rem, 12vw, 3.4rem);
  line-height: 1.15;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
}

.hero-names .amp {
  font-size: 0.8em;
  opacity: 0.9;
  margin: 0 6px;
}

.hero-date {
  margin: 10px 0 0;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  opacity: 0.96;
}

/* ---------- Dividers ---------- */
.divider {
  display: block;
  width: 170px;
  height: 16px;
  margin: 10px auto;
  color: var(--gold);
}

.divider-light { color: rgba(255, 255, 255, 0.85); }

.section-heading {
  text-align: center;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 600;
}

/* ---------- Layout ---------- */
main {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px;
}

.install-banner {
  background: var(--card);
  border: 1px solid rgba(184, 147, 90, 0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  text-align: center;
}

.install-banner p {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--ink);
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  margin-left: 2px;
  color: var(--gold);
  cursor: pointer;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn svg { transition: transform 0.35s ease; }
.icon-btn:active svg { transform: rotate(180deg); }

/* ---------- Upload card ---------- */
.upload-card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(184, 147, 90, 0.22);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  box-shadow: 0 10px 30px rgba(74, 63, 53, 0.08);
  margin-bottom: 32px;
}

.corner-flourish {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 34px;
  height: 34px;
  color: var(--gold);
  opacity: 0.55;
}

.upload-intro {
  margin: 6px 0 18px;
  text-align: center;
  font-size: 1.02rem;
  color: var(--ink);
}

.name-field {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.name-field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid #e6dccb;
  font-size: 1rem;
  font-family: inherit;
  background: #fffdfb;
}

.name-field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 147, 90, 0.15);
}

.muted { color: var(--muted); }

.upload-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button { font-family: inherit; cursor: pointer; }

.btn-primary, .btn-secondary {
  flex: 1;
  min-width: 150px;
  padding: 14px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #fff;
  border: none;
  box-shadow: 0 6px 16px rgba(143, 109, 63, 0.28);
}

.btn-secondary {
  background: #fff;
  color: var(--gold-dark);
  border: 1.5px solid var(--gold);
}

.btn-primary:active, .btn-secondary:active { transform: scale(0.97); }

.upload-status {
  margin-top: 16px;
  font-size: 0.85rem;
}

.upload-row {
  padding: 7px 0;
  border-bottom: 1px dashed #eee0d3;
}

/* ---------- Gallery: scattered polaroid layout ---------- */
.gallery-grid {
  column-count: 2;
  column-gap: 14px;
}

.gallery-item {
  display: block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 16px;
  padding: 8px 8px 22px;
  background: #fffdfa;
  border: none;
  border-radius: 3px;
  box-shadow: 0 5px 16px rgba(74, 63, 53, 0.16);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  cursor: pointer;
}

.gallery-item:active {
  transform: rotate(0deg) scale(1.05);
  box-shadow: 0 10px 26px rgba(74, 63, 53, 0.24);
}

.gallery-item img {
  width: 100%;
  height: auto;
  border-radius: 2px;
  display: block;
}

.gallery-item.pop-in {
  animation: photoPopIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes photoPopIn {
  from {
    opacity: 0;
    transform: rotate(var(--tilt, 0deg)) scale(0.8) translateY(14px);
  }
  to {
    opacity: 1;
    transform: rotate(var(--tilt, 0deg)) scale(1) translateY(0);
  }
}

.hidden { display: none !important; }

/* ---------- Pull to refresh ---------- */
.pull-refresh-indicator {
  position: fixed;
  top: -50px;
  left: 0;
  right: 0;
  height: 50px;
  line-height: 50px;
  text-align: center;
  background: var(--card);
  color: var(--gold-dark);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 200;
  transform: translateY(0);
  transition: transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(74, 63, 53, 0.12);
}

/* ---------- Welcome / onboarding ---------- */
#welcome-screen { display: block; }
#app-content { display: none; }
html.is-onboarded #welcome-screen { display: none; }
html.is-onboarded #app-content { display: block; }

.welcome-card #welcome-name {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e6dccb;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 16px;
  text-align: center;
}

.btn-large {
  display: block;
  width: 100%;
  padding: 20px 16px;
  font-size: 1.1rem;
}

.name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 0;
  font-size: 0.85rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(28, 20, 15, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.lightbox img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-caption {
  color: #f4e9db;
  margin-top: 14px;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
}

/* --- Admin --- */
.admin-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

.admin-login {
  max-width: 320px;
  margin: 80px auto;
  background: var(--card);
  padding: 26px;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(74, 63, 53, 0.10);
  text-align: center;
  border: 1px solid rgba(184, 147, 90, 0.22);
}

.admin-login h2 { font-style: italic; margin-bottom: 6px; }

.admin-login input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid #e6dccb;
  font-size: 1rem;
  margin: 14px 0;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.admin-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #eee;
  aspect-ratio: 1 / 1;
  box-shadow: 0 3px 10px rgba(74, 63, 53, 0.10);
}

.admin-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-item .delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
}

.admin-item .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.7rem;
  padding: 4px 6px;
}

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