@font-face {
    font-family: "MRT Poster";
    src: url("../fonts/vazir.woff") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Couple Names";
    src: url("../fonts/font.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

:root {
    color-scheme: light;
    --ink: #39322a;
    --gold: #9f8b75;
    --paper: #f5f0ed;
    --gold-gradient: linear-gradient(115.76deg, #39322a 16.24%, #9f8b75 66.28%);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    background: var(--paper);
}

body {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
    font-family: "MRT Poster", Tahoma, sans-serif;
}

.invitation {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    isolation: isolate;
    background: var(--paper);
}

.invitation__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--paper);
}

.invitation__frame {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    width: min(100vw, calc(100vh * 440 / 956));
    width: min(100vw, calc(100dvh * 440 / 956));
    max-height: 100vh;
    max-height: 100dvh;
    aspect-ratio: 440 / 956;
    transform: translate(-50%, -50%);
    container-type: inline-size;
}

.invitation__video--hidden {
    visibility: hidden;
}

.open-button {
    position: absolute;
    z-index: 3;
    top: 70%;
    left: 50%;
    padding: 3.5cqw 7cqw;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(159, 139, 117, 0.8);
    background: var(--gold-gradient);
    color: #f7f2f0;
    font: inherit;
    font-size: 3.2cqw;
    cursor: pointer;
    opacity: 1;
    transition: opacity 450ms ease, transform 450ms ease;
}

.open-button.is-fading {
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    pointer-events: none;
}

.open-button:focus-visible,
.map-button:focus-visible,
.rsvp-button:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

.open-button[hidden] {
    display: none;
}

.card-content {
    position: absolute;
    z-index: 1;
    inset: 0;
    color: var(--ink);
    font-weight: 400;
}

.card-content[hidden] {
    display: none;
}

.card-content > :not(.couple-names, .event-summary, .rsvp-buttons) {
    position: absolute;
    margin: 0;
}

.card-heart {
    position: absolute;
    width: 3.5%;
    aspect-ratio: 1;
    background: var(--gold);
    -webkit-mask: url("../images/heart.svg") center / contain no-repeat;
    mask: url("../images/heart.svg") center / contain no-repeat;
}

.card-heart--top {
    top: 15.7%;
    left: 66.5%;
}

.card-heart--names {
    top: 32.3%;
    left: 45.2%;
}

.card-heart--venue {
    top: 65%;
    left: 90.8%;
}

.blessing {
    top: 18.5%;
    left: 53.5%;
    width: 30%;
    font-size: 3.64cqw;
    line-height: 1.2;
    text-align: center;
}

.couple-names {
    position: absolute;
    inset: 0;
}

.couple-names > span {
    position: absolute;
    display: block;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-family: "Couple Names", sans-serif;
    font-weight: 400;
    line-height: 1.16;
    text-align: center;
    -webkit-text-fill-color: transparent;
}

.couple-names__first {
    top: 24.7%;
    left: 51.5%;
    width: 36%;
    font-size: 11.36cqw;
}

.couple-names__and {
    top: 30.8%;
    left: 75.5%;
    width: 5%;
    font-size: 6.82cqw;
}

.couple-names__second {
    top: 33.4%;
    left: 42.5%;
    width: 35%;
    font-size: 11.36cqw;
}

.divider {
    top: 40.9%;
    left: 49%;
    width: 29%;
    height: auto;
}

.story {
    top: 46.9%;
    left: 32.7%;
    display: flex;
    width: 61.8%;
    height: 8%;
    align-items: center;
    font-size: 3.64cqw;
    line-height: 1.35;
    text-align: right;
}

.guest {
    top: 55.8%;
    left: 22.5%;
    width: 70.2%;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    font-size: 4.55cqw;
    line-height: 1.25;
    text-align: right;
}

.invitation-copy {
    top: 59.3%;
    left: 32.7%;
    width: 61.8%;
    font-size: 3.64cqw;
    line-height: 1.25;
    text-align: right;
}

.venue {
    top: 66.1%;
    left: 31.5%;
    width: 63%;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    font-size: 4.55cqw;
    line-height: 1.25;
    text-align: center;
}

.event-summary {
    position: absolute;
    top: 70.3%;
    left: 31.5%;
    display: grid;
    width: 63%;
    height: 6%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    text-align: center;
}

.event-summary__weekday,
.event-summary__time {
    font-size: 3.64cqw;
    line-height: 1.2;
    white-space: nowrap;
}

.event-summary__date {
    display: flex;
    min-height: 4.3cqw;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-inline: 1px solid var(--gold);
    background: var(--gold-gradient);
    background-clip: text;
    color: transparent;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.event-summary__date strong {
    font-size: 6.82cqw;
    font-weight: 400;
    line-height: 1;
}

.event-summary__date small {
    font-size: 3.18cqw;
    line-height: 1.2;
}

.address {
    top: 77%;
    left: 31.5%;
    width: 63%;
    font-size: 3.18cqw;
    line-height: 1.3;
    text-align: center;
}

.map-button {
    top: 79.5%;
    left: 46.4%;
    display: grid;
    width: 33.6%;
    height: 2.93%;
    place-items: center;
    border: 1px solid rgba(159, 139, 117, 0.72);
    background: var(--gold-gradient);
    color: #f7f2f0;
    font-size: 2.73cqw;
    line-height: 1;
    text-decoration: none;
}

.rsvp-question {
    top: 84.5%;
    left: 31.5%;
    width: 63%;
    font-size: 3.18cqw;
    line-height: 1.3;
    text-align: center;
}

.rsvp-buttons {
    position: absolute;
    top: 87.3%;
    left: 46.4%;
    display: grid;
    width: 33.6%;
    height: 2.93%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5.4%;
    direction: ltr;
}

.rsvp-button {
    min-width: 0;
    padding: 0;
    border: 1px solid rgba(159, 139, 117, 0.72);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 2.73cqw;
    line-height: 1;
    direction: rtl;
    cursor: pointer;
}

.rsvp-button[aria-pressed="true"] {
    background: var(--gold-gradient);
    color: #f7f2f0;
}

.fade-overlay {
    position: absolute;
    z-index: 4;
    inset: 0;
    background: var(--paper);
    opacity: 0;
    pointer-events: none;
    transition: opacity 700ms ease;
}

.fade-overlay.is-visible {
    opacity: 1;
}

.loading-screen {
    position: absolute;
    z-index: 5;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--paper);
    color: var(--ink);
    text-align: center;
}

.loading-screen[hidden] {
    display: none;
}

.loading-screen.has-error .loading-spinner {
    display: none;
}

.loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(159, 139, 117, 0.25);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: loading-spin 800ms linear infinite;
}

.loading-screen p {
    margin: 0;
}

.loading-retry {
    padding: 0.6rem 1rem;
    border: 1px solid rgba(159, 139, 117, 0.8);
    background: var(--gold-gradient);
    color: #f7f2f0;
    font: inherit;
    cursor: pointer;
}

.loading-retry[hidden] {
    display: none;
}

@keyframes loading-spin {
    to {
        transform: rotate(360deg);
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .fade-overlay,
    .open-button {
        transition-duration: 1ms;
    }

    .loading-spinner {
        animation: none;
    }
}
