/* ============ TENNIS LOVE MATCH — THEME ============ */
:root {
  --purple: #2e1a47;
  --purple-deep: #1c1030;
  --green: #14532d;
  --grass: #1e6b3a;
  --ball: #d8f651;
  --ball-dark: #a8c22e;
  --cream: #f6f3ea;
  --white: #ffffff;
  --ink: #221733;
  --gold: #c9a227;
  --line: rgba(255, 255, 255, 0.28);
  --serif: "Playfair Display", serif;
  --sans: "Jost", sans-serif;
  --mono: "Space Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--purple-deep);
  color: var(--cream);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

.container { width: min(1080px, 90%); margin: 0 auto; }
.container.narrow { width: min(680px, 90%); }

section { position: relative; padding: 96px 0; }

/* ---------- Typography helpers ---------- */
.section-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  color: var(--ball);
  text-align: center;
  margin-bottom: 14px;
}
.section-eyebrow.light { color: var(--ball); }
.section-title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 28px;
}
.verse {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  text-align: center;
  color: var(--ball);
  margin-bottom: 22px;
  line-height: 1.6;
}
.body-text {
  text-align: center;
  font-weight: 300;
  line-height: 1.9;
  color: rgba(246, 243, 234, 0.85);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 14px 34px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.btn:active { transform: scale(0.96); }
.btn-ball {
  background: var(--ball);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(216, 246, 81, 0.35);
}
.btn-ball:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(216, 246, 81, 0.5); }
.btn-outline {
  border: 1px solid var(--cream);
  color: var(--cream);
  background: transparent;
}
.btn-outline:hover { background: var(--cream); color: var(--ink); }
.btn-outline-light {
  border: 1px solid var(--ball);
  color: var(--ball);
  background: transparent;
}
.btn-outline-light:hover { background: var(--ball); color: var(--ink); }
.btn-small { padding: 10px 22px; font-size: 0.68rem; background: var(--green); color: var(--cream); }
.btn-small:hover { background: var(--grass); }

/* ---------- Tennis ball (reusable) ---------- */
.ball {
  background: radial-gradient(circle at 32% 30%, #efff8f, var(--ball) 55%, var(--ball-dark));
  border-radius: 50%;
  position: relative;
  box-shadow: inset -6px -8px 14px rgba(0, 0, 0, 0.22), 0 10px 24px rgba(0, 0, 0, 0.35);
}
.ball::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  border: 2px solid transparent;
  border-left-color: #fff;
  border-right-color: #fff;
  transform: rotate(38deg);
}

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 400;
  background: var(--purple-deep);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-ball { width: 54px; height: 54px; animation: bounce 0.9s cubic-bezier(0.5, 0, 0.5, 1) infinite alternate; }
@keyframes bounce {
  0% { transform: translateY(-46px) scale(1); }
  90% { transform: translateY(22px) scale(1.04, 0.92); }
  100% { transform: translateY(24px) scale(1.08, 0.88); }
}
.loader-text { font-family: var(--mono); letter-spacing: 0.5em; font-size: 0.8rem; color: var(--ball); }

/* ---------- Serve transition ---------- */
#serveTransition { position: fixed; inset: 0; z-index: 300; pointer-events: none; display: none; }
#serveTransition.play { display: block; }
.serve-racket {
  position: absolute; left: -180px; bottom: 18%;
  width: 120px; height: 120px;
  border: 10px solid #e6dfcf;
  border-radius: 50%;
  background:
    repeating-linear-gradient(0deg, transparent 0 10px, rgba(255,255,255,0.55) 10px 11px),
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(255,255,255,0.55) 10px 11px),
    rgba(0, 0, 0, 0.12);
}
.serve-racket::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  width: 14px; height: 74px; background: #e6dfcf;
  transform: translateX(-50%);
  border-radius: 0 0 8px 8px;
}
.serve-ball { position: absolute; left: 6vw; bottom: 30%; width: 34px; height: 34px; opacity: 0; }
#serveTransition.play .serve-racket { animation: swing 1s ease-in forwards; }
#serveTransition.play .serve-ball { animation: ballfly 0.85s 0.38s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
@keyframes swing {
  0% { transform: translate(0, 0) rotate(-45deg); }
  55% { transform: translate(38vw, -12vh) rotate(25deg); }
  100% { transform: translate(52vw, -22vh) rotate(50deg); }
}
@keyframes ballfly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 1; transform: translate(120vw, -34vh) rotate(720deg); }
}

/* ---------- Cover ---------- */
#cover {
  position: fixed; inset: 0; z-index: 250;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(216, 246, 81, 0.08), transparent 55%),
    var(--purple-deep);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
#cover.opened { opacity: 0; visibility: hidden; }
.cover-frame {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  outline: 1px solid var(--line);
  outline-offset: 10px;
  padding: 56px 32px;
  text-align: center;
  background: rgba(46, 26, 71, 0.6);
  backdrop-filter: blur(6px);
}
.cover-eyebrow { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.4em; color: var(--ball); margin-bottom: 26px; }
.cover-ball { width: 44px; height: 44px; margin: 0 auto 22px; }
.cover-names { font-family: var(--serif); font-size: clamp(2.2rem, 7vw, 3.4rem); font-weight: 700; line-height: 1.15; }
.cover-names em { color: var(--ball); font-style: italic; }
.cover-tagline { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.35em; margin: 16px 0 34px; color: rgba(246,243,234,0.7); }
.cover-dear { font-size: 0.85rem; color: rgba(246,243,234,0.6); }
.cover-guest { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; margin: 6px 0 10px; color: var(--ball); }
.cover-note { font-size: 0.85rem; font-weight: 300; color: rgba(246,243,234,0.7); margin-bottom: 30px; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(216, 246, 81, 0.1), transparent 60%),
    linear-gradient(180deg, var(--green) 0%, var(--grass) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 120px 20px 140px;
}
.court-box { position: absolute; inset: 28px; border: 2px solid var(--line); pointer-events: none; }
.court-box::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 2px; background: var(--line); transform: translateX(-50%);
}
.court-box::after {
  content: ""; position: absolute; top: 50%; left: 0; right: 0;
  height: 2px; background: var(--line); transform: translateY(-50%);
}
.hero-eyebrow { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.45em; color: var(--ball); margin-bottom: 22px; }
.hero-names { font-family: var(--serif); font-size: clamp(2.4rem, 7vw, 4.6rem); font-weight: 700; line-height: 1.15; }
.hero-names span { color: var(--ball); font-style: italic; font-size: 0.6em; }
.hero-date { font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.25em; margin: 26px 0 34px; color: rgba(246,243,234,0.85); }
.hero-scroll {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.4em; color: rgba(246,243,234,0.55);
  animation: scrollHint 2s ease-in-out infinite;
}
@keyframes scrollHint { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

/* ---------- Opening ---------- */
#opening { background: var(--purple-deep); }

/* ---------- Couple ---------- */
#couple { background: var(--purple); }
.couple-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 28px;
  align-items: center;
  margin-top: 20px;
}
.player-card {
  background: var(--cream);
  color: var(--ink);
  border-radius: 18px;
  padding: 34px 28px;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}
.player-photo {
  width: 170px; height: 170px;
  margin: 0 auto 22px;
  border-radius: 50% 50% 46% 46%;
  overflow: hidden;
  border: 5px solid var(--green);
}
.player-photo img { width: 100%; height: 100%; object-fit: cover; }
.player-role { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.35em; color: var(--green); margin-bottom: 8px; }
.player-name { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; margin-bottom: 18px; }
.player-stats { list-style: none; text-align: left; margin-bottom: 22px; }
.player-stats li {
  font-size: 0.85rem; padding: 9px 0;
  border-bottom: 1px dashed rgba(34, 23, 51, 0.2);
}
.player-stats li span {
  display: block;
  font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.3em;
  color: var(--grass); margin-bottom: 3px;
}
.versus { text-align: center; font-family: var(--serif); }
.versus span { display: block; font-size: 1.6rem; font-style: italic; color: var(--ball); }
.versus i { font-style: normal; font-family: var(--mono); font-size: 0.8rem; color: rgba(246,243,234,0.6); }

/* ---------- Scoreboard ---------- */
#scoreboard { background: var(--purple-deep); }
.board {
  background: #0d0a14;
  border: 1px solid rgba(216, 246, 81, 0.35);
  border-radius: 12px;
  font-family: var(--mono);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(216, 246, 81, 0.12);
}
.board-head, .board-foot {
  text-align: center; padding: 12px;
  font-size: 0.62rem; letter-spacing: 0.3em;
  color: var(--ball);
  background: rgba(216, 246, 81, 0.07);
}
.board-row {
  display: grid;
  grid-template-columns: 1fr 44px 44px 44px 64px;
  padding: 14px 18px;
  font-size: 0.85rem;
  color: var(--cream);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.board-row span:not(:first-child) { text-align: center; }
.board-cols { font-size: 0.58rem; letter-spacing: 0.2em; color: rgba(246,243,234,0.45); }
.board-row .adv { color: var(--ball); font-weight: 700; }

/* ---------- Schedule ---------- */
#schedule { background: linear-gradient(180deg, var(--green), var(--purple-deep)); }
.countdown { text-align: center; margin-bottom: 56px; }
.countdown-label { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.35em; color: var(--ball); margin-bottom: 18px; }
.countdown-grid { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.cd-box {
  width: 92px; padding: 16px 0;
  background: rgba(13, 10, 20, 0.7);
  border: 1px solid rgba(216, 246, 81, 0.3);
  border-radius: 12px;
}
.cd-box b { display: block; font-family: var(--mono); font-size: 1.7rem; color: var(--ball); }
.cd-box span { font-size: 0.62rem; letter-spacing: 0.25em; text-transform: uppercase; color: rgba(246,243,234,0.6); }
.event-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 26px; }
.event-card {
  background: rgba(13, 10, 20, 0.55);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 38px 30px;
  text-align: center;
}
.event-tag { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.35em; color: var(--ball); margin-bottom: 14px; }
.event-card h3 { font-family: var(--serif); font-size: 1.4rem; margin-bottom: 16px; }
.event-date { font-weight: 500; }
.event-time { font-family: var(--mono); font-size: 0.8rem; color: var(--ball); margin: 6px 0 16px; }
.event-venue { font-size: 0.9rem; margin-bottom: 24px; }
.event-venue span { font-weight: 300; font-size: 0.8rem; color: rgba(246,243,234,0.65); }

/* ---------- RSVP ---------- */
#rsvp { background: var(--cream); color: var(--ink); }
#rsvp .section-title, #rsvp .section-eyebrow.light { color: var(--ink); }
#rsvp .section-eyebrow.light { color: var(--grass); }
.card-form {
  background: var(--white);
  border-radius: 18px;
  padding: 36px 30px;
  box-shadow: 0 24px 48px rgba(28, 16, 48, 0.12);
  display: flex; flex-direction: column; gap: 18px;
}
.card-form label { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--grass); display: flex; flex-direction: column; gap: 8px; }
.card-form input, .card-form select, .card-form textarea {
  font-family: var(--sans); font-size: 0.95rem;
  padding: 13px 16px;
  border: 1px solid rgba(34, 23, 51, 0.2);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  outline: none;
  transition: border 0.2s ease;
}
.card-form input:focus, .card-form select:focus, .card-form textarea:focus { border-color: var(--green); }
.form-status { font-family: var(--mono); font-size: 0.72rem; text-align: center; color: var(--green); min-height: 1em; }

/* ---------- Gift ---------- */
#gift { background: var(--purple); }
.gift-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; margin-top: 30px; }
.gift-card {
  background: rgba(13, 10, 20, 0.55);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 24px;
  text-align: center;
}
.gift-bank { font-family: var(--mono); letter-spacing: 0.35em; font-size: 0.7rem; color: var(--ball); margin-bottom: 12px; }
.gift-number { font-family: var(--mono); font-size: 1.25rem; margin-bottom: 6px; }
.gift-name { font-size: 0.8rem; font-weight: 300; color: rgba(246,243,234,0.65); margin-bottom: 18px; }

/* ---------- Gallery ---------- */
#gallery { background: var(--purple-deep); }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 220px;
  gap: 14px;
  margin-top: 10px;
}
.gallery-grid img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.35s ease, filter 0.35s ease;
}
.gallery-grid img:hover { transform: scale(1.03); filter: brightness(1.1); }
.gallery-grid img.tall { grid-row: span 2; }

/* ---------- Guestbook ---------- */
#guestbook { background: var(--purple); }
#guestbook .card-form { margin-bottom: 34px; }
.wish-list { display: flex; flex-direction: column; gap: 14px; max-height: 380px; overflow-y: auto; padding-right: 6px; }
.wish-item {
  background: rgba(13, 10, 20, 0.5);
  border-left: 3px solid var(--ball);
  border-radius: 10px;
  padding: 16px 20px;
}
.wish-item b { font-family: var(--serif); color: var(--ball); display: block; margin-bottom: 4px; }
.wish-item p { font-size: 0.88rem; font-weight: 300; color: rgba(246,243,234,0.85); }

/* ---------- Notes ---------- */
#notes { background: var(--green); }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin-top: 10px; }
.note-card {
  background: rgba(246, 243, 234, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 22px;
}
.note-card h4 { font-family: var(--serif); font-size: 1.1rem; color: var(--ball); margin-bottom: 10px; }
.note-card p { font-size: 0.85rem; font-weight: 300; line-height: 1.7; color: rgba(246,243,234,0.85); }

/* ---------- Closing ---------- */
#closing { background: var(--purple-deep); text-align: center; padding-bottom: 160px; }
.closing-ball { width: 56px; height: 56px; margin: 0 auto 30px; }
.closing-big {
  font-family: var(--serif);
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  line-height: 1.05;
  color: var(--ball);
  margin-bottom: 30px;
}
.closing-names { font-family: var(--serif); font-style: italic; font-size: 1.6rem; margin-top: 26px; }

footer {
  background: #0d0a14;
  text-align: center;
  padding: 26px 16px 110px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  color: rgba(246,243,234,0.4);
}

/* ---------- Bottom nav ---------- */
#bottomNav {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 150;
  display: flex; gap: 4px;
  background: rgba(13, 10, 20, 0.85);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 6px;
}
#bottomNav a {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: rgba(246,243,234,0.7);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}
#bottomNav a:hover { background: var(--ball); color: var(--ink); }

/* ---------- Music button ---------- */
#musicBtn {
  position: fixed; top: 18px; right: 18px; z-index: 160;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--ball);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}
#musicBtn.playing { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Lightbox ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 350;
  background: rgba(13, 10, 20, 0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
  cursor: zoom-out;
}
#lightbox img { max-width: 92%; max-height: 88vh; border-radius: 14px; border: 4px solid var(--cream); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  section { padding: 72px 0; }
  .couple-grid { grid-template-columns: 1fr; }
  .versus { padding: 6px 0; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 170px; }
  .board-row { grid-template-columns: 1fr 34px 34px 34px 52px; font-size: 0.72rem; padding: 12px 12px; }
  #bottomNav a { padding: 8px 9px; font-size: 0.55rem; }
  .court-box { inset: 14px; }
}

/* ---------- Add to Calendar ---------- */
.cal-actions { display: flex; justify-content: center; margin-top: 28px; }
.cal-btn { padding: 13px 26px; font-size: 0.7rem; letter-spacing: 0.15em; }
