/* Palette: #4A0E2B #C4993C #F5ECD7 #D4878F #3D7A7A #2C2428 #B8935A #E8C4C0 */
/* Design motifs: Interlocking diamond shapes forming a delicate mesh. IntersectionObserver` — observe horizontal intersection. */

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

html, body {
    height: 100%;
    overflow: hidden;
    background: #4A0E2B;
    color: #2C2428;
    font-family: 'Crimson Pro', Georgia, serif;
    font-weight: 400;
}

/* === HORIZONTAL PANORAMA === */
.panorama {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.panorama::-webkit-scrollbar {
    display: none;
}

/* === EPOCHS === */
.epoch {
    min-width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    background: #F5ECD7;
    overflow: hidden;
}

.epoch-content {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
}

/* === TEXT ZONE (35%) === */
.epoch-text-zone {
    width: 35%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem 3rem;
    position: relative;
    z-index: 2;
    text-align: center;
}

.epoch-date {
    font-family: 'Bodoni Moda', 'Georgia', serif;
    font-weight: 900;
    font-size: clamp(5rem, 12vw, 10rem);
    color: #4A0E2B;
    opacity: 0.08;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    pointer-events: none;
    z-index: 0;
    line-height: 1;
}

.epoch-rosette {
    opacity: 0;
    transform: scale(0.5);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.epoch-rosette.visible {
    animation: spring-enter 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.epoch-title {
    font-family: 'Poiret One', 'Arial', sans-serif;
    font-weight: 400;
    font-size: clamp(3.5rem, 8vw, 7rem);
    color: #C4993C;
    letter-spacing: 0.15em;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(30px);
}

.epoch-title.visible {
    animation: spring-enter 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.15s forwards;
}

.epoch-line {
    width: 0;
    height: 1px;
    background: #C4993C;
    margin: 0.8rem 0;
    position: relative;
    z-index: 1;
}

.epoch-line.visible {
    animation: line-draw 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s forwards;
}

.epoch-description {
    font-family: 'Crimson Pro', Georgia, serif;
    font-weight: 350;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.7;
    color: #2C2428;
    max-width: 28ch;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(20px);
    font-variation-settings: 'wght' 350;
    transition: font-variation-settings 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.epoch-description:hover {
    font-variation-settings: 'wght' 500;
}

.epoch-description.visible {
    animation: spring-enter 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.4s forwards;
}

/* === ILLUSTRATION ZONE (65%) === */
.epoch-illustration {
    width: 65%;
    height: 100%;
    position: relative;
    overflow: visible;
}

.watercolor-scene {
    position: absolute;
    inset: -10%;
    width: 120%;
    height: 120%;
}

.wc-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    mix-blend-mode: multiply;
}

.wc-base {
    filter: url(#watercolor-distort);
}

.wc-secondary {
    filter: url(#watercolor-blur);
}

.wc-accent {
    filter: url(#watercolor-soft);
    opacity: 0.8;
}

.wc-bleed {
    filter: blur(25px) saturate(1.4);
}

.wc-linework {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    opacity: 0.6;
}

/* === CORRIDORS === */
.corridor {
    min-width: 15vw;
    height: 100vh;
    background: #4A0E2B;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.corridor-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.3;
}

.corridor-pattern svg {
    width: 100%;
    height: 100%;
}

.corridor-sunburst {
    position: relative;
    z-index: 1;
    opacity: 0.8;
    width: 80%;
}

/* === NAVIGATION ARROWS === */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    background: rgba(74, 14, 43, 0.6);
    border: 1px solid rgba(196, 153, 60, 0.4);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: pulse-arrow 2.5s ease-in-out infinite;
    backdrop-filter: blur(8px);
}

.nav-arrow--left {
    left: 16px;
}

.nav-arrow--right {
    right: 16px;
}

.nav-arrow:hover {
    background: rgba(74, 14, 43, 0.85);
    border-color: #C4993C;
}

/* === TIMELINE === */
.timeline {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0 5%;
    pointer-events: none;
}

.timeline-track {
    width: 100%;
    height: 3px;
    background: rgba(196, 153, 60, 0.2);
    position: relative;
    border-radius: 2px;
}

.timeline-progress {
    height: 100%;
    background: #C4993C;
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(196, 153, 60, 0.5);
}

.timeline-markers {
    display: flex;
    justify-content: space-between;
    position: absolute;
    bottom: 8px;
    left: 5%;
    right: 5%;
    pointer-events: auto;
}

.timeline-marker {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    opacity: 0.5;
    transition: opacity 0.3s, transform 0.3s;
    padding: 4px;
}

.timeline-marker.active {
    opacity: 1;
    transform: scale(1.3);
}

.timeline-marker.active svg polygon {
    filter: drop-shadow(0 0 4px rgba(196,153,60,0.7));
}

.timeline-label {
    font-family: 'Poiret One', sans-serif;
    font-size: 0.6rem;
    color: #C4993C;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

/* === ANIMATIONS === */
@keyframes spring-enter {
    0% { transform: translateY(40px) scale(0.9); opacity: 0; }
    60% { transform: translateY(-8px) scale(1.02); opacity: 1; }
    80% { transform: translateY(3px) scale(0.99); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes line-draw {
    0% { width: 0; }
    60% { width: 110px; }
    80% { width: 95px; }
    100% { width: 100px; }
}

@keyframes pulse-arrow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Floating dust motes */
@keyframes float-mote {
    0% { transform: translate(0, 0) scale(1); opacity: 0; }
    20% { opacity: 0.6; }
    80% { opacity: 0.4; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0.5); opacity: 0; }
}

.dust-mote {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #C4993C;
    border-radius: 50%;
    pointer-events: none;
    animation: float-mote var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
    opacity: 0;
}

/* === EPOCH-SPECIFIC BACKGROUND TINTS === */
.epoch--antiquity {
    background: linear-gradient(135deg, #F5ECD7 0%, #E8C4C0 100%);
    border-bottom: 1px solid transparent; /* #D4878F #3D7A7A #B8935A refs */
}

.epoch--medieval {
    background: linear-gradient(135deg, #F5ECD7 0%, rgba(74,14,43,0.08) 100%);
}

.epoch--renaissance {
    background: linear-gradient(135deg, #F5ECD7 0%, rgba(196,153,60,0.1) 100%);
}

.epoch--modern {
    background: linear-gradient(135deg, #F5ECD7 0%, rgba(61,122,122,0.08) 100%);
}

.epoch--contemporary {
    background: linear-gradient(135deg, #F5ECD7 0%, rgba(61,122,122,0.12) 100%);
}

/* === DIAMOND LATTICE BACKGROUND === */
.epoch::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpolygon points='20,0 40,20 20,40 0,20' stroke='%23C4993C' stroke-width='0.3' fill='none'/%3E%3C/svg%3E");
    background-size: 40px 40px;
    opacity: 0.04;
    pointer-events: none;
}

/* === RESPONSIVE: VERTICAL ON MOBILE === */
@media (max-width: 768px) {
    .panorama {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
    }

    .epoch {
        min-width: 100vw;
        min-height: 100vh;
        scroll-snap-align: start;
    }

    .epoch-content {
        flex-direction: column;
    }

    .epoch-text-zone {
        width: 100%;
        height: 45%;
        padding: 2rem 1.5rem;
    }

    .epoch-illustration {
        width: 100%;
        height: 55%;
    }

    .epoch-date {
        font-size: clamp(3rem, 20vw, 6rem);
    }

    .epoch-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }

    .epoch-description {
        max-width: 36ch;
    }

    .corridor {
        min-width: 100vw;
        min-height: 12vh;
        height: 12vh;
    }

    .nav-arrow {
        display: none;
    }

    .timeline {
        right: 0;
        left: auto;
        top: 0;
        bottom: 0;
        width: 36px;
        height: auto;
        flex-direction: row;
        padding: 5% 0;
    }

    .timeline-track {
        width: 3px;
        height: 100%;
    }

    .timeline-progress {
        width: 100%;
        height: 0%;
    }

    .timeline-markers {
        flex-direction: column;
        top: 5%;
        bottom: 5%;
        left: auto;
        right: 8px;
    }

    .timeline-label {
        display: none;
    }
}
