/* ══════════════════════════════════════════════════════════════
   Full-screen states of the IoT UI: the splash while the app starts (App.razor #farab-splash) and the sign-out
   page (Logout.razor), with the greenhouse drawing (GreenhouseArt.razor). The same soft background and frosted
   glass as the shell; tokens from ui-tokens.css (.iot). wwwroot/offline.html is a standalone copy of this look.
   ══════════════════════════════════════════════════════════════ */

/* ── backdrop: the app background with its two colour glows ── */
.gx-screen {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    background:
        radial-gradient(50rem 28rem at 85% -10%, var(--glow-a), transparent 60%),
        radial-gradient(44rem 28rem at -10% 110%, var(--glow-b), transparent 60%),
        var(--bg);
    color: var(--txt);
    font-family: inherit;
}

/* ── frosted card ── */
.gx-card {
    width: min(420px, 100%);
    padding: 22px 28px 28px;
    border: 1px solid var(--frost-line);
    border-radius: 28px;
    background: linear-gradient(160deg, var(--frost-hi), transparent 55%), var(--frost);
    -webkit-backdrop-filter: blur(22px) saturate(1.35);
    backdrop-filter: blur(22px) saturate(1.35);
    box-shadow: var(--frost-shadow);
    text-align: center;
    animation: gx-rise .6s var(--ease-soft) both;
}

.gx-card h1 { margin: 10px 0 6px; color: var(--txt); font-size: 1.3rem; font-weight: 700; }
.gx-card p { margin: 0 auto; max-width: 34ch; color: var(--muted); font-size: .95rem; line-height: 1.7; }

.gx-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }

.gx-btn {
    display: inline-flex;
    flex: 1 1 140px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--ink-soft);
    color: var(--txt);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--dcc-t-base, .2s) var(--ease-soft), box-shadow var(--dcc-t-base, .2s), background var(--dcc-t-base, .2s);
}

    .gx-btn:hover { background: var(--glass-2, var(--ink-soft)); color: var(--txt); transform: translateY(-1px); }
    .gx-btn:active { transform: scale(.97); }
    .gx-btn:focus-visible { outline: 0; box-shadow: 0 0 0 4px var(--tint-acc); }

    .gx-btn.is-primary { border: 0; background: linear-gradient(140deg, var(--acc-2), var(--acc) 60%); color: #04241a; box-shadow: 0 12px 24px -12px var(--acc); }
    /* a fixed deep red: the dark theme's --err is too light for white text */
    .gx-btn.is-danger { border: 0; background: #e11d48; color: #fff; box-shadow: 0 12px 24px -12px var(--err); }
    .gx-btn.is-danger:hover { background: #be123c; color: #fff; }
    .gx-btn.is-danger:focus-visible { box-shadow: 0 0 0 4px var(--tint-err); }

/* ── splash: brand under the drawing, an indeterminate bar, fades out once the app has drawn ── */
#farab-splash { z-index: 100001; transition: opacity .45s var(--ease-soft), visibility .45s; }
#farab-splash.is-out { opacity: 0; visibility: hidden; pointer-events: none; }

.gx-splash { display: flex; flex-direction: column; align-items: center; width: min(320px, 100%); text-align: center; }
.gx-splash .gh-art { max-width: 240px; }
.gx-brand { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--txt); font-size: 1.15rem; font-weight: 700; animation: gx-rise .7s .3s var(--ease-soft) both; }
    .gx-brand img { width: 34px; height: 34px; object-fit: contain; }
.gx-splash small { margin-top: 10px; color: var(--muted); font-size: .85rem; animation: gx-rise .7s .45s var(--ease-soft) both; }

.gx-bar { width: 160px; height: 4px; margin-top: 18px; overflow: hidden; border-radius: 4px; background: var(--tint-acc); }
    .gx-bar i { display: block; width: 40%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--acc), var(--cool)); animation: gx-slide 1.4s ease-in-out infinite; }
[dir="rtl"] .gx-bar i { animation-name: gx-slide-rtl; }

/* ── the greenhouse drawing ── */
.gh-art { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto; overflow: visible; }
.gh-stop-a { stop-color: var(--acc); }
.gh-stop-b { stop-color: var(--cool); }
.gh-fill-a { stop-color: var(--cool); stop-opacity: .2; }
.gh-fill-b { stop-color: var(--acc); stop-opacity: .03; }

.gh-house { fill: url(#gh-fill); stroke: url(#gh-stroke); stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.gh-mullion { fill: none; stroke: var(--cool); stroke-width: 1; opacity: .3; }
.gh-ground { stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; opacity: .4; }
.gh-stem { fill: none; stroke: var(--gh-stem, #059669); stroke-width: 2; stroke-linecap: round; }
.gh-leaf { fill: var(--acc); }
    .gh-leaf.is-alt { fill: var(--gh-leaf-2, #34d399); }

.gh-sun, .gh-halo { fill: #fbbf24; }
.gh-halo { opacity: .25; transform-box: fill-box; transform-origin: center; }
.gh-moon { fill: #fcd34d; }
.gh-star { fill: var(--muted); }
[data-bs-theme="dark"] .gh-star { fill: #e2e8f0; }

.gh-wave { fill: none; stroke: var(--muted); stroke-width: 2.6; stroke-linecap: round; opacity: .35; }
.gh-dot { fill: var(--muted); }
.gh-cut { stroke: var(--err); stroke-width: 3; stroke-linecap: round; }

.gh-grow, .gh-sway { transform-box: fill-box; transform-origin: 50% 100%; }

/* grow (splash): the house draws in, plants rise and sway, the sun breathes */
.gh-art.is-grow .gh-house { stroke-dashoffset: 1; animation: gh-draw 1.4s .1s var(--ease-soft) forwards; }
.gh-art.is-grow .gh-grow { animation: gh-grow .9s cubic-bezier(.2, .9, .3, 1.2) both; }
.gh-art.is-grow .gh-sway, .gh-art.is-night .gh-sway { animation: gh-sway 3s ease-in-out infinite; }
.gh-art.is-grow .gh-halo { animation: gh-halo 2.4s ease-in-out infinite; }

/* night (sign out): lights on inside, stars twinkle */
.gh-art.is-night .gh-house { fill: color-mix(in srgb, #fbbf24 12%, transparent); }
.gh-art.is-night .gh-star { animation: gh-twinkle 2.6s ease-in-out infinite; }
    .gh-art.is-night .gh-star.s2 { animation-delay: .7s; }
    .gh-art.is-night .gh-star.s3 { animation-delay: 1.3s; }
    .gh-art.is-night .gh-star.s4 { animation-delay: 1.9s; }

/* offline: plants droop, the outer waves fade in and out */
.gh-art.is-offline { --gh-stem: #a16207; --gh-leaf-2: #e9c46a; }
.gh-art.is-offline .gh-leaf:not(.is-alt) { fill: #d6a24a; }
.gh-art.is-offline .gh-sway { transform: rotate(12deg) scaleY(.94); }
.gh-art.is-offline .gh-wave.w2, .gh-art.is-offline .gh-wave.w3 { stroke-dasharray: 3 5; animation: gh-blink 1.8s ease-in-out infinite; }
    .gh-art.is-offline .gh-wave.w3 { animation-delay: .3s; }

/* ── keyframes ── */
@keyframes gx-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes gx-slide { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
@keyframes gx-slide-rtl { from { transform: translateX(110%); } to { transform: translateX(-260%); } }
@keyframes gh-draw { to { stroke-dashoffset: 0; } }
@keyframes gh-grow { from { transform: scaleY(0); opacity: 0; } }
@keyframes gh-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes gh-halo { 0%, 100% { transform: scale(.85); opacity: .18; } 50% { transform: scale(1.15); opacity: .35; } }
@keyframes gh-twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes gh-blink { 0%, 100% { opacity: .15; } 50% { opacity: .6; } }

/* animations off (user menu, or the system's reduce-motion): everything at its final state, the bar stands still */
:root[data-motion="off"] :is(.gx-card, .gx-brand, .gx-splash small, .gh-art *) { animation: none !important; }
:root[data-motion="off"] .gh-art .gh-house { stroke-dashoffset: 0; }
:root[data-motion="off"] .gx-bar i { animation: none; width: 100%; opacity: .6; }
