/* ==========================================================================
   conc.quest - Brutalist Concrete Monolith
   ========================================================================== */

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

:root {
    /* Color Palette (Monochrome) */
    --raw-concrete: #1A1A1A;
    --deep-foundation: #111111;
    --chalk-white: #E8E8E8;
    --worn-concrete: #8A8A8A;
    --graphite: #3A3A3A;
    --rebar-orange: #C45A2D;
    --frosted-slab: rgba(255,255,255,0.06);
    --frost-edge: rgba(255,255,255,0.12);
    --ash: #B0B0B0;

    /* Typography */
    --font-display: 'Bebas Neue', sans-serif;
    --font-body: 'IBM Plex Mono', monospace;
    --font-accent: 'Space Grotesk', sans-serif;
}

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

body {
    background-color: var(--raw-concrete);
    color: var(--chalk-white);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Concrete Noise Texture --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255,255,255,0.03) 2px,
            rgba(255,255,255,0.03) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(255,255,255,0.02) 2px,
            rgba(255,255,255,0.02) 4px
        );
    background-blend-mode: overlay;
}

/* --- Scroll Depth Indicator --- */
#scroll-depth-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--graphite);
    z-index: 9999;
}

#scroll-depth-fill {
    height: 100%;
    width: 0%;
    background: var(--rebar-orange);
    transition: width 0.1s linear;
}

#scroll-depth-label {
    position: absolute;
    top: 4px;
    right: 12px;
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--worn-concrete);
    letter-spacing: 0.05em;
}

/* --- Rebar Line --- */
#rebar-line {
    position: fixed;
    top: 0;
    left: calc((100% / 12) * 0.5);
    width: 1px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

#rebar-line-inner {
    width: 100%;
    height: 100%;
    background: var(--ash);
    transition: background-color 0.6s ease;
}

#rebar-line.pulse #rebar-line-inner {
    background: var(--rebar-orange);
}

/* --- Rebar Tick Marks --- */
.rebar-tick {
    position: absolute;
    left: calc((100% / 12) * 0.5 - 8px);
    width: 17px;
    height: 1px;
    background: var(--ash);
    z-index: 101;
    pointer-events: none;
}

/* --- Slab (Section) Base --- */
.slab {
    position: relative;
    min-height: 100vh;
    width: 100%;
    background: var(--raw-concrete);
    overflow: hidden;
}

.slab-tall {
    min-height: 120vh;
}

.slab-extra-tall {
    min-height: 140vh;
}

.slab-foundation {
    min-height: 80vh;
    background: var(--deep-foundation);
}

/* --- Slab Separator (Expansion Joint) --- */
.slab-separator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--graphite);
}

/* --- Slab Grid System (12 columns, 24px gutters) --- */
.slab-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 24px;
    max-width: 100%;
    padding: 80px 24px;
    min-height: inherit;
    align-content: start;
}

.slab-content-left {
    grid-column: 2 / 9;
    padding-top: 40px;
}

.slab-content-right {
    grid-column: 9 / 13;
    position: relative;
    padding-top: 40px;
}

.slab-content-full {
    grid-column: 1 / 13;
    padding-top: 40px;
}

.slab-grid-centered .slab-content-full {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: calc((100% / 12) * 1);
}

/* --- SURFACE (Hero) Slab --- */
#slab-surface {
    display: flex;
    align-items: center;
    min-height: 100vh;
}

#slab-surface .slab-grid {
    align-items: center;
    min-height: 100vh;
    padding-top: 0;
}

#slab-surface .slab-content-left {
    padding-top: 0;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(4rem, 10vw, 9rem);
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 0.95;
    color: var(--chalk-white);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--worn-concrete);
    margin-top: 24px;
}

.lottie-container {
    width: 100%;
    height: 300px;
}

#slab-surface .slab-content-right {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-top: 0;
}

/* --- Slab Headings --- */
.slab-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--chalk-white);
    margin-bottom: 40px;
}

/* --- Slab Body Text --- */
.slab-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: var(--chalk-white);
    margin-bottom: 28px;
    max-width: 65ch;
}

/* --- Slab Caption --- */
.slab-caption {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.85;
    color: var(--worn-concrete);
    margin-bottom: 32px;
}

/* --- Glassmorphic Cards --- */
.glass-card {
    background: var(--frosted-slab);
    border: 1px solid var(--frost-edge);
    border-radius: 0;
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    box-shadow: 8px 8px 0 rgba(0,0,0,0.3);
    padding: 24px;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.glass-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.glass-card-featured {
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    width: 100%;
}

.card-wider {
    margin-left: -20px;
}

.card-widest {
    margin-left: -40px;
}

.card-label {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--worn-concrete);
    margin-bottom: 16px;
}

.card-diagram {
    width: 100%;
    height: auto;
}

.card-code {
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.7;
    white-space: pre;
    overflow-x: auto;
}

.code-dim {
    color: var(--worn-concrete);
}

.code-bright {
    color: var(--chalk-white);
}

/* Card entrance stagger */
.glass-card.card-animate:nth-child(2) {
    transition-delay: 0ms;
}

.glass-card.card-animate:nth-child(3) {
    transition-delay: 100ms;
}

.glass-card.card-animate:nth-child(4) {
    transition-delay: 200ms;
}

.glass-card.card-animate:nth-child(5) {
    transition-delay: 300ms;
}

/* --- Reveal Zones --- */
.reveal-zone {
    position: relative;
    height: 120px;
    background: var(--deep-foundation);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.reveal-zone .lottie-container {
    height: 100px;
    width: 200px;
}

/* --- Flowing SVG Curves --- */
.flow-curve {
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}

.flow-curve-tree {
    height: 100%;
}

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

.curve-path.drawn {
    stroke-dashoffset: 0;
}

.system-curve {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.system-curve.drawn {
    stroke-dashoffset: 0;
}

/* --- System Diagram --- */
.system-diagram {
    width: 100%;
    height: auto;
    max-height: 400px;
}

/* --- Foundation Slab --- */
.foundation-meta {
    margin-bottom: 40px;
}

.meta-line {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--worn-concrete);
    line-height: 2.2;
}

.foundation-curves {
    width: 500px;
    max-width: 100%;
    height: 200px;
    margin-top: 20px;
}

#rebar-terminator {
    position: absolute;
    bottom: 40px;
    left: calc((100% / 12) * 0.5 - 3px);
    width: 8px;
    height: 8px;
    background: var(--rebar-orange);
    z-index: 101;
}

/* --- Responsive Adjustments --- */
@media (max-width: 1024px) {
    .slab-grid {
        padding: 60px 20px;
    }

    .slab-content-left {
        grid-column: 2 / 10;
    }

    .slab-content-right {
        grid-column: 9 / 13;
    }
}

@media (max-width: 768px) {
    .slab-grid {
        display: flex;
        flex-direction: column;
        padding: 40px 20px 40px 40px;
    }

    .slab-content-left,
    .slab-content-right,
    .slab-content-full {
        width: 100%;
    }

    .slab-grid-centered .slab-content-full {
        padding-left: 0;
    }

    .hero-title {
        font-size: clamp(3rem, 12vw, 6rem);
    }

    .flow-curve {
        display: none;
    }

    .card-wider,
    .card-widest {
        margin-left: 0;
    }

    #rebar-line {
        left: 16px;
    }

    .rebar-tick {
        left: 8px;
    }

    #rebar-terminator {
        left: 13px;
    }

    .system-diagram {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2.5rem, 14vw, 4rem);
    }

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

    .slab-body {
        font-size: 0.9rem;
    }

    .glass-card {
        padding: 16px;
    }

    .card-code {
        font-size: 0.75rem;
    }
}
