/* ============================================================
   namu.style - Mid-Century Magazine Spread Design
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --teak-warm: #E8D8C0;
    --walnut-dark: #3A2A18;
    --leaf-sage: #7A9868;
    --burnt-sienna: #C87848;
    --cream-paper: #FAF5E8;
    --olive-muted: #6A7A48;
    --charcoal: #2A2A28;

    --font-primary: 'Space Grotesk', sans-serif;

    --heading-size: clamp(32px, 4vw, 64px);
    --body-size: clamp(14px, 1vw, 16px);
    --caption-size: clamp(16px, 1.5vw, 22px);
    --meta-size: 11px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--cream-paper);
    color: var(--walnut-dark);
    overflow-x: hidden;
    counter-reset: page-counter;
}

/* --- Spread Layout (Magazine Two-Page Spread) --- */
.spread {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.cover-spread {
    height: 100vh;
}

/* --- Gutter --- */
.gutter {
    width: 1px;
    background: var(--walnut-dark);
    position: relative;
    z-index: 2;
}

.gutter-dark {
    background: var(--teak-warm);
    opacity: 0.3;
}

#cover-gutter {
    height: 0;
    transition: height 600ms ease-out;
    align-self: start;
}

#cover-gutter.animate {
    height: 100%;
}

/* --- Page --- */
.page {
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.page-left {
    background-color: var(--teak-warm);
}

.page-right {
    background-color: var(--cream-paper);
}

.page-content {
    position: relative;
    z-index: 1;
}

/* --- Cover Spread Specifics --- */
.cover-spread .page-left {
    background-color: var(--teak-warm);
}

.cover-spread .page-right {
    background-color: var(--cream-paper);
}

.site-title {
    font-family: var(--font-primary);
    font-size: clamp(48px, 6vw, 96px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--walnut-dark);
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.site-title.animate {
    opacity: 1;
    transform: translateY(0);
}

.title-dot {
    color: var(--burnt-sienna);
}

.site-subtitle {
    font-family: var(--font-primary);
    font-size: var(--caption-size);
    font-weight: 500;
    font-style: italic;
    color: var(--walnut-dark);
    margin-bottom: 16px;
    opacity: 0;
    transition: opacity 500ms ease 500ms;
}

.site-subtitle.animate {
    opacity: 1;
}

.site-tagline {
    font-family: var(--font-primary);
    font-size: var(--body-size);
    font-weight: 400;
    line-height: 1.75;
    color: var(--walnut-dark);
    opacity: 0.8;
    opacity: 0;
    transition: opacity 500ms ease 600ms;
}

.site-tagline.animate {
    opacity: 0.8;
}

/* --- Page Numbers --- */
.page-number {
    position: absolute;
    bottom: 24px;
    font-family: var(--font-primary);
    font-size: var(--meta-size);
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--walnut-dark);
    opacity: 0;
    transition: opacity 400ms ease, text-decoration 200ms ease;
}

.page-number.animate {
    opacity: 0.6;
}

.page-left .page-number {
    left: 48px;
}

.page-right .page-number {
    right: 48px;
}

.page-number:hover {
    text-decoration: underline;
}

.page-number.light {
    color: var(--cream-paper);
}

/* --- Illustrations --- */
.illustration-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.interior-illustration {
    width: 100%;
    max-width: 600px;
    height: auto;
}

.interior-illustration.small {
    max-width: 500px;
}

/* SVG draw animation */
.interior-illustration line,
.interior-illustration rect,
.interior-illustration circle,
.interior-illustration path,
.interior-illustration ellipse {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1200ms ease-out;
}

.interior-illustration.animate line,
.interior-illustration.animate rect,
.interior-illustration.animate circle,
.interior-illustration.animate path,
.interior-illustration.animate ellipse {
    stroke-dashoffset: 0;
}

/* Detail group (hidden, revealed on hover) */
.detail-group line {
    opacity: 0;
    transition: opacity 400ms ease;
}

.interior-illustration:hover .detail-group line {
    opacity: 0.3;
}

/* --- Pattern Strips --- */
.pattern-strip {
    height: 70px;
    width: 95%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    transition: width 400ms ease, opacity 300ms ease;
}

.pattern-strip.in-view {
    width: 100%;
}

/* Leaf pattern 1 - alternating diagonal leaves */
.pattern-strip-leaves {
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            var(--leaf-sage) 10px,
            var(--leaf-sage) 12px,
            transparent 12px,
            transparent 22px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 10px,
            var(--olive-muted) 10px,
            var(--olive-muted) 12px,
            transparent 12px,
            transparent 22px
        );
    background-color: var(--teak-warm);
}

/* Pattern 2 - radial arrangement */
.pattern-strip-radial {
    background:
        radial-gradient(circle at 20% 50%, var(--leaf-sage) 3px, transparent 3px),
        radial-gradient(circle at 40% 30%, var(--olive-muted) 4px, transparent 4px),
        radial-gradient(circle at 60% 70%, var(--leaf-sage) 3px, transparent 3px),
        radial-gradient(circle at 80% 40%, var(--olive-muted) 4px, transparent 4px),
        radial-gradient(circle at 10% 80%, var(--leaf-sage) 2px, transparent 2px),
        radial-gradient(circle at 50% 20%, var(--olive-muted) 3px, transparent 3px),
        radial-gradient(circle at 90% 60%, var(--leaf-sage) 3px, transparent 3px);
    background-size: 120px 70px;
    background-color: var(--cream-paper);
    border-top: 1px solid var(--walnut-dark);
    border-bottom: 1px solid var(--walnut-dark);
}

/* Pattern 3 - flowing vine */
.pattern-strip-vine {
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 8px,
            var(--leaf-sage) 8px,
            var(--leaf-sage) 10px,
            transparent 10px,
            transparent 30px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 14px,
            var(--olive-muted) 14px,
            var(--olive-muted) 16px,
            transparent 16px,
            transparent 34px
        );
    background-color: var(--teak-warm);
}

/* Pattern 4 - alternate leaf */
.pattern-strip-leaves-alt {
    background:
        repeating-linear-gradient(
            60deg,
            transparent,
            transparent 8px,
            var(--olive-muted) 8px,
            var(--olive-muted) 10px,
            transparent 10px,
            transparent 20px
        ),
        repeating-linear-gradient(
            -30deg,
            transparent,
            transparent 12px,
            var(--leaf-sage) 12px,
            var(--leaf-sage) 14px,
            transparent 14px,
            transparent 26px
        );
    background-color: var(--cream-paper);
    border-top: 1px solid var(--walnut-dark);
    border-bottom: 1px solid var(--walnut-dark);
}

/* Pattern 5 - alternate radial */
.pattern-strip-radial-alt {
    background:
        radial-gradient(ellipse at 15% 50%, var(--olive-muted) 4px, transparent 4px),
        radial-gradient(ellipse at 35% 25%, var(--leaf-sage) 3px, transparent 3px),
        radial-gradient(ellipse at 55% 75%, var(--olive-muted) 4px, transparent 4px),
        radial-gradient(ellipse at 75% 50%, var(--leaf-sage) 3px, transparent 3px),
        radial-gradient(ellipse at 95% 30%, var(--olive-muted) 3px, transparent 3px),
        radial-gradient(ellipse at 5% 70%, var(--leaf-sage) 2px, transparent 2px),
        radial-gradient(ellipse at 45% 45%, var(--olive-muted) 5px, transparent 5px),
        radial-gradient(ellipse at 65% 15%, var(--leaf-sage) 3px, transparent 3px),
        radial-gradient(ellipse at 85% 85%, var(--olive-muted) 3px, transparent 3px);
    background-size: 100px 70px;
    background-color: var(--teak-warm);
}

.pattern-strip:hover {
    background-size: 80px 70px;
}

.pattern-strip-leaves:hover,
.pattern-strip-vine:hover,
.pattern-strip-leaves-alt:hover {
    background-size: auto;
}

/* --- Typography --- */
.spread-title {
    font-family: var(--font-primary);
    font-size: var(--heading-size);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--walnut-dark);
    margin-bottom: 32px;
}

.body-text {
    font-family: var(--font-primary);
    font-size: var(--body-size);
    font-weight: 400;
    line-height: 1.75;
    color: var(--walnut-dark);
    margin-bottom: 16px;
}

.caption-text {
    font-family: var(--font-primary);
    font-size: var(--caption-size);
    font-weight: 500;
    font-style: italic;
    line-height: 1.5;
    color: var(--walnut-dark);
    margin-top: 16px;
}

.pull-quote {
    font-family: var(--font-primary);
    font-size: var(--caption-size);
    font-weight: 500;
    font-style: italic;
    line-height: 1.5;
    color: var(--walnut-dark);
}

.pull-quote.light {
    color: var(--cream-paper);
}

.metadata-text {
    font-family: var(--font-primary);
    font-size: var(--meta-size);
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--walnut-dark);
    margin-bottom: 8px;
}

.metadata-text.light {
    color: var(--cream-paper);
    opacity: 0.7;
}

.large-number {
    font-family: var(--font-primary);
    font-size: clamp(80px, 12vw, 180px);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--walnut-dark);
    opacity: 0.12;
    display: block;
    margin-bottom: 24px;
}

.large-number.light {
    color: var(--cream-paper);
    opacity: 0.12;
}

/* --- Color Blocks --- */
.color-block-sage {
    background-color: var(--leaf-sage);
}

.color-block-sage .pull-quote {
    color: var(--cream-paper);
}

.color-block-sage .large-number {
    color: var(--cream-paper);
}

.color-block-sage:hover {
    background-color: #6E8E5C;
}

.color-block-sienna {
    background-color: var(--burnt-sienna);
}

.color-block-sienna .large-number {
    color: var(--cream-paper);
}

.color-block-sienna:hover {
    background-color: #B86A3C;
}

.color-block-charcoal {
    background-color: var(--charcoal);
}

.color-block-charcoal:hover {
    background-color: #1E1E1C;
}

/* --- Foldout (Progressive Disclosure) --- */
.foldout {
    cursor: pointer;
    margin-top: 24px;
    position: relative;
}

.foldout-indicator {
    width: 0;
    height: 1px;
    background-color: var(--burnt-sienna);
    transition: width 400ms ease;
    margin-bottom: 16px;
}

.foldout:hover .foldout-indicator,
.foldout.in-view .foldout-indicator {
    width: 60px;
}

.foldout-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 400ms ease;
}

.foldout.open .foldout-content {
    max-height: 600px;
}

.foldout.open .foldout-indicator {
    width: 100%;
    background-color: var(--leaf-sage);
}

/* --- Type Specimen --- */
.type-specimen {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 16px;
}

.specimen-display {
    font-family: var(--font-primary);
    font-size: clamp(60px, 8vw, 120px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--walnut-dark);
    line-height: 1;
}

.specimen-weights {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.specimen-weights span {
    font-family: var(--font-primary);
    font-size: var(--body-size);
    color: var(--walnut-dark);
}

/* --- Type Showcase (Right Page) --- */
.type-showcase {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.type-display-large {
    font-family: var(--font-primary);
    font-size: clamp(120px, 18vw, 280px);
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--walnut-dark);
    line-height: 0.85;
    margin-bottom: 24px;
}

/* --- Material Illustration --- */
.material-illustration {
    width: 100%;
    max-width: 400px;
    height: auto;
}

/* --- Swatch Grid --- */
.swatch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.swatch {
    aspect-ratio: 3 / 2;
    border-radius: 4px;
    display: flex;
    align-items: flex-end;
    padding: 12px;
    transition: transform 200ms ease;
}

.swatch:hover {
    transform: scale(1.03);
}

.swatch:last-child {
    grid-column: span 2;
}

.swatch-label {
    font-family: var(--font-primary);
    font-size: 10px;
    font-weight: 300;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.5;
    color: var(--walnut-dark);
}

.swatch-label.light {
    color: var(--cream-paper);
}

/* --- Footer Spread --- */
.footer-dark {
    background-color: var(--charcoal);
}

.footer-title {
    font-family: var(--font-primary);
    font-size: clamp(32px, 4vw, 56px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--cream-paper);
    margin-bottom: 16px;
}

.footer-text {
    font-family: var(--font-primary);
    font-size: var(--body-size);
    font-weight: 400;
    line-height: 1.75;
    color: var(--cream-paper);
    opacity: 0.8;
    margin-bottom: 24px;
}

.footer-credits {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}

/* --- Scroll Animations --- */
.feature-spread .page-left,
.feature-spread .page-right {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.feature-spread .page-right {
    transition-delay: 100ms;
}

.feature-spread.in-view .page-left,
.feature-spread.in-view .page-right {
    opacity: 1;
    transform: translateY(0);
}

/* --- Pulse Animation for Pattern Strip --- */
@keyframes patternPulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

.pattern-strip.pulse {
    animation: patternPulse 300ms ease-in-out;
}

/* --- Responsive (maintain magazine metaphor on smaller screens) --- */
@media (max-width: 768px) {
    .spread {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    .gutter {
        width: 100%;
        height: 1px;
    }

    #cover-gutter {
        height: 1px;
        width: 0;
        transition: width 600ms ease-out;
    }

    #cover-gutter.animate {
        width: 100%;
        height: 1px;
    }

    .page {
        padding: 32px 24px;
        min-height: 60vh;
    }

    .cover-spread {
        height: auto;
        min-height: 100vh;
    }

    .page-left .page-number {
        left: 24px;
    }

    .page-right .page-number {
        right: 24px;
    }

    .swatch-grid {
        grid-template-columns: 1fr 1fr;
    }

    .type-display-large {
        font-size: clamp(80px, 25vw, 180px);
    }

    .pattern-strip {
        height: 50px;
    }
}
