/* ==========================================
   1. GLOBAL VARIABLES & RESET
   ========================================== */
:root {
  --cream: #fbf8f2;
  --paper: #fffdf9;
  --blue: #dce9ed;
  --ink: #263238;
  --muted: #667176;
  --gold: #b89150;
  --line: #dcccae;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/1.7 Montserrat, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ==========================================
   2. REUSABLE COMPONENTS
   ========================================== */
.container {
  width: min(1120px, 92%);
  margin: auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .28em;
  font-size: .68rem;
  color: var(--gold);
}

h1, h2, h3 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  line-height: 1;
  margin: 0;
}

.reveal {
  opacity: 0;
  transform: translateY(25px);
  transition: .8s;
}

.reveal.show {
  opacity: 1;
  transform: none;
}

/* ==========================================
   3. OPENING SCREEN / ENVELOPE ANIMATION
   ========================================== */
#opening {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: #f5eee3;
  transition: .8s;
}

#opening.hide {
  opacity: 0;
  visibility: hidden;
}

.envelope {
  width: min(430px, 82vw);
  aspect-ratio: 1.55;
  position: relative;
}

.env {
  position: absolute;
  inset: 0;
  background: #fffdf9;
  border: 1px solid #d7c39b;
  box-shadow: 0 20px 55px #0002;
}

.flap {
  position: absolute;
  z-index: 4;
  inset: 0 0 auto;
  width: 100%;
  height: 58%;
  background: #fff;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: 1s;
}

.letter {
  position: absolute;
  z-index: 2;
  left: 9%;
  width: 82%;
  bottom: 7%;
  height: 76%;
  background: #fff;
  border: 1px solid #eadfc9;
  display: grid;
  place-items: center;
  transform: translateY(25%);
  transition: 1s;
}

.letter b {
  font: 600 2.1rem "Cormorant Garamond";
  color: var(--gold);
}

.seal {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  display: grid;
  place-items: center;
  font: 600 1.1rem "Cormorant Garamond";
  transition: .3s;
}

.envelope.open .flap {
  transform: rotateX(180deg);
}

.envelope.open .letter {
  transform: translateY(-48%);
}

.envelope.open .seal {
  opacity: 0;
}

.open {
  margin: 32px auto 0;
  display: block;
  padding: 12px 28px;
  border: 1px solid var(--gold);
  background: transparent;
  color: #765b2c;
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .68rem;
  cursor: pointer;
}

/* ==========================================
   4. NAVIGATION MENU
   ========================================== */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fffdf9ee;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #b8915030;
}

nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font: 500 2rem "Cormorant Garamond";
  color: var(--gold);
}

.links {
  display: flex;
  gap: 28px;
}

.links a {
  font-size: .63rem;
  letter-spacing: .22em;
  text-transform: uppercase;
}

/* ==========================================
   5. HERO BANNER
   ========================================== */
.hero {
  min-height: 650px;
  display: flex;
  align-items: end;
  background: linear-gradient(90deg, #fffdf9f5 0%, #fffdf9b8 42%, #fff0 100%), 
              url("https://images.unsplash.com/photo-1519741497674-611481863552?auto=format&fit=crop&w=2000&q=85") center/cover;
}

.hero-content {
  padding: 100px 0 85px;
  max-width: 520px;
}

.hero h1 {
  font-size: clamp(5rem, 11vw, 8.2rem);
}

.hero h1 span {
  display: block;
  color: var(--gold);
  font-style: italic;
  font-size: .62em;
}

.date {
  margin-top: 30px;
  font-size: .8rem;
  letter-spacing: .38em;
  text-transform: uppercase;
}

.place {
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .24em;
  text-transform: uppercase;
}

/* ==========================================
   6. COUNTDOWN TIMER
   ========================================== */
.countdown {
  background: var(--blue);
  padding: 52px 0;
  text-align: center;
}

.count-title {
  font-size: 2.2rem;
  margin-top: 8px;
}

.count-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 720px;
  margin: 32px auto 0;
}

.count-item {
  border-right: 1px solid #6e828a4d;
}

.count-item:last-child {
  border: 0;
}

.number {
  font: 500 2.8rem "Cormorant Garamond";
  color: var(--gold);
}

.label {
  font-size: .6rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #58656a;
}

/* ==========================================
   7. PAGE SECTIONS (STORY, DETAILS, GALLERY, RSVP)
   ========================================== */
section {
  padding: 100px 0;
}

/* --- Our Story --- */
.story {
  background: var(--paper);
}

.story-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 70px;
  align-items: center;
}

.story h2, .details h2, .gallery h2, .rsvp h2 {
  font-size: 3.7rem;
}

.story h2 em, .details h2 em, .gallery h2 em, .rsvp h2 em {
  color: var(--gold);
  font-style: italic;
}

.story p {
  max-width: 500px;
  color: #596166;
}

.quote {
  font: italic 1.35rem "Cormorant Garamond";
  color: var(--gold);
  margin: 28px 0;
}

.stack {
  position: relative;
  min-height: 430px;
}

.photo {
  position: absolute;
  background: #fff;
  padding: 10px 10px 36px;
  box-shadow: 0 14px 35px #2d281e22;
}

.photo img {
  height: 300px;
}

.p1 {
  left: 2%;
  top: 10px;
  width: 60%;
  transform: rotate(-4deg);
}

.p2 {
  right: 2%;
  top: 65px;
  width: 43%;
  transform: rotate(5deg);
}

.p2 img {
  height: 210px;
}

.p3 {
  right: 12%;
  bottom: 0;
  width: 42%;
  transform: rotate(-5deg);
}

.p3 img {
  height: 190px;
}

/* --- Event Details --- */
.details {
  background: #fffdfa;
}

.details-grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, 1fr);
  margin-top: 55px;
  border-block: 1px solid var(--line);
}

.detail {
  padding: 42px 28px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.detail:first-child {
  text-align: left;
}

.detail:last-child {
  border: 0;
}

.detail h3 {
  font-size: 1.5rem;
}

.detail p {
  font-size: .78rem;
  color: var(--muted);
}

/* --- Photo Gallery --- */
.gallery {
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 170px;
  gap: 12px;
  margin-top: 45px;
  text-align: left;
}

.gallery-card {
  overflow: hidden;
}

.g1 {
  grid-column: span 3;
  grid-row: span 2;
}

.g2 {
  grid-column: span 3;
}

.g3 {
  grid-column: span 3;
  grid-row: span 2;
}

.g4 {
  grid-column: span 3;
}

.g5 {
  grid-column: span 6;
}

.g6 {
  grid-column: span 3;
}

.gallery-card img {
  transition: .7s;
}

.gallery-card:hover img {
  transform: scale(1.05);
}

/* --- RSVP Form --- */
.rsvp {
  background: var(--blue);
}

.rsvp-grid {
  display: grid;
  grid-template-columns: .75fr 1.25fr;
  gap: 70px;
}

.form {
  background: #ffffffa6;
  padding: 34px;
  border: 1px solid #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #59656a;
}

input, select, textarea {
  width: 100%;
  margin-top: 7px;
  padding: 12px;
  border: 1px solid #c6d2d5;
  background: #fffdfa;
  font: 400 .78rem Montserrat;
}

textarea {
  min-height: 100px;
}

.full {
  grid-column: 1/-1;
}

.submit {
  width: 100%;
  padding: 14px;
  border: 0;
  background: var(--gold);
  color: white;
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .65rem;
  cursor: pointer;
}

/* ==========================================
   8. FOOTER
   ========================================== */
footer {
  text-align: center;
  padding: 45px 0;
  background: #fffdfa;
}

footer .logo {
  font-size: 2.1rem;
}

footer p {
  font-size: .6rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #7a8082;
}

/* ==========================================
   9. MEDIA QUERIES (MOBILE RESPONSIVENESS)
   ========================================== */
@media(max-width: 800px) {
  .links {
    display: none;
  }

  .hero {
    min-height: 610px;
  }

  .count-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .count-item:nth-child(2) {
    border: 0;
  }

  .story-grid, 
  .rsvp-grid {
    grid-template-columns: 1fr;
  }

  .details-grid {
    grid-template-columns: 1fr 1fr;
  }

  .detail:first-child, 
  .detail:last-child {
    grid-column: 1/-1;
  }

  .detail:first-child {
    text-align: center;
  }

  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 170px;
  }

  .g1, 
  .g3 {
    grid-row: span 2;
  }

  .g1, .g2, .g3, .g4, .g5, .g6 {
    grid-column: span 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full {
    grid-column: auto;
  }
}
