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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Nunito', sans-serif;
    color: #4a4a56;
    background: #e8e8ee;
    overflow-x: hidden;
    line-height: 1.7;
}

/* Grain overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.06;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 128px 128px;
}

/* ==================== TYPOGRAPHY ==================== */
.split-title {
    font-family: 'Silkscreen', cursive;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #2d2d3a;
    text-shadow: 2px 2px 0px #c0c0cc;
    line-height: 1.1;
}

.split-title span {
    display: inline-block;
    opacity: 0;
    animation: letterFadeIn 0.3s ease forwards;
}

@keyframes letterFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-subtitle {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    color: #4a4a56;
    margin-top: 1.5rem;
    max-width: 380px;
    opacity: 0;
    animation: fadeInUp 0.8s ease 1.8s forwards;
}

.diorama-label, .city-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a8a96;
}

/* ==================== SPLIT SECTION ==================== */
.split-section {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    position: relative;
}

.panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    min-height: 100vh;
}

.panel-left {
    background: #e8e8ee;
    opacity: 0;
    transform: translateX(-20px);
    animation: panelSlideLeft 0.8s ease forwards;
}

.panel-left::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    pointer-events: none;
    opacity: 0.10;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 128px 128px;
}

.panel-left .split-title {
    opacity: 0.4;
    filter: blur(1px);
}

.panel-right {
    background: #d4d4de;
    opacity: 0;
    transform: translateX(20px);
    animation: panelSlideRight 0.8s ease 0.2s forwards;
}

.panel-right::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    pointer-events: none;
    opacity: 0.04;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 128px 128px;
}

.panel-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

@keyframes panelSlideLeft {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes panelSlideRight {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Divider */
.divider-line {
    width: 3px;
    position: relative;
    z-index: 2;
}

#wave-divider {
    width: 100%;
    height: 100%;
    color: #6a8fb4;
}

#divider-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawDivider 1.5s ease 0.5s forwards;
}

@keyframes drawDivider {
    to { stroke-dashoffset: 0; }
}

/* ==================== FLIP SECTION ==================== */
.flip-section {
    padding: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 4rem);
    background: linear-gradient(to bottom, #e8e8ee, #d4d4de);
    position: relative;
}

.flip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.flip-card {
    perspective: 1000px;
    height: 320px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.flip-card-front,
.flip-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;
}

.flip-card-front {
    background: #e8e8ee;
    border: 1px solid #c0c0cc;
}

.flip-card-back {
    background: #2d2d3a;
    color: #e8e8ee;
    transform: rotateY(180deg);
    font-family: 'Nunito', sans-serif;
    font-size: 1.05rem;
    line-height: 1.7;
    text-align: center;
}

.diorama-label {
    margin-top: 1.5rem;
}

.wave-underline {
    display: block;
    width: 100%;
    height: 30px;
    margin-top: 3rem;
}

/* ==================== ISOMETRIC BLOCKS ==================== */
.diorama {
    position: relative;
    width: 180px;
    height: 160px;
    transform: rotateX(60deg) rotateZ(-45deg);
    transform-style: preserve-3d;
}

.iso-block {
    position: absolute;
    transform-style: preserve-3d;
}

/* Block face mixin via individual blocks */
/* Top face: #bdbdc8, Left: #9a9aa6, Right: #6d6d7a */

/* Bridge diorama */
.diorama-bridge .bridge-base-1 {
    width: 40px; height: 20px;
    background: #bdbdc8;
    bottom: 0; left: 10px;
    box-shadow: 8px 8px 0 #9a9aa6, 8px 0 0 #6d6d7a;
}
.diorama-bridge .bridge-base-2 {
    width: 40px; height: 20px;
    background: #bdbdc8;
    bottom: 0; right: 10px;
    box-shadow: 8px 8px 0 #9a9aa6, 8px 0 0 #6d6d7a;
}
.diorama-bridge .bridge-pillar-1 {
    width: 15px; height: 60px;
    background: #bdbdc8;
    bottom: 20px; left: 22px;
    box-shadow: 8px 8px 0 #9a9aa6, 8px 0 0 #6d6d7a;
}
.diorama-bridge .bridge-pillar-2 {
    width: 15px; height: 60px;
    background: #bdbdc8;
    bottom: 20px; right: 22px;
    box-shadow: 8px 8px 0 #9a9aa6, 8px 0 0 #6d6d7a;
}
.diorama-bridge .bridge-span-broken {
    width: 30px; height: 8px;
    background: #9a9aa6;
    bottom: 70px; left: 25px;
    transform: rotate(-15deg);
    opacity: 0.5;
}
.diorama-bridge .bridge-span-new {
    width: 70px; height: 10px;
    background: #d4856a;
    bottom: 78px; left: 50%;
    transform: translateX(-50%);
    box-shadow: 4px 4px 0 #b06a52;
}

/* Clocks diorama */
.diorama-clocks .clock-base-1 {
    width: 50px; height: 50px;
    background: #9a9aa6;
    bottom: 0; left: 15px;
    border-radius: 4px;
    box-shadow: 6px 6px 0 #6d6d7a;
}
.diorama-clocks .clock-face-1 {
    width: 36px; height: 36px;
    border: 3px solid #6d6d7a;
    border-radius: 50%;
    bottom: 7px; left: 22px;
    background: #e8e8ee;
}
.diorama-clocks .clock-face-1::before {
    content: '';
    position: absolute;
    width: 2px; height: 12px;
    background: #2d2d3a;
    top: 5px; left: 50%;
    transform: translateX(-50%) rotate(30deg);
    transform-origin: bottom center;
}
.diorama-clocks .clock-base-2 {
    width: 50px; height: 50px;
    background: #bdbdc8;
    bottom: 0; right: 15px;
    border-radius: 4px;
    box-shadow: 6px 6px 0 #9a9aa6;
}
.diorama-clocks .clock-face-2 {
    width: 36px; height: 36px;
    border: 3px solid #d4856a;
    border-radius: 50%;
    bottom: 7px; right: 22px;
    background: #f0f0f5;
}
.diorama-clocks .clock-face-2::before {
    content: '';
    position: absolute;
    width: 2px; height: 14px;
    background: #d4856a;
    top: 4px; left: 50%;
    transform: translateX(-50%) rotate(0deg);
    transform-origin: bottom center;
}

/* Path diorama */
.diorama-path .path-start {
    width: 30px; height: 12px;
    background: #9a9aa6;
    bottom: 20px; left: 0;
    box-shadow: 5px 5px 0 #6d6d7a;
}
.diorama-path .path-fork-1 {
    width: 40px; height: 10px;
    background: #9a9aa6;
    bottom: 60px; left: 40px;
    transform: rotate(-20deg);
    opacity: 0.5;
}
.diorama-path .path-fork-2 {
    width: 45px; height: 12px;
    background: #d4856a;
    bottom: 30px; left: 35px;
    transform: rotate(10deg);
    box-shadow: 4px 4px 0 #b06a52;
}
.diorama-path .path-end {
    width: 30px; height: 30px;
    background: #bdbdc8;
    bottom: 10px; right: 10px;
    border-radius: 50%;
    box-shadow: 5px 5px 0 #9a9aa6;
}

/* Blocks diorama */
.diorama-blocks .block-scattered-1 {
    width: 25px; height: 25px;
    background: #9a9aa6;
    bottom: 0; left: 5px;
    transform: rotate(15deg);
    opacity: 0.6;
}
.diorama-blocks .block-scattered-2 {
    width: 20px; height: 20px;
    background: #9a9aa6;
    bottom: 10px; left: 45px;
    transform: rotate(-25deg);
    opacity: 0.6;
}
.diorama-blocks .block-scattered-3 {
    width: 22px; height: 22px;
    background: #9a9aa6;
    bottom: 5px; left: 80px;
    transform: rotate(40deg);
    opacity: 0.6;
}
.diorama-blocks .block-neat-1 {
    width: 25px; height: 25px;
    background: #bdbdc8;
    bottom: 60px; right: 30px;
    box-shadow: 5px 5px 0 #9a9aa6;
}
.diorama-blocks .block-neat-2 {
    width: 25px; height: 25px;
    background: #bdbdc8;
    bottom: 60px; right: 60px;
    box-shadow: 5px 5px 0 #9a9aa6;
}
.diorama-blocks .block-neat-3 {
    width: 25px; height: 25px;
    background: #d4856a;
    bottom: 88px; right: 45px;
    box-shadow: 5px 5px 0 #b06a52;
}

/* ==================== MERGE SECTION ==================== */
.merge-section {
    min-height: 100vh;
    background: #d4d4de;
    display: flex;
    align-items: center;
    padding: clamp(2rem, 5vw, 4rem) 0;
    overflow: hidden;
}

.merge-landscape-wrapper {
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.merge-landscape {
    display: flex;
    gap: 4rem;
    padding: 4rem clamp(2rem, 5vw, 4rem);
    min-width: max-content;
}

.city-block {
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.iso-building {
    transform-style: preserve-3d;
    position: relative;
}

/* Building variations */
.building-tall {
    width: 60px;
    height: 120px;
    background: #bdbdc8;
    box-shadow: 12px 12px 0 #9a9aa6, 12px 0 0 #6d6d7a;
}

.building-wide {
    width: 100px;
    height: 60px;
    background: #bdbdc8;
    box-shadow: 12px 12px 0 #9a9aa6, 12px 0 0 #6d6d7a;
}

.building-step {
    width: 80px;
    height: 80px;
    background: #bdbdc8;
    box-shadow: 12px 12px 0 #9a9aa6, 12px 0 0 #6d6d7a;
    clip-path: polygon(0 40%, 50% 40%, 50% 0, 100% 0, 100% 100%, 0 100%);
}

.building-arch {
    width: 70px;
    height: 90px;
    background: #bdbdc8;
    border-radius: 35px 35px 0 0;
    box-shadow: 12px 12px 0 #9a9aa6;
}

.building-tower {
    width: 45px;
    height: 140px;
    background: #d4856a;
    box-shadow: 10px 10px 0 #b06a52, 10px 0 0 #9a5a48;
}

.building-pyramid {
    width: 0;
    height: 0;
    border-left: 55px solid transparent;
    border-right: 55px solid transparent;
    border-bottom: 100px solid #bdbdc8;
    box-shadow: none;
    filter: drop-shadow(10px 10px 0 #9a9aa6);
}

.city-label {
    text-align: center;
}

/* ==================== CLOSING SECTION ==================== */
.closing-section {
    min-height: 100vh;
    background: #e8e8ee;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#closing-waves {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.closing-message {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1s ease, transform 1s ease;
}

.closing-message.visible {
    opacity: 1;
    transform: translateY(0);
}

.closing-message h2 {
    font-family: 'Silkscreen', cursive;
    font-size: clamp(1.8rem, 5vw, 4rem);
    color: #d4856a;
    text-shadow: 2px 2px 0px #c0c0cc;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.site-footer {
    position: absolute;
    bottom: 2rem;
    z-index: 2;
}

.footer-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9a9aa6;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .split-section {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto 1fr;
    }
    
    .panel {
        min-height: 50vh;
    }
    
    .divider-line {
        width: 100%;
        height: 3px;
    }
    
    #wave-divider {
        width: 100%;
        height: 100%;
    }
    
    .flip-grid {
        grid-template-columns: 1fr;
    }
    
    .flip-card {
        height: 280px;
    }
}
