/* ======================================================
   archetype.boo -- Retro-Futuristic Blueprint Aesthetic
   Cool-grays palette with Blueprint Cyan accent
   Diagonal-sections composition, hand-drawn SVG motifs
   ====================================================== */

/* ---- CSS Custom Properties (Palette) ---- */
:root {
    --zinc-white: #e8e9eb;
    --graphite: #4a4e57;
    --steel-charcoal: #2b2d33;
    --phantom-gray: #6b7080;
    --blueprint-cyan: #3a8fb7;
    --vapor-silver: #c4c8d0;
    --deep-slate: #1a1c22;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-mono: 'Space Mono', monospace;

    --baseline: 28px;
    --skew-angle: 12deg;
}

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

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

body {
    background-color: var(--zinc-white);
    color: var(--graphite);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.02em;
    overflow: hidden;
}

/* ---- SVG Filters (hidden) ---- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---- Cross-Hatch Background Pattern ---- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.06;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 7px,
            var(--vapor-silver) 7px,
            var(--vapor-silver) 8px
        ),
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 7px,
            var(--vapor-silver) 7px,
            var(--vapor-silver) 8px
        );
}

/* ================================================
   LOADING SCREEN
   ================================================ */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--deep-slate);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

#loading-screen.slide-up {
    transform: translateY(-100vh);
}

#loading-screen.hidden {
    display: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.loading-circle {
    width: clamp(80px, 20vw, 160px);
    height: clamp(80px, 20vw, 160px);
}

.loading-circle circle {
    stroke-dasharray: 502;
    stroke-dashoffset: 502;
    animation: drawIncompleteCircle 1.2s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes drawIncompleteCircle {
    0% {
        stroke-dashoffset: 502;
    }
    100% {
        stroke-dashoffset: 75;
    }
}

.loading-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 12vw, 10rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--zinc-white);
    overflow: hidden;
}

.loading-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    animation: letterReveal 0.3s ease-out forwards;
}

@keyframes letterReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================
   SCROLL CONTAINER (Snap)
   ================================================ */
.scroll-container {
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    position: relative;
    z-index: 1;
}

/* ================================================
   SNAP SECTIONS
   ================================================ */
.snap-section {
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 20% 1fr 1fr;
    grid-template-rows: 1fr;
    align-items: center;
}

/* ---- Grid Fragment Background Texture ---- */
.grid-fragment {
    position: absolute;
    width: 200px;
    height: 200px;
    opacity: 0;
    transition: opacity 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'%3E%3Cg stroke='%23c4c8d0' stroke-width='1' fill='none'%3E%3Cline x1='0' y1='0' x2='40' y2='0'/%3E%3Cline x1='0' y1='40' x2='40' y2='40'/%3E%3Cline x1='0' y1='80' x2='40' y2='80'/%3E%3Cline x1='0' y1='120' x2='40' y2='120'/%3E%3Cline x1='0' y1='160' x2='40' y2='160'/%3E%3Cline x1='0' y1='200' x2='40' y2='200'/%3E%3Cline x1='0' y1='0' x2='0' y2='200'/%3E%3Cline x1='40' y1='0' x2='40' y2='200'/%3E%3Cline x1='80' y1='0' x2='80' y2='160'/%3E%3Cline x1='120' y1='0' x2='120' y2='120'/%3E%3Cline x1='160' y1='0' x2='160' y2='80'/%3E%3Cline x1='200' y1='0' x2='200' y2='40'/%3E%3Cline x1='80' y1='0' x2='200' y2='0'/%3E%3Cline x1='80' y1='40' x2='200' y2='40'/%3E%3Cline x1='80' y1='80' x2='160' y2='80'/%3E%3Cline x1='80' y1='120' x2='120' y2='120'/%3E%3Cline x1='80' y1='160' x2='80' y2='160'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}

.grid-fragment-1 { top: 10%; right: 5%; }
.grid-fragment-2 { bottom: 15%; left: 5%; }
.grid-fragment-3 { top: 20%; right: 10%; }
.grid-fragment-4 { bottom: 10%; right: 8%; }

.snap-section.in-view .grid-fragment {
    opacity: 0.2;
}

/* ---- Diagonal Band Primary ---- */
.diagonal-band-primary {
    grid-column: 1 / 3;
    grid-row: 1;
    padding-left: 20%;
    padding-right: 5%;
    transform: skewY(calc(-1 * var(--skew-angle)));
    position: relative;
    z-index: 2;
}

.diagonal-band-primary > * {
    transform: skewY(var(--skew-angle));
}

/* ---- Diagonal Band Secondary ---- */
.diagonal-band-secondary {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    transform: skewY(var(--skew-angle));
    position: relative;
    z-index: 2;
    padding: 2rem;
}

.diagonal-band-secondary > * {
    transform: skewY(calc(-1 * var(--skew-angle)));
}

/* ---- Annotation Gutter ---- */
.annotation-gutter {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: calc(var(--baseline) * 0.75);
}

.annotation-label {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    letter-spacing: 0.04em;
    color: var(--phantom-gray);
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    transition-delay: 0.4s;
}

.annotation-line {
    height: 1px;
    flex-grow: 1;
    background: var(--phantom-gray);
    border: none;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transition-delay: 0.5s;
}

.snap-section.in-view .annotation-label {
    opacity: 1;
    transform: translateX(0);
}

.snap-section.in-view .annotation-line {
    opacity: 0.5;
    transform: scaleX(1);
}

/* ---- Section Headings ---- */
.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--steel-charcoal);
    line-height: 1.1;
    margin-bottom: calc(var(--baseline) * 0.75);
    position: relative;
    display: inline-block;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transition-delay: 0.7s;
}

.snap-section.in-view .section-heading {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Heading Underline (SVG drawn beneath) ---- */
.heading-underline {
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 10px;
    overflow: visible;
}

.heading-underline path {
    stroke: var(--blueprint-cyan);
    stroke-width: 2;
    fill: none;
    stroke-dasharray: var(--path-length);
    stroke-dashoffset: var(--path-length);
    transition: stroke-dashoffset 0.5s ease-in-out;
    transition-delay: 1s;
}

.snap-section.in-view .heading-underline path {
    stroke-dashoffset: 0;
}

/* ---- Body Text ---- */
.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.4vw, 1.1rem);
    letter-spacing: 0.02em;
    line-height: 1.7;
    color: var(--graphite);
    max-width: 540px;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    transition-delay: 1.2s;
}

.body-text-secondary {
    margin-top: calc(var(--baseline) * 0.5);
    transition-delay: 1.4s;
}

.snap-section.in-view .body-text {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Coordinate Labels ---- */
.coordinate-label {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.04em;
    color: var(--phantom-gray);
    opacity: 0;
    transition: opacity 0.4s ease;
    transition-delay: 1.4s;
}

.snap-section.in-view .coordinate-label {
    opacity: 0.7;
}

/* ================================================
   GEOMETRIC MOTIFS
   ================================================ */

/* Hero Triangles (Section 1 background) */
.hero-triangles {
    position: absolute;
    width: 80vw;
    height: 80vw;
    max-width: 800px;
    max-height: 800px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.08;
    z-index: 0;
    animation: slowRotate 720s linear infinite;
}

@keyframes slowRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Motif SVGs in secondary bands */
.motif-incomplete-circle {
    width: clamp(100px, 15vw, 200px);
    height: clamp(100px, 15vw, 200px);
}

.motif-incomplete-circle .draw-circle {
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.65, 0, 0.35, 1);
    transition-delay: 0.6s;
}

.snap-section.in-view .motif-incomplete-circle .draw-circle {
    stroke-dashoffset: 66;
}

.motif-triangles {
    width: clamp(120px, 18vw, 250px);
    height: clamp(120px, 18vw, 250px);
}

.motif-triangles .draw-triangle-1 {
    stroke-dasharray: 700;
    stroke-dashoffset: 700;
    transition: stroke-dashoffset 0.6s ease-in-out;
    transition-delay: 0.6s;
}

.motif-triangles .draw-triangle-2 {
    stroke-dasharray: 700;
    stroke-dashoffset: 700;
    transition: stroke-dashoffset 0.6s ease-in-out;
    transition-delay: 0.9s;
}

.snap-section.in-view .motif-triangles .draw-triangle-1,
.snap-section.in-view .motif-triangles .draw-triangle-2 {
    stroke-dashoffset: 0;
}

.motif-lines {
    width: clamp(150px, 20vw, 280px);
    height: auto;
}

.motif-lines .draw-line-1,
.motif-lines .draw-line-2,
.motif-lines .draw-line-3,
.motif-lines .draw-line-4 {
    stroke-dasharray: 280;
    stroke-dashoffset: 280;
    transition: stroke-dashoffset 0.5s ease-in-out;
}

.motif-lines .draw-line-1 { transition-delay: 0.6s; }
.motif-lines .draw-line-2 { transition-delay: 0.8s; }
.motif-lines .draw-line-3 { transition-delay: 1.0s; }
.motif-lines .draw-line-4 { transition-delay: 1.2s; }

.snap-section.in-view .motif-lines .draw-line-1,
.snap-section.in-view .motif-lines .draw-line-2,
.snap-section.in-view .motif-lines .draw-line-3,
.snap-section.in-view .motif-lines .draw-line-4 {
    stroke-dashoffset: 0;
}

/* Cross-hatch demo block */
.crosshatch-demo {
    width: clamp(100px, 12vw, 160px);
    height: clamp(80px, 10vw, 120px);
    background-color: var(--zinc-white);
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 6px,
            var(--vapor-silver) 6px,
            var(--vapor-silver) 7px
        ),
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 6px,
            var(--vapor-silver) 6px,
            var(--vapor-silver) 7px
        );
    border: 1px dashed var(--phantom-gray);
    opacity: 0;
    transition: opacity 0.4s ease;
    transition-delay: 0.8s;
}

.snap-section.in-view .crosshatch-demo {
    opacity: 1;
}

/* Convergence Construction (Section 4) */
.convergence-construction {
    position: absolute;
    width: 80vw;
    height: 80vw;
    max-width: 700px;
    max-height: 700px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.1;
    z-index: 0;
    animation: slowRotate 720s linear infinite;
}

.convergence-secondary {
    justify-content: flex-end;
    padding-bottom: 15vh;
}

/* Annotation Arrows */
.annotation-arrow {
    position: absolute;
    width: 150px;
    height: 40px;
    z-index: 3;
}

.arrow-1 {
    bottom: 30%;
    left: 22%;
    transform: rotate(-12deg);
}

.draw-arrow {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.4s ease;
    transition-delay: 0.8s;
}

.snap-section.in-view .draw-arrow {
    stroke-dashoffset: 0;
}

/* ================================================
   CONNECTING LINES (Diagonal, full page)
   ================================================ */
.connecting-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
}

/* ================================================
   VERTICAL NAVIGATION STRIP
   ================================================ */
#nav-strip {
    position: fixed;
    right: 0;
    top: 0;
    width: 60px;
    height: 100vh;
    background-color: var(--deep-slate);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    z-index: 1000;
    padding: 2rem 0;
}

.nav-icon {
    width: 36px;
    height: 36px;
    position: relative;
    color: var(--vapor-silver);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.nav-icon svg:first-child {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.nav-icon-filled {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 0.3s ease;
}

.nav-icon:hover .nav-icon-filled,
.nav-icon.active .nav-icon-filled {
    clip-path: circle(70% at 50% 50%);
}

.nav-icon:hover {
    color: var(--blueprint-cyan);
}

.nav-wordmark {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.04em;
    color: var(--phantom-gray);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    position: absolute;
    bottom: 1.5rem;
    opacity: 0.6;
}

/* ================================================
   SECTION-SPECIFIC STYLES
   ================================================ */

/* Section 1 */
.section-one {
    background-color: var(--zinc-white);
}

/* Section 2 */
.section-two {
    background-color: var(--zinc-white);
}

/* Section 3 */
.section-three {
    background-color: var(--zinc-white);
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 7px,
            var(--vapor-silver) 7px,
            var(--vapor-silver) 8px
        );
    background-size: 100% 100%;
    background-blend-mode: normal;
}

.section-three::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--zinc-white);
    opacity: 0.92;
    pointer-events: none;
}

.section-three .section-content,
.section-three .diagonal-band-secondary {
    position: relative;
    z-index: 2;
}

/* Section 4 */
.section-four {
    background-color: var(--zinc-white);
}

/* ================================================
   CROSS-HATCH HOVER STATES
   ================================================ */
.nav-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 3px,
            rgba(58, 143, 183, 0.3) 3px,
            rgba(58, 143, 183, 0.3) 4px
        );
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 4px;
    pointer-events: none;
}

.nav-icon:hover::before {
    opacity: 1;
}

/* ================================================
   RESPONSIVE ADJUSTMENTS
   ================================================ */
@media (max-width: 768px) {
    .snap-section {
        grid-template-columns: 10% 1fr;
        grid-template-rows: 1fr auto;
    }

    .diagonal-band-primary {
        grid-column: 1 / -1;
        grid-row: 1;
        padding-left: 12%;
        padding-right: 12%;
        transform: skewY(calc(-0.5 * var(--skew-angle)));
    }

    .diagonal-band-primary > * {
        transform: skewY(calc(0.5 * var(--skew-angle)));
    }

    .diagonal-band-secondary {
        grid-column: 1 / -1;
        grid-row: 2;
        transform: none;
        padding: 1rem;
        flex-direction: row;
        gap: 1rem;
    }

    .diagonal-band-secondary > * {
        transform: none;
    }

    #nav-strip {
        width: 44px;
        gap: 1rem;
    }

    .nav-icon {
        width: 28px;
        height: 28px;
    }

    .nav-wordmark {
        display: none;
    }

    .hero-triangles,
    .convergence-construction {
        width: 100vw;
        height: 100vw;
    }

    .body-text {
        max-width: 100%;
    }

    .annotation-arrow {
        display: none;
    }
}

@media (max-width: 480px) {
    .section-heading {
        font-size: clamp(1.6rem, 8vw, 2.5rem);
    }

    .diagonal-band-primary {
        padding-left: 8%;
        padding-right: 8%;
        transform: none;
    }

    .diagonal-band-primary > * {
        transform: none;
    }

    #nav-strip {
        width: 36px;
    }
}
