/* ========================================
   gabs.cx — Terminal Noir
   ======================================== */

/* CSS Custom Properties for Counter-Animate */
@property --signal {
    syntax: '<integer>';
    initial-value: 0;
    inherits: false;
}
@property --elapsed {
    syntax: '<integer>';
    initial-value: 0;
    inherits: false;
}
@property --distance {
    syntax: '<integer>';
    initial-value: 0;
    inherits: false;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(180deg, #080c14 0%, #0f1a2e 50%, #080c14 100%);
    background-attachment: fixed;
    color: #8a9db4;
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    font-weight: 400;
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.mono {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    font-weight: 400;
    letter-spacing: 0.06em;
}

a {
    color: #4a8cb8;
    text-decoration: none;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

a:hover {
    color: #6bbfee;
    text-shadow: 0 0 12px rgba(107, 191, 238, 0.3);
}

/* ========================================
   DEEP LAYER — Fixed Wireframe Polyhedra
   ======================================== */

#deep-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    perspective: 1200px;
}

.polyhedron {
    position: absolute;
    transform-style: preserve-3d;
}

.polyhedron .face {
    position: absolute;
    background: transparent;
    border: 1px solid rgba(74, 140, 184, 0.12);
}

/* Polyhedron 1 — large, top-right */
.poly-1 {
    width: 240px;
    height: 240px;
    top: 10%;
    right: 15%;
    animation: rotate-slow-1 120s linear infinite;
}
.poly-1 .face-a { width: 100%; height: 100%; transform: rotateY(0deg) translateZ(120px); }
.poly-1 .face-b { width: 100%; height: 100%; transform: rotateY(90deg) translateZ(120px); }
.poly-1 .face-c { width: 100%; height: 100%; transform: rotateX(90deg) translateZ(120px); }
.poly-1 .face-d { width: 100%; height: 100%; transform: rotateY(180deg) translateZ(120px); }
.poly-1 .face-e { width: 100%; height: 100%; transform: rotateY(-90deg) translateZ(120px); }
.poly-1 .face-f { width: 100%; height: 100%; transform: rotateX(-90deg) translateZ(120px); }

/* Polyhedron 2 — small, center-right */
.poly-2 {
    width: 100px;
    height: 100px;
    top: 45%;
    right: 25%;
    opacity: 0.7;
    animation: rotate-slow-2 150s linear infinite;
}
.poly-2 .face-a { width: 100%; height: 100%; transform: rotateY(0deg) translateZ(50px); }
.poly-2 .face-b { width: 100%; height: 100%; transform: rotateY(120deg) translateZ(50px); }
.poly-2 .face-c { width: 100%; height: 100%; transform: rotateX(60deg) translateZ(50px); }
.poly-2 .face-d { width: 100%; height: 100%; transform: rotateX(-60deg) translateZ(50px); }

/* Polyhedron 3 — medium, bottom-right */
.poly-3 {
    width: 180px;
    height: 180px;
    bottom: 15%;
    right: 10%;
    opacity: 0.5;
    animation: rotate-slow-3 180s linear infinite;
}
.poly-3 .face-a { width: 100%; height: 100%; transform: rotateY(0deg) translateZ(90px); }
.poly-3 .face-b { width: 100%; height: 100%; transform: rotateY(72deg) translateZ(90px); }
.poly-3 .face-c { width: 100%; height: 100%; transform: rotateY(144deg) translateZ(90px); }
.poly-3 .face-d { width: 100%; height: 100%; transform: rotateY(216deg) translateZ(90px); }
.poly-3 .face-e { width: 100%; height: 100%; transform: rotateY(288deg) translateZ(90px); }

/* Polyhedron 4 — tiny, mid-left */
.poly-4 {
    width: 80px;
    height: 80px;
    top: 30%;
    right: 55%;
    opacity: 0.4;
    animation: rotate-slow-2 100s linear infinite reverse;
}
.poly-4 .face-a { width: 100%; height: 100%; transform: rotateY(0deg) translateZ(40px); }
.poly-4 .face-b { width: 100%; height: 100%; transform: rotateY(90deg) translateZ(40px); }
.poly-4 .face-c { width: 100%; height: 100%; transform: rotateX(90deg) translateZ(40px); }
.poly-4 .face-d { width: 100%; height: 100%; transform: rotateX(-90deg) translateZ(40px); }

/* Polyhedron 5 — large, far right */
.poly-5 {
    width: 300px;
    height: 300px;
    top: 60%;
    right: 5%;
    opacity: 0.3;
    animation: rotate-slow-1 160s linear infinite reverse;
}
.poly-5 .face-a { width: 100%; height: 100%; transform: rotateY(0deg) translateZ(150px); }
.poly-5 .face-b { width: 100%; height: 100%; transform: rotateY(60deg) translateZ(150px); }
.poly-5 .face-c { width: 100%; height: 100%; transform: rotateY(120deg) translateZ(150px); }
.poly-5 .face-d { width: 100%; height: 100%; transform: rotateY(180deg) translateZ(150px); }
.poly-5 .face-e { width: 100%; height: 100%; transform: rotateY(240deg) translateZ(150px); }
.poly-5 .face-f { width: 100%; height: 100%; transform: rotateY(300deg) translateZ(150px); }

/* Polyhedron 6 — small, top-center */
.poly-6 {
    width: 120px;
    height: 120px;
    top: 8%;
    right: 40%;
    opacity: 0.35;
    animation: rotate-slow-3 140s linear infinite;
}
.poly-6 .face-a { width: 100%; height: 100%; transform: rotateY(0deg) translateZ(60px); }
.poly-6 .face-b { width: 100%; height: 100%; transform: rotateY(120deg) translateZ(60px); }
.poly-6 .face-c { width: 100%; height: 100%; transform: rotateX(90deg) translateZ(60px); }

@keyframes rotate-slow-1 {
    from { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    to   { transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg); }
}
@keyframes rotate-slow-2 {
    from { transform: rotateX(15deg) rotateY(0deg) rotateZ(30deg); }
    to   { transform: rotateX(375deg) rotateY(360deg) rotateZ(390deg); }
}
@keyframes rotate-slow-3 {
    from { transform: rotateX(45deg) rotateY(20deg) rotateZ(0deg); }
    to   { transform: rotateX(405deg) rotateY(380deg) rotateZ(360deg); }
}

/* ========================================
   NEAR LAYER — Rule Lines
   ======================================== */

#near-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
}

.rule-line {
    position: absolute;
    left: 12vw;
    width: 70vw;
    height: 1px;
    background: #4a8cb8;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.rule-line.visible {
    opacity: 0.4;
}

.rule-1 { top: 25%; }
.rule-2 { top: 50%; }
.rule-3 { top: 75%; }

/* ========================================
   TERMINAL CURSOR
   ======================================== */

#terminal-cursor {
    position: fixed;
    bottom: 2rem;
    left: 12vw;
    z-index: 20;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    color: #4a8cb8;
    animation: blink 1.06s step-end infinite;
    transition: color 0.6s ease;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ========================================
   SITE LOGO
   ======================================== */

#site-logo {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 20;
    color: #4a8cb8;
    opacity: 0.6;
    transition: opacity 0.3s ease, color 0.3s ease;
}

#site-logo:hover {
    opacity: 1;
    color: #6bbfee;
}

/* ========================================
   MID LAYER — Content
   ======================================== */

#mid-layer {
    position: relative;
    z-index: 5;
    margin-left: 12vw;
    max-width: 52ch;
    padding-top: 25vh;
    padding-bottom: 40vh;
}

/* ========================================
   ACT 1: BOOT SEQUENCE
   ======================================== */

#boot-sequence {
    margin-bottom: clamp(8rem, 20vh, 16rem);
}

#boot-text {
    color: #4a8cb8;
    min-height: 1.5em;
    margin-bottom: 2rem;
    opacity: 0;
}

#boot-text.visible {
    opacity: 1;
}

#hero-title {
    font-family: 'Cormorant Garamond', Garamond, serif;
    font-weight: 300;
    font-size: clamp(4rem, 10vw, 9rem);
    letter-spacing: 0.02em;
    line-height: 1.05;
    color: #c8dce8;
    opacity: 0;
    transition: opacity 1.5s ease;
}

#hero-title.visible {
    opacity: 1;
}

#hero-tagline {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    color: #8a9db4;
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 1.2s ease;
}

#hero-tagline.visible {
    opacity: 1;
}

/* ========================================
   ACT 2: DIRECTORY
   ======================================== */

#directory {
    margin-bottom: clamp(8rem, 20vh, 16rem);
}

.dir-listing {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.dir-line {
    display: block;
    color: #4a8cb8;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease, text-shadow 0.3s ease;
}

.dir-line.visible {
    opacity: 1;
    transform: translateY(0);
}

a.dir-line:hover {
    color: #6bbfee;
    text-shadow: 0 0 12px rgba(107, 191, 238, 0.3);
}

/* ========================================
   SVG DIVIDERS
   ======================================== */

.svg-divider {
    margin: clamp(4rem, 10vh, 8rem) 0;
    opacity: 0.6;
}

.divider-svg {
    width: clamp(120px, 30vw, 300px);
    height: auto;
    display: block;
}

/* ========================================
   ACT 3: TRANSMISSIONS
   ======================================== */

#transmissions {
    margin-bottom: clamp(8rem, 20vh, 16rem);
}

.transmission {
    margin-bottom: clamp(8rem, 20vh, 16rem);
}

.transmission:last-child {
    margin-bottom: 0;
}

.transmission h2,
#end h2 {
    font-family: 'Cormorant Garamond', Garamond, serif;
    font-weight: 300;
    font-size: clamp(2.8rem, 7vw, 6.5rem);
    letter-spacing: 0.02em;
    line-height: 1.05;
    color: #c8dce8;
    margin-bottom: 2rem;
}

.transmission p,
#end p {
    margin-bottom: 1.5rem;
    color: #8a9db4;
}

/* Fade-in animation */
.fade-in-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-block.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   ACT 4: SIGNAL READINGS
   ======================================== */

#signal-readings {
    margin-bottom: clamp(8rem, 20vh, 16rem);
    display: flex;
    flex-direction: column;
    gap: clamp(4rem, 8vh, 8rem);
}

.reading {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.reading-label {
    color: #4a8cb8;
    text-transform: uppercase;
}

.reading-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(3rem, 6vw, 4rem);
    font-weight: 400;
    color: #c49a3f;
    line-height: 1;
    transition: color 0.6s ease;
}

.reading-unit {
    color: #2a3d54;
}

/* ========================================
   ACT 5: END TRANSMISSION
   ======================================== */

#end {
    padding-bottom: 10vh;
}

.end-prompt {
    color: #4a8cb8;
    margin-top: 3rem;
}

.inline-cursor {
    animation: blink 1.06s step-end infinite;
    color: #4a8cb8;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    #mid-layer {
        margin-left: 6vw;
        margin-right: 4vw;
        max-width: none;
    }

    #terminal-cursor {
        left: 6vw;
    }

    .rule-line {
        left: 6vw;
    }
}
