/* ==========================================================================
   a6c.dev — Terracotta Warm / Muji / Marble / Parallax-Sections
   ========================================================================== */

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

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

body {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.75;
    color: #3B2F2F;
    background: #F5F0EB;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Marble Background Layer (fixed, cached) --- */
#marble-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 30%, #F5F0EB 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, #DDD5CA 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, #EDE4D8 0%, transparent 70%),
        #F5F0EB;
    background-blend-mode: soft-light;
}

#marble-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.5;
    mix-blend-mode: soft-light;
}

/* --- Wordmark --- */
#wordmark {
    position: fixed;
    top: 32px;
    left: 40px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #3B2F2F;
    z-index: 100;
    letter-spacing: 0.05em;
    opacity: 0;
    animation: wordmarkFadeIn 600ms 200ms ease-out forwards;
}

@keyframes wordmarkFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Navigation Dots --- */
#section-nav {
    position: fixed;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.nav-dot {
    width: 12px;
    height: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-dot span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 40% 40%, #EDE4D8, #DDD5CA);
    border: 1px solid #A0522D;
    transition:
        width 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
        height 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
        border-radius 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
        background 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-dot.active span {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: #C1440E;
    border-color: #C1440E;
}

/* --- Parallax Container --- */
#parallax-container {
    position: relative;
    z-index: 1;
}

/* --- District (Section) --- */
.district {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 80px;
}

/* District background — rotated marble layer for variation */
.district-bg {
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(245, 240, 235, 0.6) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(221, 213, 202, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(237, 228, 216, 0.3) 0%, transparent 60%);
    background-blend-mode: soft-light;
    opacity: 0.4;
    will-change: transform;
}

/* --- District Content (8-col grid, asymmetric) --- */
.district-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 40px;
    align-items: start;
}

/* Content left alignment (uses columns 1-6) */
.district-content.content-left .display-title {
    grid-column: 1 / 5;
}

.district-content.content-left .body-text {
    grid-column: 1 / 5;
}

.district-content.content-left .marble-image-container {
    grid-column: 5 / 8;
    grid-row: 1 / 3;
    align-self: center;
}

/* Content right alignment (uses columns 3-8) */
.district-content.content-right .display-title {
    grid-column: 4 / 8;
}

.district-content.content-right .body-text {
    grid-column: 4 / 8;
}

.district-content.content-right .marble-image-container {
    grid-column: 1 / 4;
    grid-row: 1 / 3;
    align-self: center;
}

/* Hero content — centered */
#district-0 .district-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    max-width: 800px;
    padding-left: 80px;
}

/* --- Typography --- */
.display-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(48px, 6vw, 80px);
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: #C1440E;
    margin-bottom: 24px;
}

.section-title {
    color: #C1440E;
}

.body-text {
    max-width: 520px;
    color: #3B2F2F;
    margin-bottom: 32px;
}

.body-text p {
    margin-bottom: 16px;
}

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

/* --- Hero Title Morph Letters --- */
.hero-title-wrap {
    margin-bottom: 40px;
}

.morph-letter {
    display: inline-block;
    color: #F5F0EB;
    transform: translateY(4px);
    transition: color 300ms ease-out, transform 300ms ease-out;
}

.morph-letter.space {
    width: 0.3em;
}

.morph-letter.revealed {
    color: #C1440E;
    transform: translateY(0);
}

/* Hero title compression on scroll-out */
.display-title.compressed {
    transform: scaleX(0.6);
    color: #DDD5CA;
    transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1), color 600ms ease-out;
}

/* --- Crosswalk Divider (hero) --- */
#crosswalk-divider {
    width: 100%;
    max-width: 400px;
    margin-top: 16px;
    opacity: 0;
}

#crosswalk-divider.drawn {
    opacity: 1;
}

#crosswalk-line {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 800ms ease-out;
}

#crosswalk-divider.drawn #crosswalk-line {
    stroke-dashoffset: 0;
}

/* --- Hero Body --- */
.hero-body {
    max-width: 520px;
    margin-top: 24px;
}

/* --- Fade Paragraph Animation --- */
.fade-paragraph p {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.fade-paragraph p.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Marble Image Containers --- */
.marble-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    transition: border-radius 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.marble-image-container:hover {
    border-radius: 24px 8px 24px 8px;
}

.marble-image-inner {
    width: 100%;
    height: auto;
}

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

/* --- Skyline SVGs --- */
.skyline-svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 600ms ease-out;
    will-change: transform;
}

.skyline-svg.visible {
    opacity: 1;
}

.skyline-path {
    fill: none;
    stroke: #A0522D;
    stroke-width: 1.5;
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 1000ms ease-out;
}

.skyline-svg.visible .skyline-path {
    stroke-dashoffset: 0;
}

/* --- Crack Dividers --- */
.crack-divider {
    position: relative;
    z-index: 3;
    height: 12px;
    overflow: visible;
    margin: -6px 0;
}

.crack-divider svg {
    width: 100%;
    height: 12px;
    display: block;
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.crack-divider.widened svg {
    transform: scaleY(2.5);
}

/* --- Annotations (Caveat handwritten) --- */
.annotation {
    position: absolute;
    z-index: 5;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
    max-width: 200px;
}

.annotation.visible {
    opacity: 1;
    transform: translateY(0);
}

.annotation-right {
    right: 100px;
    top: 30%;
}

.annotation-left {
    left: 60px;
    bottom: 25%;
}

.annotation-text {
    font-family: 'Caveat', cursive;
    font-size: 20px;
    font-weight: 400;
    color: #C1440E;
    display: block;
    transform: rotate(-2deg);
    line-height: 1.4;
}

.annotation-icon {
    margin-top: 8px;
    display: block;
}

/* --- Window Grid Decoration --- */
.window-grid {
    position: absolute;
    z-index: 1;
    opacity: 0.5;
    pointer-events: none;
}

#window-grid-1 {
    right: 60px;
    top: 15%;
}

#window-grid-2 {
    left: 50px;
    top: 20%;
}

/* --- Street Lamp --- */
.street-lamp {
    position: absolute;
    z-index: 1;
    opacity: 0.5;
    pointer-events: none;
}

#lamp-1 {
    left: 50px;
    bottom: 10%;
}

#lamp-2 {
    right: 80px;
    bottom: 15%;
}

/* --- Fire Escape --- */
.fire-escape {
    position: absolute;
    right: 50px;
    top: 15%;
    z-index: 1;
    opacity: 0.5;
    pointer-events: none;
}

/* --- Crosswalk Stripes Decoration --- */
.crosswalk-stripes {
    position: absolute;
    bottom: 40px;
    left: 80px;
    display: flex;
    gap: 12px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.3;
}

.crosswalk-stripes .stripe {
    width: 40px;
    height: 6px;
    background: #A0522D;
    border-radius: 1px;
}

/* --- Footer --- */
.district-footer {
    position: absolute;
    bottom: 40px;
    left: 80px;
    right: 80px;
    text-align: center;
}

.crosswalk-divider-bottom {
    max-width: 300px;
    margin: 0 auto 16px;
    opacity: 0.5;
}

.crosswalk-divider-bottom svg {
    width: 100%;
    height: 8px;
    display: block;
}

.footer-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #A0522D;
    letter-spacing: 0.1em;
    opacity: 0.6;
}

/* --- Scroll-triggered section title compression --- */
.section-title {
    transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1), color 600ms ease-out;
    transform-origin: left center;
}

.section-title.compressed {
    transform: scaleX(0.6);
    color: #DDD5CA;
}

/* --- Utility: Link underlines in sage --- */
a {
    color: #3B2F2F;
    text-decoration: underline;
    text-decoration-color: #8A9A7B;
    text-underline-offset: 3px;
    transition: text-decoration-color 200ms ease;
}

a:hover {
    text-decoration-color: #C1440E;
}

/* --- Dusty Rose Hover Accent (#D4886C) --- */
.nav-dot:hover span {
    background: #D4886C;
    border-color: #D4886C;
}

.marble-image-container:hover {
    box-shadow: 0 2px 12px rgba(212, 136, 108, 0.15);
}

.annotation-text:hover {
    color: #D4886C;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .district {
        padding: 60px 40px;
    }

    .district-content {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }

    .district-content.content-left .display-title,
    .district-content.content-left .body-text,
    .district-content.content-right .display-title,
    .district-content.content-right .body-text {
        grid-column: 1 / -1;
    }

    .district-content.content-left .marble-image-container,
    .district-content.content-right .marble-image-container {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    #district-0 .district-content {
        padding-left: 0;
    }

    .annotation-right {
        right: 20px;
    }

    .annotation-left {
        left: 20px;
    }

    .window-grid,
    .fire-escape {
        display: none;
    }
}

@media (max-width: 640px) {
    .district {
        padding: 40px 20px;
    }

    .display-title {
        font-size: clamp(36px, 8vw, 56px);
    }

    #wordmark {
        top: 20px;
        left: 20px;
    }

    #section-nav {
        right: 12px;
    }

    .district-footer {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }

    .street-lamp {
        display: none;
    }

    .crosswalk-stripes {
        left: 20px;
    }
}
