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

:root {
    --bg-primary: #e8e6e1;
    --bg-secondary: #f5f2ec;
    --holo-lavender: #b4a7d6;
    --holo-gold: #d4c17f;
    --holo-teal: #7ec4b8;
    --text-primary: #2b2b2b;
    --text-secondary: #6b6b6b;
    --accent-rose: #d4928a;
    --scroll-y: 0;
    --scroll-angle: 0deg;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ===== BREADCRUMB ===== */
.breadcrumb-pill {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 6px;
    background: rgba(245, 242, 236, 0.92);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid rgba(180, 167, 214, 0.3);
}

.crumb {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.65rem, 1vw, 0.75rem);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 14px;
    transition: all 0.4s ease;
    cursor: default;
}

.crumb.active {
    background: linear-gradient(135deg, var(--holo-lavender), var(--holo-gold), var(--holo-teal));
    color: #fff;
}

/* ===== SVG SUPPLY LINE ===== */
.supply-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.35;
}

.main-path {
    stroke-dasharray: 20000;
    stroke-dashoffset: 20000;
    transition: stroke-dashoffset 0.1s linear;
}

/* ===== SCENES ===== */
.scene {
    position: relative;
    z-index: 2;
    min-height: 120vh;
    padding: 10vh 8vw;
}

.scene-origin {
    min-height: 130vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scene-consumer {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== TITLE ===== */
.origin-hero {
    text-align: center;
    padding-top: 12vh;
    margin-bottom: 6vh;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.site-title span {
    display: inline-block;
    background: linear-gradient(calc(45deg + var(--scroll-angle)), var(--holo-lavender), var(--holo-gold), var(--holo-teal));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s ease-in-out infinite alternate;
}

@keyframes shimmer {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.15); }
}

.subtitle {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--text-secondary);
    max-width: 32em;
    margin: 0 auto;
}

/* ===== SECTION NUMBERS ===== */
.section-number {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 5rem);
    background: linear-gradient(calc(60deg + var(--scroll-angle)), var(--holo-lavender), var(--holo-gold), var(--holo-teal));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.section-number.final {
    text-align: center;
    margin-top: 2rem;
}

/* ===== STATIONS ===== */
.station {
    background: var(--bg-secondary);
    padding: 3rem 3.5rem;
    border-radius: 8px;
    max-width: 38em;
    margin-bottom: 4rem;
    border: 1px solid rgba(180, 167, 214, 0.15);
    position: relative;
}

.station h2 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
    line-height: 1.15;
}

.station h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.4rem, 3vw, 2rem);
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.station p {
    margin-bottom: 1rem;
    max-width: 38em;
}

.station .emphasis {
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-style: italic;
    color: var(--accent-rose);
}

.station-left {
    margin-right: auto;
    margin-left: 0;
}

.station-right {
    margin-left: auto;
    margin-right: 0;
}

.station-center {
    margin-left: auto;
    margin-right: auto;
}

.station.wide {
    max-width: 65vw;
}

.station.narrow {
    max-width: 40vw;
}

/* ===== ORIGIN LANDSCAPE ===== */
.origin-landscape {
    position: relative;
    width: 100%;
    height: 300px;
    margin-bottom: 6vh;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.origin-landscape.visible {
    opacity: 1;
}

.hill {
    position: absolute;
    border-radius: 50%;
    bottom: 0;
}

.hill-far {
    width: 120%;
    height: 200px;
    left: -10%;
    background: #5a9e8f;
    bottom: -60px;
    z-index: 1;
}

.hill-mid {
    width: 80%;
    height: 180px;
    left: 15%;
    background: #6db3a3;
    bottom: -40px;
    z-index: 2;
}

.hill-near {
    width: 100%;
    height: 160px;
    left: -5%;
    background: var(--holo-teal);
    bottom: -70px;
    z-index: 3;
}

.tree {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 28px solid #4a8a7a;
    z-index: 4;
}

.tree::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 10px;
    background: #6b5a4a;
    left: -2px;
    top: 28px;
}

.tree-1 { bottom: 60px; left: 20%; }
.tree-2 { bottom: 70px; left: 35%; }
.tree-3 { bottom: 55px; left: 55%; }
.tree-4 { bottom: 65px; left: 70%; }
.tree-5 { bottom: 50px; left: 85%; }

.holo-sun {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--holo-gold) 0%, var(--holo-lavender) 50%, var(--holo-teal) 100%);
    top: 10px;
    right: 20%;
    z-index: 0;
    box-shadow: 0 0 60px 20px rgba(212, 193, 127, 0.3);
}

/* ===== MANUFACTURING ===== */
.manufacturing-layout {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.manufacturing-layout .station-left {
    flex: 1 1 55%;
    min-width: 300px;
}

.watermill {
    flex: 0 0 280px;
    position: relative;
    height: 300px;
}

.mill-building {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
}

.mill-roof {
    width: 0;
    height: 0;
    border-left: 70px solid transparent;
    border-right: 70px solid transparent;
    border-bottom: 50px solid #8a7a6a;
    position: relative;
    left: -10px;
}

.mill-body {
    width: 120px;
    height: 100px;
    background: var(--bg-secondary);
    border: 2px solid #c0c0c0;
    border-radius: 3px;
    position: relative;
}

.mill-window {
    width: 30px;
    height: 30px;
    background: rgba(212, 193, 127, 0.3);
    border: 1px solid var(--holo-gold);
    border-radius: 2px;
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
}

.mill-door {
    width: 28px;
    height: 40px;
    background: #8a7a6a;
    border-radius: 14px 14px 0 0;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.gear-wheel {
    position: absolute;
    width: 100px;
    height: 100px;
    bottom: 30px;
    right: 10px;
}

.gear-spin {
    transform-origin: 60px 60px;
    animation: spin 8s linear infinite;
    animation-play-state: paused;
}

.gear-wheel.spinning .gear-spin {
    animation-play-state: running;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.steam {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(192, 192, 192, 0.4);
    top: 40px;
    animation: rise 3s ease-out infinite;
    opacity: 0;
}

.steam.active {
    opacity: 1;
}

.steam-1 { left: 45%; animation-delay: 0s; }
.steam-2 { left: 50%; animation-delay: 1s; }
.steam-3 { left: 55%; animation-delay: 2s; }

@keyframes rise {
    0% { transform: translateY(0) scale(1); opacity: 0.5; }
    100% { transform: translateY(-80px) scale(2); opacity: 0; }
}

/* ===== DISTRIBUTION ===== */
.distribution-layout {
    position: relative;
}

.road-network {
    position: absolute;
    top: 0;
    left: -8vw;
    width: calc(100% + 16vw);
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.distribution-layout .station {
    position: relative;
    z-index: 1;
}

/* ===== CARD FLIPS ===== */
.card-flip-row {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 4rem 0;
}

.card-flip {
    width: 280px;
    height: 360px;
    perspective: 800px;
    cursor: pointer;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-flip:hover .card-inner,
.card-flip:focus .card-inner,
.card-flip.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.card-front {
    background: var(--bg-secondary);
    border: 1px solid rgba(180, 167, 214, 0.2);
    text-align: center;
}

.card-front::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--holo-lavender), var(--holo-gold), var(--holo-teal)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
}

.card-flip:hover .card-front::after {
    opacity: 1;
}

.card-back {
    background: var(--holo-teal);
    color: #fff;
    transform: rotateY(180deg);
    font-size: 0.95rem;
    line-height: 1.65;
}

.card-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.2rem;
}

.card-front h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
}

.card-hint {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

/* ===== RETAIL ===== */
.retail-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.retail-layout .station-center {
    line-height: 1.8;
}

.market-stalls {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin: 3rem 0;
    flex-wrap: wrap;
}

.stall {
    width: 140px;
    text-align: center;
}

.awning {
    height: 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--holo-lavender), var(--holo-gold), var(--holo-teal));
    border-radius: 4px 4px 0 0;
    transition: height 0.8s ease;
}

.awning.open {
    height: 24px;
}

.stall-body {
    height: 80px;
    background: var(--bg-secondary);
    border: 1px solid #c0c0c0;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

/* ===== CONSUMER ===== */
.consumer-layout {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.cottage-scene {
    position: relative;
    margin-bottom: 4rem;
}

.cottage {
    position: relative;
    width: 180px;
    margin: 0 auto;
}

.cottage-roof {
    width: 0;
    height: 0;
    border-left: 100px solid transparent;
    border-right: 100px solid transparent;
    border-bottom: 70px solid #8a7a6a;
    position: relative;
    left: -10px;
}

.cottage-body {
    width: 180px;
    height: 120px;
    background: var(--bg-secondary);
    border: 2px solid #c0c0c0;
    border-radius: 3px;
    position: relative;
}

.cottage-window {
    width: 40px;
    height: 40px;
    background: rgba(212, 146, 138, 0.3);
    border: 2px solid var(--accent-rose);
    border-radius: 3px;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 40px 10px rgba(212, 146, 138, 0.4);
}

.cottage-door {
    width: 36px;
    height: 50px;
    background: #8a7a6a;
    border-radius: 18px 18px 0 0;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.garden-path {
    width: 300px;
    margin: 1rem auto 0;
}

.garden-path svg {
    width: 100%;
    height: 60px;
}

.breathing-wave {
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { stroke-dashoffset: 0; opacity: 0.6; }
    50% { stroke-dashoffset: 20; opacity: 1; }
}

.breathing-wave {
    stroke-dasharray: 10 5;
}

.closing-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.8rem);
    max-width: 20em;
    line-height: 1.4;
    color: var(--text-primary);
    border: none;
    padding: 0;
    margin: 0 auto 2rem;
}

/* ===== WAVE SEPARATORS ===== */
.wave-separator {
    width: 100%;
    height: 80px;
    margin: 2rem 0;
    overflow: visible;
}

.wave-path {
    animation: waveDrift 20s linear infinite;
}

@keyframes waveDrift {
    0% { transform: translateX(0); }
    100% { transform: translateX(-60px); }
}

/* ===== ANIMATIONS ===== */
.station {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.card-flip {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.card-flip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .scene {
        padding: 8vh 5vw;
    }

    .manufacturing-layout {
        flex-direction: column;
    }

    .station.narrow {
        max-width: 100%;
    }

    .station.wide {
        max-width: 100%;
    }

    .watermill {
        flex: 0 0 auto;
        width: 100%;
    }

    .card-flip-row.triple {
        flex-direction: column;
        align-items: center;
    }

    .breadcrumb-pill {
        gap: 2px;
        padding: 6px 10px;
    }

    .crumb {
        font-size: 0.6rem;
        padding: 3px 6px;
    }
}
