/* ============================================
   archetype.moe - Swiss International Style + Organic Motifs
   ============================================ */

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

:root {
    /* Palette */
    --ink: #1A1A1A;
    --paper: #FAFAF5;
    --parchment: #F5F0E8;
    --forest: #0B3D2E;
    --sage: #6B8F71;
    --moss: #A8C5A0;
    --bone: #E8E0D0;
    --charcoal: #2D2D2D;

    /* Typography scale */
    --font-heading: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-accent: 'Space Grotesk', sans-serif;

    /* Spacing (8px base) */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 48px;
    --space-xl: 80px;
    --space-xxl: 120px;

    /* Grid */
    --col-width: 64px;
    --gutter: 24px;
    --margin: 120px;

    /* Diagonal */
    --diag: 6vw;

    /* Scroll tracking (set via JS) */
    --scroll: 0;
}

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(16px, 1.2vw, 20px);
    line-height: 1.65;
    color: var(--charcoal);
    background-color: var(--paper);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--ink);
    line-height: 1.2;
}

h1 {
    font-weight: 300;
    font-size: clamp(48px, 8vw, 128px);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

h2 {
    font-weight: 600;
    font-size: clamp(24px, 3vw, 48px);
    line-height: 1.2;
    letter-spacing: 0;
    margin-bottom: var(--space-md);
}

h3 {
    font-weight: 600;
    font-size: clamp(18px, 2vw, 32px);
    line-height: 1.2;
}

p {
    max-width: 680px;
    margin-bottom: 1.5em;
}

.section-label {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sage);
    display: block;
    margin-bottom: var(--space-md);
}

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

/* --- RULES --- */
.rule {
    border: none;
    height: 1px;
    background-color: var(--ink);
    margin: var(--space-lg) 0;
    width: 100%;
}

.rule-light {
    background-color: var(--bone);
}

.rule-sm {
    border: none;
    height: 1px;
    background-color: var(--ink);
    margin: var(--space-md) 0;
    width: 80px;
}

/* --- SCROLL PROGRESS INDICATOR --- */
#scroll-indicator {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
}

#scroll-indicator .dot {
    width: 16px;
    height: 16px;
    color: var(--moss);
    transition: color 300ms ease, transform 300ms ease;
    cursor: pointer;
}

#scroll-indicator .dot.active {
    color: var(--forest);
    transform: scale(1.3);
}

#scroll-indicator .dot svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* --- PARALLAX LAYERS --- */
.parallax-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#parallax-fg {
    z-index: 5;
    will-change: transform;
}

#parallax-bg {
    z-index: 0;
    will-change: transform;
}

/* Eucalyptus scatter positions */
.eucalyptus {
    position: absolute;
    opacity: 0.6;
}
.e1 { top: 15%; left: 5%; transform: rotate(15deg); }
.e2 { top: 35%; right: 8%; transform: rotate(-30deg); }
.e3 { top: 55%; left: 3%; transform: rotate(45deg); }
.e4 { top: 70%; right: 4%; transform: rotate(-15deg); }
.e5 { top: 25%; right: 15%; transform: rotate(60deg); }
.e6 { top: 85%; left: 10%; transform: rotate(-45deg); }
.e7 { top: 45%; left: 12%; transform: rotate(30deg); }

/* Background watermarks */
.monstera-watermark {
    position: absolute;
}
.wm1 {
    top: 20%;
    left: -5%;
}
.oak-bg {
    position: absolute;
    bottom: 5%;
    right: -5%;
    width: 60vw;
    height: auto;
}

/* --- BANDS (DIAGONAL SECTIONS) --- */
.band {
    position: relative;
    width: 100%;
    z-index: 1;
}

.band-inner {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--margin);
}

/* --- HERO BAND --- */
.band-hero {
    min-height: 100vh;
    background-color: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--diag)), 0 100%);
    overflow: hidden;
}

.hero-leaf-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: circle(5% at 50% 50%);
    transition: clip-path 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 0;
}

.hero-leaf-mask.unfurled {
    clip-path: polygon(
        50% 2%,
        62% 5%,
        78% 12%,
        88% 25%,
        92% 40%,
        90% 50%,
        85% 45%,
        80% 50%,
        88% 58%,
        90% 70%,
        85% 82%,
        75% 90%,
        62% 95%,
        50% 98%,
        38% 95%,
        25% 90%,
        15% 82%,
        10% 70%,
        12% 58%,
        20% 50%,
        15% 45%,
        10% 50%,
        8% 40%,
        12% 25%,
        22% 12%,
        38% 5%
    );
}

.hero-green-bg {
    width: 100%;
    height: 100%;
    background-color: var(--forest);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    transition: opacity 600ms ease;
    transition-delay: 1.2s;
}

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

.hero-title {
    color: var(--parchment);
    margin-bottom: var(--space-sm);
    mix-blend-mode: difference;
}

.hero-title .dot {
    color: var(--sage);
}

.hero-subtitle {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--moss);
    max-width: none;
}

/* --- PHILOSOPHY BAND --- */
.band-philosophy {
    background-color: var(--parchment);
    padding: calc(var(--diag) + var(--space-xl)) 0 var(--space-xxl);
    margin-top: calc(var(--diag) * -1);
    clip-path: polygon(0 var(--diag), 100% 0, 100% calc(100% - var(--diag)), 0 100%);
    min-height: 120vh;
}

.section-header {
    margin-bottom: var(--space-xl);
}

.philosophy-columns {
    display: flex;
    gap: 0;
    align-items: flex-start;
}

.phil-col {
    flex: 1;
    padding: 0 var(--space-md);
}

.phil-col h2 {
    color: var(--ink);
}

.phil-col p {
    color: var(--charcoal);
}

.fern-divider {
    flex: 0 0 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: var(--space-lg);
}

.fern-svg {
    opacity: 0.6;
}

/* --- GALLERY BAND --- */
.band-gallery {
    background-color: var(--paper);
    padding: calc(var(--diag) + var(--space-xl)) 0 var(--space-xxl);
    margin-top: calc(var(--diag) * -1);
    clip-path: polygon(0 0, 100% var(--diag), 100% 100%, 0 calc(100% - var(--diag)));
    min-height: 100vh;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gutter);
}

.gallery-frame {
    aspect-ratio: 1 / 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-frame svg {
    display: block;
}

.frame-label {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sage);
}

/* --- MANIFESTO BAND --- */
.band-manifesto {
    background-color: var(--forest);
    padding: calc(var(--diag) + var(--space-xxl)) 0 var(--space-xxl);
    margin-top: calc(var(--diag) * -1);
    clip-path: polygon(0 var(--diag), 100% 0, 100% calc(100% - var(--diag)), 0 100%);
    min-height: 80vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.manifesto-leaves {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    will-change: transform;
}

.m-leaf {
    position: absolute;
}
.m-leaf-1 {
    top: 10%;
    left: 8%;
    transform: rotate(15deg);
}
.m-leaf-2 {
    top: 30%;
    right: 10%;
    transform: rotate(-10deg);
}
.m-leaf-3 {
    bottom: 15%;
    left: 20%;
    transform: rotate(25deg);
}

.manifesto-quote {
    margin: var(--space-xl) 0;
}

.manifesto-quote p {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(32px, 5vw, 80px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--parchment);
    max-width: 960px;
    margin: 0 auto;
    text-align: center;
}

.manifesto-attribution {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--moss);
    text-align: center;
    max-width: none;
}

/* --- CLOSING BAND --- */
.band-closing {
    background-color: var(--paper);
    padding: calc(var(--diag) + var(--space-xl)) 0 var(--space-lg);
    margin-top: calc(var(--diag) * -1);
    clip-path: polygon(0 0, 100% var(--diag), 100% 100%, 0 100%);
    min-height: 60vh;
}

.closing-text {
    font-size: clamp(18px, 2vw, 28px);
    line-height: 1.5;
    color: var(--charcoal);
    max-width: 640px;
    margin-bottom: var(--space-xl);
}

.return-to-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    margin: var(--space-xl) 0;
}

.spinning-leaf {
    transition: transform 600ms ease;
}

.return-to-top:hover .spinning-leaf {
    transform: rotate(360deg) translateY(-8px);
}

.return-label {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sage);
}

.closing-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--margin);
    margin-top: var(--space-xxl);
}

.footer-text {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sage);
    max-width: none;
}

/* --- ANIMATIONS --- */
.animate-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.animate-in.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.philosophy-columns .animate-in:nth-child(1) { transition-delay: 0ms; }
.philosophy-columns .animate-in:nth-child(3) { transition-delay: 100ms; }
.philosophy-columns .animate-in:nth-child(5) { transition-delay: 200ms; }

.gallery-grid .animate-in:nth-child(1) { transition-delay: 0ms; }
.gallery-grid .animate-in:nth-child(2) { transition-delay: 100ms; }
.gallery-grid .animate-in:nth-child(3) { transition-delay: 200ms; }
.gallery-grid .animate-in:nth-child(4) { transition-delay: 300ms; }
.gallery-grid .animate-in:nth-child(5) { transition-delay: 400ms; }
.gallery-grid .animate-in:nth-child(6) { transition-delay: 500ms; }

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
    .animate-in {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hero-leaf-mask {
        transition: none;
        clip-path: polygon(
            50% 2%, 62% 5%, 78% 12%, 88% 25%, 92% 40%, 90% 50%,
            85% 45%, 80% 50%, 88% 58%, 90% 70%, 85% 82%, 75% 90%,
            62% 95%, 50% 98%, 38% 95%, 25% 90%, 15% 82%, 10% 70%,
            12% 58%, 20% 50%, 15% 45%, 10% 50%, 8% 40%, 12% 25%,
            22% 12%, 38% 5%
        );
    }

    .hero-content {
        opacity: 1;
        transition: none;
    }

    #parallax-fg,
    #parallax-bg,
    .manifesto-leaves {
        display: none;
    }

    .spinning-leaf {
        transition: none;
    }
}

/* --- RESPONSIVE --- */
@media (max-width: 1200px) {
    .band-inner {
        padding: 0 var(--space-xl);
    }

    .closing-footer {
        padding: 0 var(--space-xl);
    }
}

@media (max-width: 768px) {
    :root {
        --diag: 4vw;
        --margin: 24px;
    }

    .band-inner {
        padding: 0 var(--space-md);
    }

    .closing-footer {
        padding: 0 var(--space-md);
    }

    .philosophy-columns {
        flex-direction: column;
        gap: var(--space-lg);
    }

    .fern-divider {
        display: none;
    }

    .phil-col {
        padding: 0;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        max-width: 320px;
        margin: 0 auto;
    }

    #scroll-indicator {
        right: 12px;
        gap: 24px;
    }

    #scroll-indicator .dot {
        width: 12px;
        height: 12px;
    }

    .manifesto-quote p {
        font-size: clamp(24px, 6vw, 48px);
    }

    .hero-title {
        font-size: clamp(36px, 10vw, 72px);
    }

    .eucalyptus {
        display: none;
    }
}

@media (max-width: 480px) {
    .band-philosophy {
        min-height: auto;
        padding-bottom: var(--space-xl);
    }

    .band-gallery {
        min-height: auto;
    }

    .band-manifesto {
        min-height: auto;
        padding: calc(var(--diag) + var(--space-xl)) 0 var(--space-xl);
    }
}
