/* ============================================================
   historic.day — Translucent Frost Dark-Mode Design
   Split-screen architecture with border-animate pattern
   ============================================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    display: grid;
    grid-template-columns: 38vw 62vw;
    min-height: 100vh;
    background: #080c14;
    color: #e8f0fe;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    overflow: hidden;
    position: relative;
}

/* === 7-Degree Diagonal Divide === */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        97deg,
        transparent calc(38vw - 1px),
        rgba(127, 200, 248, 0.4) calc(38vw - 1px),
        rgba(127, 200, 248, 0.4) 38vw,
        transparent 38vw
    );
    z-index: 10;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(
        36vw 100%,
        36vw 100%,
        40vw 0%,
        40vw 0%
    );
    background: rgba(127, 200, 248, 0.08);
    z-index: 5;
    pointer-events: none;
}

/* === Frost Particle Field === */
.frost-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.frost-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #7fc8f8;
    opacity: 0.12;
    transform: rotate(45deg);
    animation: particleDrift linear infinite;
}

@keyframes particleDrift {
    0% {
        transform: rotate(45deg) translateX(0);
        opacity: 0;
    }
    5% {
        opacity: 0.12;
    }
    95% {
        opacity: 0.12;
    }
    100% {
        transform: rotate(45deg) translateX(100vw);
        opacity: 0;
    }
}

/* === Timeline Spine (Left Panel) === */
.timeline-spine {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #0a0e17;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    z-index: 3;
    overflow: hidden;
}

/* Score marks - horizontal lines every 80px */
.spine-score-marks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 79px,
        rgba(127, 200, 248, 0.08) 79px,
        rgba(127, 200, 248, 0.08) 80px
    );
    pointer-events: none;
}

/* Timeline Markers */
.timeline-marker {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
    z-index: 4;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.marker-year {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    height: 32px;
    padding: 0 12px;
    background: rgba(26, 39, 68, 0.55);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(127, 200, 248, 0.15);
    color: #7fc8f8;
    font-family: 'Exo 2', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    opacity: 0.5;
}

.timeline-marker.active .marker-year {
    opacity: 1;
    border-color: rgba(127, 200, 248, 0.6);
    box-shadow: 0 0 20px rgba(127, 200, 248, 0.15);
    transform: scale(1.1);
}

/* Border-animate for active marker */
.timeline-marker.active .marker-year::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background:
        linear-gradient(90deg, #7fc8f8, #7fc8f8) top left / 0% 2px no-repeat,
        linear-gradient(180deg, #7fc8f8, #7fc8f8) top right / 2px 0% no-repeat,
        linear-gradient(270deg, #7fc8f8, #7fc8f8) bottom right / 0% 2px no-repeat,
        linear-gradient(0deg, #7fc8f8, #7fc8f8) bottom left / 2px 0% no-repeat;
    animation: borderDraw 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes borderDraw {
    0% {
        background-size: 0% 2px, 2px 0%, 0% 2px, 2px 0%;
    }
    25% {
        background-size: 100% 2px, 2px 0%, 0% 2px, 2px 0%;
    }
    50% {
        background-size: 100% 2px, 2px 100%, 0% 2px, 2px 0%;
    }
    75% {
        background-size: 100% 2px, 2px 100%, 100% 2px, 2px 0%;
    }
    100% {
        background-size: 100% 2px, 2px 100%, 100% 2px, 2px 100%;
    }
}

/* Spine strata */
.spine-strata {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
}

/* === Narrative Flow (Right Panel) === */
.narrative-flow {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    position: relative;
    z-index: 3;
}

/* Hide scrollbar */
.narrative-flow::-webkit-scrollbar {
    width: 2px;
}
.narrative-flow::-webkit-scrollbar-track {
    background: #080c14;
}
.narrative-flow::-webkit-scrollbar-thumb {
    background: rgba(127, 200, 248, 0.2);
}

/* === Epoch Blocks === */
.epoch-block {
    min-height: 100vh;
    position: relative;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8vh 6vw;
    overflow: hidden;
}

/* === Monument Mode === */
.monument-mode {
    align-items: flex-start;
}

.monument-headline {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 7vw, 6rem);
    letter-spacing: -0.02em;
    color: #e8f0fe;
    line-height: 1.1;
    max-width: 90%;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease 0.4s, transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s;
    z-index: 2;
}

.epoch-block.visible .monument-headline {
    opacity: 1;
    transform: translateY(0);
}

.monument-illustration {
    position: absolute;
    bottom: 8vh;
    right: 4vw;
    width: 200px;
    height: 200px;
    transform: rotate(-12deg);
    opacity: 0.6;
    z-index: 1;
}

.nature-motif {
    width: 100%;
    height: 100%;
}

/* Tree Ring Container */
.tree-ring-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    z-index: 0;
    pointer-events: none;
}

.tree-rings {
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 2s ease;
}

.epoch-block.visible .tree-rings {
    opacity: 1;
}

.tree-rings path {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.epoch-block.visible .tree-rings path:nth-child(1) { opacity: 0.15; transition-delay: 0.2s; }
.epoch-block.visible .tree-rings path:nth-child(2) { opacity: 0.2; transition-delay: 0.5s; }
.epoch-block.visible .tree-rings path:nth-child(3) { opacity: 0.25; transition-delay: 0.8s; }
.epoch-block.visible .tree-rings path:nth-child(4) { opacity: 0.3; transition-delay: 1.1s; }
.epoch-block.visible .tree-rings path:nth-child(5) { opacity: 0.35; transition-delay: 1.4s; }
.epoch-block.visible .tree-rings path:nth-child(6) { opacity: 0.4; transition-delay: 1.7s; }

/* === Fragment Mode === */
.fragment-mode {
    align-items: center;
    padding: 12vh 4vw;
}

/* Frost Glass Cards */
.frost-card {
    background: rgba(26, 39, 68, 0.55);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(127, 200, 248, 0.25);
    padding: 32px 36px;
    margin: 12px 0;
    max-width: 520px;
    width: 100%;
    position: relative;
    transform: rotate(var(--card-rotation, 0deg));
    opacity: 0;
    transition: opacity 0.5s ease var(--card-delay, 0ms),
                transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) var(--card-delay, 0ms);
    box-shadow: 4px -2px 12px rgba(127, 200, 248, 0.08);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

/* Stagger positions for off-grid layout */
.frost-card.card-1 { align-self: flex-start; margin-left: 5%; }
.frost-card.card-2 { align-self: flex-end; margin-right: 3%; }
.frost-card.card-3 { align-self: flex-start; margin-left: 12%; }
.frost-card.card-4 { align-self: flex-end; margin-right: 8%; }
.frost-card.card-5 { align-self: flex-start; margin-left: 2%; }

.frost-card p {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    color: #b0c4de;
}

.epoch-block.visible .frost-card {
    opacity: 1;
}

/* Border-animate for frost cards */
.frost-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background:
        linear-gradient(90deg, #7fc8f8, #7fc8f8) top left / 0% 2px no-repeat,
        linear-gradient(180deg, #7fc8f8, #7fc8f8) top right / 2px 0% no-repeat,
        linear-gradient(270deg, #7fc8f8, #7fc8f8) bottom right / 0% 2px no-repeat,
        linear-gradient(0deg, #7fc8f8, #7fc8f8) bottom left / 2px 0% no-repeat;
    opacity: 0;
    pointer-events: none;
}

.frost-card.border-animated::before {
    opacity: 1;
    animation: borderDraw 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Hover states - skewX instead of scale */
.frost-card:hover {
    transform: rotate(var(--card-rotation, 0deg)) skewX(-2deg);
    border-color: rgba(127, 200, 248, 0.45);
}

/* === Fracture Lines === */
.fracture-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.fracture-line {
    position: absolute;
    height: 1px;
    background: #4ecdc4;
    opacity: 0;
    transform-origin: left center;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    width: 0;
}

.fracture-line.active {
    opacity: 0.3;
    width: 100%;
}

.fracture-line.fading {
    opacity: 0;
    transition: opacity 2s ease;
}

.fracture-line:nth-child(1) { top: 20%; left: 0; transform: rotate(15deg); }
.fracture-line:nth-child(2) { top: 35%; left: 10%; transform: rotate(37deg); }
.fracture-line:nth-child(3) { top: 55%; left: 5%; transform: rotate(52deg); }
.fracture-line:nth-child(4) { top: 70%; left: 15%; transform: rotate(78deg); }

/* === Geological Strata Bands === */
.strata-bands {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
}

.strata-line {
    width: 100%;
    height: 1px;
    background: #1a2744;
}

.strata-line:nth-child(1) { opacity: 0.08; height: 1px; }
.strata-line:nth-child(2) { opacity: 0.12; height: 2px; }
.strata-line:nth-child(3) { opacity: 0.10; height: 1px; }
.strata-line:nth-child(4) { opacity: 0.15; height: 3px; }
.strata-line:nth-child(5) { opacity: 0.09; height: 1px; }
.strata-line:nth-child(6) { opacity: 0.18; height: 2px; }
.strata-line:nth-child(7) { opacity: 0.11; height: 1px; }
.strata-line:nth-child(8) { opacity: 0.14; height: 2px; }

/* === Mountain Silhouette Horizon === */
.mountain-horizon {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8vh;
    z-index: 5;
    pointer-events: none;
}

.mountain-svg {
    width: 100%;
    height: 100%;
}

.mountain-fill {
    fill: #0a0e17;
}

.mountain-stroke {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.epoch-block.active-mountain ~ .mountain-horizon .mountain-stroke {
    opacity: 0.2;
}

/* === Diamond Navigation === */
.diamond-nav {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.3s ease;
}

.diamond-nav:hover {
    transform: scale(1.2);
}

.diamond-nav:hover .diamond-shape {
    background: rgba(127, 200, 248, 0.3);
    border-color: #7fc8f8;
}

.diamond-shape {
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
    border: 1.5px solid #ffffff;
    background: transparent;
    transition: all 0.3s ease;
}

/* === Responsive === */
@media (max-width: 768px) {
    body {
        grid-template-columns: 1fr;
    }

    .timeline-spine {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        flex-direction: row;
        justify-content: space-around;
        z-index: 50;
        background: rgba(10, 14, 23, 0.95);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .spine-score-marks {
        display: none;
    }

    .timeline-marker {
        padding: 8px 4px;
    }

    .marker-year {
        min-width: auto;
        height: 24px;
        padding: 0 6px;
        font-size: 0.6rem;
    }

    .narrative-flow {
        height: 100vh;
        padding-top: 60px;
    }

    body::before,
    body::after {
        display: none;
    }

    .spine-strata {
        display: none;
    }

    .monument-headline {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .frost-card {
        margin-left: 0 !important;
        margin-right: 0 !important;
        align-self: center !important;
        max-width: 90vw;
    }

    .tree-ring-container {
        width: 300px;
        height: 300px;
    }
}
