/* "Deschidere cu plic" (resources/views/invitation/envelope.blade.php, public/js/envelope.js) */
html.sv-env-wait, html.sv-env-wait body { overflow: hidden; }
html.sv-env-wait body > *:not(.sv-env):not(.sv-env-music) { visibility: hidden; }

.sv-env {
    position: fixed; inset: 0; z-index: 2147483000; overflow: hidden;
    /* the clips' own cream studio backdrop */
    background: linear-gradient(150deg, #f1e8de 0%, #ebe0d2 35%, #e3d5c3 70%, #d9c7b1 100%);
    color: #4a3a3c; -webkit-tap-highlight-color: transparent;
    transition: opacity .45s ease;
}
.sv-env.is-leaving { opacity: 0; pointer-events: none; }
.sv-env__stage {
    position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px;
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
}
.sv-env__box {
    position: relative; cursor: pointer;
    width: min(94vw, 560px, calc(72vh * var(--sv-env-ratio, 1.2)));
}
.sv-env__box:focus-visible { outline: 2px solid #9e2b45; outline-offset: 4px; }
.sv-env__video, .sv-env__pocket { position: absolute; inset: 0; }
.sv-env__video img, .sv-env__video video, .sv-env__pocket img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
    /* fade the frame's edges into the page, never the envelope itself */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%), linear-gradient(180deg, transparent 0, #000 3%, #000 92%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%), linear-gradient(180deg, transparent 0, #000 3%, #000 92%, transparent 100%);
    mask-composite: intersect;
}
.sv-env__video video { opacity: 0; }
.sv-env.is-live .sv-env__video video { opacity: 1; }
.sv-env.is-live .sv-env__poster { opacity: 0; }
.sv-env__pocket { opacity: 0; pointer-events: none; }
.sv-env.is-rising .sv-env__pocket { opacity: 1; }

/* the invitation rising out of the envelope: between the clip and the still of the pocket, cut above the bottom */
.sv-env__clip { position: absolute; left: 0; right: 0; overflow: hidden; pointer-events: none; }
.sv-env__card {
    position: absolute; top: 0; opacity: 0; overflow: hidden; border-radius: 2px; will-change: transform;
    box-shadow: 0 2px 6px rgba(30, 0, 8, .3); background: var(--color-background, #fff);
}
.sv-env.is-rising .sv-env__card { opacity: 1; }
.sv-env__mini { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; overflow: hidden; background: var(--color-background, #fff); }
.sv-env__card.is-growing { position: fixed; z-index: 3; transition: transform .95s cubic-bezier(.6, 0, .2, 1), box-shadow .6s; box-shadow: none; }

.sv-env__seal {
    position: absolute; transform: translate(-50%, -50%); container-type: inline-size; pointer-events: none;
    filter: drop-shadow(3px 5px 4px rgba(25, 0, 6, .45));
    transition: transform .5s cubic-bezier(.3, 1.5, .5, 1), opacity .35s ease .12s;
}
.sv-env__seal img { display: block; width: 100%; height: auto; }
.sv-env__initials {
    position: absolute; inset: 0; display: grid; place-items: center; white-space: nowrap;
    font-family: var(--sv-env-font, Georgia, "Times New Roman", serif); font-size: 26cqw; line-height: 1;
    color: rgba(108, 72, 20, .88);
    /* pressed into the wax: light from the upper left */
    text-shadow: 1px 1px 0 rgba(255, 232, 170, .55), -1px -1px 1px rgba(60, 34, 4, .45);
}
.sv-env__initials--one { font-size: 40cqw; }
.sv-env.is-playing .sv-env__seal { transform: translate(-50%, -50%) scale(1.15) rotate(-8deg); opacity: 0; }

.sv-env__to {
    margin: 4px 0 0; text-align: center; max-width: 30rem;
    font-family: var(--sv-env-font, Georgia, serif); font-size: clamp(22px, 6.5vw, 32px); line-height: 1.15; color: #6b2b3a;
    transition: opacity .4s;
}
.sv-env__hint { margin: 0; text-align: center; font: 15px/1.4 Georgia, "Times New Roman", serif; letter-spacing: .05em; color: #7a5a60; animation: sv-env-breathe 2.6s ease-in-out infinite; transition: opacity .4s; }
.sv-env.is-playing .sv-env__to, .sv-env.is-playing .sv-env__hint { opacity: 0; animation: none; }
@keyframes sv-env-breathe { 50% { opacity: .45; } }

.sv-env__skip, .sv-env-music {
    font: 14px/1 Georgia, "Times New Roman", serif; letter-spacing: .05em; cursor: pointer; border-radius: 999px;
}
.sv-env__skip {
    position: absolute; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    color: #7a5a60; background: rgba(255, 255, 255, .55); border: 1px solid rgba(122, 90, 96, .25); padding: 9px 15px;
}
.sv-env.is-playing .sv-env__skip { opacity: 0; pointer-events: none; }
/* a round button above the "back to top" one (the language switch sits bottom left) */
.sv-env-music {
    position: fixed; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); z-index: 2147483001;
    width: 44px; height: 44px; padding: 0; display: grid; place-items: center; font-size: 20px;
    color: #fff; background: rgba(30, 20, 24, .55); border: 1px solid rgba(255, 255, 255, .35);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.sv-env-music[aria-pressed="false"] { opacity: .6; text-decoration: line-through; }
.sv-env__skip:focus-visible, .sv-env-music:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* the music's credit (CC BY), under the invitation */
.sv-env-credit { margin: 0; padding: 6px 16px 18px; text-align: center; font-size: 11px; opacity: .65; }
.sv-env-music[hidden] { display: none; }
/* on a phone the demos' colour palettes sit where the music button is: the button goes above them */
@media (max-width: 520px) {
    body:has(.kit-palettes) .sv-env-music { bottom: calc(env(safe-area-inset-bottom, 0px) + 136px); }
}
