/* =====================================================
   SAHIL & MUNAZZAPARVEEN — "AFTER MAGHRIB"
   Both celebrations begin after sunset, so the whole
   invitation is set in the hour after Maghrib: an amber
   horizon fading into an emerald night, a crescent moon,
   stars, and a single golden thread tying the two names.

   Mobile-first base styles. Wider layouts live in
   responsive.css.
   ===================================================== */

/* ---------- Design tokens ---------- */
:root {
    --night:        #10231F;   /* deep emerald night — page base */
    --night-deep:   #0A1714;   /* silhouettes, deepest shadow */
    --night-raise:  #173029;   /* raised panels */
    --dusk:         #1E3D35;   /* upper sky just after sunset */
    --horizon:      #E2A56B;   /* amber afterglow on the horizon */
    --horizon-rose: #B7746A;   /* rose band above the amber */

    --gold:         #D9B970;   /* foil gold — lines, accents */
    --gold-deep:    #A98B4C;
    --gold-soft:    rgba(217, 185, 112, 0.34);

    --ivory:        #F4ECDD;   /* primary text on night */
    --ivory-soft:   #CFC6B4;   /* secondary text */
    --ivory-mute:   #938D7F;   /* captions */
    --hair:         rgba(244, 236, 221, 0.14);

    --serif:  "Cormorant Garamond", "Times New Roman", Georgia, serif;
    --sans:   "Jost", "Segoe UI", system-ui, sans-serif;
    --arabic: "Amiri", "Traditional Arabic", serif;
    --ruqaa:  "Aref Ruqaa", "Amiri", serif;

    --space-section: clamp(4.5rem, 16vw, 9rem);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    background: var(--night-deep);
    /* Mobile browsers widen the layout viewport if anything overflows;
       clip on both html and body so the page can never be zoomed out */
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    font-family: var(--sans);
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ivory);
    /* Dusk at the top of the page, deepening into night as you scroll */
    background: linear-gradient(180deg,
        var(--dusk) 0,
        var(--night) 110vh,
        var(--night) 70%,
        var(--night-deep) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-x: clip;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
}

img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: var(--gold); }

::selection { background: var(--gold); color: var(--night); }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 3px;
}

/* ---------- Starfield (fixed, painted once) ---------- */
.sky {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.sky__stars {
    position: absolute;
    inset: 0;
    background-repeat: repeat;
}

.sky__stars--a {
    background-size: 340px 420px;
    background-image:
        radial-gradient(1px 1px at 12% 18%, rgba(244,236,221,.75), transparent 60%),
        radial-gradient(1px 1px at 38% 72%, rgba(244,236,221,.5), transparent 60%),
        radial-gradient(1.4px 1.4px at 64% 34%, rgba(244,236,221,.8), transparent 60%),
        radial-gradient(1px 1px at 86% 58%, rgba(244,236,221,.45), transparent 60%),
        radial-gradient(1px 1px at 22% 90%, rgba(244,236,221,.55), transparent 60%),
        radial-gradient(1.2px 1.2px at 74% 8%, rgba(217,185,112,.7), transparent 60%),
        radial-gradient(1px 1px at 50% 50%, rgba(244,236,221,.35), transparent 60%);
    opacity: 0.7;
}

.sky__stars--b {
    background-size: 520px 610px;
    background-position: 130px 90px;
    background-image:
        radial-gradient(1.6px 1.6px at 20% 30%, rgba(244,236,221,.9), transparent 60%),
        radial-gradient(1px 1px at 70% 65%, rgba(244,236,221,.6), transparent 60%),
        radial-gradient(1.3px 1.3px at 45% 12%, rgba(217,185,112,.8), transparent 60%),
        radial-gradient(1px 1px at 90% 85%, rgba(244,236,221,.5), transparent 60%);
    animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes twinkle {
    from { opacity: 0.25; }
    to   { opacity: 0.9; }
}

/* ---------- Layout primitives ---------- */
.container {
    width: 100%;
    max-width: 70rem;
    margin-inline: auto;
    padding-inline: 1.25rem;
}

.container--narrow { max-width: 40rem; }

.section {
    padding-block: var(--space-section);
    text-align: center;
    position: relative;
}

.section-head { margin-bottom: 3rem; }

.section-title {
    font-family: var(--serif);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2rem, 9vw, 3.4rem);
    line-height: 1.12;
    color: var(--ivory);
    text-wrap: balance;
}

.section-sub {
    margin: 1rem auto 0;
    max-width: 26rem;
    color: var(--ivory-soft);
    font-size: 0.98rem;
}

.source {
    display: block;
    margin-top: 1.2rem;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--gold);
    text-wrap: balance;
}

/* ---------- Ornaments ---------- */
/* Eight-point star, drawn with two rotated squares */
.divider-star {
    position: relative;
    display: inline-block;
    width: 9px;
    height: 9px;
    flex-shrink: 0;
}

.divider-star::before,
.divider-star::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid var(--gold);
}

.divider-star::after { transform: rotate(45deg); }

/* The golden thread — segments that draw themselves between sections,
   each ending in a star knot */
.thread-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    padding-block: 0.5rem;
}

.thread-divider__line {
    width: 1px;
    height: clamp(3.5rem, 12vw, 6rem);
    background: linear-gradient(180deg, transparent, var(--gold) 40%, var(--gold));
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 1.4s var(--ease-out);
}

.thread-divider .divider-star {
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.7s var(--ease-out) 1s, transform 0.7s var(--ease-out) 1s;
}

.thread-divider.reveal { opacity: 1; transform: none; transition: none; }
.thread-divider.is-visible .thread-divider__line { transform: scaleY(1); }
.thread-divider.is-visible .divider-star { opacity: 1; transform: scale(1); }

/* ---------- Crescent moon (pure CSS) ---------- */
.moon,
.window__moon,
.closing__moon,
.invite-card__moon {
    border-radius: 50%;
    background: transparent;
    box-shadow: inset -0.62em 0.28em 0 0 #EBD8A6;
    filter: drop-shadow(0 0 0.6em rgba(235, 216, 166, 0.45));
    transform: rotate(-18deg);
}

/* =====================================================
   HERO
   ===================================================== */
/* The first screen must fit the visible viewport on every phone, so
   the hero is sized by height as well as width. --h is one percent of
   the small viewport height (the height with browser bars showing). */
.hero {
    --h: 1vh;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: calc(var(--h) * 4) 1.25rem calc(var(--h) * 3);
    position: relative;
    overflow: hidden;
}

@supports (height: 1svh) {
    .hero { --h: 1svh; }
}

/* Amber afterglow rising behind the window */
.hero::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 34%;
    width: 150vw;
    height: 70vh;
    transform: translate(-50%, -50%);
    background: radial-gradient(closest-side, rgba(226, 165, 107, 0.16), transparent);
    pointer-events: none;
}

.hero > * { position: relative; }

.hero__bismillah {
    font-family: var(--ruqaa);
    font-size: clamp(1.45rem, 6.6vw, 2.2rem);
    color: var(--gold);
    line-height: 1.8;
    margin-bottom: 1.1rem;
}

/* ---------- The arched window ---------- */
.window {
    width: min(58vw, calc(var(--h) * 22), 17rem);
    aspect-ratio: 4 / 5;
    margin-bottom: calc(var(--h) * 2.6);
}

.window__frame {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 7px;
    border: 1px solid var(--gold);
    border-radius: 100em 100em 0.4rem 0.4rem;
}

/* Second, inner keyline for the double-gilded frame */
.window__frame::after {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1px solid var(--gold-soft);
    border-radius: 100em 100em 0.3rem 0.3rem;
    pointer-events: none;
}

.window__sky {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 100em 100em 0.2rem 0.2rem;
    background: linear-gradient(180deg,
        #13302A 0%,
        #24463C 38%,
        #6B5A54 64%,
        var(--horizon-rose) 76%,
        var(--horizon) 90%,
        #F0C48A 100%);
}

.window__star {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--ivory);
    box-shadow: 0 0 6px rgba(244, 236, 221, 0.8);
    animation: star-pulse 3.2s ease-in-out var(--d) infinite alternate;
}

@keyframes star-pulse {
    from { opacity: 0.25; }
    to   { opacity: 1; }
}

.window__moon {
    position: absolute;
    top: 16%;
    right: 20%;
    width: 2.6em;
    height: 2.6em;
    font-size: clamp(0.8rem, 3.4vw, 1.1rem);
    opacity: 0;
}

.intro-done .window__moon {
    animation: moon-rise 2.6s var(--ease-out) 0.9s forwards;
}

.no-js .window__moon { opacity: 1; }

@keyframes moon-rise {
    from { opacity: 0; transform: translateY(2.2em) rotate(-18deg); }
    to   { opacity: 1; transform: translateY(0) rotate(-18deg); }
}

.window__skyline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 32%;
    fill: var(--night-deep);
}

/* Groups the words beside the window on desktop; on phones it is
   simply a centred column, identical to having no wrapper */
.hero__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* ---------- Names ---------- */
.hero__lead,
.hero__invite {
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.05rem, 4.4vw, 1.35rem);
    color: var(--ivory-soft);
}

.hero__lead { margin-bottom: calc(var(--h) * 1.2); }
.hero__invite { margin-top: calc(var(--h) * 1.2); }

.hero__names {
    font-family: var(--serif);
    font-weight: 500;
    color: var(--ivory);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* "Munazzaparveen" is one unbreakable ~7.5em word, so the size must
   track the viewport width or it forces horizontal overflow */
.hero__name {
    font-size: clamp(1.35rem, min(8.4vw, calc(var(--h) * 4.6)), 4.4rem);
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-wrap: balance;
    max-width: 100%;
    overflow-wrap: break-word;
}

/* The knot: the thread loops around the ampersand, tying the names */
.hero__amp {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: clamp(3rem, calc(var(--h) * 9), 5.6rem);
    aspect-ratio: 4 / 7;
    margin-block: calc(var(--h) * 0.8);
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.3rem, calc(var(--h) * 3.1), 1.9rem);
    color: var(--gold);
}

.hero__amp-char { position: relative; line-height: 1; }

.amp-knot {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--gold);
    stroke-width: 1.3;
    overflow: visible;
}

.amp-knot__thread {
    stroke: var(--gold-soft);
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
}

.amp-knot__loop {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transform: rotate(-90deg);
    transform-origin: center;
}

.intro-done .amp-knot__thread { animation: knot-draw 0.7s var(--ease-out) 1.7s forwards; }
.intro-done .amp-knot__loop   { animation: knot-draw 1.3s var(--ease-out) 2.2s forwards; }
.intro-done .amp-knot__thread--out { animation-delay: 3.3s; }

.no-js .amp-knot__thread,
.no-js .amp-knot__loop { stroke-dashoffset: 0; }

@keyframes knot-draw { to { stroke-dashoffset: 0; } }

/* ---------- Dates ---------- */
.hero__dates {
    margin-top: calc(var(--h) * 3);
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 1.1rem;
}

.hero__date {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.hero__date-event {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.25rem;
    color: var(--gold);
    line-height: 1.2;
}

.hero__date-day {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ivory-mute);
}

.hero__date-full {
    font-family: var(--serif);
    font-size: clamp(1rem, 4.3vw, 1.2rem);
    color: var(--ivory);
    white-space: nowrap;
}

.hero__date-sep {
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--gold-soft), transparent);
}

.hero__scroll {
    margin-top: calc(var(--h) * 2.4);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: var(--ivory-mute);
    text-decoration: none;
    min-height: 44px;
    padding: 0.4rem 0.8rem;
}

.hero__scroll-line {
    width: 1px;
    height: 2.2rem;
    background: var(--gold);
    transform-origin: top;
    animation: scroll-pulse 2.6s var(--ease-out) infinite;
}

@keyframes scroll-pulse {
    0%   { transform: scaleY(0); opacity: 0; }
    35%  { transform: scaleY(1); opacity: 1; }
    75%, 100% { transform: scaleY(1); opacity: 0; }
}

/* ---------- Hero entrance ----------
   Held until the opening doors part (html.intro-done), then
   each line arrives in turn: window, names, dates. */
.reveal-load {
    opacity: 0;
    transform: translateY(14px);
}

.intro-done .reveal-load {
    animation: rise-in 1.1s var(--ease-out) forwards;
}

.intro-done .window.reveal-load                    { animation-delay: 0.3s; }
.intro-done .hero__lead.reveal-load                { animation-delay: 0.9s; }
.intro-done .hero__names .reveal-load:nth-child(1) { animation-delay: 1.15s; }
.intro-done .hero__names .reveal-load:nth-child(2) { animation-delay: 1.5s; }
.intro-done .hero__names .reveal-load:nth-child(4) { animation-delay: 1.8s; }
.intro-done .hero__invite.reveal-load              { animation-delay: 2.2s; }
.intro-done .hero__dates.reveal-load               { animation-delay: 2.5s; }
.intro-done .hero__scroll.reveal-load              { animation-delay: 2.9s; }

/* Without JavaScript there is no opening — show the hero at once */
.no-js .reveal-load { opacity: 1; transform: none; }

/* =====================================================
   OPENING — closed doors, Bismillah, ribbon, seal
   ===================================================== */
.intro {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    perspective: 1800px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.no-js .intro { display: none; }

/* Scroll is locked while the doors are closed */
.intro-active,
.intro-active body { overflow: hidden; }

.intro__door {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50.5%;
    background-color: var(--night-raise);
    background-image:
        radial-gradient(90% 60% at 50% 45%, rgba(226, 165, 107, 0.08), transparent 70%),
        repeating-linear-gradient(45deg, rgba(217, 185, 112, 0.10) 0 1px, transparent 1px 22px),
        repeating-linear-gradient(-45deg, rgba(217, 185, 112, 0.10) 0 1px, transparent 1px 22px);
    transition: transform 1.7s cubic-bezier(0.65, 0, 0.2, 1);
    will-change: transform;
}

/* Inner gilded panel on each door */
.intro__door::before {
    content: "";
    position: absolute;
    inset: 1.1rem;
    border: 1px solid var(--gold-soft);
}

.intro__door--l {
    left: 0;
    transform-origin: left center;
    border-right: 1px solid var(--gold);
}

.intro__door--l::before { right: 0.9rem; border-radius: 100em 0 0 0 / 30% 0 0 0; }

.intro__door--r {
    right: 0;
    transform-origin: right center;
    border-left: 1px solid var(--gold);
}

.intro__door--r::before { left: 0.9rem; border-radius: 0 100em 0 0 / 0 30% 0 0; }

.intro.is-opening .intro__door--l { transform: rotateY(-100deg); }
.intro.is-opening .intro__door--r { transform: rotateY(100deg); }

.intro.is-opening { pointer-events: none; }

/* ---------- Bismillah on the doors ---------- */
.intro__content {
    position: relative;
    z-index: 2;
    padding: 0 1.5rem;
    margin-bottom: 5.5rem;
    text-align: center;
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.intro__bismillah {
    font-family: var(--ruqaa);
    font-size: clamp(2rem, 10vw, 3.6rem);
    line-height: 1.7;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(217, 185, 112, 0.25);
    opacity: 0;
    transform: translateY(12px);
    animation: rise-in 1.3s var(--ease-out) 0.2s forwards;
}

.intro__meaning {
    margin-top: 0.6rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.1rem, 4.6vw, 1.5rem);
    line-height: 1.5;
    color: var(--ivory);
    opacity: 0;
    transform: translateY(12px);
    animation: rise-in 1.2s var(--ease-out) 1s forwards;
}

.intro.is-cut .intro__content {
    opacity: 0;
    transform: translateY(-10px);
}

.intro.is-cut .intro__hint {
    animation: none;
    opacity: 0;
}

/* ---------- Ribbon ---------- */
.intro__ribbon {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(50% + 3.2rem);
    height: 14px;
    z-index: 2;
    display: flex;
    transform: scaleX(0);
    animation: ribbon-draw 1s var(--ease-out) 1.6s forwards;
}

.intro__ribbon-half {
    flex: 1;
    background: linear-gradient(180deg, #A98B4C 0%, #E6C98A 45%, #D9B970 55%, #9C7F43 100%);
    box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.6);
    transition: transform 0.9s cubic-bezier(0.5, 0, 0.3, 1), opacity 0.9s ease;
}

@keyframes ribbon-draw { to { transform: scaleX(1); } }

/* The cut: each half springs back toward its own side */
.intro.is-cut .intro__ribbon-half--l { transform: translateX(-104%) rotate(-4deg); opacity: 0; }
.intro.is-cut .intro__ribbon-half--r { transform: translateX(104%) rotate(4deg); opacity: 0; }

/* ---------- Seal ---------- */
.intro__seal {
    position: absolute;
    top: calc(50% + 3.2rem + 7px);
    left: 50%;
    z-index: 3;
    width: 4.6rem;
    height: 4.6rem;
    margin: -2.3rem 0 0 -2.3rem;
    border-radius: 50%;
    border: 1px solid var(--gold);
    background: radial-gradient(circle at 35% 30%, #24463C, var(--night-deep));
    box-shadow: 0 0 0 5px rgba(217, 185, 112, 0.14), 0 12px 30px -8px rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.6);
    animation: seal-in 0.8s var(--ease-out) 2.3s forwards, seal-pulse 2.4s ease-in-out 3.4s infinite;
    transition: opacity 0.4s ease, transform 0.4s var(--ease-out);
}

.intro__seal-moon {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.72rem;
    border-radius: 50%;
    box-shadow: inset -0.62em 0.28em 0 0 #EBD8A6;
    filter: drop-shadow(0 0 0.5em rgba(235, 216, 166, 0.5));
    transform: rotate(-18deg);
}

@keyframes seal-in {
    to { opacity: 1; transform: scale(1); }
}

@keyframes seal-pulse {
    0%, 100% { box-shadow: 0 0 0 5px rgba(217, 185, 112, 0.14), 0 12px 30px -8px rgba(0, 0, 0, 0.7); }
    50%      { box-shadow: 0 0 0 12px rgba(217, 185, 112, 0.05), 0 12px 30px -8px rgba(0, 0, 0, 0.7); }
}

.intro.is-cut .intro__seal {
    animation: none;
    opacity: 0;
    transform: scale(1.4);
}

.intro__hint {
    position: absolute;
    top: calc(50% + 7.2rem);
    left: 0;
    right: 0;
    z-index: 2;
    text-align: center;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: var(--ivory-mute);
    opacity: 0;
    animation: rise-in 0.8s var(--ease-out) 3s forwards;
    transition: opacity 0.4s ease;
}

@keyframes rise-in {
    to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   EPIGRAPH
   ===================================================== */
.section--epigraph { padding-block: calc(var(--space-section) * 0.75); }

.epigraph {
    position: relative;
    padding: clamp(2.5rem, 9vw, 4rem) clamp(1rem, 6vw, 3rem);
}

/* Gold corner brackets — the verse set like a calligraphy plate */
.epigraph::before,
.epigraph::after {
    content: "";
    position: absolute;
    width: clamp(2rem, 9vw, 3.5rem);
    height: clamp(2rem, 9vw, 3.5rem);
    border: 1px solid var(--gold);
    pointer-events: none;
}

.epigraph::before { top: 0; left: 0; border-right: none; border-bottom: none; }
.epigraph::after  { bottom: 0; right: 0; border-left: none; border-top: none; }

.epigraph__arabic {
    font-family: var(--arabic);
    font-size: clamp(2.2rem, 10.5vw, 4rem);
    line-height: 1.8;
    color: var(--gold);
}

.epigraph__meaning {
    margin-top: 0.6rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.3rem, 5.5vw, 1.75rem);
    color: var(--ivory);
}

/* =====================================================
   EVENTS
   ===================================================== */
.events {
    display: grid;
    gap: 2.5rem;
    justify-items: center;
}

.event {
    position: relative;
    width: 100%;
    max-width: 25rem;
    padding: 3.1rem 1.25rem 1.6rem;
    border: 1px solid var(--gold-soft);
    border-radius: 100em 100em 1.2rem 1.2rem;
    background:
        radial-gradient(120% 60% at 50% 0%, rgba(226, 165, 107, 0.10), transparent 60%),
        linear-gradient(180deg, rgba(23, 48, 41, 0.92), rgba(12, 27, 24, 0.94));
    box-shadow: 0 40px 70px -40px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    isolation: isolate;
}

/* Inner keyline following the arch */
.event::before {
    content: "";
    position: absolute;
    inset: 0.7rem;
    border: 1px solid rgba(217, 185, 112, 0.16);
    border-radius: 100em 100em 0.8rem 0.8rem;
    pointer-events: none;
    z-index: -1;
}

/* Event name in Arabic, very large and faint, behind the content */
.event__watermark {
    position: absolute;
    top: 1.4rem;
    left: 0;
    right: 0;
    z-index: -1;
    font-family: var(--arabic);
    font-weight: 700;
    font-size: clamp(5rem, 30vw, 8rem);
    line-height: 1;
    color: rgba(217, 185, 112, 0.075);
    pointer-events: none;
    user-select: none;
}

.event__order {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--gold);
}

.event__name {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(2.5rem, 11.5vw, 3.6rem);
    line-height: 1.05;
    color: var(--ivory);
    letter-spacing: 0.02em;
}

.event__date {
    margin-top: 0.4rem;
    font-family: var(--serif);
    font-size: 1.25rem;
    color: var(--ivory);
}

.event__time {
    margin-top: 0.25rem;
    font-size: 0.92rem;
    letter-spacing: 0.04em;
    color: var(--gold);
}

.event__rule {
    width: 3rem;
    height: 1px;
    margin: 1.1rem auto;
    background: var(--gold-soft);
}

.event__venue-name {
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--ivory);
    line-height: 1.3;
}

.event__address {
    font-size: 0.88rem;
    color: var(--ivory-soft);
    line-height: 1.5;
    text-wrap: balance;
}

.event__venue .event__address:first-of-type { margin-top: 0.35rem; }

.event__actions {
    margin-top: 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
}

.events__both {
    margin-top: 2.5rem;
    display: flex;
    justify-content: center;
}

/* ---------- Arch doors ----------
   Each evening waits behind closed lattice doors that swing open
   as the guest arrives at it. */
.event__doors {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    border-radius: inherit;
    overflow: hidden;
    perspective: 1400px;
    /* Decoration only — never blocks scrolling or taps on the details */
    pointer-events: none;
}

.event__door {
    flex: 1;
    position: relative;
    background-color: var(--night-raise);
    background-image:
        repeating-linear-gradient(45deg, rgba(217, 185, 112, 0.13) 0 1px, transparent 1px 16px),
        repeating-linear-gradient(-45deg, rgba(217, 185, 112, 0.13) 0 1px, transparent 1px 16px);
    transition: transform 1.1s cubic-bezier(0.6, 0, 0.2, 1);
}

.event__door--l { transform-origin: left center;  border-right: 1px solid var(--gold); }
.event__door--r { transform-origin: right center; border-left: 1px solid var(--gold); }

/* Diamond handles where the doors meet */
.event__door::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 1px solid var(--gold);
    transform: translateY(-50%) rotate(45deg);
}

.event__door--l::after { right: 0.8rem; }
.event__door--r::after { left: 0.8rem; }

.event.is-open .event__door--l { transform: rotateY(-105deg); }
.event.is-open .event__door--r { transform: rotateY(105deg); }

.event.is-open .event__doors {
    visibility: hidden;
    transition: visibility 0s linear 1.2s;
}

.no-js .event__doors { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    width: 100%;
    max-width: 19rem;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.25s var(--ease-out),
                background-color 0.25s var(--ease-out),
                border-color 0.25s var(--ease-out),
                color 0.25s var(--ease-out),
                box-shadow 0.25s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn--gold {
    background: var(--gold);
    border: 1px solid var(--gold);
    color: var(--night-deep);
    font-weight: 500;
}

.btn--gold:hover {
    background: #E6C98A;
    box-shadow: 0 0 0 4px rgba(217, 185, 112, 0.15), 0 14px 30px -16px rgba(217, 185, 112, 0.6);
}

.btn--line {
    background: transparent;
    border: 1px solid var(--gold-soft);
    color: var(--ivory);
}

.btn--line:hover {
    border-color: var(--gold);
    background: rgba(217, 185, 112, 0.07);
}

.btn--ghost {
    background: transparent;
    border: none;
    color: var(--ivory-soft);
}

.btn[disabled],
.btn[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
}

/* ---------- QR ----------
   Collapsed behind a toggle until the card is wide enough to show it
   beside the buttons, so every card fits on one screen when its doors
   open. A guest can't scan their own screen anyway — Maps is the button. */
.event__qr-toggle {
    margin-top: 0.5rem;
    min-height: 44px;
    padding: 0.4rem 0.8rem;
    background: none;
    border: none;
    font-family: var(--sans);
    font-size: 0.84rem;
    letter-spacing: 0.03em;
    color: var(--gold);
    text-decoration: underline;
    text-decoration-color: var(--gold-soft);
    text-underline-offset: 4px;
    cursor: pointer;
}

.event__qr-toggle[hidden],
.qr-card[hidden] { display: none !important; }

.event .qr-card { display: none; }
.event.show-qr .qr-card { display: flex; animation: rise-in 0.5s var(--ease-out) both; }

.qr-card {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}

/* White tile + quiet zone: needed for reliable scanning on a dark page */
.qr-card__code {
    background: #FFFFFF;
    padding: 12px;
    border-radius: 0.6rem;
    box-shadow: 0 0 0 1px var(--gold-soft), 0 0 0 6px rgba(217, 185, 112, 0.06);
}

.qr-card__code img,
.qr-card__code canvas {
    width: 140px;
    height: 140px;
    image-rendering: pixelated;
}

.qr-card__label {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--ivory-mute);
}

/* =====================================================
   COUNTDOWN
   ===================================================== */
.countdown__title {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.6rem, 7vw, 2.4rem);
    color: var(--ivory-soft);
    margin-bottom: 1.6rem;
}

.countdown {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 30rem;
    margin-inline: auto;
}

.countdown__unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-inline: 0.2rem;
    position: relative;
}

.countdown__unit + .countdown__unit::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18%;
    height: 50%;
    width: 1px;
    background: var(--gold-soft);
}

.countdown__value {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.4rem, 12vw, 4.4rem);
    line-height: 1;
    color: var(--gold);
    font-variant-numeric: tabular-nums lining-nums;
}

.countdown__label {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--ivory-mute);
}

.countdown__complete {
    margin-top: 1rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.3rem;
    color: var(--ivory);
}

/* =====================================================
   QURAN
   ===================================================== */
.verse__arabic {
    font-family: var(--arabic);
    font-size: clamp(1.55rem, 6.4vw, 2.2rem);
    line-height: 2.05;
    color: var(--ivory);
}

.verse__arabic--large {
    font-size: clamp(2rem, 9vw, 3.4rem);
    line-height: 1.9;
    color: var(--gold);
}

.verse__meaning {
    margin-top: 1rem;
    font-family: var(--serif);
    font-size: clamp(1.2rem, 4.8vw, 1.5rem);
    line-height: 1.6;
    color: var(--ivory);
    text-wrap: balance;
}

.verse--feature .verse__meaning {
    font-style: italic;
    font-size: clamp(1.35rem, 5.6vw, 1.8rem);
}

.verse-sep {
    display: flex;
    justify-content: center;
    margin-block: 3.5rem;
}

/* Arabic sharpens from a soft blur as it appears */
.verse__arabic.reveal,
.epigraph__arabic.reveal,
.dua__arabic.reveal {
    filter: blur(5px);
    transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out), filter 1.1s var(--ease-out);
}

.verse__arabic.reveal.is-visible,
.epigraph__arabic.reveal.is-visible,
.dua__arabic.reveal.is-visible { filter: blur(0); }

/* =====================================================
   FAMILIES
   ===================================================== */
.families {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.2rem;
}

.family { max-width: 24rem; }

.family__name {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.6rem, 7vw, 2.3rem);
    line-height: 1.2;
    color: var(--ivory);
    text-wrap: balance;
}

.family__relation {
    margin-top: 0.7rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--gold);
}

.family__parents {
    margin-top: 0.3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1rem;
    color: var(--ivory-soft);
    line-height: 1.55;
}

.family__and {
    font-family: var(--serif);
    font-style: italic;
    color: var(--ivory-mute);
}

.families__knot {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.families__knot::before,
.families__knot::after {
    content: "";
    width: 3rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold));
}

.families__knot::after { background: linear-gradient(90deg, var(--gold), transparent); }

/* =====================================================
   DUA
   ===================================================== */
.section--dua {
    background: radial-gradient(70% 55% at 50% 50%, rgba(217, 185, 112, 0.07), transparent 70%);
}

.dua__arabic {
    font-family: var(--arabic);
    font-size: clamp(1.7rem, 7.4vw, 2.6rem);
    line-height: 2;
    color: var(--gold);
}

/* =====================================================
   INVITATION CARD
   ===================================================== */
.card-stage {
    display: flex;
    justify-content: center;
    perspective: 1200px;
}

.invite-card {
    width: min(100%, 20rem);
    aspect-ratio: 9 / 16;
    padding: 0.8rem;
    border-radius: 0.9rem;
    background:
        radial-gradient(90% 40% at 50% 100%, rgba(226, 165, 107, 0.16), transparent 70%),
        linear-gradient(180deg, #1B3831, #0C1B18);
    box-shadow: 0 50px 80px -40px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--gold-soft);
    transition: transform 0.6s var(--ease-out);
}

.invite-card__frame {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 1.2rem 0.9rem;
    border: 1px solid var(--gold);
    border-radius: 100em 100em 0.4rem 0.4rem;
    text-align: center;
}

.invite-card__bismillah {
    font-family: var(--ruqaa);
    font-size: 1rem;
    color: var(--gold);
    line-height: 1.8;
}

.invite-card__moon {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.55rem;
    margin-block: 0.2rem;
}

.invite-card__lead {
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.8rem;
    color: var(--ivory-soft);
}

.invite-card__name {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.15rem;
    line-height: 1.15;
    color: var(--ivory);
    text-wrap: balance;
}

.invite-card__amp {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1rem;
    color: var(--gold);
    line-height: 1;
}

.invite-card__events {
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--gold-soft);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    width: 100%;
}

.invite-card__event {
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--gold);
}

.invite-card__when {
    font-family: var(--serif);
    font-size: 0.78rem;
    color: var(--ivory);
}

.invite-card__where {
    font-size: 0.62rem;
    color: var(--ivory-soft);
    line-height: 1.4;
}

.invite-card__time {
    margin-top: 0.5rem;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: var(--ivory-mute);
}

.invitation-actions {
    margin-top: 2.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}

.invitation-status {
    margin-top: 1rem;
    min-height: 1.4em;
    font-size: 0.85rem;
    color: var(--ivory-soft);
}

/* =====================================================
   CLOSING
   ===================================================== */
.section--closing { padding-bottom: calc(var(--space-section) * 0.7); }

.closing__moon {
    width: 3.2rem;
    height: 3.2rem;
    font-size: 1.1rem;
    margin: 0 auto 2rem;
}

.closing__moon.reveal { transform: translateY(22px) rotate(-18deg); }
.closing__moon.reveal.is-visible { transform: translateY(0) rotate(-18deg); }

.closing__title {
    font-family: var(--serif);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.9rem, 8.4vw, 3rem);
    line-height: 1.2;
    color: var(--ivory);
    text-wrap: balance;
}

.closing__signoff {
    margin-top: 2rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--ivory-soft);
}

.closing__names {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.3rem, 6vw, 1.9rem);
    line-height: 1.3;
    color: var(--gold);
}

.closing__amp {
    font-style: italic;
    font-weight: 400;
    color: var(--ivory-mute);
    font-size: 0.85em;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
    padding: 2.5rem 1.25rem calc(2.5rem + env(safe-area-inset-bottom));
    text-align: center;
    border-top: 1px solid var(--hair);
}

.footer__dua {
    font-family: var(--ruqaa);
    font-size: 1.2rem;
    color: var(--gold);
    line-height: 1.9;
}

.footer__note {
    margin-top: 0.3rem;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--ivory-mute);
}

/* =====================================================
   SHARE SHEET (fallback)
   ===================================================== */
.share-sheet {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.share-sheet[hidden] { display: none; }

.share-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 12, 10, 0.65);
}

.share-sheet__panel {
    position: relative;
    width: 100%;
    max-width: 26rem;
    padding: 1.75rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
    border-radius: 1.4rem 1.4rem 0 0;
    border: 1px solid var(--gold-soft);
    border-bottom: none;
    background: var(--night-raise);
    text-align: center;
    animation: sheet-up 0.35s var(--ease-out);
}

@keyframes sheet-up {
    from { transform: translateY(30%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.share-sheet__title {
    margin-bottom: 1.2rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.4rem;
    color: var(--ivory);
}

.share-sheet__options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}

.share-sheet__close { margin-top: 0.8rem; }

/* =====================================================
   SCROLL REVEAL (driven by animations.js)
   ===================================================== */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
    transition-delay: var(--reveal-delay, 0s);
}

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

.no-js .reveal,
.no-js .reveal-load {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
}

/* =====================================================
   REDUCED MOTION
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .reveal,
    .reveal-load,
    .verse__arabic.reveal,
    .epigraph__arabic.reveal,
    .dua__arabic.reveal {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        animation: none !important;
        transition: none !important;
    }

    .closing__moon.reveal { transform: rotate(-18deg) !important; }

    .window__moon { animation: none; opacity: 1; }
    .window__star,
    .sky__stars--b,
    .hero__scroll-line { animation: none; }

    .amp-knot__thread,
    .amp-knot__loop { animation: none; stroke-dashoffset: 0; }

    .thread-divider__line { transform: scaleY(1); transition: none; }
    .thread-divider .divider-star { opacity: 1; transform: none; transition: none; }

    .event__doors { display: none; }

    .btn, .invite-card { transition: none; }
}

/* =====================================================
   SINGLE-EVENT INVITATIONS
   ?event=nikah or ?event=walima sets html[data-only]; the
   other celebration and anything about "both" disappears.
   ===================================================== */
[data-only="nikah"] [data-for="walima"],
[data-only="walima"] [data-for="nikah"],
[data-only] [data-for="both"] { display: none !important; }

[data-only] .invite-card__events { grid-template-columns: 1fr; }
