/* gabs.day - Goblincore Terrarium Scanner Interface */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #0b1a2b;
    color: #b8d4e3;
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== HUD VISOR FRAME ===== */
#visor-frame {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
}

.visor-border {
    position: absolute;
    inset: 24px;
    border: 1px solid rgba(94, 168, 200, 0.35);
    border-radius: 12px;
    transition: opacity 0.8s ease;
}

/* Corner brackets */
.corner-bracket {
    position: absolute;
    width: 20px;
    height: 20px;
}

.corner-bracket::before,
.corner-bracket::after {
    content: '';
    position: absolute;
    background: rgba(94, 168, 200, 0.5);
}

.corner-bracket::before {
    width: 20px;
    height: 1px;
}

.corner-bracket::after {
    width: 1px;
    height: 20px;
}

.corner-tl { top: 24px; left: 24px; }
.corner-tl::before { top: 0; left: 0; }
.corner-tl::after { top: 0; left: 0; }

.corner-tr { top: 24px; right: 24px; }
.corner-tr::before { top: 0; right: 0; left: auto; }
.corner-tr::after { top: 0; right: 0; left: auto; }

.corner-bl { bottom: 24px; left: 24px; }
.corner-bl::before { bottom: 0; left: 0; top: auto; }
.corner-bl::after { bottom: 0; left: 0; top: auto; }

.corner-br { bottom: 24px; right: 24px; }
.corner-br::before { bottom: 0; right: 0; left: auto; top: auto; }
.corner-br::after { bottom: 0; right: 0; left: auto; top: auto; }

/* Corner readouts */
.corner-readout {
    position: absolute;
    font-family: 'Jost', sans-serif;
    font-weight: 200;
    font-size: 0.6rem;
    color: #4a8fa8;
    opacity: 0.5;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.readout-tl { top: 50px; left: 50px; }
.readout-tr { top: 50px; right: 50px; }
.readout-bl { bottom: 50px; left: 50px; }
.readout-br { bottom: 50px; right: 50px; }

/* Scan line */
.scan-line {
    position: absolute;
    left: 24px;
    right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #5ea8c8, transparent);
    opacity: 0.3;
    animation: scanSweep 8s ease-in-out infinite;
    will-change: transform;
}

@keyframes scanSweep {
    0% { transform: translateY(-100vh); top: 0; }
    100% { transform: translateY(100vh); top: 0; }
}

/* ===== LAYERS ===== */
.layer {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== LAYER 0 - THE VISOR ===== */
.visor-layer {
    min-height: 100vh;
    background: #0b1a2b;
}

.hero-specimen {
    width: clamp(150px, 30vw, 250px);
    height: auto;
    margin-top: 20vh;
    opacity: 0;
    animation: fadeInUp 2s ease forwards 0.5s;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.site-title {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.04em;
    color: #b8d4e3;
    text-transform: uppercase;
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
}

.site-title::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 30%, rgba(94, 168, 200, 0.15) 50%, transparent 70%);
    animation: titleScan 8s ease-in-out infinite;
}

@keyframes titleScan {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

.observe-text {
    font-family: 'Jost', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.8vw, 1.15rem);
    color: #4a8fa8;
    letter-spacing: 0.1em;
    margin-top: 1.5rem;
    opacity: 0;
    animation: fadeIn 1.5s ease forwards 2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== LAYER 1 - THE MOSS BED ===== */
.moss-layer {
    min-height: 120vh;
    background:
        repeating-conic-gradient(#1a3d2a 0.00008%, transparent 0.00012%) 0 0 / 200px 200px,
        radial-gradient(ellipse at 20% 35%, rgba(42, 92, 63, 0.7) 0%, transparent 45%) 0 0 / 400px 350px,
        radial-gradient(ellipse at 70% 60%, rgba(15, 46, 30, 0.8) 0%, transparent 50%) 0 0 / 350px 400px,
        radial-gradient(ellipse at 45% 80%, rgba(42, 92, 63, 0.5) 0%, transparent 40%) 0 0 / 300px 300px,
        #0d1f14;
}

.moss-bed {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: 120vh;
    padding: 0;
}

/* Specimen containers in moss bed */
.specimen-container {
    position: absolute;
    width: clamp(100px, 15vw, 160px);
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.specimen-container.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scan-ring {
    position: absolute;
    width: calc(100% + 40px);
    height: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ring-path {
    stroke-dasharray: 345.6;
    stroke-dashoffset: 345.6;
    transition: stroke-dashoffset 1.2s ease-out;
}

.specimen-container.revealed .ring-path {
    stroke-dashoffset: 0;
}

.specimen-art {
    width: 80px;
    height: 80px;
    position: relative;
    z-index: 2;
}

.specimen-label {
    font-family: 'Jost', sans-serif;
    font-weight: 300;
    font-size: clamp(0.55rem, 1vw, 0.75rem);
    color: #4a8fa8;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.6s ease 0.8s;
    white-space: nowrap;
}

.specimen-container.revealed .specimen-label {
    opacity: 0.8;
}

/* ===== LAYER 2 - THE ROOT NETWORK ===== */
.root-layer {
    min-height: 100vh;
    background: linear-gradient(180deg, #0d1f14 0%, #0b1a2b 30%, #0b1a2b 100%);
}

.root-layer .layer-content {
    max-width: 100%;
    padding: 0;
    position: relative;
    min-height: 100vh;
    justify-content: center;
}

.root-network {
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
}

.root-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 3s ease-in-out;
}

.root-layer.revealed .root-path {
    stroke-dashoffset: 0;
}

.root-layer.revealed .root-path:nth-child(2) { transition-delay: 0.3s; }
.root-layer.revealed .root-path:nth-child(3) { transition-delay: 0.6s; }
.root-layer.revealed .root-path:nth-child(4) { transition-delay: 0.9s; }
.root-layer.revealed .root-path:nth-child(5) { transition-delay: 1.2s; }
.root-layer.revealed .root-path:nth-child(6) { transition-delay: 1.5s; }
.root-layer.revealed .root-path:nth-child(7) { transition-delay: 1.8s; }
.root-layer.revealed .root-path:nth-child(8) { transition-delay: 2.1s; }
.root-layer.revealed .root-path:nth-child(9) { transition-delay: 2.4s; }
.root-layer.revealed .root-path:nth-child(10) { transition-delay: 2.7s; }

.central-node {
    opacity: 0;
    transition: opacity 1.5s ease 3s;
}

.central-node-glow {
    opacity: 0;
    transition: opacity 1.5s ease 3s;
}

.root-layer.revealed .central-node,
.root-layer.revealed .central-node-glow {
    opacity: 0.6;
}

.root-layer.revealed .central-node-glow {
    opacity: 0.15;
    animation: pulseGlow 4s ease-in-out infinite 3.5s;
}

@keyframes pulseGlow {
    0%, 100% { r: 8; opacity: 0.15; }
    50% { r: 14; opacity: 0.25; }
}

.connected-text {
    position: relative;
    z-index: 2;
    text-align: center;
}

.connected-word {
    font-family: 'Jost', sans-serif;
    font-weight: 200;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: #5ea8c8;
    opacity: 0;
    transition: opacity 1.5s ease 3.5s;
    letter-spacing: 0.12em;
}

.root-layer.revealed .connected-word {
    opacity: 0.6;
}

/* ===== LAYER 3 - THE SPECIMEN ARCHIVE ===== */
.archive-layer {
    min-height: 150vh;
    background: #070f17;
}

.archive-layer .layer-content {
    padding-top: 10vh;
    padding-bottom: 10vh;
    gap: 15vh;
}

.archive-specimen {
    display: flex;
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
    width: 100%;
    max-width: 800px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s ease;
}

.archive-specimen.revealed {
    opacity: 1;
    transform: translateY(0);
}

.archive-specimen:nth-child(even) {
    flex-direction: row-reverse;
}

.archive-art {
    flex: 0 0 auto;
    width: clamp(150px, 25vw, 250px);
}

.archive-svg {
    width: 100%;
    height: auto;
}

.archive-outline {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.archive-specimen.revealed .archive-outline {
    stroke-dashoffset: 0;
}

.archive-detail {
    opacity: 0;
    transition: opacity 1.5s ease 2s;
}

.archive-specimen.revealed .archive-detail {
    opacity: 0.6;
}

.archive-text {
    flex: 1;
}

.poetic-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.1rem, 2.2vw, 1.6rem);
    line-height: 1.7;
    color: #c4a265;
    opacity: 0;
    transition: opacity 1s ease;
}

.poetic-text.revealed {
    opacity: 1;
}

.poetic-text .char {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.poetic-text.revealed .char {
    opacity: 1;
}

/* ===== LAYER 4 - THE RETURN ===== */
.return-layer {
    min-height: 60vh;
    background: #0b1a2b;
}

.return-layer .layer-content {
    justify-content: center;
    min-height: 60vh;
    gap: 3rem;
}

.return-message {
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2.5vw, 1.6rem);
    color: #b8d4e3;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.return-message.revealed {
    opacity: 1;
    transform: translateY(0);
}

.return-title {
    opacity: 0;
    transition: opacity 1.5s ease 1s;
}

.return-title.revealed {
    opacity: 1;
}

.title-svg {
    width: clamp(200px, 40vw, 420px);
    height: auto;
}

.title-letter {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.return-title.revealed .title-letter {
    stroke-dashoffset: 0;
}

.return-title.revealed .title-letter:nth-child(2) { transition-delay: 0.2s; }
.return-title.revealed .title-letter:nth-child(3) { transition-delay: 0.4s; }
.return-title.revealed .title-letter:nth-child(4) { transition-delay: 0.6s; }
.return-title.revealed .title-letter:nth-child(5) { transition-delay: 0.8s; }
.return-title.revealed .title-letter:nth-child(6) { transition-delay: 1.0s; }
.return-title.revealed .title-letter:nth-child(7) { transition-delay: 1.2s; }
.return-title.revealed .title-letter:nth-child(8) { transition-delay: 1.4s; }

/* ===== BIOLUMINESCENT GLOW ===== */
.bioluminescent {
    box-shadow:
        0 0 4px rgba(126, 200, 227, 0.4),
        0 0 12px rgba(126, 200, 227, 0.2),
        0 0 30px rgba(126, 200, 227, 0.1);
    filter: drop-shadow(0 0 6px rgba(94, 168, 200, 0.3));
}

/* ===== SVG PATH ANIMATION BASE ===== */
.specimen-path {
    stroke-dasharray: var(--path-length, 500);
    stroke-dashoffset: var(--path-length, 500);
    transition: stroke-dashoffset 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.specimen-container.revealed .specimen-path,
.hero-path {
    stroke-dashoffset: 0;
}

.hero-path {
    animation: drawPath 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards 0.5s;
    stroke-dasharray: var(--path-length, 500);
    stroke-dashoffset: var(--path-length, 500);
}

@keyframes drawPath {
    to { stroke-dashoffset: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .visor-border {
        inset: 12px;
    }

    .corner-bracket { display: none; }

    .corner-readout {
        font-size: 0.5rem;
    }

    .readout-tl { top: 20px; left: 20px; }
    .readout-tr { top: 20px; right: 20px; }
    .readout-bl { bottom: 20px; left: 20px; }
    .readout-br { bottom: 20px; right: 20px; }

    .layer-content {
        padding: 0 24px;
    }

    .specimen-container {
        width: clamp(80px, 25vw, 120px);
    }

    .archive-specimen {
        flex-direction: column !important;
        text-align: center;
    }

    .archive-art {
        width: clamp(120px, 50vw, 200px);
    }

    .moss-bed {
        min-height: 140vh;
    }
}

@media (max-width: 480px) {
    .specimen-label {
        font-size: 0.5rem;
        white-space: normal;
        max-width: 120px;
    }

    .site-title {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
    }
}


/* ===== DESIGN COLOR REFERENCES ===== */
/* Ensure all palette colors are defined in CSS */
.moss-bed {
    background:
        repeating-conic-gradient(#1a3d2a 0.00008%, transparent 0.00012%) 0 0 / 200px 200px,
        radial-gradient(ellipse at 20% 35%, rgba(42, 92, 63, 0.7) 0%, transparent 45%) 0 0 / 400px 350px,
        radial-gradient(ellipse at 70% 60%, rgba(15, 46, 30, 0.8) 0%, transparent 50%) 0 0 / 350px 400px,
        radial-gradient(ellipse at 45% 80%, rgba(42, 92, 63, 0.5) 0%, transparent 40%) 0 0 / 300px 300px,
        #0d1f14;
}

/* Specimen vector line color */
.specimen-path,
.archive-outline,
.archive-detail path,
.hero-path {
    stroke: #7ec8e3;
}

/* Root network paths */
.root-path {
    stroke: #3a7a9a;
}

/* Moss texture deep green accents */
.moss-layer::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 50%, rgba(15, 46, 30, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 30%, #0f2e1e 0%, transparent 40%);
    pointer-events: none;
    opacity: 0.3;
}

/* Bioluminescent green highlight */
.scan-ring circle {
    filter: drop-shadow(0 0 4px #2a5c3f);
}
