/*! © 2026 Dastan Invites, dastaninvites.com. All rights reserved. This invitation's design, code, artwork and music may not be copied, reused or resold. */

.letter {
    --in: calc(clamp(8px, 2.3%, 26px) + clamp(9px, 2.2%, 24px));
    --garland-h: calc(min((100% - 2 * var(--in)) * .88, 600px) / var(--garland-r, 4.4));
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: calc(var(--in) + 1.2% + var(--garland-h) + 2px) calc(var(--in) + 6px) calc(var(--in) + max(40px, 7%));
    background: var(--sage-paper, #94967d) url(../assets/letter/sage.webp) 0 0 / 540px repeat;
    color: var(--ink);
    container-type: inline-size;
    overflow-anchor: none;
    -webkit-tap-highlight-color: transparent
}

.lt-papers {
    --m1: clamp(8px, 2.3cqi, 26px);
    --m2: calc(var(--m1) + clamp(9px, 2.2cqi, 24px));
    --edge: clamp(13px, 3.4cqi, 30px);
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none
}

.lt-papers>i {
    position: absolute;
    display: block
}

.lp-blush {
    inset: var(--m1);
    border: var(--edge) solid transparent;
    border-image: url(../assets/letter/sheet-blush.webp) var(--blush-slice) / var(--edge) round;
    background: var(--blush-paper) padding-box;
    filter: drop-shadow(0 1px 2px rgba(60, 50, 40, .22)) drop-shadow(0 3px 8px rgba(60, 50, 40, .12))
}

.lp-ivory {
    inset: var(--m2);
    border: var(--edge) solid transparent;
    border-image: url(../assets/letter/sheet-ivory.webp) var(--ivory-slice) fill / var(--edge) round;
    filter: drop-shadow(0 1px 2px rgba(90, 60, 55, .2)) drop-shadow(0 3px 7px rgba(90, 60, 55, .1))
}

.lp-garland {
    left: 50%;
    top: calc(var(--m2) + 1.2cqi);
    width: min((100cqi - 2 * var(--m2)) * .88, 600px);
    aspect-ratio: var(--garland-r);
    translate: -50% 0;
    background: url(../assets/letter/garland.webp) center / 100% 100% no-repeat
}

.lp-corner {
    left: calc(var(--m2) + .6cqi);
    bottom: calc(var(--m2) + .6cqi);
    width: min(32cqi, 240px);
    aspect-ratio: var(--corner-r);
    background: url(../assets/letter/corner.webp) center / 100% 100% no-repeat
}

.lp-corner-r {
    left: auto;
    right: calc(var(--m2) + .6cqi);
    scale: -1 1
}

.lt-shade {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 100vh;
    height: 100svh;
    z-index: 8;
    overflow: hidden;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(#000 35%, transparent 95%);
    mask-image: linear-gradient(#000 35%, transparent 95%)
}

.lt-shade:before {
    content: "";
    position: absolute;
    left: -8%;
    top: -6%;
    width: max(125cqi, 70svh);
    aspect-ratio: 1;
    background: url(../assets/letter/shade.webp) 0 0 / 100% 100% no-repeat;
    opacity: .24;
    transform-origin: 0 0;
    animation: lt-sway 7.5s ease-in-out infinite alternate
}

@keyframes lt-sway {
    0% {
        transform: rotate(-1.1deg) translate(-.8%, .2%) skew(.8deg)
    }
    45% {
        transform: rotate(.5deg) translate(.6%, -.3%) skew(-.4deg)
    }
    to {
        transform: rotate(1.2deg) translate(1.1%, .5%) skew(-1deg)
    }
}

.lt-petals {
    position: absolute;
    inset: 0;
    z-index: 9;
    overflow: hidden;
    pointer-events: none
}

.lt-petal {
    position: absolute;
    left: 0;
    top: 0;
    perspective: 300px
}

.lt-petal b {
    display: block;
    transform-style: preserve-3d
}

.lt-petal img {
    width: 100%;
    height: auto
}

.lt-head {
    text-align: center;
    margin: 0 0 10px
}

.lt-head>* {
    margin: 0
}

.lt-kicker {
    font: 600 clamp(11px, 3cqi, 14px)/1.3 "Cormorant Garamond", Georgia, serif;
    letter-spacing: .28em;
    padding-left: .28em;
    text-transform: uppercase;
    color: var(--sage-ink)
}

.lt-for {
    font: 700 clamp(48px, 14cqi, 80px)/1.1 "Corinthia", cursive;
    padding: 0 .3em .06em;
    color: var(--rose-ink);
    text-shadow: 0 0 14px rgba(255, 250, 242, .7), 0 1px 1px rgba(255, 250, 242, .6);
    overflow-wrap: anywhere
}

.lt-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto
}

.letter.is-open {
    justify-content: flex-start
}

.lt-slot {
    width: 100%;
    display: none;
    justify-content: center
}

.letter.is-open .lt-slot {
    display: flex
}

.lt-letter {
    --pb: clamp(12px, 3.4cqi, 20px);
    position: relative;
    width: min(100%, 560px);
    margin: 0;
    padding: calc(var(--pb) * .4 + min(100cqi, 560px) * .2) clamp(14px, 5cqi, 36px) clamp(28px, 8cqi, 48px);
    border: var(--pb) solid transparent;
    border-image: url(../assets/letter/paper.webp) var(--paper-slice) fill / var(--pb) round;
    filter: drop-shadow(0 10px 14px rgba(90, 64, 52, .2)) drop-shadow(0 1px 2px rgba(90, 64, 52, .2));
    text-align: center;
    container-type: inline-size;
    font: 500 clamp(15.5px, 5.2cqi, 20px)/1.55 "Cormorant Garamond", Georgia, serif;
    color: var(--ink)
}

.lt-letter:before,
.lt-letter:after {
    content: "";
    position: absolute;
    background: center / 100% 100% no-repeat;
    pointer-events: none
}

.lt-letter:before {
    left: calc(var(--pb) * -.2);
    top: calc(var(--pb) * -.2);
    width: 36%;
    aspect-ratio: var(--spray-r);
    background-image: url(../assets/letter/paper-spray.webp)
}

.lt-letter:after {
    right: calc(var(--pb) * -.1);
    bottom: calc(var(--pb) * -.1);
    width: 11%;
    aspect-ratio: var(--bud-r);
    background-image: url(../assets/letter/paper-bud.webp)
}

.letter:not(.is-read) .lt-slot .lt-letter {
    visibility: hidden
}

.lt-letter:focus {
    outline: none
}

.lt-letter:focus-visible {
    outline: 2px solid rgba(168, 100, 106, .7);
    outline-offset: 5px
}

.lt-letter>* {
    margin: 0 0 .85em
}

.lt-verse {
    font: 400 clamp(19px, 6.4cqi, 28px)/2.05 "Amiri Quran", "Amiri", serif;
    color: var(--rose-ink-soft);
    margin-bottom: .35em
}

.lt-verse-en {
    font-style: italic;
    font-size: .9em;
    line-height: 1.45;
    color: #5b3c40d9;
    margin-bottom: .3em
}

.lt-verse-ref {
    font: 600 clamp(10px, 2.9cqi, 13px)/1.3 "Cormorant Garamond", Georgia, serif;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--sage-ink)
}

.lt-rule {
    position: relative;
    height: 14px;
    margin: 1.1em auto 1.2em;
    width: 62%;
    background: linear-gradient(90deg, transparent, var(--blush-deep) 18%, var(--blush-deep) 82%, transparent) center / 100% 1px no-repeat
}

.lt-rule i {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    translate: -50% -50%;
    rotate: 45deg;
    background: var(--sage);
    box-shadow: 0 0 0 2px #fbf7ef, 0 0 0 3px var(--blush-deep)
}

.lt-greeting {
    font: 700 clamp(32px, 10.5cqi, 46px)/1.2 "Corinthia", cursive;
    color: var(--rose-ink);
    margin-bottom: .3em !important
}

.lt-closing {
    font-style: italic;
    margin: 1.4em 0 0 !important
}

.lt-sign {
    font: 700 clamp(36px, 11.5cqi, 52px)/1.15 "Corinthia", cursive;
    color: var(--rose-ink);
    margin-bottom: .1em !important
}

.lt-parents {
    display: none
}

.lt-letter[data-from]>.lt-parents {
    display: block
}

.lt-letter[data-from]>p:not([class]),
.lt-letter[data-from]>.lt-closing,
.lt-letter[data-from]>.lt-sign {
    display: none
}

.lt-parents>p {
    margin: 0
}

.lp-mr {
    margin-top: 1.3em !important;
    font: 600 clamp(10px, 2.9cqi, 13px)/1.3 "Cormorant Garamond", Georgia, serif;
    letter-spacing: .22em;
    padding-left: .22em;
    text-transform: uppercase;
    color: var(--sage-ink)
}

.lt-parents>.lp-mr:first-child {
    margin-top: .3em !important
}

.lp-name {
    font-weight: 600;
    font-size: 1.2em;
    line-height: 1.25;
    text-wrap: balance;
    overflow-wrap: anywhere
}

.lt-parents>.lp-name:first-child {
    margin-top: .3em !important
}

.lp-line+.lp-name {
    margin-top: .5em !important
}

.lp-line {
    margin-top: 1em !important;
    font-style: italic;
    text-wrap: balance
}

.lp-couple {
    margin-top: .2em !important;
    font: 700 clamp(34px, 11cqi, 50px)/1.1 "Corinthia", cursive;
    color: var(--rose-ink);
    text-wrap: balance;
    overflow-wrap: anywhere
}

.lp-with {
    font-style: italic;
    color: var(--rose-ink-soft)
}

.lp-couple+.lp-line {
    margin-top: .5em !important
}

.lt-letter[data-from]>.lt-mono {
    margin-top: 1.1em !important
}

.lt-mono {
    display: grid;
    place-items: center;
    width: clamp(54px, 16cqi, 72px);
    aspect-ratio: 1;
    margin: .3em auto 0 !important;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px var(--blush-deep), inset 0 0 0 4px #fbf7ef, inset 0 0 0 5px #c98a868c;
    font: 700 clamp(22px, 6.4cqi, 30px)/1 "Corinthia", cursive;
    color: var(--rose-ink)
}

.lt-mono i {
    font-size: .7em;
    font-style: normal;
    margin: 0 .06em
}

.lt-keep {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%
}

.letter.is-open .lt-keep {
    margin-top: clamp(18px, 5cqi, 34px)
}

.lt-env {
    position: relative;
    display: block;
    width: min(96cqi, 500px);
    aspect-ratio: var(--env-r);
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent
}

.letter:not(.is-open) .lt-env {
    margin-top: calc(min(96cqi, 500px) / var(--env-r) * var(--env-t-n) * -.86)
}

.letter.is-open .lt-env {
    width: min(62cqi, 320px);
    cursor: default
}

.lt-env:focus-visible {
    outline: 2px solid rgba(168, 100, 106, .8);
    outline-offset: 6px;
    border-radius: 10px
}

:where(.lt-env)>span {
    position: absolute;
    inset: 0;
    background: center / 100% 100% no-repeat;
    pointer-events: none
}

.e-back {
    z-index: 1;
    background-image: url(../assets/letter/env-back.webp);
    filter: drop-shadow(0 9px 12px rgba(90, 64, 52, .22)) drop-shadow(0 1px 2px rgba(90, 64, 52, .2))
}

.e-flap-open {
    z-index: 2;
    background-image: url(../assets/letter/env-flap-open.webp);
    transform-origin: 50% var(--env-t);
    opacity: 0
}

.e-pocket {
    z-index: 4;
    background-image: url(../assets/letter/env-pocket.webp)
}

.e-flap-shadow {
    z-index: 5;
    background-image: url(../assets/letter/env-flap-shadow.webp)
}

.e-flap {
    z-index: 6;
    background-image: url(../assets/letter/env-flap.webp);
    transform-origin: 50% var(--env-t)
}

.letter.is-open .e-flap,
.letter.is-open .e-flap-shadow {
    opacity: 0
}

.letter.is-open .e-flap-open {
    opacity: 1
}

.letter.is-open .e-seal {
    opacity: 0
}

.lt-env>.e-seal {
    z-index: 7;
    inset: auto;
    left: var(--env-tip-x);
    top: var(--env-tip-y);
    width: calc((var(--env-r-edge) - var(--env-l)) * .15 / var(--seal-d));
    aspect-ratio: var(--seal-r);
    margin-top: -3.2%;
    translate: calc(-1 * var(--seal-cx)) calc(-1 * var(--seal-cy));
    background-image: url(../assets/letter/seal.webp);
    filter: drop-shadow(0 3px 3px rgba(90, 45, 45, .3)) drop-shadow(0 1px 1px rgba(90, 45, 45, .25))
}

.gl-seal-ring {
    position: absolute;
    left: var(--seal-cx);
    top: var(--seal-cy);
    width: calc(var(--seal-d) * 118%);
    aspect-ratio: 1;
    translate: -50% -50%;
    border-radius: 50%;
    border: 1.5px solid rgba(168, 100, 106, .75);
    opacity: 0;
    animation: lt-ring 2.8s cubic-bezier(.2, .6, .3, 1) 1.2s infinite
}

@keyframes lt-ring {
    0% {
        opacity: .9;
        transform: scale(.8)
    }
    to {
        opacity: 0;
        transform: scale(1.35)
    }
}

.letter.is-open .gl-seal-ring {
    display: none
}

.lt-hint {
    visibility: hidden;
    margin: 12px 0 0;
    font: italic 500 clamp(15px, 4.4cqi, 19px)/1.3 "Cormorant Garamond", Georgia, serif;
    color: var(--rose-ink-soft);
    text-shadow: 0 0 10px rgba(255, 250, 242, .8);
    animation: lt-hint 2.8s ease-in-out infinite
}

.letter.is-open .lt-hint {
    display: none
}

@keyframes lt-hint {
    0%,
    to {
        opacity: .6
    }
    50% {
        opacity: 1
    }
}

.lt-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap
}

.lt-packet {
    position: absolute;
    z-index: 3;
    transform-style: preserve-3d;
    pointer-events: none;
    transform-origin: 50% 50%
}

.pk-panel {
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d
}

.pk-mid {
    top: 0
}

.pk-top {
    bottom: 100%;
    transform-origin: 50% 100%
}

.pk-bottom {
    top: 100%;
    transform-origin: 50% 0
}

.pk-face,
.pk-back {
    position: absolute;
    inset: 0;
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden
}

.pk-face>.lt-letter {
    position: absolute;
    left: 0;
    filter: none
}

.pk-back {
    transform: rotateX(180deg);
    background: linear-gradient(180deg, rgba(120, 100, 80, .1), transparent 18%, transparent 82%, rgba(120, 100, 80, .1)), #f4efe6;
    box-shadow: inset 0 0 0 1px #96826e47
}

.pk-mid .pk-face {
    filter: drop-shadow(0 10px 14px rgba(90, 64, 52, .26))
}

.lt-head,
.lt-keep {
    transition: opacity 1s ease, translate 1.2s cubic-bezier(.2, .7, .2, 1)
}

.lt-keep {
    transition-delay: .15s
}

.letter:not(.is-seen) .lt-head,
.letter:not(.is-seen) .lt-keep {
    opacity: 0;
    translate: 0 16px
}

@media(min-aspect-ratio:6/5) {
    html.is-tablet .letter.is-open .lt-stage {
        display: grid;
        grid-template-columns: min(30cqi, 360px) minmax(0, 560px);
        justify-content: center;
        align-items: start;
        column-gap: clamp(24px, 4.5cqi, 60px)
    }
    html.is-tablet .letter.is-open .lt-slot {
        grid-column: 2;
        grid-row: 1
    }
    html.is-tablet .letter.is-open .lt-keep {
        grid-column: 1;
        grid-row: 1;
        position: sticky;
        top: calc(50svh - 10cqi);
        margin-top: 12vh
    }
    html.is-tablet .letter.is-open .lt-env {
        width: 100%
    }
    html.is-tablet .letter:not(.is-open) .lt-env {
        width: min(56cqi, 560px, calc(66svh * var(--env-r)));
        margin-top: calc(min(56cqi, 560px, calc(66svh * var(--env-r))) / var(--env-r) * var(--env-t-n) * -.86)
    }
}

@media(prefers-reduced-motion:reduce) {
    .gl-seal-ring,
    .lt-hint,
    .lt-shade:before {
        animation: none
    }
    .lt-head,
    .lt-keep {
        transition: none
    }
    .lt-hint {
        opacity: .95
    }
}