/* Landing page only. Hidden without JS; every interference sequence plays once. */
.landing-loader {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    overflow: hidden;
    background: #0c0d0e;
    color: #ecece8;
    isolation: isolate;
    opacity: 1;
    transition: opacity 320ms ease;
}

html.landing-loading {
    overflow: hidden;
    scrollbar-gutter: stable;
}

.landing-loading .page-wrap {
    visibility: hidden;
}

.landing-loading.landing-revealing .page-wrap {
    visibility: visible;
}

.landing-loading .landing-loader {
    display: grid;
    place-items: center;
}

.landing-loader::before,
.landing-loader::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.landing-loader::before {
    z-index: 3;
    background: repeating-linear-gradient(0deg, transparent 0 3px, #000 3px 4px);
    opacity: .16;
}

.landing-loader::after {
    z-index: 3;
    background: radial-gradient(ellipse at center, transparent 30%, #0009 100%);
}

.landing-loader__noise {
    position: absolute;
    inset: -16px;
    background: url("../img/loading-noise.png") repeat;
    opacity: 0;
    pointer-events: none;
    animation: landing-static 2200ms steps(1, end) both;
}

.landing-loader__interference {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 36%, #c8d4d412 36.5%, #c8d4d408 43%, transparent 43.5%),
                linear-gradient(transparent 66%, #ff594f25 66.1%, transparent 66.4%);
    opacity: 0;
    pointer-events: none;
    animation: landing-interference 2200ms steps(1, end) both;
}

.landing-loader__frame,
.landing-loader__footer {
    position: absolute;
    z-index: 4;
    left: max(24px, env(safe-area-inset-left));
    right: max(24px, env(safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    gap: 24px;
    font: 10px/1.5 var(--font-mono);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #969b9b;
    animation: landing-acquire 480ms ease both;
}

.landing-loader__frame {
    top: max(24px, env(safe-area-inset-top));
    padding-bottom: 12px;
    border-bottom: 1px solid #ffffff1a;
}

.landing-loader__signal::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 9px;
    background: #ff594f;
    vertical-align: middle;
}

.landing-loader__footer {
    bottom: max(24px, env(safe-area-inset-bottom));
}

.landing-loader__content {
    position: relative;
    z-index: 2;
    width: min(100% - 48px, 1000px);
    padding: 88px 0;
    text-align: center;
    animation: landing-acquire 480ms ease both;
}

.landing-loader__eyebrow {
    display: block;
    margin-bottom: 22px;
    font: 10px/1.6 var(--font-mono);
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #969b9b;
}

.landing-loader__wordmark {
    position: relative;
    width: fit-content;
    margin: 0 auto;
    font: 700 clamp(26px, 6.6vw, 88px)/1.1 var(--font-sans);
    letter-spacing: -.045em;
    white-space: nowrap;
}

.landing-loader__wordmark::before,
.landing-loader__wordmark::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    opacity: 0;
    clip-path: inset(30% 0 40%);
    pointer-events: none;
    animation: landing-split 2200ms steps(1, end) both;
}

.landing-loader__wordmark::before {
    color: #ff594f;
    --split-x: -4px;
}

.landing-loader__wordmark::after {
    color: #81c6cc;
    --split-x: 4px;
    clip-path: inset(56% 0 18%);
}

.landing-loader__rule {
    width: min(100%, 460px);
    height: 1px;
    margin: 32px auto 24px;
    background: #ffffff24;
    position: relative;
}

.landing-loader__rule::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #ff594f;
    transform-origin: left;
    animation: landing-lock 1600ms cubic-bezier(.2, .7, .3, 1) both;
}

.landing-loader .landing-loader__title {
    margin: 0 0 10px;
    font: 600 clamp(16px, 2vw, 20px)/1.5 var(--font-sans);
    color: #ecece8;
}

.landing-loader__title .landing-loader__accent {
    color: #ff594f;
}

.landing-loader .landing-loader__message {
    max-width: 40ch;
    margin: 0 auto;
    color: #afb3b3;
    font-size: clamp(13px, 1.5vw, 15px);
    line-height: 1.7;
}

/* Three spaced, low-contrast bursts, then complete stillness while loading. */
@keyframes landing-static {
    0%, 7%, 22%, 52%, 73%, 100% { opacity: 0; }
    8% { opacity: .14; transform: translate(0, 0); }
    15% { opacity: .08; transform: translate(-9px, 7px); }
    46% { opacity: .1; transform: translate(8px, -5px); }
    66% { opacity: .07; transform: translate(-4px, -11px); }
}

@keyframes landing-interference {
    0%, 22%, 52%, 73%, 100% { opacity: 0; transform: translateY(0); }
    8% { opacity: .7; transform: translateY(-15%); }
    46% { opacity: .6; transform: translateY(18%); }
    66% { opacity: .4; transform: translateY(-5%); }
}

@keyframes landing-split {
    0%, 25%, 54%, 100% { opacity: 0; transform: translateX(0); }
    19%, 48% { opacity: .65; transform: translateX(var(--split-x)); }
}

@keyframes landing-acquire {
    0%, 25% { opacity: 0; transform: translateY(4px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Signal acquisition, not a fabricated download percentage. */
@keyframes landing-lock {
    from { transform: scaleX(.04); }
    to { transform: scaleX(1); }
}

.landing-loader.is-leaving {
    opacity: 0;
}

.landing-loader.is-leaving *,
.landing-loader.is-leaving *::before,
.landing-loader.is-leaving *::after {
    animation: none;
}

.landing-loader.is-leaving .landing-loader__noise,
.landing-loader.is-leaving .landing-loader__interference {
    opacity: 0;
}

@media (max-width: 600px) {
    .landing-loader__frame,
    .landing-loader__footer { font-size: 9px; letter-spacing: .4px; }
    .landing-loader__frame { flex-direction: column; gap: 6px; }
    .landing-loader__eyebrow { font-size: 9px; letter-spacing: 1.5px; }
    .landing-loader__noise { background-size: 96px; }
    .landing-loader__interference { display: none; }
}

@media (max-height: 450px) {
    .landing-loader__content { padding: 64px 0; }
    .landing-loader__eyebrow { margin-bottom: 10px; }
    .landing-loader__wordmark { font-size: clamp(26px, 6vw, 48px); }
    .landing-loader__rule { margin: 18px auto 14px; }
    .landing-loader__frame { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
    .landing-loader { transition-duration: 120ms; }
    .landing-loader *,
    .landing-loader *::before,
    .landing-loader *::after { animation: none !important; }
    .landing-loader__noise,
    .landing-loader__interference,
    .landing-loader__wordmark::before,
    .landing-loader__wordmark::after { display: none; }
    .landing-loader::before { display: none; }
}
