@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/fonts/playfair-display.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("/fonts/playfair-display-italic.woff2") format("woff2");
}

:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2b2521;
  --ink-soft: #6b6058;
  --accent: #a9765b;
  --accent-ink: #ffffff;
  --border: #e8e0d6;
  --success: #4c8c62;
  --error: #c1543f;
  --radius: 14px;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Kills the grey/blue flash Safari and Chrome show on every tap. */
  -webkit-tap-highlight-color: transparent;
}

/* This site is used almost exclusively on phones (iOS Safari / Android
   Chrome) -- these rules are standard mobile hardening, not decorative. */
button,
.btn,
.grid-item,
.picker,
a {
  /* Removes the ~300ms tap delay and disables double-tap-to-zoom on
     interactive elements, so selecting photos in quick succession or
     tapping buttons feels immediate rather than laggy. */
  touch-action: manipulation;
}

.grid-item img {
  /* Stops iOS Safari's long-press "Save Image" callout from popping up
     over thumbnails, which otherwise fights with tap-to-select/tap-to-open
     and lets guests bypass the download flow via a long-press. */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.wrap-wide {
  max-width: 900px;
}

.header {
  position: relative;
  text-align: center;
  margin-bottom: 20px;
  padding-top: 34px;
}

.header h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 6px;
  position: relative;
  z-index: 1;
  color: var(--ink-soft);
}

.eyebrow {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.wedding-date {
  position: relative;
  z-index: 1;
  margin: 2px 0 16px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.subtitle {
  color: var(--ink-soft);
  margin: 0;
  font-size: 0.95rem;
  position: relative;
  z-index: 1;
}

/* Decorative header flourishes -- confetti, purely cosmetic. */
.confetti {
  position: absolute;
  inset: -10px 0 auto 0;
  height: 130px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.confetti-piece {
  position: absolute;
  top: -14px;
  left: var(--x, 50%);
  width: 7px;
  height: 12px;
  background: var(--color, var(--accent));
  opacity: 0;
  animation: confetti-fall var(--duration, 4s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.confetti-piece.confetti-round {
  border-radius: 50%;
  width: 8px;
  height: 8px;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  8% { opacity: 0.9; }
  90% { opacity: 0.7; }
  100% { transform: translateY(150px) rotate(var(--rot, 180deg)); opacity: 0; }
}

.corner-floral {
  position: absolute;
  top: -6px;
  width: 148px;
  z-index: 0;
  pointer-events: none;
}

.corner-floral img {
  width: 100%;
  height: auto;
  display: block;
}

.corner-floral-left {
  left: -8px;
}

.corner-floral-right {
  right: -8px;
}

.corner-floral-right img {
  transform: scaleX(-1);
}

@media (max-width: 420px) {
  .corner-floral {
    width: 108px;
  }
}


.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 20px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}

.picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 16px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.picker:active {
  border-color: var(--accent);
  background: #fbf4ee;
}

.picker-icon {
  font-size: 2rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 300;
}

.picker-text {
  font-weight: 600;
}

.picker-hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.upload-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.upload-item-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.upload-item.queued .progress-track {
  display: none;
}

.upload-thumb {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.remove-btn {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

.submit-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  justify-content: center;
}

/* Author styles beat the UA stylesheet's [hidden] rule regardless of
   specificity -- see the matching note on .lightbox above. */
.submit-bar[hidden] {
  display: none;
}

.submit-bar .submit-btn {
  width: 100%;
  max-width: 480px;
  border: none;
  font-size: 1rem;
  padding: 14px 18px;
  cursor: pointer;
}

.submit-bar .submit-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

body.has-submit-bar .wrap {
  padding-bottom: 96px;
}

.upload-thumb-fallback {
  font-size: 0.65rem;
  color: var(--ink-soft);
  text-align: center;
}

.upload-item-main {
  flex: 1;
  min-width: 0;
}

.upload-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caption-input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  /* iOS Safari auto-zooms the page when a focused input's font-size is
     under 16px -- this must stay at 1rem/16px or larger. */
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
  resize: none;
  overflow: hidden;
  min-height: 34px;
}

.caption-saved {
  display: block;
  font-size: 0.7rem;
  color: var(--success);
  height: 0;
  opacity: 0;
  margin-top: 0;
  transition: opacity 0.2s ease;
}

.caption-saved.show {
  opacity: 1;
  height: auto;
  margin-top: 3px;
}

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s ease;
}

.upload-item.done .progress-fill { background: var(--success); }
.upload-item.error .progress-fill { background: var(--error); }

.upload-item-status {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

.upload-item.error .upload-item-status { color: var(--error); }

.footer-link {
  text-align: center;
  margin-top: 28px;
}

.footer-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.gallery-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-plain {
  background: transparent;
  color: var(--ink-soft);
  padding: 10px 12px;
}

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

.grid-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--border);
  cursor: pointer;
}

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

.grid-item .video-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.7rem;
}

.grid-item .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 8px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hearting is the only selection mechanism -- always visible, persists
   across visits via localStorage, so a guest can browse at their own pace
   and mark favourites without committing to a download right away. */
.grid-item.hearted {
  outline: 3px solid #e3546a;
  outline-offset: -3px;
}

.grid-item .heart-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
}

.grid-item.hearted .heart-btn {
  background: rgba(0, 0, 0, 0.45);
  color: #e3546a;
}

.hearted-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hearted-bar.visible {
  display: flex;
}

.hearted-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.hearted-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.hearted-status {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

body.has-hearted-bar .wrap {
  padding-bottom: 100px;
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  margin-top: 40px;
}

/* PhotoSwipe (public/vendor/photoswipe) handles the modal/overlay/swipe
   mechanics itself -- these are just the custom bits we bolt on: a caption
   bar, a download link, and a wrapper so <video> slides sit centered and
   don't get cropped the way a zoomable photo would. */
.pswp-video-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pswp-video-wrap video {
  max-width: 100%;
  max-height: 100%;
}

.pswp-custom-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
  z-index: 10;
}

.pswp-custom-caption .pcc-guest {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
}

/* PhotoSwipe's top bar is a flex row with justify-content:flex-end, so
   everything naturally clusters at the right. PhotoSwipe's own built-in
   elements (counter, preloader, zoom, close) have order values 5/7/10/20 --
   our button was order:8, sandwiched between them, so it competed for space
   with whichever of those happened to be present for a given slide (video
   slides skip the zoom button, photos don't) and got squeezed by a
   different amount each time. Fix: order:-1 makes it the first flex item,
   and margin-right:auto eats all the row's free space at that point,
   pinning it to the left edge and leaving the rest of PhotoSwipe's buttons
   clustered on the right, untouched. */
.pswp__button--download {
  margin-right: auto;
  flex-shrink: 0;
  flex-grow: 0;
  width: auto;
  height: 60px;
  overflow: visible;
  padding: 0 14px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 60px;
  text-decoration: none;
  white-space: nowrap;
}

/* Deliberately NOT in the top toolbar -- a small icon among three others up
   there is too easy to miss entirely. Floats over the bottom-right of the
   photo instead: vertically centered on the right edge collided with
   PhotoSwipe's own next/prev arrows (also right/left-edge, vertically
   centered), and the bottom stays clear of those regardless of screen
   size. Sits above the caption bar with enough clearance for a couple of
   lines of caption text. */
.pswp__button--heart {
  position: absolute;
  right: 18px;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  overflow: visible;
}

.pswp__button--heart.is-hearted {
  color: #ff5c77;
  border-color: #ff5c77;
  background: rgba(0, 0, 0, 0.55);
}

.pswp__button--heart.pop {
  animation: heart-pop 0.35s ease;
}

@keyframes heart-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@media (max-width: 420px) {
  .pswp__button--heart {
    width: 54px;
    height: 54px;
    font-size: 1.7rem;
    right: 12px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1815;
    --card: #262019;
    --ink: #f2ece5;
    --ink-soft: #b3a99e;
    --border: #3a322b;
  }
}

/* Entry gate -- shown once per browser, never uses the `hidden` attribute
   (see the earlier notes on .lightbox / .submit-bar) so there's no
   author-vs-UA-stylesheet precedence trap here; visibility is controlled
   entirely by our own classes. */
#entry-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 16, 14, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

html.gate-pre-accepted #entry-gate,
#entry-gate.gate-dismissed {
  display: none;
}

body.gate-locked {
  overflow: hidden;
}

.gate-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 380px;
  text-align: center;
}

.gate-card h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 0 0 12px;
  color: var(--ink);
}

.gate-card p {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 22px;
}

.gate-actions {
  display: flex;
  gap: 10px;
}

.gate-actions button {
  flex: 1;
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

#gate-accept {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
}

#gate-decline {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border);
}
