@font-face {
    font-family: 'Expo Arabic';
    src: url('fonts/ExpoArabic-Book.ttf') format('truetype');
    font-weight: 300 500;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Kufi Arabic Local';
    src: url('fonts/NotoKufiArabic-Regular.woff2') format('woff2');
    font-weight: 300 500;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Kufi Arabic Local';
    src: url('fonts/NotoKufiArabic-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Kufi Arabic Local';
    src: url('fonts/NotoKufiArabic-Bold.woff2') format('woff2');
    font-weight: 700 800;
    font-display: swap;
}

@font-face {
    font-family: 'Expo Arabic';
    src: url('fonts/ExpoArabic-Bold.ttf') format('truetype');
    font-weight: 600 800;
    font-display: swap;
}

:root {
    --ivory: #fffaf5;
    --paper: #f9efe6;
    --paper-deep: #f1dfd4;
    --ink: #4b292a;
    --muted: #8b6762;
    --wine: #651d2a;
    --wine-dark: #441019;
    --blush: #dba9a2;
    --gold: #b88a47;
    --gold-pale: #e7c98e;
    --shadow: 0 25px 80px rgba(81, 35, 38, .16);
    --font: 'Expo Arabic', 'Noto Kufi Arabic Local', Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    background: var(--paper);
}

body {
    margin: 0;
    min-width: 320px;
    overflow: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 10%, rgba(219, 169, 162, .22), transparent 28rem),
        radial-gradient(circle at 90% 40%, rgba(184, 138, 71, .12), transparent 30rem),
        linear-gradient(180deg, #fffaf6 0%, #f9eee6 50%, #fffaf7 100%);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

body.invitation-open {
    overflow-x: hidden;
    overflow-y: auto;
}

button, a { font: inherit; }

.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .11;
    z-index: 50;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.38'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
}

.ambient {
    position: fixed;
    width: 22rem;
    height: 22rem;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: -1;
}

.ambient-one { top: -8rem; right: -7rem; background: rgba(163, 60, 75, .14); }
.ambient-two { bottom: -10rem; left: -8rem; background: rgba(204, 163, 95, .16); }

.envelope-scene {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: clamp(1rem, 3vh, 2rem);
    min-height: 100svh;
    padding: max(1.5rem, env(safe-area-inset-top)) 1.25rem max(1.5rem, env(safe-area-inset-bottom));
    background:
        radial-gradient(circle at 50% 42%, rgba(255,255,255,.96) 0 9rem, rgba(250,240,232,.84) 25rem, transparent 42rem),
        linear-gradient(145deg, #f6e8de, #fffaf5 55%, #edd9d1);
    transition: opacity .8s ease .55s, visibility .8s ease .55s;
}

.envelope-scene::before,
.envelope-scene::after {
    content: '♡';
    position: absolute;
    color: rgba(101,29,42,.12);
    font-family: Georgia, serif;
    font-size: clamp(5rem, 18vw, 12rem);
}

.envelope-scene::before { top: 4%; right: 4%; transform: rotate(16deg); }
.envelope-scene::after { bottom: 1%; left: 5%; transform: rotate(-18deg); }

.envelope-copy { text-align: center; z-index: 2; }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .8rem;
    color: var(--gold);
    font-size: .72rem;
    letter-spacing: .18em;
}
.eyebrow::before, .eyebrow::after { content: ''; width: 2.8rem; height: 1px; background: currentColor; }
.envelope-copy h1 { margin: .5rem 0 .2rem; font-size: clamp(2rem, 7vw, 4rem); font-weight: 500; color: var(--wine-dark); }
.envelope-copy p { margin: 0; color: var(--muted); font-size: .95rem; }

.envelope-button {
    position: relative;
    width: min(84vw, 390px);
    height: min(59vw, 275px);
    padding: 0;
    border: 0;
    color: inherit;
    cursor: pointer;
    background: transparent;
    perspective: 1200px;
    animation: envelopeFloat 3.8s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
}

.envelope-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 10px; border-radius: 1rem; }
.envelope-shadow { position: absolute; right: 9%; bottom: 0; left: 9%; height: 1.1rem; border-radius: 50%; background: rgba(73,33,35,.2); filter: blur(12px); transform: translateY(1.5rem); }
.envelope { position: absolute; inset: 0 0 14%; transform-style: preserve-3d; }
.envelope-back { position: absolute; inset: 0; border-radius: .45rem .45rem 1.1rem 1.1rem; background: linear-gradient(145deg, #f3d9ca, #fff7ef); box-shadow: 0 28px 50px rgba(84,40,39,.2), inset 0 0 0 1px rgba(140,87,72,.13); }
.envelope-front { position: absolute; inset: 0; z-index: 4; overflow: hidden; border-radius: .45rem .45rem 1.1rem 1.1rem; }
.envelope-front::before, .envelope-front::after { content: ''; position: absolute; bottom: -54%; width: 75%; height: 145%; background: linear-gradient(160deg, #f7e4d8, #e9c9ba); box-shadow: 0 0 0 1px rgba(119,73,62,.06); }
.envelope-front::before { right: -20%; transform: rotate(43deg); }
.envelope-front::after { left: -20%; transform: rotate(-43deg); }
.envelope-flap { position: absolute; top: 0; right: 0; left: 0; z-index: 6; height: 56%; transform-origin: top; clip-path: polygon(0 0, 100% 0, 50% 100%); background: linear-gradient(165deg, #efd1c2, #fff5ec); filter: drop-shadow(0 4px 3px rgba(78,38,37,.12)); transition: transform 1s cubic-bezier(.22,.75,.25,1); backface-visibility: visible; }
.letter { position: absolute; z-index: 3; right: 6%; bottom: 4%; left: 6%; height: 91%; display: grid; place-items: center; border-radius: .4rem; color: var(--wine); background: linear-gradient(#fffdf9, #faf0e5); box-shadow: 0 7px 18px rgba(65,30,30,.08); transition: transform 1.2s cubic-bezier(.2,.82,.25,1) .35s; }
.letter::before { content: ''; position: absolute; inset: .75rem; border: 1px solid rgba(184,138,71,.32); border-radius: 50% 50% .3rem .3rem; }
.letter span { position: relative; font-size: clamp(1.2rem, 5vw, 2rem); font-weight: 600; }
.letter i { padding: 0 .35rem; color: var(--gold); font-style: normal; font-weight: 300; }
.wax-seal { position: absolute; z-index: 8; top: 47%; left: 50%; width: clamp(3.5rem, 14vw, 4.9rem); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; gap: .18rem; transform: translate(-50%,-50%) rotate(-5deg); border-radius: 50% 47% 53% 48%; color: #f4c7b8; background: radial-gradient(circle at 36% 28%, #9e4250 0 8%, #6c1424 36%, #3c0710 86%); border: 5px double rgba(255,186,173,.2); box-shadow: 0 5px 10px rgba(64,11,18,.38), inset 0 0 0 2px rgba(255,198,180,.15); transition: opacity .25s ease .15s, transform .45s ease; }
.wax-seal b { font-size: clamp(.7rem, 3vw, 1rem); }
.wax-seal small { color: #d98b8d; font-size: .58rem; }
.tap-hint { color: var(--muted); font-size: .75rem; opacity: .8; animation: pulse 2s ease-in-out infinite; }

.envelope-scene.opened { pointer-events: none; opacity: 0; visibility: hidden; }
.envelope-scene.opened .envelope-button { animation: none; }
.envelope-scene.opened .envelope-flap { transform: rotateX(180deg); z-index: 2; }
.envelope-scene.opened .letter { transform: translateY(-61%) scale(1.03); }
.envelope-scene.opened .wax-seal { opacity: 0; transform: translate(-50%,-50%) scale(.55) rotate(18deg); }
.envelope-scene.opened .envelope-copy { animation: copyFade .4s ease forwards; }

main { visibility: hidden; opacity: 0; transition: opacity 1s ease .8s, visibility 1s ease .8s; }
body.invitation-open main { visibility: visible; opacity: 1; }
.section-pad { position: relative; display: grid; place-items: center; min-height: 100svh; padding: clamp(4.5rem, 10vw, 8rem) 1.25rem; }
.hero-section { overflow: hidden; }
.hero-card { width: min(100%, 680px); text-align: center; }
.ornament-line { display: flex; align-items: center; justify-content: center; gap: 1rem; color: var(--gold); }
.ornament-line::before, .ornament-line::after { content: ''; width: min(26vw, 9rem); height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament-line::after { transform: scaleX(-1); }
.kicker { margin: 1.3rem 0 .9rem; color: var(--gold); font-size: clamp(1rem, 3.2vw, 1.35rem); letter-spacing: .11em; line-height: 1.8; }
.invitation-verse { margin: 0 auto; color: var(--muted); font-size: clamp(.92rem, 2.8vw, 1.08rem); line-height: 2.1; }
.names { display: flex; align-items: center; justify-content: center; gap: clamp(.7rem, 3vw, 1.5rem); margin: 1.2rem 0 0; color: var(--wine); font-size: clamp(2.7rem, 10vw, 5.6rem); line-height: 1.2; font-weight: 600; text-shadow: 0 4px 18px rgba(90,25,38,.08); }
.names b { position: relative; color: var(--gold); font-size: .48em; font-weight: 300; }
.names b::before, .names b::after { content: ''; position: absolute; top: 50%; width: 1rem; height: 1px; background: currentColor; }
.names b::before { right: 140%; }
.names b::after { left: 140%; }
.engagement-label { margin: .1rem 0 .3rem; color: var(--muted); font-size: .8rem; letter-spacing: .08em; }
.couple-wrap { position: relative; width: min(78vw, 410px); margin: -.3rem auto -1rem; }
.couple-halo { position: absolute; top: 20%; left: 50%; width: 95%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle, rgba(226,185,145,.26), rgba(206,137,140,.08) 55%, transparent 72%); filter: blur(1px); }
.couple-art { position: relative; z-index: 1; display: block; width: 100%; max-height: 48vh; object-fit: contain; filter: drop-shadow(0 18px 22px rgba(77,33,34,.18)); }
.scroll-copy { margin: 0; color: var(--muted); font-size: .68rem; }
.scroll-arrow { display: block; width: 1px; height: 2.8rem; margin: .7rem auto 0; background: linear-gradient(var(--gold), transparent); animation: arrowDown 1.7s ease-in-out infinite; }
.floating-heart { position: absolute; color: rgba(101,29,42,.12); font-family: Georgia, serif; animation: softDrift 5s ease-in-out infinite; }
.heart-one { top: 15%; right: 7%; font-size: 4rem; }
.heart-two { bottom: 17%; left: 7%; font-size: 2.5rem; animation-delay: -2s; }

.story-section { align-content: center; gap: 2.8rem; background: rgba(255,255,255,.28); }
.section-heading { text-align: center; }
.mini-heart { display: block; color: var(--wine); font-size: .8rem; }
.section-heading p { margin: .8rem 0 0; color: var(--gold); font-size: clamp(1rem, 3.2vw, 1.35rem); line-height: 1.8; }
.section-heading h2 { margin: .4rem 0 1rem; color: var(--wine-dark); font-size: clamp(1.8rem, 6vw, 3.2rem); font-weight: 500; }
.fine-rule { display: block; width: 5rem; height: 1px; margin: auto; background: var(--gold); }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; width: min(100%, 760px); }
.detail-card { position: relative; min-height: 220px; padding: 2rem 1.4rem; overflow: hidden; text-align: center; border: 1px solid rgba(184,138,71,.22); border-radius: 1.7rem; background: rgba(255,252,248,.72); box-shadow: 0 18px 45px rgba(93,50,48,.08); backdrop-filter: blur(12px); }
.detail-card::before { content: ''; position: absolute; top: -3rem; left: -3rem; width: 7rem; height: 7rem; border: 1px solid rgba(184,138,71,.14); border-radius: 50%; }
.detail-icon { display: grid; place-items: center; width: 3rem; height: 3rem; margin: 0 auto 1rem; border-radius: 50%; color: var(--wine); background: #f6e6dd; }
.detail-icon svg { width: 1.35rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.detail-label { color: var(--gold); font-size: .7rem; }
.detail-card h3 { margin: .45rem 0 .4rem; color: var(--wine-dark); font-size: clamp(1.15rem, 4vw, 1.55rem); font-weight: 600; }
.detail-card p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.9; }
.map-action { text-align: center; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: .7rem; min-height: 3.5rem; padding: .8rem 1.7rem; border: 1px solid var(--wine); border-radius: 999px; color: #fff; background: linear-gradient(135deg, var(--wine), var(--wine-dark)); box-shadow: 0 14px 28px rgba(83,20,31,.2); text-decoration: none; transition: transform .25s ease, box-shadow .25s ease; }
.primary-button:hover { transform: translateY(-3px); box-shadow: 0 18px 35px rgba(83,20,31,.27); }
.primary-button svg { width: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.5; }

.countdown-section { min-height: 70svh; }
.countdown-section::before { content: '♡'; position: absolute; top: 10%; left: 50%; color: rgba(101,29,42,.05); font-family: Georgia, serif; font-size: min(55vw, 27rem); transform: translateX(-50%); }
.countdown-shell { position: relative; width: min(100%, 860px); padding: clamp(2rem, 7vw, 4.3rem) clamp(1rem, 5vw, 3rem); text-align: center; border-radius: 2.4rem; background: linear-gradient(145deg, rgba(91,21,33,.97), rgba(55,8,17,.98)); box-shadow: var(--shadow); }
.section-overline { margin: 0 0 2rem; color: var(--gold-pale); font-size: .82rem; }
.countdown { direction: ltr; display: flex; align-items: center; justify-content: center; gap: clamp(.3rem, 2vw, 1.2rem); color: #fff; }
.countdown div { min-width: clamp(3.5rem, 15vw, 7rem); }
.countdown strong { display: block; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2.2rem, 10vw, 5.2rem); font-weight: 400; line-height: 1; font-variant-numeric: tabular-nums; }
.countdown span { display: block; margin-top: .8rem; color: #d8b9b0; font-size: .65rem; }
.countdown i { align-self: flex-start; margin-top: .25rem; color: rgba(255,255,255,.35); font-family: serif; font-size: clamp(1.7rem, 6vw, 3rem); font-style: normal; }
.countdown-finished, .pending-copy { color: #fff; font-size: clamp(1rem, 4vw, 1.35rem); }

.closing-section { min-height: 80svh; }
.closing-card { width: min(100%, 680px); text-align: center; }
.closing-mark { display: inline-flex; align-items: center; gap: 1rem; color: var(--gold); font-size: 1rem; }
.closing-mark i { color: var(--wine); font-size: .7rem; font-style: normal; }
.closing-card p { margin: 2rem 0 .5rem; color: var(--muted); }
.closing-card h2 { margin: 0; color: var(--wine); font-size: clamp(2.3rem, 8vw, 4.6rem); font-weight: 500; }
.signature { margin-top: 2.2rem; color: var(--gold); font-size: 1.15rem; }

.music-toggle { position: fixed; z-index: 60; bottom: max(1rem, env(safe-area-inset-bottom)); left: 1rem; display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0; border: 1px solid rgba(184,138,71,.35); border-radius: 50%; color: #fff; background: rgba(82,18,30,.88); box-shadow: 0 10px 28px rgba(74,22,29,.24); backdrop-filter: blur(9px); cursor: pointer; }
.music-toggle svg { width: 1.15rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.music-toggle .music-off { display: none; }
.music-toggle.paused .music-on { display: none; }
.music-toggle.paused .music-off { display: block; }

.reveal { opacity: 0; transform: translateY(60px) scale(.985); transition: opacity .9s cubic-bezier(.2,.8,.2,1), transform .9s cubic-bezier(.2,.8,.2,1); }
.reveal.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.reveal-delay-1 { transition-delay: .08s; }
.reveal-delay-2 { transition-delay: .18s; }

@keyframes envelopeFloat { 0%,100% { transform: translateY(0) rotate(-.5deg); } 50% { transform: translateY(-13px) rotate(.7deg); } }
@keyframes pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes copyFade { to { opacity: 0; transform: translateY(-10px); } }
@keyframes arrowDown { 0% { transform: translateY(-4px); opacity: .25; } 50% { opacity: 1; } 100% { transform: translateY(7px); opacity: 0; } }
@keyframes softDrift { 0%,100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-18px) rotate(5deg); } }

@media (max-width: 640px) {
    .section-pad { padding-right: 1rem; padding-left: 1rem; }
    .details-grid { grid-template-columns: 1fr; }
    .detail-card { min-height: 195px; }
    .hero-section { min-height: 100svh; padding-top: 3rem; padding-bottom: 2rem; }
    .couple-art { max-height: 42vh; }
    .countdown-shell { border-radius: 1.6rem; }
    .countdown { gap: .15rem; }
    .countdown div { min-width: 3.5rem; }
}

@media (max-height: 720px) {
    .envelope-scene { gap: .8rem; }
    .envelope-button { width: min(68vw, 310px); height: min(46vw, 210px); }
    .envelope-copy h1 { font-size: 1.8rem; }
    .couple-art { max-height: 38vh; }
}

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