@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

:root { --hue: 140; }

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

body {
    background: hsl(var(--hue), 15%, 4%);
    color: hsl(var(--hue), 40%, 40%);
    font-family: "JetBrains Mono", monospace;
    overflow-x: hidden;
    overflow-y: auto;
    width: 100vw;
    min-height: 100vh;
}

.terminal {
    width: 100%;
    min-height: 100vh;
    position: relative;
}

.scanline {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,0.03) 3px, rgba(0,0,0,0.03) 6px);
    pointer-events: none; z-index: 10;
}

.grid {
    display: grid;
    font-size: clamp(10px, 2vw, 22px);
    line-height: 1.35;
    white-space: pre;
    position: absolute;
    top: 0; left: 0;
}

.c {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.1s ease;
}
.c.v { opacity: 1; }

/* Backtrack flash — fades to invisible */
.c.bt {
    opacity: 0;
    transition: opacity 0.3s;
}

/* WFC background */
.c.wfc { color: hsl(var(--hue), 15%, 12%); }
.c.wfc-line { color: hsl(var(--hue), 30%, 22%); }

/* Structure borders */
.c.border { color: hsl(var(--hue), 45%, 38%); }

/* Content text */
.c.content { color: hsl(var(--hue), 40%, 50%); }

/* ASCII art name — bold with top-left to bottom-right fade-in */
.c.name {
    color: hsl(var(--hue), 55%, 60%);
    font-weight: 700;
    text-shadow: 0 0 8px hsla(var(--hue), 60%, 50%, 0.3);
    animation: nameFade 0.4s ease both;
    animation-delay: calc(var(--d, 0) * 15ms);
}

@keyframes nameFade {
    from { opacity: 0; color: hsl(var(--hue), 70%, 80%); }
    to { opacity: 1; color: hsl(var(--hue), 55%, 60%); }
}

.c.title { color: hsl(var(--hue), 55%, 65%); font-weight: 500; }

/* Clickable link cells */
.c.link {
    cursor: pointer;
    text-decoration: none;
}
.c.link:hover {
    color: hsl(var(--hue), 70%, 80%);
    text-shadow: 0 0 12px hsla(var(--hue), 70%, 60%, 0.5);
}

/* HUD — floating above content */
.hud {
    position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 10px; align-items: center;
    flex-wrap: wrap; justify-content: center;
    font-size: 0.65rem;
    color: hsl(var(--hue), 30%, 35%);
    z-index: 20; opacity: 0.5;
    transition: opacity 0.2s;
    padding: 6px 16px;
    background: hsla(var(--hue), 15%, 5%, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid hsla(var(--hue), 25%, 25%, 0.2);
    border-radius: 6px;
}
.hud:hover { opacity: 1; }

.hud label {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.6rem; color: hsl(var(--hue), 25%, 32%);
}
.hud input[type="range"] {
    width: 55px; height: 3px;
    -webkit-appearance: none; appearance: none;
    background: hsla(var(--hue), 25%, 25%, 0.3);
    border-radius: 2px; outline: none; cursor: pointer;
}
.hud input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 10px; height: 10px; border-radius: 50%;
    background: hsl(var(--hue), 35%, 40%); cursor: pointer;
}
.hud button {
    background: hsla(var(--hue), 25%, 25%, 0.08);
    color: hsl(var(--hue), 30%, 35%);
    border: 1px solid hsla(var(--hue), 25%, 25%, 0.15);
    border-radius: 2px; padding: 2px 8px;
    font-family: inherit; font-size: 0.6rem; cursor: pointer;
}
.hud button:hover { color: hsl(var(--hue), 45%, 55%); border-color: hsl(var(--hue), 40%, 45%); }

#nav { display: flex; gap: 3px; flex-wrap: wrap; }
#nav a {
    color: hsl(var(--hue), 25%, 28%);
    text-decoration: none; padding: 1px 5px;
    border: 1px solid transparent; border-radius: 2px;
    font-size: 0.55rem; transition: all 0.15s;
}
#nav a:hover { color: hsl(var(--hue), 45%, 55%); border-color: hsl(var(--hue), 35%, 35%); }
#nav a.active { color: hsl(var(--hue), 55%, 65%); border-color: hsl(var(--hue), 45%, 45%); }

.terminal::after {
    content: '';
    position: fixed; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(ellipse at center, hsla(var(--hue), 40%, 25%, 0.02) 0%, transparent 70%);
    pointer-events: none;
}
