/* "Get out of the saddle" screen: a phone turned sideways in a browser (see js/upright.js) */
.lgb-upright {
    --lgb-lie: -90deg;
    --lgb-head: -26px;
    --lgb-upright-yellow: #ffd23f;
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    gap: clamp(16px, 5vw, 40px);
    padding: 16px max(24px, env(safe-area-inset-right)) 16px max(24px, env(safe-area-inset-left));
    background:
        radial-gradient(circle at 18% 22%, rgba(255, 255, 255, .18), transparent 45%),
        repeating-linear-gradient(115deg, rgba(255, 255, 255, .045) 0 22px, transparent 22px 44px),
        #6b42fe;
    color: #fff;
    touch-action: none;
    overscroll-behavior: contain;
    user-select: none;
}

.lgb-upright[data-turn="ccw"] {
    --lgb-lie: 90deg;
    --lgb-head: 26px;
}

.lgb-sideways .lgb-upright {
    display: flex;
}

.lgb-upright__art {
    flex: none;
    width: min(170px, 48vh);
    height: auto;
    overflow: visible;
    animation: lgb-upright-loop 3.6s infinite;
}

.lgb-upright__art * {
    transform-box: view-box;
}

.lgb-upright__shadow {
    fill: rgba(16, 6, 60, .28);
    transform-origin: 80px 135px;
    animation: lgb-upright-shadow 3.6s infinite;
}

.lgb-upright__phone {
    transform-origin: 80px 80px;
    animation: lgb-upright-phone 3.6s infinite;
}

.lgb-upright__body {
    fill: #1d1240;
    stroke: #fff;
    stroke-width: 4;
}

.lgb-upright__screen {
    fill: #8f72ff;
}

.lgb-upright__speaker {
    fill: rgba(255, 255, 255, .55);
}

.lgb-upright__face path {
    fill: none;
    stroke: #fff;
    stroke-width: 2.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lgb-upright__cheek {
    fill: #ff8fb8;
    opacity: .75;
}

.lgb-upright__face--ko {
    animation: lgb-upright-ko 3.6s infinite;
}

.lgb-upright__face--ok {
    opacity: 0;
    animation: lgb-upright-ok 3.6s infinite;
}

.lgb-upright__stars {
    fill: var(--lgb-upright-yellow);
    transform: translate(calc(80px + var(--lgb-head)), 64px);
    animation: lgb-upright-stars 3.6s infinite;
}

.lgb-upright__stars path {
    transform-box: fill-box;
    transform-origin: center;
    animation: lgb-upright-orbit 1.2s linear infinite;
}

.lgb-upright__stars path:nth-child(2) {
    animation-delay: -.4s;
}

.lgb-upright__stars path:nth-child(3) {
    animation-delay: -.8s;
}

.lgb-upright__text {
    max-width: 380px;
}

.lgb-upright__kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 4px 12px 4px 10px;
    border-radius: 999px;
    background: rgba(16, 6, 60, .3);
    font-family: 'LGB-Equip', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.lgb-upright__live {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4d5e;
    animation: lgb-upright-live 1.2s ease-in-out infinite;
}

.lgb-upright__title {
    margin: 0 0 8px;
    font-family: 'LGB-Garaje', sans-serif;
    font-size: clamp(22px, 8vh, 32px);
    font-weight: 900;
    line-height: 1.05;
}

.lgb-upright__title em {
    font-style: normal;
    color: var(--lgb-upright-yellow);
}

.lgb-upright__body,
.lgb-upright__foot {
    margin: 0;
    font-family: 'LGB-Equip', sans-serif;
    line-height: 1.35;
}

.lgb-upright__body {
    font-size: 16px;
}

.lgb-upright__foot {
    margin-top: 10px;
    font-size: 13px;
    opacity: .78;
}

/* Landscape with the keyboard open: just the essentials */
@media (max-height: 260px) {
    .lgb-upright__kicker,
    .lgb-upright__foot {
        display: none;
    }
}

/* 0-32%: knocked out in the ditch / 32-50%: gets back up / 50-58%: proud little hop / 88%: fades, then starts over */
@keyframes lgb-upright-phone {
    0%, 32% { transform: translateY(22px) rotate(var(--lgb-lie)); }
    8% { transform: translateY(22px) rotate(calc(var(--lgb-lie) + 4deg)); }
    16% { transform: translateY(22px) rotate(calc(var(--lgb-lie) - 3deg)); }
    24% { transform: translateY(22px) rotate(calc(var(--lgb-lie) + 2deg)); }
    45% { transform: translateY(-3px) rotate(calc(var(--lgb-lie) * -.1)); animation-timing-function: ease-out; }
    50%, 58%, 89% { transform: translateY(0) rotate(0deg); }
    54% { transform: translateY(-9px) rotate(0deg); }
    89.1%, 100% { transform: translateY(22px) rotate(var(--lgb-lie)); }
}

@keyframes lgb-upright-loop {
    0%, 84%, 100% { opacity: 1; }
    89%, 95% { opacity: 0; }
}

@keyframes lgb-upright-shadow {
    0%, 32%, 89.1%, 100% { transform: scaleX(1); }
    50%, 58%, 89% { transform: scaleX(.6); }
    54% { transform: scaleX(.45); }
}

@keyframes lgb-upright-ko {
    0%, 36%, 89.1%, 100% { opacity: 1; }
    44%, 89% { opacity: 0; }
}

@keyframes lgb-upright-ok {
    0%, 36%, 89.1%, 100% { opacity: 0; }
    44%, 89% { opacity: 1; }
}

@keyframes lgb-upright-stars {
    0%, 30%, 92%, 100% { opacity: 1; }
    40%, 91% { opacity: 0; }
}

/* Ellipse 24 x 7: bigger in front, smaller behind */
@keyframes lgb-upright-orbit {
    0%, 100% { transform: translate(24px, 0) scale(1); }
    12.5% { transform: translate(17px, 5px) scale(1.15); }
    25% { transform: translate(0, 7px) scale(1.25); }
    37.5% { transform: translate(-17px, 5px) scale(1.15); }
    50% { transform: translate(-24px, 0) scale(1); }
    62.5% { transform: translate(-17px, -5px) scale(.8); }
    75% { transform: translate(0, -7px) scale(.7); }
    87.5% { transform: translate(17px, -5px) scale(.8); }
}

@keyframes lgb-upright-live {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(.75); }
}

/* No animation: the phone already back on its feet, smiling */
@media (prefers-reduced-motion: reduce) {
    .lgb-upright *,
    .lgb-upright__art {
        animation: none !important;
    }

    .lgb-upright__stars,
    .lgb-upright__face--ko {
        opacity: 0;
    }

    .lgb-upright__face--ok {
        opacity: 1;
    }

    .lgb-upright__shadow {
        transform: scaleX(.6);
    }
}
