/* One continuous backdrop, shared by the envelope and the whole invitation. */
#invitation-app {
    position: relative;
    isolation: isolate;
}
.invitation-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: #102d46 url("/img/stationery/navy-paper.webp") center / cover no-repeat;
}
#main { background: none; }
.wedding-photo::after, .portrait-photo::after { content: none; }
.wedding-photo > img {
    filter: grayscale(1) contrast(.88) brightness(1.06);
}
.wedding-photo::after {
    content: "";
    background: radial-gradient(ellipse at center, transparent 45%, #251f1a 100%);
    mix-blend-mode: multiply;
    opacity: .2;
}
.envelope-gate {
    background: none;
    color: var(--paper);
}
.gate-top { color: var(--paper); }
.open-hint { color: var(--paper); }
.gate-date {
    font-size: clamp(12px, 1.3vw, 14px);
    text-align: center;
    max-width: 100%;
}
.envelope-gate h1 i { color: #d7b980; }
.gate-top, .gate-date, #gate-title, .open-hint {
    transition: opacity .4s, transform .6s;
}
.envelope-gate.is-opening > :not(.envelope) {
    opacity: 0;
    transform: translateY(-15px);
}
.envelope { container-type: inline-size; }
.envelope:disabled { opacity: 1; cursor: default; }
.envelope-back-original, .envelope-front-original, .envelope-papers {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}
.envelope-back-original {
    z-index: 1;
    inset: auto 0 0;
    transition: opacity .4s .35s;
}
.envelope-back-original img, .envelope-front-original img {
    width: 100%;
    height: auto;
}
.envelope-front-original {
    z-index: 3;
    inset: auto 0 0;
    transition: opacity .4s .35s, transform .8s;
}
.envelope-front-original::after {
    content: "";
    position: absolute;
    width: 20%;
    aspect-ratio: 1;
    left: 40%;
    top: 37%;
    background: url("/img/stationery/seal-monogram.webp") center / contain no-repeat;
}
.envelope-body { transition: opacity .35s .35s; }
.envelope-papers {
    z-index: 2;
    /* Keep hidden papers inside the pocket, including during rotation. */
    clip-path: inset(-160% -40% 0 -40%);
    transition: opacity .15s .6s;
}
.envelope-paper { position: absolute; display: block; }
.envelope-paper > img { width: 100%; height: auto; }
.envelope-photo {
    width: 45%;
    left: 9%;
    bottom: 4%;
    transform: rotate(-3deg);
}
.envelope-note {
    width: 47%;
    right: 7%;
    bottom: 7%;
    transform: rotate(2deg);
}
.envelope-name-card {
    width: 63%;
    left: 18.5%;
    bottom: 0;
    transform: none;
}
.paper-save-date {
    position: absolute;
    inset: 16% 9% 12%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Original Eyesome", var(--script);
    font-size: 9cqw;
    line-height: 1.65;
    color: #27211d;
    text-align: center;
}
.paper-names {
    position: absolute;
    inset: 22% 10% auto;
    font: 5.5cqw / .95 var(--serif);
    color: #211b15;
}
.paper-names i { font-size: .75em; }
.paper-date {
    position: absolute;
    top: 57%;
    left: 10%;
    right: 10%;
    color: var(--burgundy);
    font: italic 3cqw / 1 var(--serif);
}
.envelope.is-opening { transform: translateY(70px); }
.envelope.is-opening .envelope-body { opacity: 0; }
.envelope.is-opening .envelope-back-original,
.envelope.is-opening .envelope-front-original,
.envelope.is-opening .envelope-papers { opacity: 1; }
.envelope.is-opening .envelope-photo { animation: photoOut 1.5s .55s both; }
.envelope.is-opening .envelope-note { animation: noteOut 1.5s .65s both; }
.envelope.is-opening .envelope-name-card { animation: cardOut 1.5s .75s both; }
@keyframes photoOut {
    from { transform: rotate(-3deg); }
    to { transform: translate(-7%, -73%) rotate(-12deg); }
}
@keyframes noteOut {
    from { transform: rotate(2deg); }
    to { transform: translate(5%, -109%) rotate(4deg); }
}
@keyframes cardOut {
    from { transform: none; }
    to { transform: translateY(-48%); }
}
.envelope-gate.is-unpacking .envelope-papers { opacity: 0; transition: opacity .45s .3s; }
.envelope-gate.is-unpacking .envelope-photo { animation: photoUnpack .75s both; }
.envelope-gate.is-unpacking .envelope-note { animation: noteUnpack .75s both; }
.envelope-gate.is-unpacking .envelope-name-card { animation: cardUnpack .75s both; }
@keyframes photoUnpack {
    from { transform: translate(-7%, -73%) rotate(-12deg); }
    to { transform: translate(-25%, -150%) rotate(-16deg); }
}
@keyframes noteUnpack {
    from { transform: translate(5%, -109%) rotate(4deg); }
    to { transform: translate(25%, -180%) rotate(10deg); }
}
@keyframes cardUnpack {
    from { transform: translateY(-48%); }
    to { transform: translateY(-140%); }
}
.envelope-gate.is-unpacking .envelope-front-original,
.envelope-gate.is-unpacking .envelope-back-original { transform: translateY(90px); opacity: 0; transition: transform .75s, opacity .75s; }

/* The same papers settle separately at the start of the landing. */
.unpacked-papers {
    position: relative;
    width: min(490px, 86vw);
    margin: 0 auto 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6%;
    container-type: inline-size;
}
.unpacked-photo { width: 43%; transform: rotate(-7deg); }
.unpacked-note { width: 49%; position: relative; transform: rotate(4deg); }
.unpacked-photo img, .unpacked-note > img { width: 100%; height: auto; }
#main.is-arriving .unpacked-photo { animation: photoSettle .9s both; }
#main.is-arriving .unpacked-note { animation: noteSettle .9s .1s both; }
@keyframes photoSettle { from { opacity: 0; transform: translate(35px, -35px) rotate(-14deg); } to { opacity: 1; transform: rotate(-7deg); } }
@keyframes noteSettle { from { opacity: 0; transform: translate(-35px, -35px) rotate(9deg); } to { opacity: 1; transform: rotate(4deg); } }

.wedding-actions { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-top: 18px; }
.wedding-schedule { font: 24px / 1.3 var(--serif); color: var(--paper); }
.countdown-note:empty { display: none; }
.countdown-section { padding-bottom: 45px; }

.monogram { display: block; flex: 0 0 auto; line-height: 0; }
.monogram img { width: 66px; height: 53px; object-fit: contain; }

/* Compact printed-paper action. */
.stationery-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #b4a284;
    border-radius: 2px;
    background: #f5f0e7 url("/img/stationery/paper-texture.webp") center / 240px;
    color: var(--burgundy);
    box-shadow: inset 0 0 0 3px #f5f0e7, inset 0 0 0 4px #b4a28455, 0 3px 8px #03132225;
    font: italic 14px/1.2 var(--serif);
    letter-spacing: .02em;
    white-space: nowrap;
    transition: transform .3s, box-shadow .3s;
}
.stationery-action::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 25%, #e8cf8e66 50%, transparent 75%);
    transform: translateX(-130%);
    transition: transform .65s;
}
.action-icon { width: 16px; height: 16px; flex: 0 0 auto; }
.action-arrow { width: 12px; height: 12px; flex: 0 0 auto; transition: transform .3s; }
.stationery-action:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 5px; }
#ceremony .location-label { bottom: 16%; text-decoration: underline; line-height: 1.2; }
#ceremony .gold-doily .church-art { transition: transform .4s; }
@media (hover: hover) and (pointer: fine) {
    .stationery-action:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 3px #f5f0e7, inset 0 0 0 4px #b4a28499, 0 6px 14px #03132235; }
    .stationery-action:hover::after { transform: translateX(130%); }
    .stationery-action:hover .action-arrow { transform: translate(2px, -2px); }
    #ceremony .gold-doily:hover .church-art { transform: translateY(-3px); }
}
.stationery-action:active { transform: translateY(1px); }

/* The reference's photographic backgrounds appear only on expanded notes. */
.travel-note[open] {
    background-color: #f5f0e7;
    background-image: linear-gradient(#faf8f4c7, #faf8f4d6), var(--travel-image);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}
.travel-note[open] .travel-number { color: #57554f; }
.travel-note[open] .travel-details { border-top-color: #81776855; }

/* Leave room for the script's ascenders and the curved embossed borders. */
#ceremony .ceremony-card { padding-top: 11cqw; }
#ceremony .ceremony-card h2 { font-size: clamp(36px, 10.5cqw, 58px); line-height: 1.35; margin-bottom: -.45em; }
#ceremony .ceremony-copy { margin-top: 0; }
#rsvp .rsvp-heading h2 { line-height: 1.4; margin-bottom: -.2em; }
#rsvp .rsvp-heading p { margin-top: 0; }
.itinerary-paper { padding: 106px 60px 130px; }
.itinerary-paper > h2 { font-size: 40px; line-height: 1.6; margin: 0 0 24px; }
.timeline { --timeline-axis: 34%; }
.timeline-line { left: var(--timeline-axis); }
.timeline-item { grid-template-columns: 29% 10% 61%; }
.timeline-item h3 { font-size: 21px; text-align: center; text-wrap: balance; }
.timeline-time { font-size: 20px; text-align: center; }
.dress-stripes { container-type: inline-size; }
.dress-paper { padding: 20cqw 15cqw 16cqw; min-height: 0; }
.dress-paper h2 { font-size: clamp(30px, 11cqw, 46px); line-height: 1.35; }
.dress-paper .dress-level { max-width: 100%; font-size: clamp(12px, 3.7cqw, 16px); margin: 8px 0 12px; }
.dress-paper > p:not(.dress-level) { font-size: clamp(17px, 5cqw, 21px); line-height: 1.4; }
.dress-paper .dress-request { margin-top: 16px; }
.dress-paper .attire-art { width: 118px; max-width: 60%; height: auto; margin: 22px auto 0; }

@media (max-width: 699px) {
    .monogram img { width: 53px; height: 43px; }
    .envelope.is-opening { transform: translateY(40px); }
    .unpacked-papers { width: min(380px, 83vw); margin-bottom: 30px; }
    .wedding-actions { gap: 14px; margin-top: 14px; }
    .wedding-schedule { font-size: 20px; }
    .itinerary-paper { padding: 76px 40px 100px; }
    .itinerary-paper > h2 { font-size: clamp(25px, 7vw, 38px); line-height: 1.6; margin-bottom: 24px; }
    .timeline-item { padding-bottom: 26px; }
    .timeline-time { font-size: clamp(13px, 3.9vw, 18px); }
    .timeline-item h3 { font-size: clamp(16px, 4.3vw, 20px); }
    .timeline-item p { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
    .stationery-action::after { display: none; }
    .stationery-action, .action-arrow, #ceremony .gold-doily .church-art { transition: none; transform: none; }
    .envelope.is-opening, .envelope-gate.is-unpacking .envelope-papers,
    .envelope-gate.is-unpacking .envelope-front-original,
    .envelope-gate.is-unpacking .envelope-back-original { transform: none; }
    #main.is-arriving .unpacked-photo, #main.is-arriving .unpacked-note { animation: none; }
}
