:root {
  --ink: #251c26;
  --ink-soft: #6d5a69;
  --plum: #2a182c;
  --plum-2: #4d2949;
  --rose: #c96f7d;
  --rose-deep: #a64f63;
  --peach: #f2b49f;
  --gold: #e9c989;
  --cream: #fff7ee;
  --paper: #fffdf8;
  --white: #ffffff;
  --shadow: 0 24px 80px rgba(42, 24, 44, .18);
  --shadow-soft: 0 16px 42px rgba(42, 24, 44, .12);
  --radius: 28px;
  --shell: min(1180px, calc(100% - 40px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.7;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }
img { display: block; max-width: 100%; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }
::selection { background: var(--peach); color: var(--plum); }

.shell { width: var(--shell); margin-inline: auto; }
.section { position: relative; padding: 120px 0; }
.section--dark { color: var(--white); background: var(--plum); }
.section--cream { background: #f8eee5; }
.eyebrow {
  margin: 0 0 14px;
  color: var(--rose-deep);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.section--dark .eyebrow, .hero .eyebrow { color: var(--peach); }
.section-heading { max-width: 780px; margin-bottom: 60px; }
.section-heading h2,
.promise h2,
.memory-game h2,
.finale h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 5vw, 4.6rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -.035em;
}
.section-heading > p:last-child { max-width: 670px; margin-top: 22px; color: var(--ink-soft); font-size: 1.08rem; }

.button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease, color .25s ease;
}
.button:hover { transform: translateY(-2px); }
.button:focus-visible, .letter-tab:focus-visible, .gallery__item button:focus-visible, .music-control:focus-visible, .copy-button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
.button--primary { color: var(--white); background: linear-gradient(135deg, var(--rose-deep), var(--rose)); box-shadow: 0 12px 30px rgba(166, 79, 99, .28); }
.button--primary:hover { box-shadow: 0 17px 35px rgba(166, 79, 99, .38); }
.button--ghost { color: currentColor; border-color: rgba(255,255,255,.34); background: rgba(255,255,255,.08); backdrop-filter: blur(10px); }
.button--light { color: var(--plum); background: var(--white); box-shadow: 0 14px 35px rgba(0,0,0,.18); }

.scroll-progress { position: fixed; z-index: 200; top: 0; left: 0; width: 100%; height: 4px; background: rgba(255,255,255,.08); }
.scroll-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--peach), var(--rose), var(--gold)); }
#confettiCanvas { position: fixed; z-index: 999; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.opening {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--white);
  background: radial-gradient(circle at 50% 20%, #6f3a65 0, var(--plum) 48%, #160f18 100%);
  transition: opacity .8s ease, visibility .8s ease;
}
.opening.is-hidden { opacity: 0; visibility: hidden; }
.opening__card { position: relative; z-index: 2; width: min(560px, 100%); padding: 40px; border: 1px solid rgba(255,255,255,.16); border-radius: 34px; text-align: center; background: rgba(255,255,255,.08); box-shadow: 0 30px 100px rgba(0,0,0,.35); backdrop-filter: blur(24px); }
.opening__card h1 { margin: 0 0 12px; font-family: Georgia, serif; font-size: clamp(2.8rem, 9vw, 5.4rem); font-weight: 500; letter-spacing: -.04em; }
.opening__card > p:not(.eyebrow) { margin: 0 auto 26px; max-width: 410px; color: rgba(255,255,255,.76); }
.opening__card small { display: block; margin-top: 20px; color: rgba(255,255,255,.52); }
.opening__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.opening__glow { position: absolute; width: 35vw; height: 35vw; border-radius: 50%; filter: blur(65px); opacity: .26; animation: floatGlow 7s ease-in-out infinite alternate; }
.opening__glow--one { top: -10%; left: -6%; background: var(--rose); }
.opening__glow--two { right: -7%; bottom: -15%; background: var(--gold); animation-delay: -3s; }
@keyframes floatGlow { to { transform: translate(6vw, 4vh) scale(1.08); } }
.gift { position: relative; width: 94px; height: 82px; margin: 2px auto 24px; filter: drop-shadow(0 16px 24px rgba(0,0,0,.28)); animation: giftBounce 2.1s ease-in-out infinite; }
.gift__box, .gift__lid, .gift__ribbon { position: absolute; display: block; }
.gift__box { left: 8px; right: 8px; bottom: 0; height: 58px; border-radius: 6px 6px 12px 12px; background: linear-gradient(145deg, var(--peach), var(--rose)); }
.gift__lid { z-index: 2; top: 13px; left: 0; width: 100%; height: 19px; border-radius: 7px; background: var(--gold); }
.gift__ribbon { z-index: 3; top: 0; left: 39px; width: 16px; height: 82px; background: rgba(255,255,255,.72); }
.gift::before, .gift::after { content: ""; position: absolute; z-index: 4; top: 0; width: 35px; height: 23px; border: 8px solid rgba(255,255,255,.75); }
.gift::before { left: 11px; border-radius: 60% 50% 0 50%; transform: rotate(20deg); }
.gift::after { right: 11px; border-radius: 50% 60% 50% 0; transform: rotate(-20deg); }
@keyframes giftBounce { 50% { transform: translateY(-8px) rotate(-1deg); } }

.music-control {
  position: fixed;
  z-index: 190;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px 10px 10px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  color: var(--white);
  background: rgba(42,24,44,.88);
  box-shadow: 0 15px 38px rgba(20,10,20,.28);
  backdrop-filter: blur(14px);
  cursor: pointer;
}
.music-control__icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: var(--plum); background: var(--peach); font-size: 1.25rem; font-weight: 900; }
.music-control__text { display: grid; text-align: left; line-height: 1.2; }
.music-control__text strong { font-size: .8rem; }
.music-control__text small { margin-top: 3px; color: rgba(255,255,255,.6); font-size: .66rem; }
.equalizer { display: flex; height: 18px; align-items: flex-end; gap: 2px; }
.equalizer i { display: block; width: 3px; height: 5px; border-radius: 4px; background: var(--gold); }
.music-control.is-playing .equalizer i { animation: equalize .7s ease-in-out infinite alternate; }
.music-control.is-playing .equalizer i:nth-child(2) { animation-delay: -.35s; }
.music-control.is-playing .equalizer i:nth-child(3) { animation-delay: -.18s; }
@keyframes equalize { to { height: 17px; } }

.hero { position: relative; min-height: 100svh; overflow: hidden; color: var(--white); background: linear-gradient(135deg, #201322 0%, #422340 55%, #6b384e 100%); }
.hero::before { content: ""; position: absolute; width: 760px; height: 760px; top: -220px; right: -210px; border-radius: 50%; background: radial-gradient(circle, rgba(242,180,159,.34), rgba(242,180,159,0) 68%); }
.hero::after { content: ""; position: absolute; width: 680px; height: 680px; bottom: -360px; left: -180px; border-radius: 50%; background: radial-gradient(circle, rgba(233,201,137,.18), rgba(233,201,137,0) 68%); }
.hero__noise { position: absolute; inset: 0; opacity: .15; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; }
.nav { position: relative; z-index: 5; display: flex; width: var(--shell); margin-inline: auto; min-height: 88px; align-items: center; justify-content: space-between; }
.nav__brand { display: inline-flex; align-items: center; gap: 2px; color: var(--white); text-decoration: none; font-family: Georgia, serif; font-size: 1.3rem; font-weight: 700; letter-spacing: .08em; }
.nav__brand span { color: var(--peach); font-size: .85rem; }
.nav__links { display: flex; gap: 28px; }
.nav__links a { color: rgba(255,255,255,.72); text-decoration: none; font-size: .9rem; font-weight: 700; }
.nav__links a:hover { color: var(--white); }
.hero__content { position: relative; z-index: 2; display: grid; min-height: calc(100svh - 88px); grid-template-columns: 1.02fr .98fr; align-items: center; gap: 70px; padding: 70px 0 120px; }
.hero__copy h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(4rem, 7.5vw, 7.7rem); font-weight: 500; line-height: .88; letter-spacing: -.055em; }
.hero__copy h1 em { color: var(--peach); font-weight: 500; }
.hero__lead { max-width: 630px; margin: 30px 0; color: rgba(255,255,255,.78); font-family: Georgia, serif; font-size: clamp(1.25rem, 2vw, 1.62rem); line-height: 1.45; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__stats { display: grid; max-width: 660px; grid-template-columns: repeat(3,1fr); gap: 1px; margin-top: 52px; overflow: hidden; border: 1px solid rgba(255,255,255,.13); border-radius: 20px; background: rgba(255,255,255,.13); }
.hero__stats div { display: grid; padding: 18px; background: rgba(35,20,38,.65); }
.hero__stats strong { color: var(--gold); font-family: Georgia, serif; font-size: 1.45rem; }
.hero__stats span { color: rgba(255,255,255,.62); font-size: .74rem; }
.hero__photos { position: relative; min-height: 650px; }
.photo-card { position: absolute; margin: 0; padding: 10px 10px 30px; border-radius: 9px; background: #fffaf5; box-shadow: 0 28px 75px rgba(0,0,0,.33); }
.photo-card img { width: 100%; height: 100%; border-radius: 4px; object-fit: cover; }
.photo-card figcaption { position: absolute; right: 14px; bottom: 6px; left: 14px; color: #59404f; font-family: "Segoe Print", "Comic Sans MS", cursive; font-size: .92rem; text-align: center; }
.photo-card--main { z-index: 2; top: 20px; right: 55px; width: min(430px, 72%); height: 540px; transform: rotate(3deg); }
.photo-card--main img { object-position: center 30%; }
.photo-card--small { z-index: 3; width: 190px; height: 215px; padding-bottom: 10px; }
.photo-card--left { bottom: 28px; left: 10px; transform: rotate(-8deg); }
.photo-card--right { right: 2px; bottom: 5px; transform: rotate(8deg); }
.hero__scribble { position: absolute; z-index: 4; top: 32px; left: 0; color: var(--gold); font-family: "Segoe Print", "Comic Sans MS", cursive; font-size: 1rem; line-height: 1.2; transform: rotate(-9deg); }
.scroll-hint { position: absolute; z-index: 3; right: 42px; bottom: 38px; display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.55); text-decoration: none; font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; transform: rotate(90deg); transform-origin: right bottom; }
.scroll-hint i { position: relative; display: block; width: 46px; height: 1px; background: rgba(255,255,255,.35); }
.scroll-hint i::after { content: ""; position: absolute; right: 0; top: -3px; width: 7px; height: 7px; border-top: 1px solid rgba(255,255,255,.55); border-right: 1px solid rgba(255,255,255,.55); transform: rotate(45deg); }

.timeline { position: relative; display: grid; gap: 48px; }
.timeline::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: linear-gradient(var(--peach), var(--rose), var(--gold)); opacity: .55; }
.timeline__item { position: relative; display: grid; grid-template-columns: 1fr 110px 1fr; align-items: center; gap: 28px; }
.timeline__item > div { grid-column: 1; max-width: 420px; justify-self: end; text-align: right; }
.timeline__item > img { grid-column: 3; width: 100%; height: 330px; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow-soft); }
.timeline__item:nth-child(1) > img { object-position: center 27%; }
.timeline__item:nth-child(2) > img { object-position: center 32%; }
.timeline__item:nth-child(3) > img { object-position: center 35%; }
.timeline__number { z-index: 2; display: grid; width: 70px; height: 70px; grid-column: 2; grid-row: 1; place-items: center; justify-self: center; border: 8px solid var(--cream); border-radius: 50%; color: var(--white); background: var(--rose-deep); box-shadow: 0 10px 24px rgba(166,79,99,.24); font-family: Georgia, serif; font-size: 1.15rem; }
.timeline__item h3 { margin: 0 0 10px; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.timeline__item p { margin: 0; color: var(--ink-soft); }
.timeline__item--reverse > div { grid-column: 3; justify-self: start; text-align: left; }
.timeline__item--reverse > img { grid-column: 1; grid-row: 1; }

.promise { overflow: hidden; }
.promise::before { content: ""; position: absolute; inset: 0; opacity: .12; background-image: radial-gradient(circle at 1px 1px, white 1px, transparent 0); background-size: 26px 26px; }
.promise__grid { position: relative; display: grid; grid-template-columns: .8fr 1.2fr; align-items: center; gap: 72px; }
.promise__copy p:not(.eyebrow):not(.contract-result) { max-width: 520px; color: rgba(255,255,255,.68); font-size: 1.08rem; }
.promise__copy .button { margin-top: 18px; }
.contract-result { min-height: 28px; color: var(--gold); font-weight: 800; }
.contract { position: relative; padding: 52px; overflow: hidden; border-radius: 28px; color: var(--ink); background: #fffaf0; box-shadow: 0 30px 90px rgba(0,0,0,.27); transform: rotate(1.2deg); }
.contract::before { content: ""; position: absolute; inset: 14px; border: 1px dashed rgba(91,67,80,.25); border-radius: 20px; pointer-events: none; }
.contract h3 { position: relative; margin: 0 0 24px; font-family: Georgia, serif; font-size: 2rem; }
.contract ul { position: relative; display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.contract li { display: flex; align-items: flex-start; gap: 12px; }
.contract li span { display: grid; flex: 0 0 25px; height: 25px; place-items: center; border-radius: 50%; color: white; background: var(--rose-deep); font-size: .74rem; font-weight: 900; }
.contract__stamp { position: absolute; top: 24px; right: 25px; padding: 8px 12px; border: 3px double var(--rose-deep); border-radius: 6px; color: var(--rose-deep); font-size: .62rem; font-weight: 900; line-height: 1.2; letter-spacing: .1em; text-align: center; transform: rotate(11deg); opacity: .78; }
.contract__signatures { position: relative; display: flex; justify-content: space-between; gap: 25px; margin-top: 38px; padding-top: 20px; border-top: 1px solid rgba(37,28,38,.14); color: var(--ink-soft); font-family: "Segoe Print", "Comic Sans MS", cursive; font-size: .86rem; }
.contract.is-signed { animation: signed .7s ease; }
@keyframes signed { 50% { transform: rotate(-1deg) scale(1.02); } }

.letter-tabs { display: flex; width: fit-content; margin-bottom: 30px; padding: 6px; border-radius: 999px; background: rgba(42,24,44,.08); }
.letter-tab { padding: 12px 20px; border: 0; border-radius: 999px; color: var(--ink-soft); background: transparent; cursor: pointer; font-weight: 800; }
.letter-tab.is-active { color: var(--white); background: var(--plum); box-shadow: 0 8px 20px rgba(42,24,44,.18); }
.letter { position: relative; max-width: 930px; margin-inline: auto; padding: clamp(35px, 7vw, 84px); border-radius: 8px 8px 30px 8px; background-color: var(--paper); background-image: linear-gradient(rgba(201,111,125,.06) 1px, transparent 1px); background-size: 100% 34px; box-shadow: var(--shadow); transform: rotate(-.25deg); }
.letter[hidden] { display: none; }
.letter__pin { position: absolute; top: 19px; left: 50%; width: 18px; height: 18px; border: 4px solid #f2a7a8; border-radius: 50%; background: #c95563; box-shadow: 0 8px 11px rgba(0,0,0,.2); transform: translateX(-50%); }
.letter__kicker { margin: 0 0 35px; color: var(--rose-deep); font-size: .78rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; text-align: center; }
.letter__body { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.08rem, 2vw, 1.25rem); line-height: 1.95; }
.letter__body p { margin: 0 0 22px; }
.letter__body blockquote { margin: 38px 0; color: var(--rose-deep); font-size: clamp(2.8rem, 8vw, 5.8rem); font-weight: 500; line-height: 1; text-align: center; }
.letter__birthday { margin-top: 45px !important; color: var(--rose-deep); font-size: 1.8em; text-align: center; }
.letter__ending { margin-top: 35px !important; font-size: 1.2em; text-align: center; }
.letter__signature { margin: 42px 0 0; color: var(--rose-deep); font-family: "Segoe Print", "Comic Sans MS", cursive; font-size: 1.25rem; text-align: right; }
.copy-button { display: block; margin: 24px auto 0; padding: 10px 18px; border: 1px solid rgba(42,24,44,.16); border-radius: 999px; color: var(--plum); background: rgba(255,255,255,.74); cursor: pointer; font-weight: 800; }

.gallery { columns: 3 280px; column-gap: 24px; }
.gallery__item { position: relative; display: inline-block; width: 100%; margin: 0 0 24px; break-inside: avoid; overflow: hidden; border-radius: 22px; background: var(--white); box-shadow: 0 15px 42px rgba(42,24,44,.1); transition: transform .3s ease, box-shadow .3s ease; }
.gallery__item:hover { transform: translateY(-7px); box-shadow: 0 22px 50px rgba(42,24,44,.18); }
.gallery__item button { display: block; width: 100%; padding: 0; overflow: hidden; border: 0; background: none; cursor: zoom-in; }
.gallery__item img { width: 100%; height: auto; transition: transform .7s ease; }
.gallery__item:hover img { transform: scale(1.035); }
.gallery__item figcaption { display: grid; gap: 5px; padding: 18px 20px 21px; }
.gallery__item figcaption strong { font-family: Georgia, serif; font-size: 1.18rem; }
.gallery__item figcaption span { color: var(--ink-soft); font-size: .86rem; line-height: 1.45; }
.gallery__item--featured { border: 3px solid rgba(201,111,125,.22); }

.memory-game { overflow: hidden; }
.memory-game::after { content: "❤️"; position: absolute; right: 6vw; bottom: -90px; font-size: 16rem; filter: grayscale(1); opacity: .04; transform: rotate(-14deg); }
.memory-game__inner { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 50px; }
.memory-game__inner > div:first-child { grid-row: span 2; }
.memory-card { min-height: 190px; padding: 30px; border: 1px solid rgba(255,255,255,.16); border-radius: 24px; background: rgba(255,255,255,.08); box-shadow: 0 22px 60px rgba(0,0,0,.18); backdrop-filter: blur(12px); }
.memory-card span { color: var(--peach); font-size: .75rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.memory-card p { margin: 18px 0 0; font-family: Georgia, serif; font-size: clamp(1.35rem, 3vw, 2.05rem); line-height: 1.35; }
.memory-card.is-changing { animation: cardFlip .5s ease; }
@keyframes cardFlip { 50% { opacity: .1; transform: translateY(8px) rotateX(8deg); } }
.memory-game .button { justify-self: start; }

.finale { min-height: 830px; display: grid; align-items: center; overflow: hidden; color: var(--white); background: #1d131f; }
.finale__photo { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(29,19,31,.98) 0%, rgba(29,19,31,.84) 45%, rgba(29,19,31,.12) 100%), url('images/01_balniat_nachalo.webp') center 30% / cover no-repeat; opacity: .94; }
.finale__content { position: relative; z-index: 2; margin-block: 80px; }
.finale__content > p:not(.eyebrow):not(.finale__big):not(.finale__signature) { max-width: 720px; color: rgba(255,255,255,.72); font-size: 1.14rem; }
.finale__big { margin: 34px 0 4px; color: var(--peach); font-family: Georgia, serif; font-size: clamp(2.4rem, 6vw, 5.4rem); line-height: 1.05; }
.finale__signature { font-family: "Segoe Print", "Comic Sans MS", cursive; font-size: 1.35rem; }
.finale__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 35px; }

.footer { padding: 42px 0; color: rgba(255,255,255,.62); background: #140d15; }
.footer__inner { display: grid; grid-template-columns: 1.3fr 1fr auto; align-items: center; gap: 30px; }
.footer p { margin: 0; }
.footer__music { font-size: .78rem; }
.footer a { color: var(--peach); text-decoration: none; font-weight: 800; }

.lightbox { width: min(1000px, calc(100% - 32px)); max-height: calc(100svh - 32px); padding: 0; overflow: visible; border: 0; border-radius: 22px; color: white; background: transparent; }
.lightbox::backdrop { background: rgba(15,8,16,.88); backdrop-filter: blur(12px); }
.lightbox img { width: 100%; max-height: calc(100svh - 135px); border-radius: 20px; object-fit: contain; background: #120d13; box-shadow: 0 25px 90px rgba(0,0,0,.55); }
.lightbox p { margin: 15px 45px 0; text-align: center; }
.lightbox__close { position: absolute; z-index: 2; top: -14px; right: -10px; display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 50%; color: var(--plum); background: white; box-shadow: 0 10px 25px rgba(0,0,0,.25); cursor: pointer; font-size: 1.8rem; }
.toast { position: fixed; z-index: 1100; left: 50%; bottom: 30px; max-width: calc(100% - 36px); padding: 12px 20px; border-radius: 999px; color: white; background: rgba(42,24,44,.94); box-shadow: 0 16px 40px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: .3s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; z-index: 2000; right: 15px; bottom: 15px; left: 15px; padding: 15px; color: white; background: #7d3348; text-align: center; }

.reveal { opacity: 0; transform: translateY(32px); transition: opacity .85s ease, transform .85s cubic-bezier(.2,.75,.25,1); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.heart-particle { position: fixed; z-index: 1001; pointer-events: none; animation: heartFly var(--duration, 2.8s) ease-out forwards; font-size: var(--size, 24px); }
@keyframes heartFly { 0% { opacity: 0; transform: translate(0,20px) scale(.5) rotate(0); } 18% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x,0), -110vh) scale(1.3) rotate(var(--rotate,40deg)); } }

@media (max-width: 980px) {
  .section { padding: 90px 0; }
  .nav__links { display: none; }
  .hero__content { grid-template-columns: 1fr; gap: 10px; padding-top: 35px; }
  .hero__photos { width: min(600px, 100%); min-height: 610px; margin-inline: auto; }
  .timeline::before { left: 35px; }
  .timeline__item, .timeline__item--reverse { grid-template-columns: 70px 1fr; gap: 20px; }
  .timeline__number { grid-column: 1; grid-row: 1; width: 58px; height: 58px; border-width: 6px; }
  .timeline__item > div, .timeline__item--reverse > div { grid-column: 2; grid-row: 1; justify-self: stretch; text-align: left; }
  .timeline__item > img, .timeline__item--reverse > img { grid-column: 2; grid-row: 2; height: 300px; }
  .promise__grid { grid-template-columns: 1fr; }
  .memory-game__inner { grid-template-columns: 1fr; }
  .memory-game__inner > div:first-child { grid-row: auto; }
  .footer__inner { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --shell: min(100% - 28px, 1180px); }
  .section { padding: 72px 0; }
  .opening__card { padding: 30px 21px; }
  .opening__actions { display: grid; }
  .opening__actions .button { width: 100%; }
  .music-control__text { display: none; }
  .music-control { padding: 8px; }
  .hero__content { padding-bottom: 95px; }
  .hero__copy h1 { font-size: clamp(3.6rem, 18vw, 5.4rem); }
  .hero__stats { grid-template-columns: 1fr; }
  .hero__stats div { grid-template-columns: 70px 1fr; align-items: center; }
  .hero__photos { min-height: 480px; }
  .photo-card--main { top: 20px; right: 8%; width: 72%; height: 390px; }
  .photo-card--small { width: 125px; height: 145px; }
  .photo-card--left { left: 0; bottom: 0; }
  .photo-card--right { right: 0; bottom: 18px; }
  .hero__scribble { top: 0; left: 0; font-size: .75rem; }
  .scroll-hint { display: none; }
  .timeline::before { left: 25px; }
  .timeline__item, .timeline__item--reverse { grid-template-columns: 52px 1fr; gap: 14px; }
  .timeline__number { width: 48px; height: 48px; border-width: 5px; font-size: .86rem; }
  .timeline__item > img, .timeline__item--reverse > img { height: 230px; border-radius: 18px; }
  .contract { padding: 45px 25px 30px; }
  .contract__stamp { top: 15px; right: 16px; font-size: .5rem; }
  .contract__signatures { display: grid; }
  .letter-tabs { width: 100%; }
  .letter-tab { flex: 1; padding: 10px 8px; font-size: .78rem; }
  .letter { padding: 45px 22px 32px; }
  .letter__body { font-size: 1.02rem; line-height: 1.82; }
  .gallery { columns: 1; }
  .finale { min-height: 760px; }
  .finale__photo { background-image: linear-gradient(180deg, rgba(29,19,31,.25) 0%, rgba(29,19,31,.82) 48%, rgba(29,19,31,.98) 100%), url('images/01_balniat_nachalo.webp'); background-position: 50% 20%; }
  .finale__content { align-self: end; margin-bottom: 50px; padding-top: 260px; }
  .finale__actions .button { width: 100%; }
  .lightbox__close { top: -8px; right: -3px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Compact family stats on narrow screens, so the photo story appears sooner. */
@media (max-width: 640px) {
  .hero__stats { grid-template-columns: repeat(3, 1fr); }
  .hero__stats div { grid-template-columns: 1fr; padding: 12px 7px; text-align: center; }
  .hero__stats strong { font-size: 1.15rem; }
  .hero__stats span { font-size: .6rem; line-height: 1.25; }
}
