/* Warm, comfy, big-print styling shared by all pages. */

:root {
  --cream: #fdf8f2;
  --card: #ffffff;
  --rose: #c98a8a;
  --rose-dark: #b06f6f;
  --blush: #f6e3e0;
  --leaf: #96a888;
  --leaf-fill: #b9c7ae;
  --brown: #5c4438;
  --brown-soft: #8a7264;
  --shadow: 0 6px 24px rgba(92, 68, 56, 0.12);

  /* Hand-drawn rose spray used to frame the pages (line-art SVG). */
  --rose-spray: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 90'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M14 86 Q30 60 42 47' stroke='%2396a888' stroke-width='2.5'/%3E%3Cpath d='M25 69 Q13 60 20 50 Q32 56 25 69 Z' fill='%23b9c7ae' stroke='%2396a888' stroke-width='1.5'/%3E%3Cpath d='M33 59 Q46 64 43 75 Q30 72 33 59 Z' fill='%23b9c7ae' stroke='%2396a888' stroke-width='1.5'/%3E%3Cpath d='M52 38 c2-5 9-4 9 1 0 6-8 8-12 4 -5-5-1-13 6-14 9-1 15 6 13 14 -2 9-12 13-20 9 -9-4-11-15-5-22' stroke='%23c98a8a' stroke-width='2.4'/%3E%3Cpath d='M39 19 q8-6 16-4 M66 22 q6 4 7 12' stroke='%23d8a3a3' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  min-height: 100vh;
  /* A soft blush glow behind the header, fading into cream. */
  background:
    radial-gradient(ellipse 120% 55% at 50% -10%, var(--blush) 0%, rgba(246, 227, 224, 0) 70%),
    var(--cream);
  color: var(--brown);
  font-family: Georgia, 'Times New Roman', serif;
  text-align: center;
}

/* Content sits above the falling petals. */
header,
main,
footer {
  position: relative;
  z-index: 1;
}

header {
  padding: 1.6rem 1rem 0.4rem;
}

/* Rose sprays framing the top corners of every page. */
header::before,
header::after {
  content: '';
  position: absolute;
  top: 6px;
  width: 74px;
  height: 74px;
  background: var(--rose-spray) center / contain no-repeat;
  pointer-events: none;
}

header::before {
  left: 10px;
}

header::after {
  right: 10px;
  transform: scaleX(-1);
}

h1 {
  /* Scales down on narrow phones so long names stay on one line. */
  font-size: clamp(1.3rem, 7.5vw, 2.2rem);
  margin: 0;
  font-weight: normal;
  letter-spacing: 0.02em;
}

.subtitle {
  color: var(--brown-soft);
  font-size: 1.15rem;
  margin: 0.5rem 0 0;
}

/* The "❦ ❦ ❦" text is swapped for a drawn rose-and-vine divider. */
.divider {
  font-size: 0;
  height: 30px;
  margin: 0.9rem auto;
  max-width: 260px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 30'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M8 15 H92 M148 15 H232' stroke='%23dcc3b4' stroke-width='1.6'/%3E%3Cpath d='M56 15 q6 -9 13 0 Z' fill='%23b9c7ae' stroke='%2396a888' stroke-width='1.3'/%3E%3Cpath d='M184 15 q-6 9 -13 0 Z' fill='%23b9c7ae' stroke='%2396a888' stroke-width='1.3'/%3E%3Cpath d='M121 15 c1-3 5-2 5 1 0 3-4 4-6 2 -3-3 0-7 4-7 5 0 8 4 6 8 -2 4-8 5-11 2 -4-3-3-9 1-11' stroke='%23c98a8a' stroke-width='1.9'/%3E%3C/g%3E%3C/svg%3E")
    center / contain no-repeat;
  user-select: none;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.2rem 3rem;
}

.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1.6rem 1.3rem;
  margin: 1rem 0;
}

.invite {
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 0 0 1.4rem;
}

/* Big friendly buttons */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 1.15rem 1.4rem;
  font-size: 1.35rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--rose);
  box-shadow: var(--shadow);
  margin: 0.8rem 0;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
  background: var(--rose-dark);
}

.btn.secondary {
  background: #fff;
  color: var(--brown);
  border: 2px solid #eaddd3;
}

.btn.secondary:active {
  background: #f7efe8;
}

.hint {
  color: var(--brown-soft);
  font-size: 1rem;
  line-height: 1.5;
}

/* Photo preview on the guest page */
.preview {
  width: 100%;
  max-height: 55vh;
  object-fit: contain;
  border-radius: 16px;
  background: #f2eae2;
}

input[type='text'],
input[type='password'] {
  width: 100%;
  font-size: 1.2rem;
  font-family: inherit;
  padding: 0.9rem 1rem;
  border: 2px solid #eaddd3;
  border-radius: 14px;
  margin: 0.7rem 0;
  text-align: center;
  color: var(--brown);
  background: #fffdfb;
}

input[type='text']:focus,
input[type='password']:focus {
  outline: none;
  border-color: var(--rose);
}

/* Gallery grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 1rem;
}

.grid a {
  display: block;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #f2eae2;
}

.grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.grid .who {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(60, 40, 30, 0.65));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Fullscreen photo viewer */
.viewer {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 15, 0.94);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 0.8rem;
}

.viewer.open {
  display: flex;
}

.viewer img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 12px;
  /* When the gallery knows the photo's shape (--ratio), the photo fills the
     same space whether the small or the sharp copy is showing. */
  width: min(100%, calc(72vh * var(--ratio)));
  aspect-ratio: var(--ratio, auto);
}

.viewer .caption {
  color: #f5e9df;
  font-size: 1.1rem;
  margin: 0.8rem 0 0.4rem;
}

.viewer .row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.6rem;
}

.viewer .btn {
  width: auto;
  margin: 0;
  padding: 0.8rem 1.5rem;
  font-size: 1.1rem;
}

.spinner {
  width: 52px;
  height: 52px;
  margin: 1.4rem auto;
  border: 5px solid #f0e4da;
  border-top-color: var(--rose);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.big-emoji {
  font-size: 4rem;
  margin: 0.6rem 0;
}

footer {
  padding: 1rem;
  color: var(--brown-soft);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

/* Off screen but still "there", so a tap on its <label> opens it. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

label.btn {
  -webkit-user-select: none;
  user-select: none;
}

/* ------------------------------------------------------------------ */
/* Kinetic header type (driven by decor.js)                            */
/* ------------------------------------------------------------------ */

/* Each word is one unbreakable unit, so names never split mid-word. */
h1 .word {
  display: inline-block;
}

/* Title letters rise into place, one beat after the last. */
h1 .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.45em);
  transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

body.kinetic-in h1 .ch {
  opacity: 1;
  transform: translateY(0);
}

/* Subtitle drifts into focus once the names have landed. */
.subtitle.kinetic {
  opacity: 0;
  filter: blur(8px);
  transition: opacity 0.8s ease 0.9s, filter 0.8s ease 0.9s;
}

body.kinetic-in .subtitle.kinetic {
  opacity: 1;
  filter: blur(0);
}

/* An ink stroke draws itself beneath the names. */
.ink-underline {
  display: block;
  width: min(240px, 60vw);
  height: 18px;
  margin: 0.2rem auto 0;
}

.ink-underline path {
  fill: none;
  stroke: var(--rose);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  transition: stroke-dashoffset 1.1s ease 1s;
}

body.kinetic-in .ink-underline path {
  stroke-dashoffset: 0;
}

@media (prefers-reduced-motion: reduce) {
  .ink-underline path {
    stroke-dashoffset: 0;
    transition: none;
  }
}

/* Gallery photos rise in on first load (delays set inline). */
.grid a.rise {
  animation: grid-rise 0.45s ease backwards;
}

@keyframes grid-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .grid a.rise {
    animation: none;
  }
}

/* ------------------------------------------------------------------ */
/* Falling rose petals (spawned by decor.js)                           */
/* ------------------------------------------------------------------ */

.petal-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.petal {
  position: absolute;
  top: -30px;
  background: radial-gradient(circle at 30% 30%, #f2ccc9, #d89d9d);
  border-radius: 80% 10% 80% 10%;
  animation: petal-fall linear infinite;
  will-change: transform;
}

@keyframes petal-fall {
  0% {
    transform: translate3d(0, -4vh, 0) rotate(10deg);
  }
  25% {
    transform: translate3d(4vw, 24vh, 0) rotate(95deg);
  }
  50% {
    transform: translate3d(-3vw, 50vh, 0) rotate(170deg);
  }
  75% {
    transform: translate3d(3vw, 76vh, 0) rotate(250deg);
  }
  100% {
    transform: translate3d(-2vw, 106vh, 0) rotate(330deg);
  }
}

@media print {
  .petal-layer {
    display: none;
  }
}

/* Keep the corner sprays clear of the title on small phones. */
@media (max-width: 430px) {
  header {
    padding-left: 3.2rem;
    padding-right: 3.2rem;
  }

  header::before,
  header::after {
    width: 56px;
    height: 56px;
    top: 2px;
  }

  header::before {
    left: 2px;
  }

  header::after {
    right: 2px;
  }
}
