:root {
  --bg: #fcf8f3;
  --brand: #e6c3bb;
  --brand-dark: #d9afa6;
  --blush: #d9a7a0;
  --text: #3b2a20;
  --muted: #8a7566;
  --surface: #efe4d6;
  --surface-hover: #e5d5c2;
  --border: #dccbb8;
  --placeholder: #f1e2dc;
  --danger: #a8322d;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

[hidden] { display: none !important; }

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: rgba(252, 248, 243, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark em { font-style: normal; color: var(--brand); }

.event-name { flex: 1; max-width: 100%; min-width: 0; margin: 0; }
.event-name a { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; text-decoration: none; }
.event-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar-action {
  display: flex;
  width: 40px;
  height: 40px;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  border-radius: 50%;
  color: var(--muted);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.topbar-action svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.mark {
  width: 26px;
  height: 26px;
  background: var(--brand);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 28.5S3 20.8 3 11.6A7.1 7.1 0 0 1 16 7.7a7.1 7.1 0 0 1 13 3.9c0 9.2-13 16.9-13 16.9z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 28.5S3 20.8 3 11.6A7.1 7.1 0 0 1 16 7.7a7.1 7.1 0 0 1 13 3.9c0 9.2-13 16.9-13 16.9z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Layout */

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 12px calc(32px + env(safe-area-inset-bottom));
}

.page.narrow { max-width: 520px; }

.page.centered {
  min-height: calc(80vh - 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.hero {
  font-size: clamp(1.75rem, 6vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 8px;
}

.heading {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.lead { color: var(--muted); margin: 0 0 16px; max-width: 36em; }

.home-page {
  max-width: 1240px;
  padding: 32px 20px 48px;
}

.home-hero {
  display: grid;
  gap: 40px;
  align-items: center;
}

.home-copy { max-width: 620px; }

.home-eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.home-copy .hero {
  max-width: 12em;
  font-size: clamp(2.4rem, 10vw, 4.5rem);
  line-height: 0.98;
}

.home-lead {
  max-width: 36em;
  margin: 20px 0 24px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.home-cta {
  min-width: 200px;
  min-height: 56px;
  padding-inline: 28px;
}

.home-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 20px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  list-style: none;
}

.home-benefits li::before {
  content: '♥';
  margin-right: 6px;
  color: var(--brand-dark);
}

.home-collage {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 500px;
  max-width: 620px;
  margin: 0 auto;
}

.home-photo {
  position: absolute;
  overflow: hidden;
  margin: 0;
  border: 5px solid rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  background: var(--placeholder);
  box-shadow: 0 16px 40px rgba(59, 42, 32, 0.14);
}

.home-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-photo-wedding { top: 20px; left: 0; width: 58%; height: 220px; transform: rotate(-2deg); }
.home-photo-dog { top: 0; right: 0; width: 38%; height: 300px; transform: rotate(2.5deg); }
.home-photo-party { bottom: 8px; left: 5%; width: 47%; height: 220px; transform: rotate(1.5deg); }
.home-photo-birthday { right: 0; bottom: 24px; width: 44%; height: 170px; transform: rotate(-2deg); }

.home-bubble {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.45;
}

.home-bubble-one { top: 4px; left: 42%; width: 84px; height: 84px; }
.home-bubble-two { right: 35%; bottom: 0; width: 54px; height: 54px; background: #d8c8cf; }

.home-how {
  margin-top: 72px;
  padding: 36px 24px;
  border-radius: 32px;
  background: #fff;
}

.home-how > h2 {
  max-width: 12em;
  margin: 0;
  font-size: clamp(1.8rem, 7vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.home-steps { display: grid; gap: 12px; margin-top: 28px; }

.home-steps article {
  padding: 20px;
  border-radius: 22px;
  background: var(--bg);
}

.home-steps article > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  font-size: 0.8rem;
  font-weight: 800;
}

.home-steps h3 { margin: 16px 0 4px; font-size: 1.1rem; }
.home-steps p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.home-credit { margin: 24px 0 0; color: var(--muted); font-size: 0.72rem; text-align: center; }

@media (min-width: 800px) {
  .home-page { padding-top: 56px; }
  .home-hero { grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr); gap: 56px; }
  .home-copy .hero { font-size: clamp(3.2rem, 6vw, 5rem); }
  .home-how { margin-top: 96px; padding: 48px; }
  .home-steps { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: #fff;
  border-radius: 32px;
  padding: 24px;
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.1);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { background: var(--surface-hover); }
.btn.primary { background: var(--brand); color: var(--text); }
.btn.primary:hover, .btn.primary:active { background: var(--brand-dark); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.large { min-height: 56px; font-size: 1.05rem; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; }

.text-button {
  background: none;
  border: 0;
  padding: 8px;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}

.icon-button {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.error { color: var(--danger); margin: 8px 0; font-weight: 600; }
.notice { color: var(--muted); margin: 8px 0; }

/* Masonry gallery */

.gallery {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.masonry-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--placeholder);
}

.tile img {
  display: block;
  width: 100%;
  height: auto;
}

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background-color 0.15s;
}

.tile:hover::after { background: rgba(59, 42, 32, 0.15); }

.placeholder-tile {
  min-height: 150px;
  background-color: #e5b9aa;
  background-repeat: no-repeat;
  pointer-events: none;
}

.placeholder-tile::after { display: none; }

.placeholder-0 {
  background-image:
    radial-gradient(circle at 72% 28%, rgba(255,255,255,.3) 0 18%, transparent 18.5%),
    radial-gradient(circle at 16% 70%, rgba(255,244,238,.4) 0 10%, transparent 10.5%),
    linear-gradient(145deg, #b97866, #efd0c0 68%, #f7e4d8);
}

.placeholder-1 {
  background-image:
    radial-gradient(circle at 24% 18%, rgba(255,244,238,.38) 0 15%, transparent 15.5%),
    radial-gradient(circle at 88% 64%, rgba(255,255,255,.3) 0 12%, transparent 12.5%),
    linear-gradient(155deg, #e8c4b6, #f8e9df);
}

.placeholder-2 {
  background-image:
    radial-gradient(circle at 32% 66%, rgba(255,238,230,.4) 0 13%, transparent 13.5%),
    radial-gradient(circle at 78% 20%, rgba(255,255,255,.28) 0 9%, transparent 9.5%),
    linear-gradient(135deg, #8e584b, #c89482);
}

.placeholder-3 {
  background-image:
    radial-gradient(circle at 68% 46%, rgba(255,246,240,.42) 0 20%, transparent 20.5%),
    radial-gradient(circle at 18% 16%, rgba(255,255,255,.28) 0 8%, transparent 8.5%),
    linear-gradient(150deg, #d49e8c, #f2d8c9);
}

.gallery-sentinel { height: 1px; }

.empty { text-align: center; color: var(--muted); margin: 48px 0; }

@media (min-width: 600px) {
  .page { padding-left: 16px; padding-right: 16px; }
  .gallery, .masonry-column { gap: 16px; }
}

/* Event page */

.page.event { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }

.add-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  pointer-events: none;
}

.add-button {
  pointer-events: auto;
  width: min(100%, 360px);
  min-height: 56px;
  font-size: 1.1rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.add-button .plus { font-size: 1.5rem; font-weight: 400; line-height: 1; }
.add-button.disabled { opacity: 0.5; pointer-events: none; }

.upload-status {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 11;
  width: min(44vw, 180px);
  transform: translateX(-50%);
  color: #fff;
}

.upload-status.has-errors {
  width: min(calc(100% - 32px), 420px);
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--text);
  box-shadow: 0 4px 18px rgba(59, 42, 32, 0.24);
}

.upload-progress-line {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(59, 42, 32, 0.22);
}

.upload-progress-line span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-dark);
  transition: width 0.2s ease;
}

.upload-status.has-errors .upload-progress-line {
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.2);
}

.upload-status-row { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 28px; }
.upload-status p { margin: 0; font-size: 0.9rem; font-weight: 700; }
.upload-status:not(.has-errors) .upload-status-row { display: none; }
.upload-status .icon-button { background: rgba(255, 255, 255, 0.15); color: #fff; }

.upload-errors { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; color: #ffb4b4; }
.upload-errors:not(:empty) { margin-top: 8px; }
.upload-errors li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.upload-errors .text-button { color: #fff; }

/* Photo page */

.pin {
  position: relative;
  max-width: 1016px;
  margin: 0 auto 32px;
  border-radius: 32px;
  overflow: hidden;
  background: #fff;
}

.pin-image {
  height: clamp(360px, 112vw, 620px);
  margin: 0;
  padding-top: 20px;
  background: #fff;
}

.photo-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  touch-action: pan-y;
}

.pin-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pin-side { display: flex; flex-direction: column; gap: 12px; padding: 20px 24px 24px; }

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.actions .btn {
  min-width: 0;
  padding-inline: 4px;
  font-size: clamp(0.75rem, 3.5vw, 1rem);
  white-space: nowrap;
}

.actions .all-photos { background: #d8c8cf; }
.actions .all-photos:hover, .actions .all-photos:active { background: #cdb9c2; }

.overflow-menu {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
}

.overflow-menu summary {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 12px rgba(59, 42, 32, 0.15);
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.overflow-menu summary::-webkit-details-marker { display: none; }

.menu-dots {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: -5px 0 currentColor, 5px 0 currentColor;
}

.overflow-menu-items {
  position: absolute;
  top: 36px;
  right: 0;
  width: max-content;
  min-width: 210px;
  overflow: hidden;
  padding: 6px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(59, 42, 32, 0.2);
}

.overflow-menu-items button {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.overflow-menu-items button:hover { background: var(--bg); color: var(--text); }

@media (min-width: 900px) {
  .pin { display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
  .pin-image { height: 620px; padding-top: 32px; overflow: hidden; }
  .pin-side { padding: 32px; }
}

.more-heading { text-align: center; font-size: 1.25rem; font-weight: 800; margin: 0 0 16px; }

dialog {
  width: min(92vw, 400px);
  border: 0;
  border-radius: 24px;
  padding: 24px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.dialog-message { margin: 0 0 16px; font-size: 1.1rem; font-weight: 700; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Forms */

dialog input, .form input {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

dialog input:focus, .form input:focus { outline: none; border-color: var(--blush); box-shadow: 0 0 0 4px rgba(217, 167, 160, 0.35); }

.form { display: flex; flex-direction: column; gap: 18px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 700; }
.form small { color: var(--muted); font-weight: 400; }

.created { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.event-link { font-size: 1.1rem; font-weight: 700; color: var(--brand); word-break: break-all; }
.qr { width: 240px; height: 240px; margin: 8px auto 16px; display: block; }

/* QR page */

.qr-page {
  display: grid;
  min-height: calc(100vh - 64px);
  place-items: center;
  padding-block: 24px;
}

.qr-card {
  width: min(100%, 520px);
  padding: clamp(24px, 6vw, 44px);
  border: 1px solid rgba(230, 195, 187, 0.5);
  border-radius: 36px;
  background:
    radial-gradient(circle at 8% 8%, rgba(230, 195, 187, 0.32) 0 8%, transparent 8.5%),
    radial-gradient(circle at 92% 88%, rgba(216, 200, 207, 0.35) 0 11%, transparent 11.5%),
    #fff;
  box-shadow: 0 16px 50px rgba(59, 42, 32, 0.12);
  text-align: center;
}

.qr-eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.qr-card .lead { margin-inline: auto; }

.qr-frame {
  width: min(100%, 320px);
  margin: 22px auto 16px;
  padding: 16px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(59, 42, 32, 0.12);
}

.qr-display { display: block; width: 100%; height: auto; }

.qr-event-link {
  display: block;
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  word-break: break-word;
}

.qr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
