/* ==========================================================================
   a6c.boo -- Fairycore / Terminal / Coastal Ma
   Color Palette (Coastal Blend):
     Abyssal Slate:        #0B1A1E  (primary bg)
     Tidal Midnight:       #122B33  (secondary bg)
     Seafoam Mist:         #C8DCD8  (primary text)
     Pewter Drift:         #7A8F8C  (secondary text)
     Bioluminescent Amber: #D4A86A  (accent warm)
     Tide Pool:            #7FB5B0  (accent cool)
     Steel Current:        #4A7A8C  (structural line)
     Black Coral:          #060E11  (deep void)
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #0B1A1E;
    color: #C8DCD8;
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: #4A7A8C;
    color: #C8DCD8;
}

/* --- Fixed Navigation --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 1.2rem clamp(4rem, 12vw, 10rem);
    display: flex;
    gap: 2.5rem;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(11, 26, 30, 0.9) 0%, rgba(11, 26, 30, 0) 100%);
}

#main-nav.visible {
    opacity: 1;
    pointer-events: auto;
}

#main-nav a {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7A8F8C;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.3s ease, border-bottom-color 0.3s ease;
    padding-bottom: 2px;
}

#main-nav a:hover {
    color: #D4A86A;
    border-bottom-color: #7FB5B0;
}

/* --- Particle Field --- */
.particle-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.particle-field::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    box-shadow:
        120vw 15vh 0 0 rgba(212, 168, 106, 0.25),
        85vw 35vh 0 0 rgba(212, 168, 106, 0.15),
        30vw 55vh 0 0 rgba(212, 168, 106, 0.35),
        65vw 75vh 0 0 rgba(212, 168, 106, 0.20),
        10vw 20vh 0 0 rgba(212, 168, 106, 0.40),
        90vw 60vh 0 0 rgba(212, 168, 106, 0.18),
        45vw 85vh 0 0 rgba(212, 168, 106, 0.30),
        75vw 10vh 0 0 rgba(212, 168, 106, 0.22),
        20vw 40vh 0 0 rgba(212, 168, 106, 0.50),
        55vw 90vh 0 0 rgba(212, 168, 106, 0.15),
        38vw 25vh 0 0 rgba(212, 168, 106, 0.28),
        92vw 45vh 0 0 rgba(212, 168, 106, 0.20),
        15vw 70vh 0 0 rgba(212, 168, 106, 0.45),
        68vw 50vh 0 0 rgba(212, 168, 106, 0.17),
        42vw 15vh 0 0 rgba(212, 168, 106, 0.33);
    animation: particleDrift1 65s linear infinite;
}

.particle-field::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    box-shadow:
        25vw 30vh 0 0 rgba(212, 168, 106, 0.20),
        70vw 65vh 0 0 rgba(212, 168, 106, 0.35),
        50vw 10vh 0 0 rgba(212, 168, 106, 0.25),
        5vw 80vh 0 0 rgba(212, 168, 106, 0.40),
        80vw 25vh 0 0 rgba(212, 168, 106, 0.15),
        35vw 95vh 0 0 rgba(212, 168, 106, 0.30),
        60vw 40vh 0 0 rgba(212, 168, 106, 0.18),
        95vw 70vh 0 0 rgba(212, 168, 106, 0.22),
        18vw 55vh 0 0 rgba(212, 168, 106, 0.38),
        48vw 5vh 0 0 rgba(212, 168, 106, 0.28),
        78vw 85vh 0 0 rgba(212, 168, 106, 0.16),
        8vw 48vh 0 0 rgba(212, 168, 106, 0.42),
        58vw 22vh 0 0 rgba(212, 168, 106, 0.19),
        88vw 92vh 0 0 rgba(212, 168, 106, 0.32),
        32vw 68vh 0 0 rgba(212, 168, 106, 0.24);
    animation: particleDrift2 82s linear infinite;
}

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

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

/* --- Passages (General) --- */
.passage {
    position: relative;
    z-index: 2;
}

/* --- PASSAGE 1: THE THRESHOLD --- */
.passage-threshold {
    height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 40vh;
    padding-left: clamp(4rem, 12vw, 10rem);
    padding-right: 2rem;
    background: radial-gradient(ellipse at 50% 50%, #122B33 0%, #0B1A1E 70%);
    overflow: hidden;
}

.threshold-content {
    position: relative;
    z-index: 3;
}

.site-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.03em;
    color: #C8DCD8;
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.site-subtitle {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7A8F8C;
    margin-bottom: 3rem;
}

/* Dotted circles */
.dotted-circle {
    position: absolute;
    z-index: 2;
}

.dotted-circle--threshold {
    bottom: 12%;
    right: 12%;
    animation: circleRotate 120s linear infinite;
}

.dotted-circle--clearing {
    animation: circleRotate 120s linear infinite;
}

@keyframes circleRotate {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Skeleton Bars --- */
.skeleton-cluster {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-bar {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        #122B33 0%,
        #122B33 40%,
        rgba(200, 220, 216, 0.08) 50%,
        #122B33 60%,
        #122B33 100%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 2.5s ease-in-out infinite;
}

.skeleton-bar--wide {
    height: 12px;
}

@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-cluster--threshold {
    max-width: 320px;
}

.skeleton-cluster--gap {
    max-width: 400px;
    padding-left: clamp(4rem, 12vw, 10rem);
    margin: 8vh 0;
}

.skeleton-cluster--resolve {
    position: relative;
    max-width: 50%;
    padding-left: clamp(4rem, 12vw, 10rem);
    margin: 10vh 0;
}

.skeleton-cluster--archive-gap {
    max-width: 500px;
    margin-left: auto;
    padding-right: clamp(4rem, 12vw, 10rem);
    margin-top: 8vh;
}

.resolved-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    padding-left: clamp(4rem, 12vw, 10rem);
    transition: opacity 0.8s ease 0.2s;
}

.resolved-content p {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: #C8DCD8;
}

.skeleton-cluster--resolve.resolved .skeleton-bar {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.skeleton-cluster--resolve.resolved .resolved-content {
    opacity: 1;
}

/* --- Content Islands --- */
.content-island {
    position: relative;
    max-width: 50%;
    margin-bottom: 30vh;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.content-island.visible {
    opacity: 1;
    transform: translateY(0);
}

.content-island--left {
    margin-left: clamp(4rem, 12vw, 10rem);
    margin-right: auto;
}

.content-island--right {
    margin-left: auto;
    margin-right: clamp(4rem, 12vw, 10rem);
}

.content-island--center {
    margin-left: auto;
    margin-right: auto;
    max-width: 60%;
    text-align: center;
}

/* --- PASSAGE 2: THE CATALOGUE --- */
.passage-catalogue {
    padding-top: 30vh;
    padding-bottom: 15vh;
    min-height: 150vh;
}

/* --- Terminal Blocks --- */
.terminal-block {
    background-color: #0B1A1E;
    border: 1px solid #4A7A8C;
    padding: 2rem 2.5rem;
    position: relative;
}

.terminal-header {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: #7FB5B0;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

.terminal-prompt {
    color: #D4A86A;
}

.terminal-command {
    color: #7FB5B0;
}

.terminal-meta {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7A8F8C;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(74, 122, 140, 0.2);
}

.terminal-body p {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #C8DCD8;
    margin-bottom: 0.5rem;
}

.terminal-body p:last-child {
    margin-bottom: 0;
}

/* --- Trace Lines --- */
.trace-line {
    position: absolute;
    width: 300px;
    height: 2px;
    opacity: 0;
    transition: opacity 1s ease;
}

.trace-line--left {
    right: -300px;
    top: 50%;
}

.trace-line--right {
    left: -300px;
    top: 50%;
}

.content-island.visible .trace-line {
    opacity: 1;
}

/* Trace line animation */
.trace-line line {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.5s ease;
}

.content-island.visible .trace-line line {
    stroke-dashoffset: 0;
}

/* --- Pull-Quotes --- */
.pull-quote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: -0.01em;
    color: #D4A86A;
    line-height: 1.4;
}

/* --- Duotone Image --- */
.duotone-image-container {
    width: 100%;
    max-width: 320px;
}

.duotone-image {
    position: relative;
    overflow: hidden;
}

.duotone-image svg {
    display: block;
    width: 100%;
    height: auto;
}

/* --- Node Clusters --- */
.node-cluster {
    position: absolute;
    z-index: 2;
}

.node-cluster--catalogue {
    bottom: 5vh;
    left: 60%;
}

.node-cluster--root {
    bottom: 20%;
    right: clamp(4rem, 12vw, 10rem);
}

/* --- PASSAGE 3: THE ARCHIVE --- */
.passage-archive {
    padding-top: 20vh;
    padding-bottom: 15vh;
    min-height: 120vh;
}

.passage-archive .content-island {
    margin-bottom: 12vh;
}

/* --- PASSAGE 4: THE CLEARING --- */
.passage-clearing {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.passage-clearing .dotted-circle--clearing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    margin-top: -200px;
    margin-left: -200px;
}

.clearing-message {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #4A7A8C;
    position: relative;
    z-index: 3;
}

/* --- PASSAGE 5: THE ROOT --- */
.passage-root {
    min-height: 80vh;
    padding-top: 15vh;
    padding-bottom: 10vh;
    background: linear-gradient(to bottom, #0B1A1E 0%, #060E11 100%);
    position: relative;
}

.passage-root .content-island {
    margin-bottom: 8vh;
}

.terminal-block--root {
    border-color: rgba(74, 122, 140, 0.4);
}

.root-attribution {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1.2rem;
    color: #C8DCD8;
    margin-bottom: 0.75rem;
}

.root-detail {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: #7A8F8C;
    text-transform: uppercase;
}

.pull-quote--exit {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 60%;
    margin: 10vh auto 0 auto;
    display: block;
}

/* --- Reveal on scroll (initial state) --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-island {
        max-width: 85%;
    }

    .content-island--left {
        margin-left: 1.5rem;
    }

    .content-island--right {
        margin-right: 1.5rem;
    }

    .content-island--center {
        max-width: 90%;
    }

    #main-nav {
        padding: 1rem 1.5rem;
        gap: 1.5rem;
    }

    .passage-threshold {
        padding-left: 2rem;
    }

    .skeleton-cluster--gap {
        padding-left: 2rem;
    }

    .skeleton-cluster--resolve {
        max-width: 85%;
        padding-left: 2rem;
    }

    .resolved-content {
        padding-left: 2rem;
    }

    .skeleton-cluster--archive-gap {
        padding-right: 2rem;
    }

    .terminal-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .trace-line {
        display: none;
    }

    .node-cluster--catalogue,
    .node-cluster--root {
        display: none;
    }

    .pull-quote--exit {
        max-width: 90%;
    }
}
