/*
Top-of-file notes:
- Colors, spacing, and typography are controlled via CSS variables in :root.
- Replace images by editing the <img> src attributes in `index.html`.
- Optional audio: see the comment in `index.html`.
*/

/* CSS Variables: Tweak theme easily */
:root {
  --color-bg: #fffaf3; /* soft cream */
  --color-surface: #ffffff; /* white */
  --color-text: #1f2937; /* slate-800 */
  --color-muted: #6b7280; /* slate-500 */
  --color-accent: #b58b2a; /* subtle gold */
  --color-accent-weak: #e9d79e; /* light gold */
  --color-border: #e5e7eb; /* gray-200 */
  --color-border-gold: rgba(181,139,42,0.35);

  --radius-sm: 8px;
  --radius-md: 14px;

  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.08);

  --max-w: 1000px;
}

/* Base Reset */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; }

/* Utilities */
.container {
  width: min(var(--max-w), 92vw);
  margin: 0 auto;
}
.main { position: relative; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* Header */
.site-header { min-height: var(--space-3); }

/* Hero */
.hero {
  padding: var(--space-7) var(--space-4) var(--space-6);
  text-align: center;
  position: relative; /* create stacking context for content above decor */
}
.anim-chars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0; /* keep decorative hearts behind text/content */
}
.anim {
  position: absolute;
  width: 68px;
  height: 68px;
  opacity: 0.75;
  animation-duration: 9s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}
.anim--heart:nth-child(1) { left: 6%; top: 6%; animation-name: floatUp1; }
.anim--heart:nth-child(2) { right: 8%; top: 12%; animation-name: floatUp2; }
.anim--heart:nth-child(3) { left: 10%; bottom: 8%; animation-name: glide1; opacity: 0.6; }
.anim--heart:nth-child(4) { right: 10%; bottom: 12%; animation-name: glide2; opacity: 0.6; }

@keyframes floatUp1 {
  0% { transform: translateY(0) scale(1); opacity: 0.0; }
  10% { opacity: 0.7; }
  50% { transform: translateY(-18px) scale(1.06); }
  100% { transform: translateY(0) scale(1); opacity: 0.0; }
}
@keyframes floatUp2 {
  0% { transform: translateY(0) scale(1); opacity: 0.0; }
  15% { opacity: 0.7; }
  50% { transform: translateY(-22px) scale(1.05); }
  100% { transform: translateY(0) scale(1); opacity: 0.0; }
}
@keyframes glide1 {
  0% { transform: translateX(0) translateY(0) rotate(0deg); }
  50% { transform: translateX(12px) translateY(-6px) rotate(-2deg); }
  100% { transform: translateX(0) translateY(0) rotate(0deg); }
}
@keyframes glide2 {
  0% { transform: translateX(0) translateY(0) rotate(0deg); }
  50% { transform: translateX(-12px) translateY(-6px) rotate(2deg); }
  100% { transform: translateX(0) translateY(0) rotate(0deg); }
}
.hero__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.75rem, 6vw, 3rem);
  margin: 0 0 var(--space-3);
  letter-spacing: 0.02em;
}
.hero__subtitle {
  margin: 0 auto var(--space-3);
  width: min(700px, 94vw);
  color: var(--color-muted);
  font-weight: 500;
}
.hero__message {
  margin: 0 auto var(--space-4);
  width: min(750px, 94vw);
}

/* Ensure hero content sits above absolute decorative images */
.hero :where(.hero__title, .hero__subtitle, .hero__message, .framed-photo, .cta3d) {
  position: relative;
  z-index: 1;
}

/* Framed photo with subtle gold accents and a gentle tilt */
.framed-photo {
  position: relative;
  display: block;
  width: min(720px, 94vw);
  margin: var(--space-4) auto;
  padding: 12px;
  background: #fffef8;
  border: 2px solid var(--color-border-gold);
  outline: 3px double var(--color-accent);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12), inset 0 0 0 3px #ffffffcc;
}
.framed-photo::before,
.framed-photo::after {
  content: "~ ~ ~ ~ ~";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-accent);
  font-size: 18px;
  letter-spacing: 4px;
  opacity: 0.7;
  pointer-events: none;
}
.framed-photo::before { top: -16px; }
.framed-photo::after { bottom: -16px; }
.framed-photo--tilt { transform: rotate(-1.5deg); }
.framed-photo__img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  outline: 1px solid var(--color-border-gold);
}

/* Small screens: keep frame comfortable and avoid overflow from tilt */
@media (max-width: 480px) {
  .framed-photo { padding: 10px; width: 94vw; }
  .framed-photo--tilt { transform: rotate(-1deg); }
}

/* CTA with microinteraction */

/* 3D CTA button (based on provided design, themed) */
.cta3d {
  width: 160px;
  height: 54px;
  position: relative;
  background: none;
  outline: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
.cta3d__top {
  width: 100%;
  height: 100%;
  background: #fffef8;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 16px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  outline: 2px solid var(--color-text);
  transition: transform 180ms ease;
  position: relative;
  overflow: hidden;
}
.cta3d__bottom {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #efe7cf;
  top: 10px;
  left: 0;
  border-radius: 14px;
  outline: 2px solid var(--color-text);
  z-index: -1;
}
.cta3d__bottom::before,
.cta3d__bottom::after {
  position: absolute;
  content: "";
  width: 2px;
  height: 9px;
  background: var(--color-text);
  bottom: 0;
}
.cta3d__bottom::before { left: 15%; }
.cta3d__bottom::after { left: 85%; }
.cta3d:active .cta3d__top { transform: translateY(10px); }
.cta3d::before {
  position: absolute;
  content: "";
  width: calc(100% + 2px);
  height: 100%;
  background: #c9c9c9;
  top: 14px;
  left: -1px;
  border-radius: 14px;
  outline: 2px solid var(--color-text);
  z-index: -1;
}
.cta3d__top::before {
  position: absolute;
  content: "";
  width: 15px;
  height: 100%;
  background: rgba(0, 0, 0, 0.08);
  transform: skewX(30deg);
  left: -20px;
  transition: 250ms ease;
}
.cta3d:active .cta3d__top::before { left: calc(100% + 20px); }
.cta3d:focus-visible .cta3d__top { outline: 3px solid var(--color-accent-weak); }

/* Full-width decorative wave at bottom */
.wave {
  position: relative;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  margin-top: var(--space-5);
}
.wave__svg {
  display: block;
  width: 100vw;
  height: clamp(90px, 18vh, 140px);
}

/* Ornate frame wrapper */
.ornate-frame {
  position: relative;
  width: min(1100px, 95vw);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
}
.ornate-frame__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.ornate-frame > * { position: relative; z-index: 1; }

/* Milestones / Timeline */
.milestones { padding: var(--space-6) 0 var(--space-7); }
.timeline {
  display: grid; gap: var(--space-3);
  grid-template-columns: 1fr;
}
.timeline__item {
  display: grid; grid-template-columns: 110px 1fr; align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  outline: 1px solid var(--color-border-gold);
  border-radius: var(--radius-md);
}
.timeline__year {
  font-weight: 600; color: var(--color-accent);
}
.timeline__event { color: var(--color-text); }

@media (min-width: 700px) {
  .timeline { grid-template-columns: 1fr 1fr; }
  .timeline__item { grid-template-columns: 120px 1fr; }
}

/* Small screens adjustments */
@media (max-width: 480px) {
  .container { width: 94vw; }
  .hero { padding: var(--space-6) var(--space-3) var(--space-5); }
  .hero__title { font-size: clamp(1.6rem, 7vw, 2.4rem); }
  .hero__subtitle { font-size: 0.95rem; }
  .hero__message { font-size: 0.98rem; }

  .anim { width: 22px; height: 22px; }
  .anim--dove:nth-child(3), .anim--dove:nth-child(4) { width: 26px; height: 26px; }

  .cta3d { width: 150px; height: 50px; }
  .cta3d__top { font-size: 15px; }

  .ornate-frame { width: 96vw; padding: var(--space-5) var(--space-3); }

  .timeline__item {
    grid-template-columns: 90px 1fr;
    padding: var(--space-3);
  }

  .modal__dialog { width: 96vw; margin: 4vh auto; }
  .carousel__viewport { height: clamp(220px, 44vh, 400px); }
  .carousel__control { padding: 8px 12px; }
}

/* Footer */
.site-footer {
  padding: var(--space-5) 0;
  text-align: center;
  color: var(--color-muted);
}
.site-footer .container { width: min(700px, 92vw); }

/* Modal */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 50;
}
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 20, 20, 0.45);
  backdrop-filter: blur(4px);
}
.modal__dialog {
  position: relative;
  margin: 0;
  width: 100vw;
  height: 100vh;
  background: var(--color-surface);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}
.modal__header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.modal__title {
  margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 1.25rem;
}
.modal__desc { margin: 0; color: var(--color-muted); font-size: 0.9rem; }
.modal__tools { display: flex; align-items: center; gap: var(--space-3); }
.modal__autoplay {
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 0.9rem; color: var(--color-text);
}
.modal__close {
  appearance: none; border: none; background: transparent; cursor: pointer;
  font-size: 1.5rem; line-height: 1; color: var(--color-muted);
}
.modal__close:hover { color: var(--color-text); }

/* Carousel */
.carousel { position: relative; }
.carousel__viewport {
  position: relative;
  width: 100%; height: calc(100vh - 56px);
  overflow: hidden; background: #161616;
}
.carousel__slide {
  position: absolute; inset: 0; opacity: 0; transform: translateX(12%);
  transition: opacity 360ms ease, transform 360ms ease;
}
.carousel__slide.is-active {
  opacity: 1; transform: translateX(0%);
}
.carousel__slide img {
  width: 100%; height: 100%; object-fit: contain; object-position: center;
  background: #161616;
}

/* Controls */
.carousel__control {
  position: absolute; top: 50%; transform: translateY(-50%);
  padding: 10px 14px;
  border-radius: 999px; border: 1px solid var(--color-border);
  background: rgba(255,255,255,0.92);
  color: var(--color-text);
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.carousel__control:hover { background: #fff; }
.carousel__control--prev { left: var(--space-3); }
.carousel__control--next { right: var(--space-3); }

/* Dots */
.carousel__dots {
  position: absolute; bottom: var(--space-3); left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; align-items: center; justify-content: center;
}
.carousel__dots button {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--color-border);
  background: rgba(255,255,255,0.95);
  cursor: pointer; padding: 0;
}
.carousel__dots button[aria-selected="true"] {
  background: var(--color-accent); border-color: var(--color-accent);
}

/* Removed in-viewport autoplay; now inside header as .modal__autoplay */

/* Small ripple/glow effect for CTA on click */
.cta.clicked .cta__ripple {
  animation: ripple 700ms ease;
  box-shadow: 0 0 0 0 rgba(181, 139, 42, 0.35);
}
@keyframes ripple {
  0% { box-shadow: 0 0 0 0 rgba(181, 139, 42, 0.35); }
  100% { box-shadow: 0 0 0 26px rgba(181, 139, 42, 0); }
}

/* Accessible, consistent focus rings */
button:focus-visible,
a:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-accent-weak);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .anim,
  .carousel__slide { animation: none !important; transition: none !important; }
}
