/* =========================================
   Error pages (404.html, error.html)
   Served by IIS for arbitrary paths, so every URL here must be absolute.
   ========================================= */
:root {
    --bg: #050a15;
    --text: #ffffff;
    --muted: #a1a1aa;
    --accent: #3b82f6;
    --accent-2: #22d3ee;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --border: rgba(255, 255, 255, 0.1);
    --panel: rgba(255, 255, 255, 0.04);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, system-ui, 'Segoe UI', sans-serif;
    color: var(--text);
    background-color: var(--bg);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Background: glows + moving perspective grid */
.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 15% 10%, rgba(59, 130, 246, 0.18), transparent 45%),
                radial-gradient(circle at 85% 90%, rgba(34, 211, 238, 0.10), transparent 45%);
}

.bg-grid {
    position: absolute;
    left: -50%;
    right: -50%;
    bottom: -10%;
    height: 70%;
    background-image: linear-gradient(rgba(59, 130, 246, 0.25) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(59, 130, 246, 0.25) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: perspective(500px) rotateX(60deg);
    transform-origin: center top;
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 85%);
    -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 85%);
    animation: grid-move 4s linear infinite;
}

@keyframes grid-move {
    from { background-position: 0 0; }
    to { background-position: 0 60px; }
}

.bg-scan {
    position: absolute;
    left: 0;
    right: 0;
    height: 140px;
    background: linear-gradient(to bottom, transparent, rgba(59, 130, 246, 0.07), transparent);
    animation: scan 7s ease-in-out infinite;
}

@keyframes scan {
    0% { top: -140px; }
    100% { top: 100%; }
}

/* Layout */
.page {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 0;
}

/* Status chip */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 10px #f59e0b;
    animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
    50% { opacity: 0.25; }
}

/* Big code with glitch layers */
.code {
    position: relative;
    margin: 28px 0 8px;
    font-size: clamp(6rem, 22vw, 12rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #ffffff 10%, var(--accent) 55%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 40px var(--accent-glow));
    user-select: none;
}

.code::before,
.code::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    background: inherit;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0.7;
}

.code::before {
    animation: glitch-1 3.2s infinite steps(1);
}

.code::after {
    animation: glitch-2 3.2s infinite steps(1);
}

@keyframes glitch-1 {
    0%, 86%, 100% { transform: none; clip-path: inset(0 0 100% 0); }
    88% { transform: translate(-6px, 2px); clip-path: inset(20% 0 55% 0); }
    92% { transform: translate(5px, -2px); clip-path: inset(62% 0 12% 0); }
}

@keyframes glitch-2 {
    0%, 88%, 100% { transform: none; clip-path: inset(100% 0 0 0); }
    90% { transform: translate(6px, -1px); clip-path: inset(40% 0 35% 0); }
    94% { transform: translate(-4px, 3px); clip-path: inset(8% 0 78% 0); }
}

h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    line-height: 1.2;
    margin: 0 0 12px;
}

.lead {
    color: var(--muted);
    max-width: 560px;
    margin: 0 auto;
    font-size: 1.05rem;
}

/* Terminal-style detail line */
.terminal {
    margin: 28px auto 0;
    max-width: 560px;
    width: 100%;
    text-align: left;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(5, 10, 21, 0.7);
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
    font-size: 0.85rem;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.terminal .prompt {
    color: var(--accent-2);
}

.terminal .value {
    color: var(--text);
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 1em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: var(--accent);
    animation: blink 1s steps(1) infinite;
}

/* Actions */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    font-weight: 600;
    font-size: 0.95rem;
    transition: 0.25s;
}

.btn:hover {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.12);
}

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
}

.btn.primary:hover {
    background: #2563eb;
    box-shadow: 0 0 36px var(--accent-glow);
}

.btn svg {
    width: 16px;
    height: 16px;
}

.footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
}

@media (max-width: 480px) {
    .actions {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bg-grid, .bg-scan, .chip-dot, .cursor, .code::before, .code::after {
        animation: none;
    }
}
