:root {
    --abyss: #030407;
    --vault: #090e17;
    --bulkhead: #101722;
    --gridline: #243047;
    --signal: #8be9ff;
    --beam: #4cb3ff;
    --seal: #edf4ff;
    --relay: #a8b6d8;
    --ready: #8ff7c6;
    --warning: #ffd27a;
    --breach: #ff8a94;
    --shadow: rgba(0, 0, 0, 0.78);
    --status-strip-height: 36px;
    --shell-top-space: calc(var(--status-strip-height) + 68px);
    --shell-x-space: 24px;
    --shell-bottom-space: 220px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 0%, rgba(76, 179, 255, 0.10), transparent 28rem),
        radial-gradient(circle at 82% 14%, rgba(143, 247, 198, 0.045), transparent 24rem),
        linear-gradient(180deg, rgba(3, 4, 7, 0.2), rgba(3, 4, 7, 0.92)),
        var(--abyss);
    color: var(--seal);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    overflow-x: hidden;
    position: relative;
    cursor: crosshair;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 233, 255, 0.018) 1px, transparent 1px);
    background-size: 100% 5px, 72px 72px;
    opacity: 0.62;
    pointer-events: none;
    z-index: 1;
}

/* Splash blocks page interaction until the short boot animation finishes. */
.splash-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--abyss);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1.5s ease-out;
    pointer-events: all;
}

.splash-content {
    text-align: center;
}

.splash-text {
    font-family: "IBM Plex Mono", monospace;
    font-size: 1rem;
    color: var(--signal);
    letter-spacing: 0.2em;
    animation: pulse 2s ease-in-out infinite;
}

.splash-bar {
    width: 200px;
    height: 2px;
    background: var(--signal);
    margin-top: 10px;
    animation: splashLoad 1.5s ease-in-out forwards;
}

@keyframes splashLoad {
    0% { width: 0; opacity: 0; }
    100% { width: 200px; opacity: 1; }
}

.stars {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 1px;
    height: 1px;
    border-radius: 999px;
    background: rgba(139, 233, 255, 0.75);
    animation: drift 18s linear infinite, pulse 6s ease-in-out infinite;
}

@keyframes drift {
    0% { transform: translateY(0); }
    100% { transform: translateY(18px); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.18; }
    50% { opacity: 0.9; }
}

/* Hero title animation stays slow to avoid fighting the content. */
@keyframes booleanScan {
    0% { letter-spacing: 0.1em; }
    50% { letter-spacing: 0.3em; }
    100% { letter-spacing: 0.1em; }
}

@keyframes chromaticAberration {
    0%, 100% { text-shadow: 0 0 5px var(--signal); opacity: 0.8; }
    50% {
        text-shadow:
            2px 0 0 rgba(255, 138, 148, 0.4),
            -2px 0 0 rgba(139, 233, 255, 0.4),
            0 0 15px var(--signal);
        opacity: 1;
    }
}

.hero-title {
    will-change: transform, letter-spacing;
    animation: booleanScan 10s ease-in-out infinite, chromaticAberration 10s ease-in-out infinite;
    animation-delay: 1s;
}

/* Touch devices get explicit press feedback because hover never fires. */
@media (hover: none) {
    .archive-card:active,
    .control-card:active {
        border-color: var(--signal);
        box-shadow: 0 0 15px rgba(76, 179, 255, 0.3);
    }
}

/* Status strip mirrors /status.json so the static page can show current posture. */
.status-strip {
    position: fixed;
    top: 0;
    z-index: 100;
    width: 100%;
    height: var(--status-strip-height);
    background: rgba(5, 7, 12, 0.94);
    border-bottom: 1px solid var(--gridline);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--relay);
}

.status-content {
    display: flex;
    gap: 24px;
    align-items: center;
}

.status-segment {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-segment::after {
    content: "";
    width: 1px;
    height: 12px;
    background: var(--gridline);
    opacity: 0.5;
}

.status-segment:last-child::after {
    display: none;
}

.status-value {
    color: var(--signal);
}

.status-value.state-clear,
.log-message.clear {
    color: var(--ready);
}

.status-value.state-degraded,
.status-value.state-unknown,
.log-message.degraded,
.log-message.unknown {
    color: var(--warning);
}

.status-value.state-breach {
    color: var(--breach);
}

/* Leave room for the fixed status strip at the top. */
.shell {
    position: relative;
    z-index: 2;
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--shell-top-space) var(--shell-x-space) var(--shell-bottom-space);
}

.hero {
    position: relative;
    text-align: center;
    padding: 72px 24px 46px;
    border: 1px solid rgba(139, 233, 255, 0.18);
    background:
        linear-gradient(180deg, rgba(13, 18, 28, 0.96), rgba(5, 7, 12, 0.96)),
        var(--vault);
    box-shadow: 0 32px 92px var(--shadow), inset 0 1px 0 rgba(237, 244, 255, 0.05);
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(139, 233, 255, 0.08);
    background:
        linear-gradient(90deg, transparent, rgba(139, 233, 255, 0.08), transparent) top / 100% 1px no-repeat,
        linear-gradient(180deg, rgba(139, 233, 255, 0.05), transparent 24%);
    pointer-events: none;
}

.hero-title {
    font-family: "Orbitron", "Segoe UI", sans-serif;
    font-size: clamp(2.4rem, 7vw, 4.2rem);
    line-height: 0.92;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--seal);
    margin-bottom: 14px;
    text-shadow: 0 0 24px rgba(139, 233, 255, 0.18);
}

.hero-subtitle {
    color: var(--relay);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 680px;
    margin: 0 auto 24px;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.warning-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 138, 148, 0.58);
    background: linear-gradient(135deg, rgba(255, 138, 148, 0.11), rgba(5, 7, 12, 0.85));
    color: #ffd7dc;
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: inline-block;
    box-shadow: 0 0 24px rgba(255, 138, 148, 0.08);
}

.hero-warning-offset {
    margin-bottom: 40px;
}

.sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 32px;
}

@media (max-width: 1024px) {
    .sections {
        grid-template-columns: 1fr;
    }
}

.section {
    border: 1px solid var(--gridline);
    background: rgba(8, 12, 20, 0.72);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(237, 244, 255, 0.035);
    padding: 24px;
    position: relative;
}

.section::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(40, 50, 74, 0.5);
    pointer-events: none;
    z-index: 0;
}

.section > * {
    position: relative;
    z-index: 1;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gridline);
}

.section-title {
    font-family: "Orbitron", "Segoe UI", sans-serif;
    font-size: 1rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--signal);
}

.section-meta {
    color: var(--relay);
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

@media (max-width: 640px) {
    .archive-grid {
        grid-template-columns: 1fr;
    }
}

.archive-card,
.control-card {
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--gridline);
    opacity: 0.82;
    transition: opacity 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.archive-card {
    display: block;
    padding: 22px 20px;
    background: var(--vault);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6), 0 2px 5px rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

.archive-card:hover,
.control-card:hover {
    opacity: 1;
}

.archive-card:hover {
    border-color: var(--signal);
    box-shadow: 0 0 20px rgba(139, 233, 255, 0.25), inset 0 0 15px rgba(0, 0, 0, 0.6);
    transform: translateY(-2px);
}

.archive-card:hover::before,
.control-card:hover::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid var(--ready);
    pointer-events: none;
    animation: tactileFlash 0.1s ease-out;
}

@keyframes tactileFlash {
    0% { border-color: var(--ready); opacity: 0.3; }
    100% { border-color: var(--ready); opacity: 0; }
}

.archive-label {
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--signal);
    margin-bottom: 14px;
}

.archive-title {
    font-family: "Orbitron", "Segoe UI", sans-serif;
    font-size: 1.6rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--seal);
    margin-bottom: 8px;
}

.archive-desc {
    color: var(--relay);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

.archive-meta {
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.78rem;
    color: var(--relay);
}

.led-indicator,
.control-led,
.wt-led,
.internal-filled {
    display: inline-block;
    border-radius: 50%;
    background: var(--ready);
}

.led-indicator,
.internal-filled {
    width: 8px;
    height: 8px;
    margin-right: 8px;
    box-shadow: 0 0 6px var(--ready);
}

.control-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-color: rgba(139, 233, 255, 0.16);
    opacity: 0.84;
    box-shadow: 0 0 10px rgba(139, 233, 255, 0.03);
    border-radius: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            rgba(40, 50, 74, 0.05) 1px,
            rgba(40, 50, 74, 0.05) 2px
        ),
        var(--bulkhead);
    background-size: 100% 2px;
}

.control-card:hover {
    border-color: rgba(139, 233, 255, 0.48);
    box-shadow: 0 0 0 1px rgba(139, 233, 255, 0.06), 0 14px 36px rgba(0, 0, 0, 0.34);
}

.control-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-led,
.wt-led {
    width: 10px;
    height: 10px;
    box-shadow: 0 0 8px var(--ready);
    animation: breath 3s ease-in-out infinite;
}

@keyframes breath {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.control-label {
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.86rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--signal);
    display: block;
    margin-bottom: 2px;
}

.control-service {
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.82rem;
    color: var(--relay);
}

.control-domain {
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.76rem;
    color: var(--relay);
}

/* Internal services may resolve publicly, but only work from the local network. */
.internal-tag {
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.64rem;
    color: var(--breach);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.internal-tag:hover {
    color: var(--warning);
}

/* Fixed footer keeps recent relay checks visible while scrolling the launch page. */
.watchtower {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 24px;
    border-top: 1px solid var(--gridline);
    background: rgba(2, 3, 6, 0.96);
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.76rem;
}

.watchtower::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.01'/%3E%3C/svg%3E");
    pointer-events: none;
    opacity: 0.01;
}

.watchtower-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(40, 50, 74, 0.8);
}

.wt-title {
    font-family: "Orbitron", "Segoe UI", sans-serif;
    font-size: 0.92rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--signal);
}

.log-stream {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 118px;
    overflow: hidden;
}

.log-entry {
    display: flex;
    gap: 12px;
}

.log-time {
    color: var(--beam);
    text-shadow: 0 0 3px rgba(76, 179, 255, 0.4);
}

.log-component {
    color: var(--signal);
    font-weight: 500;
    text-shadow: 0 0 3px rgba(139, 233, 255, 0.3);
}

.log-message {
    color: var(--relay);
}

.log-message.ready {
    color: var(--ready);
    text-shadow: 0 0 3px rgba(143, 247, 198, 0.3);
}

.log-message.clear {
    text-shadow: 0 0 3px rgba(143, 247, 198, 0.24);
}

.log-message.breach {
    color: var(--breach);
    text-shadow: 0 0 3px rgba(255, 138, 148, 0.4);
}

.archive-card.internal {
    background: linear-gradient(145deg, #160d0f, #090e17);
    border-color: rgba(255, 138, 148, 0.28);
}

.archive-card.internal:hover {
    border-color: var(--beam);
    box-shadow: 0 0 20px rgba(76, 179, 255, 0.25);
}

/* Serial IDs are visual labels only; they are not service identifiers. */
.archive-card::after,
.control-card::after {
    content: attr(data-serial);
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.6rem;
    color: var(--relay);
    opacity: 0.3;
    letter-spacing: 0.05em;
    pointer-events: none;
}

@keyframes breachFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.log-entry.breach {
    animation: breachFlicker 0.65s 2 alternate;
    color: var(--breach);
    font-weight: bold;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }

    .stars {
        display: none;
    }
}

.internal-filled {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}

@media (max-width: 720px) {
    .sections {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 48px 20px 28px;
    }

    .archive-grid,
    .control-grid {
        grid-template-columns: 1fr;
    }

    .warning-badge {
        position: relative;
        top: auto;
        right: auto;
        margin: 16px auto 0;
    }

    .hero-warning-offset {
        margin-bottom: 32px;
    }

    body {
        cursor: pointer;
    }
}

@media (max-width: 1180px) {
    :root {
        --shell-top-space: calc(var(--status-strip-height) + 36px);
        --shell-x-space: 20px;
        --shell-bottom-space: 210px;
    }
}
