* {
    box-sizing: border-box;
}

:root {
    --green-950: #08251d;
    --green-900: #0d3328;
    --green-800: #123f32;
    --paper: #fbf6ea;
    --paper-deep: #efe2c9;
    --ink: #26372f;
    --muted-ink: #65736a;
    --gold: #a9814a;
    --gold-soft: rgba(169, 129, 74, 0.36);
    --radius: 26px;
    --ease-premium: cubic-bezier(0.22, 1, 0.36, 1);
}

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: var(--green-950);
    color: var(--ink);
    font-family: "Manrope", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    background: url("ciecocinko_bright.webp") center / cover no-repeat;
    filter: blur(30px) brightness(0.9) saturate(0.95);
    opacity: 0.74;
    transform: scale(1.08);
    transition: opacity 0.8s ease;
}

body::after {
    background:
        radial-gradient(
            circle at center,
            rgba(255, 242, 209, 0.18),
            rgba(255, 242, 209, 0.05) 32%,
            transparent 58%
        ),
        linear-gradient(180deg, rgba(4, 29, 22, 0.56), rgba(1, 34, 25, 0.76));
    opacity: 1;
    transition: opacity 0.8s ease;
}

.is-loading body::before,
.is-loading body::after {
    opacity: 0;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    display: grid;
    place-items: center;
    padding: clamp(0.7rem, 2.2vw, 2rem);
    opacity: 1;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.8s ease,
        transform 0.8s var(--ease-premium);
}

.is-loading .container {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
}

.card-container {
    position: relative;
    isolation: isolate;
    width: min(96vw, 24.5rem);
    aspect-ratio: 2 / 3;
    transition: transform 420ms var(--ease-premium);
    will-change: transform;
}

.card-container::before,
.card-container::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: var(--radius);
}

.card-container::before {
    z-index: -2;
    inset: 1rem 1.15rem -1.2rem;
    background: rgba(255, 250, 239, 0.78);
    box-shadow:
        0 1.4rem 2.5rem rgba(0, 0, 0, 0.22),
        0 3rem 5rem rgba(0, 0, 0, 0.2);
    transform: rotate(-1.15deg);
    opacity: 0.78;
}

.card-container::after {
    z-index: -3;
    left: 50%;
    bottom: -1.35rem;
    width: 82%;
    height: 18%;
    background: rgba(0, 0, 0, 0.38);
    filter: blur(24px);
    transform: translateX(-50%);
    opacity: 0.55;
}

@media (min-width: 48rem) {
    .card-container {
        width: min(42vw, 25.5rem, calc((100dvh - 4rem) * 2 / 3));
    }
}

@media (max-height: 42rem) and (max-width: 47.99rem) {
    .card-container {
        width: min(96vw, calc((100dvh - 1rem) * 2 / 3));
    }
}

@media (hover: hover) and (pointer: fine) {
    .card-container:hover {
        transform: translateY(-6px) scale(1.01);
    }
}

.card {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border: 0;
    outline: none;
}

.card:focus-visible .card-face {
    box-shadow:
        0 0 0 3px rgba(255, 248, 229, 0.85),
        0 0 0 6px rgba(169, 129, 74, 0.45),
        0 1.4rem 3.2rem rgba(0, 0, 0, 0.24);
}

.card-face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    background:
        linear-gradient(rgba(255, 252, 245, 0.74), rgba(255, 252, 245, 0.74)),
        url("paper.webp") center / cover no-repeat,
        var(--paper);
    box-shadow:
        inset 0 0 0 1px rgba(169, 129, 74, 0.11),
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 1.4rem 3.2rem rgba(0, 0, 0, 0.24),
        0 3rem 5.5rem rgba(0, 0, 0, 0.16);
    transition:
        opacity 950ms var(--ease-premium),
        transform 950ms var(--ease-premium),
        filter 950ms var(--ease-premium);
    will-change: opacity, transform, filter;
}

.card-front {
    --front-pad: clamp(1.18rem, 4.3vw, 1.72rem);
    --front-text-space: clamp(7.25rem, 22vw, 8.4rem);
    --front-image-bottom: clamp(8.9rem, 25vw, 10.35rem);

    z-index: 2;
    display: grid;
    grid-template-rows: minmax(0, 1fr) minmax(var(--front-text-space), auto);
    gap: clamp(0.85rem, 2.2vw, 1.15rem);
    padding: var(--front-pad);
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.card-front::before {
    content: "";
    position: absolute;
    inset: var(--front-pad) var(--front-pad) var(--front-image-bottom);
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: calc(var(--radius) - 8px);
    pointer-events: none;
    z-index: 2;
}

.card-front::after {
    content: "";
    position: absolute;
    inset: var(--front-pad) var(--front-pad) var(--front-image-bottom);
    border-radius: calc(var(--radius) - 8px);
    background: linear-gradient(
        180deg,
        transparent 86%,
        rgba(19, 32, 26, 0.08)
    );
    pointer-events: none;
    z-index: 1;
}

.card-back {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.45rem, 5vw, 2.15rem);
    background:
        linear-gradient(rgba(255, 250, 240, 0.88), rgba(255, 250, 240, 0.9)),
        url("paper.webp") center / cover no-repeat,
        var(--paper);
    opacity: 0;
    transform: translateY(14px) scale(0.985);
    filter: blur(2px);
}

.card-back::before,
.card-back::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: calc(var(--radius) - 8px);
}

.card-back::before {
    inset: clamp(0.9rem, 3.5vw, 1.35rem);
    border: 1px solid var(--gold-soft);
}

.card-back::after {
    inset: clamp(1.18rem, 4.3vw, 1.72rem);
    border: 1px solid rgba(169, 129, 74, 0.16);
}

.card.flipped .card-front {
    opacity: 0;
    transform: translateY(-12px) scale(0.985);
    filter: blur(1.5px);
    pointer-events: none;
}

.card.flipped .card-back {
    z-index: 3;
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.wedding-photo {
    position: relative;
    z-index: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    object-position: center;
    border-radius: calc(var(--radius) - 8px);
    filter: saturate(0.92) contrast(0.96) brightness(1.02);
}

.card-text {
    position: relative;
    z-index: 3;
    text-align: center;
    color: var(--ink);
}

.card-front-text {
    display: flex;
    min-height: var(--front-text-space);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.25rem 0.1rem;
}

.eyebrow,
.prompt {
    margin: 0;
    font-family: "Manrope", "Segoe UI", sans-serif;
    font-size: clamp(0.62rem, 2.1vw, 0.74rem);
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.eyebrow {
    color: rgba(111, 91, 61, 0.82);
}

.prompt {
    margin-top: 0.45rem;
    color: rgba(86, 100, 92, 0.66);
    font-size: clamp(0.54rem, 1.8vw, 0.66rem);
    letter-spacing: 0.2em;
}

.card-text h2 {
    margin: 0.24rem 0 0.34rem;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1.75rem, 7vw, 2.6rem);
    font-weight: 500;
    line-height: 0.98;
    letter-spacing: 0.015em;
    color: #26382f;
}

.card-front-text h2 {
    font-size: clamp(2.25rem, 9vw, 3.55rem);
    letter-spacing: 0.02em;
}

.card-back-text {
    display: flex;
    width: min(100%, 19rem);
    max-width: 19rem;
    min-height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(0.35rem, 1.8vw, 0.65rem);
}

.card-back-text h2 {
    margin-top: 0.38rem;
    margin-bottom: clamp(1rem, 3.8vw, 1.35rem);
    font-size: clamp(2.05rem, 7.4vw, 3rem);
    line-height: 0.92;
}

.details-list {
    width: 100%;
    display: grid;
    gap: clamp(0.82rem, 2.9vw, 1.05rem);
}

.detail-item {
    display: grid;
    justify-items: center;
    gap: 0.18rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(0.75rem, 3vw, 1.05rem);
    padding-top: clamp(0.78rem, 2.8vw, 0.95rem);
    border-top: 1px solid rgba(169, 129, 74, 0.2);
}

.detail-label {
    color: rgba(111, 91, 61, 0.78);
    font-family: "Manrope", "Segoe UI", sans-serif;
    font-size: clamp(0.56rem, 1.85vw, 0.67rem);
    font-weight: 500;
    letter-spacing: 0.16em;
    line-height: 1.35;
    text-transform: uppercase;
}

.detail-value {
    color: #26382f;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1.28rem, 4.9vw, 1.72rem);
    font-weight: 500;
    line-height: 1.04;
    text-decoration: none;
}

.detail-place .detail-value {
    font-size: clamp(1.42rem, 5.6vw, 1.92rem);
}

.detail-link {
    text-underline-offset: 0.18em;
    transition: color 180ms ease;
}

.detail-link:hover,
.detail-link:focus-visible {
    color: var(--gold);
}

.detail-action,
.calendar-link {
    color: rgba(91, 104, 95, 0.82);
    font-family: "Manrope", "Segoe UI", sans-serif;
    font-size: clamp(0.58rem, 1.85vw, 0.68rem);
    font-weight: 500;
    letter-spacing: 0.1em;
    line-height: 1.35;
    text-decoration: none;
    text-transform: uppercase;
}

.detail-action {
    margin-top: 0.06rem;
    border-bottom: 1px solid rgba(169, 129, 74, 0.25);
}

.detail-note {
    color: rgba(91, 104, 95, 0.74);
    font-size: clamp(0.62rem, 2vw, 0.72rem);
    font-weight: 300;
    line-height: 1.35;
}

.calendar-link {
    margin-top: clamp(1rem, 3.5vw, 1.35rem);
    padding: 0.52rem 0.78rem;
    border: 1px solid rgba(169, 129, 74, 0.32);
    border-radius: 999px;
    background: rgba(255, 250, 240, 0.52);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    color: rgba(89, 72, 48, 0.86);
    transition:
        background-color 180ms ease,
        border-color 180ms ease,
        transform 180ms ease;
}

.calendar-link:hover,
.calendar-link:focus-visible {
    background: rgba(255, 247, 229, 0.8);
    border-color: rgba(169, 129, 74, 0.52);
    transform: translateY(-1px);
}

.ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: clamp(0.9rem, 3.5vw, 1.3rem) auto;
    color: rgba(169, 129, 74, 0.75);
    font-size: 0.78rem;
    line-height: 1;
}

.ornament::before,
.ornament::after {
    content: "";
    display: inline-block;
    width: 2.35rem;
    height: 1px;
    margin: 0 0.65rem;
    vertical-align: middle;
    background: rgba(169, 129, 74, 0.28);
}

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