/* ══════════════════════════════════════════════════════
   LENERE WOODS v2 — Corrupted Signal / VHS Artifact
   ══════════════════════════════════════════════════════ */

:root {
    --bg:        #06030a;
    --text:      #ddd8cc;
    --text-dim:  #665f55;
    --chroma-r:  #ff0055;
    --chroma-b:  #00ccff;
    --scanline:  rgba(0, 0, 0, 0.45);
    --font-vt:   'VT323', monospace;
    --font-mono: 'Share Tech Mono', monospace;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Hidden SVG defs */
.svg-defs {
    position: absolute;
    width: 0; height: 0;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   VHS OVERLAY
   ══════════════════════════════════════════════════════ */

#vhs-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
}

/* Scanlines */
.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        var(--scanline) 3px,
        var(--scanline) 4px
    );
    opacity: 0.55;
}

/* Noise layer */
.noise-layer {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    opacity: 0.04;
    animation: noise-drift 0.25s steps(1) infinite;
}

@keyframes noise-drift {
    0%   { background-position: 0 0; }
    20%  { background-position: -30px 15px; }
    40%  { background-position: 20px -20px; }
    60%  { background-position: -15px 30px; }
    80%  { background-position: 35px -10px; }
    100% { background-position: 0 0; }
}

/* Tracking error bars */
.tracking-bar {
    position: fixed;
    left: 0; right: 0;
    height: 3px;
    pointer-events: none;
    z-index: 9001;
    mix-blend-mode: screen;
    animation: tracking-slide 0.12s linear forwards;
}

@keyframes tracking-slide {
    from { transform: translateX(-6px); opacity: 0.8; }
    to   { transform: translateX(8px);  opacity: 0; }
}

/* Signal counter */
#signal-counter {
    position: fixed;
    bottom: 1.2rem;
    right: 1.4rem;
    z-index: 8000;
    font-family: var(--font-vt);
    font-size: 1.1rem;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
    transition: color 0.4s;
    text-shadow: none;
}

#signal-counter.all-found {
    color: #00ff88;
    text-shadow: 0 0 8px #00ff88;
}

.counter-label {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-right: 0.3rem;
}

#counter-val {
    font-size: 1.4rem;
    color: var(--text);
    transition: color 0.4s;
}

#signal-counter.all-found #counter-val {
    color: #00ff88;
}

/* ══════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════ */

#site-header {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 3rem 2.5rem 2rem;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* VHS HUD bar */
.vhs-hud {
    position: absolute;
    top: 1.2rem;
    left: 0; right: 0;
    padding: 0 1.6rem;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-vt);
    font-size: 1.1rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.12em;
}

.rec-dot {
    color: #ff3333;
    animation: blink 1s step-end infinite;
}

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

/* Main title */
.header-body {
    position: relative;
    z-index: 1;
}

.site-title {
    font-family: var(--font-vt);
    font-size: clamp(3.5rem, 12vw, 9rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.04em;
    color: var(--text);

    /* VHS chromatic aberration */
    text-shadow:
        -3px  0   0   rgba(255,  0, 85, 0.75),
         3px  0   0   rgba(  0,204,255, 0.75);

    position: relative;
    animation: title-glitch 8s infinite;
}

/* Glitch slice on the title */
@keyframes title-glitch {
    0%, 90%, 100% { clip-path: none; transform: none; }
    91% {
        clip-path: polygon(0 20%, 100% 20%, 100% 35%, 0 35%);
        transform: translate(-4px, 0);
        text-shadow: 4px 0 0 var(--chroma-r), -4px 0 0 var(--chroma-b);
    }
    92% {
        clip-path: polygon(0 55%, 100% 55%, 100% 65%, 0 65%);
        transform: translate(4px, 0);
    }
    93% { clip-path: none; transform: none; }
    94% {
        clip-path: polygon(0 70%, 100% 70%, 100% 80%, 0 80%);
        transform: translate(-2px, 0);
    }
    95% { clip-path: none; transform: none; }
}

.site-sub {
    margin-top: 0.9rem;
    font-size: clamp(0.65rem, 1.8vw, 0.85rem);
    color: rgba(221,216,204,0.5);
    letter-spacing: 0.15em;
    line-height: 1.6;
}

.static-hint {
    margin-top: 2.5rem;
    font-family: var(--font-vt);
    font-size: 1rem;
    color: rgba(255,255,255,0.18);
    letter-spacing: 0.08em;
    animation: hint-flicker 4s ease-in-out infinite;
}

@keyframes hint-flicker {
    0%, 100% { opacity: 0.6; }
    48%      { opacity: 0.6; }
    50%      { opacity: 0.1; }
    52%      { opacity: 0.6; }
    75%      { opacity: 0.6; }
    76%      { opacity: 0.15; }
    77%      { opacity: 0.6; }
}

.scroll-nudge {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-vt);
    font-size: 1.4rem;
    color: rgba(255,255,255,0.2);
    letter-spacing: 0.3em;
    animation: nudge 2.5s ease-in-out infinite;
}

@keyframes nudge {
    0%, 100% { transform: translateX(-50%) translateY(0);   opacity: 0.3; }
    50%       { transform: translateX(-50%) translateY(6px); opacity: 0.7; }
}

/* ══════════════════════════════════════════════════════
   STATIC FIELD
   ══════════════════════════════════════════════════════ */

#static-field {
    position: relative;
    min-height: 1200px;
    /* subtle background static grain */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 250px 250px;
    animation: static-bg 0.3s steps(1) infinite;
}

@keyframes static-bg {
    0%   { background-position: 0 0; }
    25%  { background-position: -40px 20px; }
    50%  { background-position: 25px -30px; }
    75%  { background-position: -20px 40px; }
    100% { background-position: 0 0; }
}

/* Decorative noise blocks */
.noise-block {
    position: absolute;
    background: rgba(255,255,255,0.03);
    mix-blend-mode: screen;
    pointer-events: none;
}

/* ── Signal Zones ── */
.signal-zone {
    position: absolute;
    left: var(--sx);
    top: var(--sy);
    width: 240px;
    height: 140px;
    cursor: crosshair;
}

/* Static mask — what you see before finding */
.sz-static {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        rgba(255,255,255,0.04)  0px,
        rgba(255,255,255,0.01)  1px,
        transparent              1px,
        transparent              4px
    ),
    repeating-linear-gradient(
        0deg,
        rgba(255,255,255,0.03)  0px,
        transparent              1px,
        transparent              3px
    );
    background-color: rgba(20, 12, 28, 0.7);
    filter: url(#noise-filter);
    border: 1px solid rgba(255,255,255,0.06);
    transition: opacity 0.35s ease;
    animation: sz-static-flicker 0.2s steps(1) infinite;
}

@keyframes sz-static-flicker {
    0%   { background-position: 0 0, 0 0; }
    33%  { background-position: -8px 5px, 3px -4px; }
    66%  { background-position: 5px -8px, -4px 3px; }
    100% { background-position: 0 0, 0 0; }
}

/* Reveal layer — what shows after found */
.sz-reveal {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.2rem 1.4rem;
    gap: 0.6rem;
    opacity: 0;
    transition: opacity 0.5s ease 0.15s;
    border: 1px solid rgba(var(--sc, 255,255,255), 0.3);
    background: rgba(6,3,10,0.92);

    /* color glow from signal color */
    box-shadow: 0 0 20px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,0,0,0.5);
}

.sz-tag {
    font-family: var(--font-vt);
    font-size: 0.85rem;
    color: var(--sc, #fff);
    letter-spacing: 0.2em;
    opacity: 0.7;
}

.sz-link {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-decoration: none;
}

.sz-name {
    font-family: var(--font-vt);
    font-size: 1.6rem;
    color: var(--text);
    letter-spacing: 0.06em;
    line-height: 1;
    text-shadow: 0 0 12px var(--sc, white);
    transition: text-shadow 0.2s;
}

.sz-link:hover .sz-name {
    text-shadow: 0 0 20px var(--sc, white), 0 0 40px var(--sc, white);
}

.sz-cta {
    font-size: 0.72rem;
    color: var(--sc, #fff);
    letter-spacing: 0.15em;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.sz-link:hover .sz-cta {
    opacity: 1;
}

/* ── Found state ── */
.signal-zone.found {
    cursor: default;
}

.signal-zone.found .sz-static {
    opacity: 0;
    pointer-events: none;
}

.signal-zone.found .sz-reveal {
    opacity: 1;
    border-color: color-mix(in srgb, var(--sc, white) 40%, transparent);
    box-shadow:
        0 0 20px rgba(0,0,0,0.8),
        0 0 15px color-mix(in srgb, var(--sc, white) 15%, transparent);
}

/* ── Hover on unfound — give a subtle hint ── */
.signal-zone:not(.found):hover .sz-static {
    opacity: 0.4;
    animation: sz-tune 0.5s steps(1) infinite;
}

@keyframes sz-tune {
    0%  { background-position: 0 0, 0 0; transform: translateX(0); }
    20% { background-position: -15px 5px, 3px -4px; transform: translateX(-2px); }
    40% { background-position: 5px -12px, -4px 3px; transform: translateX(2px); }
    60% { background-position: -5px 8px, 2px -2px; transform: translateX(-1px); }
    80% { background-position: 8px -5px, -3px 4px; transform: translateX(1px); }
}

/* ══════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════ */

#site-footer {
    padding: 4rem 2.5rem 3rem;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-tape {
    font-family: var(--font-vt);
    font-size: 1.4rem;
    color: rgba(255,255,255,0.15);
    letter-spacing: 0.3em;
    position: relative;
    animation: eot-glitch 9s infinite;
}

.footer-tape::before,
.footer-tape::after {
    content: attr(data-text);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    color: rgba(255,255,255,0.15);
    clip-path: inset(0 100% 0 0);
}

.footer-tape::before {
    text-shadow: -2px 0 rgba(255, 0, 85, 0.6);
    animation: eot-chroma-r 9s infinite;
}

.footer-tape::after {
    text-shadow: 2px 0 rgba(0, 204, 255, 0.6);
    animation: eot-chroma-b 9s infinite;
}

@keyframes eot-glitch {
    0%, 88%, 100% { transform: none; }
    89%  { transform: translateX(-3px) skewX(-1deg); }
    90%  { transform: translateX(3px);  }
    91%  { transform: translateX(-1px); }
    92%  { transform: none; }
}

@keyframes eot-chroma-r {
    0%, 88%, 100% { clip-path: inset(0 100% 0 0); }
    89%  { clip-path: inset(0 0 0 0); transform: translate(calc(-50% - 4px), 0); }
    91%  { clip-path: inset(0 100% 0 0); }
}

@keyframes eot-chroma-b {
    0%, 88%, 100% { clip-path: inset(0 100% 0 0); }
    89%  { clip-path: inset(0 0 0 0); transform: translate(calc(-50% + 4px), 0); }
    91%  { clip-path: inset(0 100% 0 0); }
}

.footer-copy {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.1);
    letter-spacing: 0.2em;
}

/* ══════════════════════════════════════════════════════
   ALL FOUND — celebration overlay
   ══════════════════════════════════════════════════════ */

#all-found-msg {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 7000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s;
}

#all-found-msg.show {
    opacity: 1;
}

.all-found-inner {
    font-family: var(--font-vt);
    font-size: clamp(1.2rem, 4vw, 2rem);
    color: #00ff88;
    text-shadow: 0 0 20px #00ff88, 0 0 40px #00ff88;
    text-align: center;
    letter-spacing: 0.1em;
    line-height: 1.8;
    padding: 2rem;
    background: rgba(6,3,10,0.85);
    border: 1px solid #00ff88;
    box-shadow: 0 0 40px rgba(0,255,136,0.2);
    animation: msg-glitch 0.5s 0.2s ease forwards;
    opacity: 0;
}

@keyframes msg-glitch {
    0%   { opacity: 0; transform: translateX(-6px); }
    30%  { opacity: 1; transform: translateX(3px); }
    60%  { opacity: 1; transform: translateX(-2px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 700px) {
    #static-field {
        /* switch to stacked layout on mobile */
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        padding: 3rem 1.5rem;
        min-height: unset;
    }

    .signal-zone {
        position: relative;
        left: unset;
        top: unset;
        width: min(100%, 300px);
        height: 140px;
        flex-shrink: 0;
    }

    #noise-blocks { display: none; }

    .site-title { font-size: clamp(3rem, 16vw, 5rem); }

    #site-header {
        padding: 3rem 1.5rem 2rem;
        min-height: 85svh;
    }
}
