/* MMIDDL.com - Mid-Century Modern Editorial Design */
/* Palette: #2c2418, #1e1a14, #9b9285, #d4a574, #f5efe6, #d4632a, #1a6b5a, #e8b83d */
/* Fonts: DM Serif Display, Source Sans 3, Inconsolata */

/* ===========================
   CSS Custom Properties
   =========================== */
:root {
    --parchment: #f5efe6;
    --camel: #d4a574;
    --walnut: #2c2418;
    --orange: #d4632a;
    --teal: #1a6b5a;
    --mustard: #e8b83d;
    --espresso: #1e1a14;
    --gray: #9b9285;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--parchment);
    color: var(--walnut);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ===========================
   Navigation
   =========================== */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 3rem;
    transition: padding 0.4s ease-out, background-color 0.4s ease-out, border-color 0.4s ease-out;
    border-bottom: 1px solid transparent;
}

.nav-bar.scrolled {
    padding: 0.75rem 3rem;
    background-color: rgba(245, 239, 230, 0.95);
    border-bottom-color: rgba(155, 146, 133, 0.3);
}

.nav-logo {
    font-family: 'DM Serif Display', serif;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    color: var(--walnut);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--walnut);
    transition: color 0.2s ease-out, transform 0.2s ease-out;
}

.nav-link:hover {
    color: var(--mustard);
    transform: translateY(-2px);
}

/* ===========================
   Chapter Sections (Base)
   =========================== */
.chapter {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8rem 3rem;
    position: relative;
    overflow: hidden;
}

.chapter-inner {
    max-width: 1000px;
    width: 100%;
    position: relative;
    z-index: 2;
}

/* ===========================
   Pin-Dot Texture Background
   =========================== */
.pin-dot-overlay {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--gray) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

/* ===========================
   Drafting Lines Background
   =========================== */
.drafting-lines-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.drafting-bg-svg {
    width: 100%;
    height: 100%;
}

/* ===========================
   Hero / Opening Section
   =========================== */
.chapter-opening {
    background-color: var(--parchment);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
}

.hero-diagonal-upper {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(60px, 12vw, 120px);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--walnut);
    transform: rotate(-6deg);
    transform-origin: center center;
    opacity: 0;
}

.hero-title.typed {
    opacity: 1;
}

.hero-diagonal-lower {
    position: absolute;
    bottom: 15%;
    right: 10%;
    z-index: 1;
}

.wire-mesh-hero {
    width: 240px;
    height: 240px;
    animation: slow-rotate-3d 30s linear infinite;
}

@keyframes slow-rotate-3d {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

.hero-drafting-line-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2rem;
    z-index: 2;
    position: relative;
}

.drafting-line-svg {
    width: 300px;
    height: 20px;
}

.drafting-line-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: draw-line 1.2s ease-out 1.2s forwards;
}

@keyframes draw-line {
    to { stroke-dashoffset: 0; }
}

.starburst-endpoint {
    width: 24px;
    height: 24px;
    opacity: 0;
    transform: scale(0);
    animation: starburst-appear 0.4s ease-out 2.4s forwards;
}

@keyframes starburst-appear {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===========================
   Starburst Motif
   =========================== */
.starburst {
    transition: transform 0.3s ease-out;
}

.starburst:hover {
    transform: scale(1.05);
}

@keyframes starburst-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.starburst-in-view {
    animation: starburst-pulse 3s ease-in-out infinite;
}

/* ===========================
   Section Dividers
   =========================== */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 3rem;
    background-color: var(--parchment);
}

.divider-line {
    display: block;
    width: 80px;
    height: 1px;
    background-color: var(--gray);
    opacity: 0.3;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.8s ease-out;
}

.divider-line-visible {
    transform: scaleX(1);
}

.starburst-divider-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* ===========================
   Chapter Number (Large Outlined)
   =========================== */
.chapter-number-large {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    overflow: visible;
    z-index: 1;
    pointer-events: none;
}

.chapter-num-svg {
    width: 280px;
    height: 200px;
    overflow: visible;
}

.chapter-num-text {
    font-family: 'DM Serif Display', serif;
    font-size: 200px;
    font-weight: 400;
    fill: none;
    stroke: var(--camel);
    stroke-width: 1;
    opacity: 0.25;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 1.5s ease-out;
}

.chapter-num-text.drawn {
    stroke-dashoffset: 0;
}

.chapter-num-light {
    stroke: var(--parchment);
    opacity: 0.15;
}

/* ===========================
   Editorial Grid Layout
   =========================== */
.editorial-grid {
    position: relative;
    padding-left: 120px;
}

.spread-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

.spread-text {
    max-width: 480px;
}

.spread-decorative {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===========================
   Section Labels and Titles
   =========================== */
.section-label {
    font-family: 'Inconsolata', monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--gray);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.75rem;
}

.section-label-light {
    color: var(--camel);
}

.section-title {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--walnut);
    margin-bottom: 1.5rem;
}

.section-body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.7;
    color: var(--walnut);
    margin-bottom: 1rem;
}

.text-parchment {
    color: var(--parchment);
}

.text-muted-light {
    color: rgba(245, 239, 230, 0.7);
}

/* ===========================
   Stagger Reveal Animation
   =========================== */
.stagger-group {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.stagger-group.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* ===========================
   Wire-Frame Geometry
   =========================== */
.wire-icosahedron {
    width: 180px;
    height: 180px;
    opacity: 0.5;
    animation: wire-rotate 20s linear infinite;
}

@keyframes wire-rotate {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

/* ===========================
   Light Section Variant
   =========================== */
.chapter-light {
    background-color: var(--parchment);
}

/* ===========================
   Dark Section Variant (Chapter Two)
   =========================== */
.chapter-dark {
    background-color: var(--espresso);
}

/* ===========================
   Teal Section Variant (Collection)
   =========================== */
.chapter-teal {
    background-color: var(--teal);
}

/* ===========================
   Kidney / Boomerang Shapes
   =========================== */
.kidney-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.kidney-shape {
    width: 200px;
    height: 120px;
    background-color: var(--orange);
    clip-path: ellipse(50% 45% at 50% 50%);
    border-radius: 60% 40% 50% 50%;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease-out 0.3s, transform 0.6s ease-out 0.3s;
}

.kidney-shape.slid-in {
    opacity: 1;
    transform: translateX(0);
}

.boomerang-float {
    position: absolute;
    width: 120px;
    height: 60px;
    border-radius: 50% 50% 0 50%;
    opacity: 0.08;
    pointer-events: none;
}

.boomerang-1 {
    top: 20%;
    right: 5%;
    background-color: var(--camel);
    transform: rotate(-30deg);
    animation: drift-slow 15s ease-in-out infinite alternate;
}

.boomerang-2 {
    bottom: 15%;
    left: 8%;
    background-color: var(--mustard);
    transform: rotate(20deg);
    animation: drift-slow 18s ease-in-out 2s infinite alternate;
}

@keyframes drift-slow {
    from { transform: translate(0, 0) rotate(-30deg); }
    to { transform: translate(20px, -15px) rotate(-25deg); }
}

/* ===========================
   Magazine Spread / Pull-Quote
   =========================== */
.magazine-spread {
    grid-template-columns: 1.2fr 1fr;
    gap: 48px;
    align-items: start;
}

.pull-quote-block {
    position: relative;
    padding: 3rem 2rem;
}

.pull-quote-mark {
    font-family: 'DM Serif Display', serif;
    font-size: 120px;
    line-height: 1;
    color: var(--teal);
    position: absolute;
    opacity: 0.3;
    transform: scale(0.8);
    transition: transform 0.6s ease-out;
}

.pull-quote-mark.scaled {
    transform: scale(1);
}

.pull-quote-open {
    top: -20px;
    left: -10px;
}

.pull-quote-close {
    bottom: 0;
    right: 0;
}

.pull-quote-text {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--walnut);
    position: relative;
    z-index: 2;
}

.pull-quote-cite {
    display: block;
    margin-top: 1.5rem;
    font-family: 'Inconsolata', monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--gray);
    font-style: normal;
}

/* ===========================
   Principles List
   =========================== */
.spread-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.principle-item {
    padding: 1.5rem;
    border-left: 2px solid var(--camel);
    transition: border-color 0.2s ease-out;
}

.principle-item:hover {
    border-color: var(--mustard);
}

.principle-num {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    color: var(--orange);
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.principle-name {
    font-family: 'DM Serif Display', serif;
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--walnut);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.principle-desc {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--gray);
}

/* ===========================
   Collection Objects
   =========================== */
.object-row {
    display: flex;
    gap: 3rem;
    justify-content: center;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.object-card {
    text-align: center;
    transition: transform 0.2s ease-out;
    cursor: default;
}

.object-card:hover {
    transform: translateY(-2px);
}

.object-silhouette {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(245, 239, 230, 0.2);
    border-radius: 50%;
    transition: border-color 0.3s ease-out;
}

.object-card:hover .object-silhouette {
    border-color: var(--mustard);
}

.object-icon {
    width: 60px;
    height: 60px;
}

.object-label {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--parchment);
    display: block;
    margin-bottom: 0.25rem;
}

.object-year {
    font-family: 'Inconsolata', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: rgba(245, 239, 230, 0.4);
}

/* ===========================
   Colophon (Footer)
   =========================== */
.chapter-colophon {
    background-color: var(--espresso);
    min-height: 60vh;
    text-align: center;
}

.colophon-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 480px;
    margin: 0 auto;
}

.starburst-colophon {
    width: 36px;
    height: 36px;
    margin-bottom: 2rem;
}

.colophon-title {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(40px, 8vw, 64px);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--mustard);
    margin-bottom: 1rem;
}

.colophon-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--gray);
    margin-bottom: 2rem;
}

.colophon-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.colophon-credit,
.colophon-year {
    font-family: 'Inconsolata', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--gray);
    text-transform: uppercase;
}

.colophon-divider {
    color: var(--gray);
    opacity: 0.4;
}

.printers-mark {
    width: 40px;
    height: 40px;
    opacity: 0.4;
}

/* ===========================
   Background Color Transition
   =========================== */
@keyframes morph-to-dark {
    from { background-color: var(--parchment); }
    to { background-color: var(--espresso); }
}

@keyframes morph-to-light {
    from { background-color: var(--espresso); }
    to { background-color: var(--parchment); }
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
    .chapter {
        padding: 6rem 1.5rem;
    }

    .editorial-grid {
        padding-left: 0;
    }

    .chapter-number-large {
        position: relative;
        left: 0;
        top: 0;
        transform: none;
        margin-bottom: 1rem;
    }

    .chapter-num-svg {
        width: 160px;
        height: 120px;
    }

    .chapter-num-text {
        font-size: 120px;
    }

    .spread-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .magazine-spread {
        grid-template-columns: 1fr;
    }

    .nav-bar {
        padding: 1rem 1.5rem;
    }

    .nav-bar.scrolled {
        padding: 0.5rem 1.5rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .hero-diagonal-lower {
        right: 5%;
        bottom: 10%;
    }

    .wire-mesh-hero {
        width: 160px;
        height: 160px;
    }

    .pull-quote-mark {
        font-size: 80px;
    }

    .object-row {
        gap: 2rem;
    }

    .section-divider {
        padding: 0.5rem 1.5rem;
    }
}
