/*
 * "Your PC can sleep. Your apps keep running.": the laptop scene of the Shared App Hosting first
 * screen, redrawn in the line of the service pages' drawings. Every rule is scoped to the component
 * (#shl-hero-demo), so nothing else on the page is restyled.
 *
 * Geometry shared with scene.php: the line is the arc of the ellipse centred (330,188) with radii
 * 186.6 x 150, from inside the globe (165.2,117.6) to the server's socket (516.6,188); the lid turns on the
 * hinge at y = 352 in the 640 x 430 drawing.
 */

#shl-hero-demo {
    width: 100%;
    max-width: 640px;
    margin-inline: auto;
    color: #0b1730;
    font-family: inherit;
}

#shl-hero-demo *,
#shl-hero-demo *::before,
#shl-hero-demo *::after {
    box-sizing: border-box;
}

#shl-hero-demo .shl-demo__figure {
    margin: 0;
}

#shl-hero-demo .shl-demo__figure[role="button"] {
    border-radius: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#shl-hero-demo .shl-demo__figure[role="button"]:focus-visible {
    outline: 3px solid #3c79b6;
    outline-offset: 5px;
}

#shl-hero-demo .shl-demo__art {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    font-family: inherit;
}

#shl-hero-demo .shl-demo__caption {
    margin: 14px 16px 0;
    color: #526780;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

#shl-hero-demo .shl-demo__controls {
    display: flex;
    justify-content: center;
    margin-top: 22px;
}

#shl-hero-demo .shl-demo__status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #435a72;
    font-size: 13px;
    line-height: 1.4;
}

#shl-hero-demo .shl-demo__status-dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #27854d;
    box-shadow: 0 0 0 4px #dff3e7; /* taste-skill-ignore: the ring of the status dot, as on the current page */
}

/* Words inside the drawing take the page's typeface. */
#shl-hero-demo .shl-label {
    fill: #345887;
    font-size: 15px;
    font-weight: 600;
}

#shl-hero-demo .shl-card-title {
    fill: #0b1730;
    font-size: 17px;
    font-weight: 700;
}

#shl-hero-demo .shl-card-value,
#shl-hero-demo .shl-card-note {
    fill: #0b1730;
    font-size: 13.5px;
    font-weight: 600;
}

#shl-hero-demo .shl-card-value {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

/* ---------- The laptop closes on its hinge; its screen goes dark first ---------- */

#shl-hero-demo .shl-lid {
    transform-box: view-box;
    transform-origin: 162px 352px;
    transition: transform 520ms cubic-bezier(.16, 1, .3, 1);
}

#shl-hero-demo .shl-screen {
    transition: opacity 180ms ease;
}

#shl-hero-demo .shl-closed {
    opacity: 0;
    transition: opacity 100ms ease;
}

#shl-hero-demo[data-laptop="closed"] .shl-lid {
    transform: scaleY(.025);
}

#shl-hero-demo[data-laptop="closed"] .shl-screen {
    opacity: 0;
}

#shl-hero-demo[data-laptop="closed"] .shl-closed {
    opacity: 1;
    transition-delay: 360ms;
}

/* Both progress bars (laptop screen and server card) follow one value set by the script. */
#shl-hero-demo .shl-progress {
    transform: scaleX(var(--shl-progress, .43));
    transform-box: fill-box;
    transform-origin: left center;
    transition: transform 1s linear;
}

/* The dotted link between the open laptop and the server lets go when the lid closes. */
#shl-hero-demo .shl-link {
    transition: opacity 220ms ease 380ms;
}

#shl-hero-demo[data-laptop="closed"] .shl-link {
    opacity: 0;
    transition-delay: 0s;
}

/* ---------- Asleep ---------- */

#shl-hero-demo .shl-sleep {
    opacity: 0;
    transition: opacity 160ms ease;
}

#shl-hero-demo .shl-z polyline {
    stroke: #345887;
}

#shl-hero-demo[data-laptop="closed"] .shl-sleep {
    opacity: 1;
    transition-delay: 420ms;
}

#shl-hero-demo .shl-z {
    transform-box: fill-box;
    transform-origin: center;
}

/* ---------- What travels down the line ---------- */

#shl-hero-demo .shl-file {
    transform: translate(var(--shl-x), var(--shl-y));
}

@media (prefers-reduced-motion: no-preference) {
    @supports (offset-path: path("M0 0 L1 1")) {
        #shl-hero-demo .shl-file {
            transform: none;
            offset-path: path("M165.2 117.6 A186.6 150 0 0 1 516.6 188");
            offset-anchor: 0 0;
            offset-rotate: 0deg;
            animation: shl-travel 9s linear infinite;
            animation-delay: var(--shl-delay, 0s);
        }
    }

    #shl-hero-demo .shl-line-flow {
        animation: shl-flow 1.5s linear infinite;
    }

    #shl-hero-demo .shl-link-flow {
        animation: shl-link 1.1s linear infinite;
    }

    #shl-hero-demo .shl-led {
        animation: shl-led 3.4s steps(1, end) infinite;
    }

    #shl-hero-demo .shl-led:nth-of-type(2n) { animation-duration: 4.3s; animation-delay: -1.2s; }
    #shl-hero-demo .shl-led:nth-of-type(3n) { animation-duration: 2.9s; animation-delay: -2.1s; }

    /* One z after another rises from the closed laptop, grows a little and fades. */
    #shl-hero-demo[data-laptop="closed"] .shl-z {
        animation: shl-z 2.7s ease-in-out infinite backwards;
        animation-delay: calc(var(--shl-n, 0) * .55s + .5s);
    }

    #shl-hero-demo[data-laptop="closed"] .shl-nightlight {
        animation: shl-night 2.6s ease-in-out infinite;
    }

    #shl-hero-demo[data-motion="paused"] .shl-link-flow,
    #shl-hero-demo[data-motion="paused"] .shl-nightlight,
    #shl-hero-demo[data-motion="paused"] .shl-file,
    #shl-hero-demo[data-motion="paused"] .shl-line-flow,
    #shl-hero-demo[data-motion="paused"] .shl-led,
    #shl-hero-demo[data-motion="paused"] .shl-z {
        animation-play-state: paused;
    }
}

/* A file comes out from behind the globe and is gone as it reaches the socket. */
@keyframes shl-travel {
    0% { offset-distance: 0%; opacity: 0; }
    4% { opacity: 1; }
    89% { opacity: 1; }
    96%, 100% { offset-distance: 96%; opacity: 0; }
}

@keyframes shl-flow {
    to { stroke-dashoffset: -61; }
}

@keyframes shl-link {
    to { stroke-dashoffset: -11; }
}

@keyframes shl-led {
    0%, 100% { opacity: 1; }
    82% { opacity: .35; }
    88% { opacity: 1; }
    93% { opacity: .35; }
}

@keyframes shl-z {
    0% { opacity: 0; transform: translate(-9px, 14px) scale(.74); }
    22% { opacity: 1; }
    66% { opacity: 1; }
    100% { opacity: 0; transform: translate(11px, -18px) scale(1.1); }
}

@keyframes shl-night {
    0%, 100% { opacity: .25; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    #shl-hero-demo *,
    #shl-hero-demo *::before,
    #shl-hero-demo *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------- Dark mode of the theme ---------- */

/* The theme's dark mode paints every "svg path" white; this drawing has none, the rule is a safeguard. */
.lagom-dark-mode #shl-hero-demo .shl-demo__art path {
    fill: revert-layer !important;
}

.lagom-dark-mode #shl-hero-demo .shl-demo__caption,
.lagom-dark-mode #shl-hero-demo .shl-demo__status {
    color: #b0bed0;
}

.lagom-dark-mode #shl-hero-demo .shl-label {
    fill: #99bbed;
}

.lagom-dark-mode #shl-hero-demo .shl-z polyline {
    stroke: #99bbed;
}

.lagom-dark-mode #shl-hero-demo .shl-demo__status-dot {
    box-shadow: 0 0 0 4px rgba(39, 133, 77, .28); /* taste-skill-ignore: the ring of the status dot */
}

@media (max-width: 480px) {
    #shl-hero-demo .shl-demo__caption {
        margin-top: 12px;
        font-size: 12px;
    }

    #shl-hero-demo .shl-demo__controls {
        margin-top: 17px;
    }

    #shl-hero-demo .shl-demo__status {
        font-size: 12px;
    }
}
