/* ============================================================
   continua.quest — Brutalist Documentary Stylesheet
   ============================================================ */

/* --- CSS Custom Properties (Palette from DESIGN.md) --- */
:root {
    --raw-concrete: #1c1c1c;
    --shuttered-grey: #2a2a2a;
    --exposed-aggregate: #e8e4e0;
    --wet-cement: #b0b0b0;
    --bleached-formwork: #f0ede8;
    --signal-orange: #e8552a;
    --rebar-grey: #4a4a4a;
    --void-concrete: #0e0e0e;
    --formwork-black: #1a1a1a;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;

    --nav-width: 60px;
}

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

html {
    scroll-behavior: auto; /* No smooth scroll — brutalism respects native scroll */
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.65;
    color: var(--wet-cement);
    background-color: var(--raw-concrete);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Diagonal Grid Background --- */
#bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 119px,
            rgba(74, 74, 74, 0.08) 119px,
            rgba(74, 74, 74, 0.08) 120px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 119px,
            rgba(74, 74, 74, 0.08) 119px,
            rgba(74, 74, 74, 0.08) 120px
        );
}

/* --- Formwork Texture (Horizontal striations on body) --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(255, 255, 255, 0.02) 3px,
        rgba(255, 255, 255, 0.02) 4px
    );
}

/* --- Vertical Rotated Navigation --- */
#vertical-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--nav-width);
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--raw-concrete);
    border-right: 2px solid var(--rebar-grey);
}

.nav-item {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--bleached-formwork);
    text-decoration: none;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: 20px 0;
    padding: 4px 0;
    position: relative;
    transition: none;
}

.nav-item:hover {
    color: var(--signal-orange);
}

.nav-item:hover::after {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--signal-orange);
}

.nav-item.active {
    color: var(--signal-orange);
}

.nav-indicator {
    position: absolute;
    left: 0;
    width: 4px;
    height: 30px;
    background-color: var(--signal-orange);
    transition: top 300ms linear;
    z-index: 1001;
}

/* --- Hero Section --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--raw-concrete);
    z-index: 10;
    padding-left: var(--nav-width);
}

.hero-content {
    text-align: left;
    padding-left: 8vw;
    width: 100%;
}

#hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 10rem);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--bleached-formwork);
    line-height: 1;
    margin-bottom: 0;
}

.hero-letter {
    display: inline-block;
    opacity: 0;
}

#hero-line {
    width: 0;
    height: 4px;
    background-color: var(--signal-orange);
    margin-top: 16px;
    margin-bottom: 12px;
    transform-origin: left;
}

#hero-suffix {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2rem, 6vw, 5rem);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--rebar-grey);
    opacity: 0;
    display: block;
}

/* --- Main Content --- */
#main-content {
    position: relative;
    z-index: 5;
    padding-left: var(--nav-width);
    opacity: 0;
}

/* --- Content Slab (Base) --- */
.content-slab {
    position: relative;
    padding: 80px 0;
    opacity: 0;
    transition: opacity 300ms linear;
}

.content-slab.slab-visible {
    opacity: 1;
}

/* --- Slab Grid (16-column system) --- */
.slab-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 0;
    padding: 0 4vw;
    position: relative;
}

/* --- Slab Labels (Stencil style) --- */
.slab-label {
    grid-column: 1 / 5;
    grid-row: 1;
    margin-bottom: 24px;
}

.slab-label--fullbleed {
    position: absolute;
    top: 0;
    left: 4vw;
    z-index: 20;
    padding-top: 16px;
}

.label-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(0.65rem, 1vw, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--signal-orange);
}

/* --- Slab Text Blocks --- */
.slab-text--left {
    grid-column: 1 / 7;
    grid-row: 2;
    padding-right: 2vw;
}

.slab-text--wide {
    grid-column: 1 / 10;
    padding: 48px 4vw 0;
}

.slab-text--right-anchor {
    grid-column: 8 / 16;
    grid-row: 2;
    padding-left: 2vw;
}

/* --- Section Headings --- */
.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--bleached-formwork);
    line-height: 1.1;
    margin-bottom: 32px;
}

.section-heading--dark {
    color: var(--formwork-black);
}

/* --- Body Text --- */
.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.65;
    color: var(--wet-cement);
    max-width: 54ch;
    margin-bottom: 24px;
}

.body-text--dark {
    color: var(--formwork-black);
}

/* --- Photo Containers --- */
.slab-photo--right {
    grid-column: 8 / 17;
    grid-row: 2;
}

.photo-container {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--rebar-grey);
    background-color: var(--shuttered-grey);
    transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}

.photo-container:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--signal-orange);
}

.photo-placeholder {
    display: block;
    width: 100%;
    height: auto;
    filter: grayscale(100%) contrast(1.25) brightness(0.95);
}

.photo-placeholder--fullbleed {
    width: 100%;
    height: 60vh;
    object-fit: cover;
}

.photo-container:hover .photo-placeholder {
    filter: grayscale(80%) contrast(1.3);
}

/* --- Photo Grain Overlay --- */
.photo-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    mix-blend-mode: screen;
}

/* --- Corner Markers (Survey L-shapes) --- */
.corner-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    z-index: 15;
}

.corner-marker--tl {
    top: 6px;
    left: 6px;
    border-top: 2px solid var(--signal-orange);
    border-left: 2px solid var(--signal-orange);
}

.corner-marker--tr {
    top: 6px;
    right: 6px;
    border-top: 2px solid var(--signal-orange);
    border-right: 2px solid var(--signal-orange);
}

.corner-marker--bl {
    bottom: 6px;
    left: 6px;
    border-bottom: 2px solid var(--signal-orange);
    border-left: 2px solid var(--signal-orange);
}

.corner-marker--br {
    bottom: 6px;
    right: 6px;
    border-bottom: 2px solid var(--signal-orange);
    border-right: 2px solid var(--signal-orange);
}

/* --- Full Bleed Photo --- */
.full-bleed-photo {
    width: 100vw;
    height: 60vh;
    margin-left: calc(-1 * var(--nav-width));
    position: relative;
    overflow: hidden;
    border: none;
    border-top: 2px solid var(--rebar-grey);
    border-bottom: 2px solid var(--rebar-grey);
}

.full-bleed-photo .photo-placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slab-grid--below-photo {
    padding-top: 48px;
}

/* --- Asymmetric Pair --- */
.asymmetric-pair {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 4px;
    padding: 48px 4vw 0;
    margin-bottom: 80px;
}

.pair-photo {
    overflow: hidden;
}

.pair-photo .photo-placeholder {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

/* --- Inset with Caption --- */
.inset-with-caption {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 0;
    padding: 0 4vw;
    align-items: start;
}

.inset-photo {
    grid-column: 1 / 9;
}

.inset-photo .photo-placeholder {
    width: 100%;
    height: auto;
}

.inset-rule {
    grid-column: 9 / 12;
    display: flex;
    justify-content: center;
    align-self: stretch;
}

.inset-rule::after {
    content: '';
    display: block;
    width: 1px;
    height: 100%;
    background-color: var(--rebar-grey);
}

.inset-caption {
    grid-column: 12 / 17;
    padding-top: 8px;
}

.caption-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(0.65rem, 1vw, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--signal-orange);
    display: block;
    margin-bottom: 16px;
}

.caption-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 1.4vw, 0.95rem);
    line-height: 1.65;
    color: var(--wet-cement);
    max-width: 32ch;
}

/* --- Cantilever Block --- */
.slab-cantilever .cantilever-block {
    grid-column: 1 / 13;
    grid-row: 2;
    position: relative;
    left: -4vw;
    padding: 48px 4vw 48px 8vw;
    background-color: var(--shuttered-grey);
    border: 2px solid var(--rebar-grey);
}

/* --- Pull Quote --- */
.pull-quote {
    position: relative;
    padding-left: 56px;
    margin: 40px 0;
}

.pull-quote-slash {
    position: absolute;
    left: 0;
    top: 4px;
    width: 40px;
    height: 40px;
    display: block;
}

.pull-quote-slash::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    width: 2px;
    height: 56px;
    background-color: var(--signal-orange);
    transform: rotate(45deg);
    transform-origin: top center;
}

.pull-quote-text {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    line-height: 1.5;
    color: var(--bleached-formwork);
    max-width: 60ch;
}

/* --- Light Slab (Exposed Aggregate) --- */
.slab-light {
    background-color: var(--exposed-aggregate);
}

.slab-light .slab-grid {
    padding-top: 0;
    padding-bottom: 0;
}

/* --- Formwork Rule (Full-width horizontal line) --- */
.formwork-rule {
    width: 100vw;
    height: 4px;
    background-color: var(--formwork-black);
    margin-left: calc(-1 * var(--nav-width));
    position: relative;
    z-index: 5;
}

/* --- Expansion Joint --- */
.expansion-joint {
    width: 100vw;
    height: 4px;
    background-color: rgba(232, 85, 42, 0.3);
    margin-left: calc(-1 * var(--nav-width));
    margin-top: 60px;
    margin-bottom: 60px;
    position: relative;
    z-index: 5;
}

/* --- Chevron Divider --- */
.chevron-divider {
    width: 100%;
    overflow: hidden;
    padding: 20px 4vw;
    display: flex;
    flex-wrap: wrap;
}

.chevron-pattern {
    width: 80px;
    height: 20px;
    flex-shrink: 0;
}

/* --- Footer --- */
#footer {
    background-color: var(--void-concrete);
    padding: 60px 4vw 60px calc(var(--nav-width) + 4vw);
    position: relative;
    z-index: 5;
}

.footer-domain {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--rebar-grey);
    display: block;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-rule {
    border: none;
    height: 1px;
    background-color: var(--rebar-grey);
    margin-bottom: 24px;
    opacity: 0.4;
}

.footer-copyright {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--rebar-grey);
    display: block;
}

/* --- Slab Border Treatment --- */
.content-slab:not(.slab-light)::before {
    content: '';
    position: absolute;
    top: 0;
    left: calc(var(--nav-width) * -1);
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
}

/* --- Section Spacing --- */
.content-slab + .formwork-rule {
    margin-top: 0;
}

/* --- Links --- */
a {
    color: var(--signal-orange);
    text-decoration: none;
    transition: none;
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* --- Selection --- */
::selection {
    background-color: var(--signal-orange);
    color: var(--bleached-formwork);
}

/* --- Responsive Adjustments --- */
@media (max-width: 1024px) {
    :root {
        --nav-width: 48px;
    }

    .slab-text--left {
        grid-column: 1 / 8;
    }

    .slab-photo--right {
        grid-column: 9 / 17;
    }

    .slab-text--right-anchor {
        grid-column: 6 / 16;
    }

    .slab-cantilever .cantilever-block {
        grid-column: 1 / 15;
    }
}

@media (max-width: 768px) {
    :root {
        --nav-width: 40px;
    }

    .nav-item {
        font-size: 0.6rem;
        margin: 14px 0;
    }

    .slab-grid {
        display: block;
        padding: 0 5vw;
    }

    .slab-text--left,
    .slab-text--wide,
    .slab-text--right-anchor,
    .slab-photo--right {
        grid-column: auto;
        padding: 0;
        margin-bottom: 32px;
    }

    .slab-cantilever .cantilever-block {
        left: 0;
        padding: 32px 5vw;
    }

    .asymmetric-pair {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .pair-photo .photo-placeholder {
        height: 250px;
    }

    .inset-with-caption {
        display: block;
        padding: 0 5vw;
    }

    .inset-rule {
        display: none;
    }

    .inset-caption {
        padding-top: 24px;
    }

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

    .full-bleed-photo {
        height: 40vh;
    }

    .hero-content {
        padding-left: 5vw;
    }

    .pull-quote {
        padding-left: 40px;
    }
}

@media (max-width: 480px) {
    :root {
        --nav-width: 0px;
    }

    #vertical-nav {
        display: none;
    }

    .full-bleed-photo {
        margin-left: 0;
    }

    .formwork-rule,
    .expansion-joint {
        margin-left: 0;
    }

    #footer {
        padding-left: 5vw;
    }
}
