:root {
  --bg: #faf5ea;
  --paper: #fffaf1;
  --ink: #3d2b1f;
  --ink-soft: rgba(61, 43, 31, 0.72);
  --accent: #a13d3d;
  --accent-deep: #6e2323;
  --gold: #c9a227;
  --gold-light: #e8cf8a;
  --envelope-start: #7f1d2d;
  --envelope-end: #4b1020;
  --shadow: rgba(61, 33, 20, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Cormorant Garamond", serif;
  font-size: 19px;
  line-height: 1.6;
}

body.intro-active {
  overflow: hidden;
  height: 100vh;
}

a {
  color: inherit;
}

.empty-state {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: "IBM Plex Sans", sans-serif;
}

/* ---------- Music toggle ---------- */

.music-toggle {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 40;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--gold-light);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--shadow);
}

.music-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  position: relative;
}

.music-icon::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0.35);
  transition: transform 0.25s ease;
}

.music-toggle.is-playing .music-icon::before {
  transform: scale(1);
}

/* ---------- Envelope intro ---------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 32%, #8f2436 0%, #5a1526 58%, #3c0d1b 100%);
  transition: opacity 0.9s ease;
}

.intro.fade-out {
  opacity: 0;
  pointer-events: none;
}

.envelope-stage {
  position: relative;
  width: min(86vw, 380px);
  aspect-ratio: 3 / 2;
  perspective: 1400px;
  background: linear-gradient(180deg, #efe2c8, #e3d2b0);
  border-radius: 6px;
  box-shadow: 0 26px 60px rgba(20, 4, 9, 0.55);
}

.flap {
  position: absolute;
  inset: 0;
}

.flap-left,
.flap-right {
  background: linear-gradient(105deg, #f6ecd8, #eadbc0 62%);
  clip-path: polygon(0 0, 50% 50%, 0 100%);
  box-shadow: inset -8px 0 18px rgba(61, 33, 20, 0.12);
}

.flap-right {
  background: linear-gradient(255deg, #f6ecd8, #eadbc0 62%);
  clip-path: polygon(100% 0, 50% 50%, 100% 100%);
}

.flap-bottom {
  background: linear-gradient(180deg, #f9f1de 0%, #f0e3c6 58%, #e7d5b1 100%);
  clip-path: polygon(0 100%, 100% 100%, 100% 35%, 50% 62%, 0 35%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3%;
  box-shadow: inset 0 14px 26px rgba(61, 33, 20, 0.14);
}

.flap-signature {
  margin: 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.flap-signature strong {
  font-family: "Great Vibes", cursive;
  font-size: 1.35rem;
  font-weight: 400;
  display: inline-block;
  margin-top: 0.15rem;
  color: var(--accent-deep);
}

.flap-top {
  background: linear-gradient(180deg, #fbf4e3 0%, #f1e4c8 62%, #e9d8b6 100%);
  clip-path: polygon(0 0, 100% 0, 50% 68%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8%;
  z-index: 3;
  box-shadow: inset 0 -16px 26px rgba(61, 33, 20, 0.1), 0 10px 24px rgba(32, 7, 14, 0.25);
  backface-visibility: hidden;
}

.flap-note {
  margin: 0;
  text-align: center;
  color: var(--accent-deep);
  font-family: "IBM Plex Sans", sans-serif;
  letter-spacing: 0.08em;
}

.flap-note-line {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.flap-note-script {
  display: block;
  margin-top: 0.1rem;
  font-family: "Great Vibes", cursive;
  font-size: 1.2rem;
  color: #b3242c;
}

.seal-button {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 30%, #c0504f, #8f2b2b 62%, #6e2020 100%);
  color: #f8ecd4;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.7rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(32, 7, 14, 0.45), inset 0 2px 6px rgba(255, 235, 200, 0.35), inset 0 -3px 8px rgba(40, 8, 8, 0.5);
  animation: seal-pulse 2.4s ease-in-out infinite;
}

.seal-button::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px dashed rgba(248, 236, 212, 0.55);
  pointer-events: none;
}

@keyframes seal-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.06); }
}

.intro.opened .flap-top {
  transform: rotateX(-170deg);
}

.intro.opened .seal-button {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  transition: opacity 0.4s ease, transform 0.4s ease;
  animation: none;
}

/* ---------- Main invitation ---------- */

.invitation {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.4rem 4rem;
}

/* Ikki chetdagi nozik anor daraxti novdasi */
.pomegranate-vine {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  height: min(94vh, 1000px);
  width: auto;
  z-index: -1;
  opacity: 0.55;
  pointer-events: none;
}

.pomegranate-vine--left {
  left: clamp(2px, 1.2vw, 22px);
}

.pomegranate-vine--right {
  right: clamp(2px, 1.2vw, 22px);
  transform: translateY(-50%) scaleX(-1);
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.letter-hero {
  min-height: 100vh;
  margin: 0 -1.4rem;
  padding: clamp(5rem, 16vw, 7.5rem) 1.2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  gap: 1.6rem;
  position: relative;
  overflow: hidden;
}

.heritage-hero {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}

.heritage-border {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: clamp(58px, 10vw, 96px);
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

.heritage-names-row {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 1.2rem 0;
}

.heritage-horn {
  position: absolute;
  top: 50%;
  width: clamp(260px, 52vw, 460px);
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(163, 110, 19, 0.3));
  z-index: 0;
  transform: translate(0, -50%) rotate(calc(var(--fan) * var(--dir))) scaleX(var(--flip));
  animation: horn-pulse 2.4s ease-in-out var(--delay, 1s) infinite alternate;
}

.heritage-horn--left {
  --dir: -1;
  --flip: -1;
  --push: -14px;
  left: clamp(-280px, -34vw, -130px);
}

.heritage-horn--right {
  --dir: 1;
  --flip: 1;
  --push: 14px;
  right: clamp(-280px, -34vw, -130px);
}

/* Yelpig'ich burchagi (--fan) va kechikish (--delay) admin'dagi karnay soniga
   qarab view'da hisoblanib, inline style orqali beriladi */
@keyframes horn-pulse {
  from { transform: translate(0, -50%) rotate(calc(var(--fan) * var(--dir))) scaleX(var(--flip)); }
  to { transform: translate(var(--push), -50%) rotate(calc((var(--fan) + 3deg) * var(--dir))) scaleX(var(--flip)); }
}

.heritage-photo {
  width: 100%;
  max-width: 520px;
  border-radius: 10px;
  border: 1px solid var(--gold-light);
  box-shadow: 0 10px 26px var(--shadow);
}

.heritage-duo {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.9rem;
  width: 100%;
}

.heritage-portrait {
  margin: 0;
  flex: 1 1 0;
  min-width: 0;
  max-width: 250px;
}

.heritage-portrait img {
  width: 100%;
  aspect-ratio: 9 / 20;
  object-fit: cover;
  object-position: top center;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--gold-light);
  box-shadow: 0 10px 26px var(--shadow);
}

.letter-couple-photo {
  width: 100%;
  max-width: 340px;
  margin-top: 1.8rem;
  border-radius: 6px;
  border: 1px solid var(--gold-light);
  box-shadow: 0 10px 26px var(--shadow);
}

.heritage-ornament {
  width: 64px;
  height: 64px;
  position: relative;
}

.heritage-ornament span,
.heritage-ornament::before,
.heritage-ornament::after {
  content: "";
  position: absolute;
  border: 1px solid var(--gold);
}

.heritage-ornament span {
  inset: 0;
  transform: rotate(45deg);
}

.heritage-ornament::before {
  inset: 14px;
  transform: rotate(45deg);
}

.ornament-names {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Corinthia", "Great Vibes", cursive;
  font-weight: 700;
  font-size: clamp(3.4rem, 15vw, 5.4rem);
  color: #b3242c;
  line-height: 0.82;
}

.ornament-name-line {
  display: block;
}

.ornament-name-amp {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(1rem, 3.4vw, 1.3rem);
  letter-spacing: 0.24em;
  text-transform: lowercase;
  color: var(--accent-deep);
  margin: 0.4rem 0;
  line-height: 1;
}

.scroll-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--ink-soft);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

.letter-card {
  padding: 3rem 0;
  text-align: center;
}

.hero-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  color: var(--accent-deep);
  margin: 0 0 1.6rem;
}

.lead p {
  margin: 0 0 1rem;
  color: var(--ink-soft);
}

.lead strong {
  color: var(--ink);
}

.details-sections {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
}

.card-sprig {
  position: absolute;
  width: clamp(80px, 20vw, 130px);
  height: auto;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 3px 6px rgba(61, 33, 20, 0.18));
}

.card-sprig--top-left {
  top: -2.2rem;
  left: -1.2rem;
  transform: rotate(-12deg);
}

.card-sprig--top-right {
  top: -2.2rem;
  right: -1.2rem;
  transform: rotate(14deg) scaleX(-1);
}

.card-sprig--bottom-left {
  bottom: -1.8rem;
  left: -1rem;
  transform: rotate(8deg);
}

.calendar-section,
.schedule-section,
.location-section,
.countdown-section {
  position: relative;
  z-index: 1;
  background: var(--paper);
  border: 1px solid var(--gold-light);
  border-radius: 6px;
  padding: 2rem 1.6rem;
  text-align: center;
}


.calendar {
  max-width: 320px;
  margin: 0 auto;
}

.calendar-head {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--accent-deep);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
  margin-bottom: 0.3rem;
  align-items: center;
}

.week-days span {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.days span,
.days .empty-cell {
  font-size: 0.95rem;
  padding: 0.35rem 0;
}

.heart-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.heart-day {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff4ea;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.schedule-title {
  font-family: "Cormorant Garamond", serif;
  color: var(--accent-deep);
  font-size: 1.4rem;
  margin: 0 0 1.4rem;
}

.schedule-timeline {
  position: relative;
  max-width: 380px;
  margin: 0 auto;
}

.schedule-timeline::before {
  content: "";
  position: absolute;
  top: 1.2rem;
  bottom: 1.2rem;
  left: 50%;
  width: 1px;
  background: var(--gold);
  transform: translateX(-50%);
}

.schedule-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 52px 1fr;
  align-items: center;
  column-gap: 0.4rem;
  padding: 0.85rem 0;
}

.schedule-time {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

.schedule-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 14px;
}

.schedule-marker::before {
  content: "";
  width: 9px;
  height: 9px;
  background: var(--accent-deep);
  transform: rotate(45deg);
}

.schedule-marker--flower::before {
  display: none;
}

.schedule-flower {
  width: 48px;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(61, 33, 20, 0.2));
}

.schedule-event-name {
  text-align: left;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.35;
}

.location-title {
  font-family: "Cormorant Garamond", serif;
  color: var(--accent-deep);
  font-size: 1.4rem;
  margin: 0 0 0.8rem;
}

.venue-name {
  font-weight: 600;
  margin: 0 0 0.3rem;
}

.venue-address {
  color: var(--ink-soft);
  margin: 0 0 0.3rem;
}

.map-links {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}

.map-link {
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  text-decoration: none;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
  transition: background 0.2s ease, color 0.2s ease;
}

.map-link:hover {
  background: var(--accent);
  color: #fff4ea;
}

.countdown-section h2 {
  font-family: "Cormorant Garamond", serif;
  color: var(--accent-deep);
  font-size: 1.4rem;
  margin: 0 0 1.4rem;
}

.countdown {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.time-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
}

.time-unit span {
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 600;
  color: var(--accent);
}

.time-unit small {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.countdown-message {
  margin-top: 1.2rem;
  color: var(--ink-soft);
  font-style: italic;
}

@media (min-width: 640px) {
  .details-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  /* Kalendar va manzil yonma-yon, dastur va sanoq to'liq kenglikda */
  .calendar-section { order: 1; }
  .location-section { order: 2; }
  .schedule-section { order: 3; grid-column: 1 / -1; }
  .countdown-section { order: 4; grid-column: 1 / -1; }
}
