/* ========================
   Anjali's Bridal Shower
   Soft pink theme
   ======================== */

:root {
  --blush-50:  #fff5f8;
  --blush-100: #fde6ee;
  --blush-200: #fbd0e1;
  --blush-300: #f6b2cc;
  --blush-400: #ef8fb3;
  --rose-500:  #d6568a;
  --rose-600:  #b93a6e;
  --plum-700:  #6d2246;
  --plum-900:  #3d1226;
  --gold:      #c9a46b;
  --cream:     #fffaf6;
  --shadow-sm: 0 4px 12px rgba(182, 58, 110, 0.08);
  --shadow-md: 0 10px 30px rgba(182, 58, 110, 0.12);
  --shadow-lg: 0 20px 50px rgba(182, 58, 110, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Lora', Georgia, serif;
  color: var(--plum-900);
  background:
    radial-gradient(circle at 20% 10%, #ffe6ef 0%, transparent 50%),
    radial-gradient(circle at 85% 80%, #ffd9e6 0%, transparent 55%),
    linear-gradient(180deg, var(--blush-50) 0%, var(--blush-100) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Subtle floral noise overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,0.4) 0, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.3) 0, transparent 2px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,0.3) 0, transparent 2px);
  background-size: 180px 180px, 240px 240px, 300px 300px;
  opacity: 0.6;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

/* ========================
   Typography
   ======================== */

h1, h2, h3 {
  font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  font-weight: 500;
  color: var(--plum-700);
  letter-spacing: 0.01em;
}

.script {
  font-family: 'Parisienne', 'Great Vibes', cursive;
  font-weight: 400;
  color: var(--rose-600);
}

a { color: var(--rose-600); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--plum-700); }

/* ========================
   Index / landing page
   ======================== */

.hero {
  text-align: center;
  padding: 90px 24px 40px;
  max-width: 900px;
  margin: 0 auto;
}

.hero .eyebrow {
  display: inline-block;
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-size: 11px;
  color: var(--rose-600);
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1.05;
  margin-bottom: 10px;
}

.hero .script-name {
  font-family: 'Parisienne', cursive;
  font-size: clamp(4.5rem, 10vw, 8rem);
  color: var(--rose-600);
  line-height: 1;
  display: block;
  margin: 6px 0 18px;
}

.hero .subtitle {
  font-style: italic;
  font-size: 1.15rem;
  color: var(--plum-700);
  max-width: 620px;
  margin: 0 auto 28px;
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 20px auto 40px;
  color: var(--rose-500);
}
.divider::before, .divider::after {
  content: "";
  flex: 0 0 90px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blush-300), transparent);
}
.divider .heart { font-size: 14px; }

/* Section labels */
.section-label {
  text-align: center;
  margin: 50px auto 24px;
  font-family: 'Parisienne', cursive;
  font-size: 2.5rem;
  color: var(--rose-600);
}

/* ========================
   Card grid
   ======================== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 44px 32px;
  max-width: 1180px;
  padding: 24px 32px 40px;
  margin: 0 auto;
}

.card {
  display: block;
  background: #fffdfb;
  padding: 14px 14px 46px 14px;
  border-radius: 2px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.08),
    0 12px 28px rgba(109, 34, 70, 0.18);
  transition: transform .35s ease, box-shadow .35s ease;
  color: inherit;
}

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--blush-100);
}

.card:nth-child(4n+1) { transform: rotate(-3deg); }
.card:nth-child(4n+2) { transform: rotate(2deg); }
.card:nth-child(4n+3) { transform: rotate(-1.5deg); }
.card:nth-child(4n+4) { transform: rotate(3deg); }

.card:hover {
  transform: rotate(0deg) scale(1.04);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.1),
    0 18px 40px rgba(109, 34, 70, 0.25);
  z-index: 2;
  position: relative;
}

/* ========================
   Letter page
   ======================== */

.letter-nav {
  padding: 24px 32px 0;
  max-width: 820px;
  margin: 0 auto;
}

.back-link {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--rose-600);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.back-link:hover { color: var(--plum-700); }

.letter {
  max-width: 820px;
  margin: 30px auto 70px;
  padding: 0 24px;
}

.letter-card {
  background: var(--cream);
  border-radius: 24px;
  padding: 50px clamp(26px, 6vw, 70px) 60px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(214, 86, 138, 0.1);
  position: relative;
}

.letter-header {
  text-align: center;
  margin-bottom: 36px;
}

.letter-header .relation {
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--rose-500);
  margin-bottom: 10px;
}

.letter-header .from {
  font-family: 'Parisienne', cursive;
  font-size: clamp(3rem, 7vw, 4.5rem);
  color: var(--rose-600);
  line-height: 1;
}

.letter-photos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin: 18px 0 48px;
  padding: 10px 6px;
}
.letter-photos.two { grid-template-columns: 1fr 1fr; }

.letter-photos img {
  width: calc(100% + 28px);
  height: auto;
  margin: 0 -14px;
  background: #fffdfb;
  padding: 14px 14px 54px 14px;
  border-radius: 2px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.08),
    0 12px 28px rgba(109, 34, 70, 0.18);
  display: block;
  transform: rotate(-2deg);
  transition: transform .4s ease;
}

.letter-photos img:hover {
  transform: rotate(0deg) scale(1.02);
}

.letter-photos.two img:first-child { transform: rotate(-3deg); }
.letter-photos.two img:last-child  { transform: rotate(2.5deg); }
.letter-photos.two img:first-child:hover,
.letter-photos.two img:last-child:hover { transform: rotate(0deg) scale(1.02); }

.letter-text {
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--plum-700);
}

.letter-text p { margin-bottom: 1.1em; }
.letter-text p:last-child { margin-bottom: 0; }

/* Audio player (WaveSurfer) */
.audio-wrap {
  text-align: center;
  padding: 18px 0 4px;
}

.ws-player {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fff5f8, #fde6ee);
  border-radius: 100px;
  box-shadow:
    0 2px 6px rgba(109, 34, 70, 0.08),
    0 10px 24px rgba(109, 34, 70, 0.12);
  border: 1px solid rgba(214, 86, 138, 0.14);
}
.ws-play {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--rose-500), var(--rose-600));
  color: #fff;
  box-shadow: 0 4px 10px rgba(185, 58, 110, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
  padding: 0;
}
.ws-play:hover  { transform: scale(1.06); box-shadow: 0 6px 14px rgba(185, 58, 110, 0.45); }
.ws-play:active { transform: scale(0.96); }
.ws-play svg    { width: 18px; height: 18px; fill: #fff; }
.ws-wave        { flex: 1; min-width: 0; height: 48px; }
.ws-time {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--rose-600);
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .ws-player { padding: 10px 14px; gap: 10px; }
  .ws-play   { flex-basis: 42px; width: 42px; height: 42px; }
  .ws-time   { min-width: 36px; font-size: 10px; }
  .ws-wave   { height: 42px; }
}

/* ========================
   Footer
   ======================== */

footer {
  text-align: center;
  padding: 36px 20px 44px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--rose-500);
}

footer .heart { color: var(--rose-600); font-size: 14px; }

/* ========================
   Responsive
   ======================== */

@media (max-width: 600px) {
  .hero { padding: 60px 20px 30px; }
  .grid { padding: 20px; gap: 40px 24px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .letter { margin: 20px auto 50px; }
  .letter-card { padding: 40px 22px 50px; }
  .section-label { font-size: 2rem; }

  /* Stacked polaroid pair on mobile */
  .letter-photos.two {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    grid-template-columns: initial;
    grid-template-rows: initial;
    gap: 0;
  }
  .letter-photos.two img {
    width: 58%;
    margin: 0;
    max-height: 320px;
  }
  .letter-photos.two img:first-child {
    margin-right: -14%;
    transform: rotate(-6deg);
    z-index: 1;
  }
  .letter-photos.two img:last-child {
    margin: 0;
    transform: rotate(5deg);
    z-index: 2;
  }
  .letter-photos.two img:first-child:hover,
  .letter-photos.two img:last-child:hover {
    transform: rotate(0deg) scale(1.02);
    z-index: 3;
  }

  /* Audio-letter pages: fit in a single mobile viewport */
  body.audio-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }
  body.audio-page .letter {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin: 14px auto 10px;
    padding: 0 16px;
    width: 100%;
  }
  body.audio-page .letter-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 28px 20px 24px;
  }
  body.audio-page .letter-header { margin-bottom: 14px; }
  body.audio-page .letter-header .from { font-size: 2.6rem; }
  body.audio-page .letter-photos {
    flex: 1;
    min-height: 0;
    margin: 4px 0 14px;
    padding: 8px 10px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  body.audio-page .letter-photos img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 10px 10px 38px 10px;
  }
  body.audio-page .letter-photos.two img {
    width: 58%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
  }
  body.audio-page .audio-wrap { padding: 0; }
  body.audio-page .audio-wrap .play-hint {
    font-size: 1.4rem;
    margin-bottom: 8px;
  }
  body.audio-page footer { padding: 12px 20px 14px; }
}

/* ========================
   Page loader
   (content stays hidden until images + audio are loaded)
   ======================== */

html.is-loading body > *:not(.page-loader) {
  opacity: 0;
  visibility: hidden;
}

html.is-loaded body > *:not(.page-loader) {
  animation: page-fade-in .7s ease both;
}

@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .6s ease, visibility .6s ease;
}

html.is-loaded .page-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader-heart {
  font-size: 2.4rem;
  color: var(--rose-500);
  animation: page-loader-pulse 1.2s ease-in-out infinite;
}

@keyframes page-loader-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.55; }
  50%      { transform: scale(1.15); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html.is-loaded body > *:not(.page-loader) { animation: none; }
  .page-loader-heart { animation: none; }
}
