/* ==========================================================================
   bada.systems — Alpine Research Station Field Journal
   Palette: Monochrome warm grays
   Fonts: Bebas Neue, Libre Baskerville, Caveat
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --ink-black: #1a1a1a;
    --charcoal-graphite: #3d3d3b;
    --pencil-gray: #7a7a76;
    --smudge-gray: #b8b8b2;
    --erased-gray: #dcdcd6;
    --aged-paper: #f2f0eb;
    --blank-page: #faf9f6;
    --lead-pressed: #2b2b28;
    --ink-dark: #2b2b2b;
}

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

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

body {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: var(--ink-black);
    background-color: var(--aged-paper);
    overflow-x: hidden;
    position: relative;
}

/* --- Paper Texture Background --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at center, transparent 60%, rgba(26,26,26,0.04) 100%);
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.04;
    filter: url(#paper-noise);
    background-color: var(--pencil-gray);
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--aged-paper);
    z-index: 1;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.hero-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(2.8rem, 7vw, 6rem);
    letter-spacing: 0.12em;
    color: var(--ink-black);
    opacity: 0;
    filter: blur(2px);
    transition: opacity 1.4s ease-out, filter 1.4s ease-out;
}

.hero-title.visible {
    opacity: 1;
    filter: blur(0);
}

.hero-subtitle {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: clamp(0.9rem, 1.6vw, 1.1rem);
    color: var(--pencil-gray);
    margin-top: 0.8rem;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

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

.hero-timeline-start {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 200px;
    z-index: 2;
}

.timeline-line-hero {
    width: 2px;
    height: 100%;
    overflow: visible;
}

.timeline-line-hero line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease-out;
}

.timeline-line-hero.animate line {
    stroke-dashoffset: 0;
}

/* Distant Range in Hero */
.distant-range {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15vh;
    z-index: 1;
    transform: translateY(20px);
    transition: transform 1.4s ease-out;
}

.distant-range.visible {
    transform: translateY(0);
}

.distant-range-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==========================================================================
   NAVIGATION INDEX TAB
   ========================================================================== */
.nav-tab {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background-color: var(--blank-page);
    border: 1px solid var(--smudge-gray);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    clip-path: polygon(0% 0%, 85% 0%, 100% 15%, 100% 100%, 0% 100%);
}

.nav-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(26,26,26,0.06);
}

.nav-tab-label {
    font-family: 'Caveat', cursive;
    font-size: 0.85rem;
    color: var(--charcoal-graphite);
    writing-mode: vertical-lr;
    text-orientation: mixed;
    letter-spacing: 0.05em;
}

.nav-overlay {
    position: fixed;
    top: 0;
    right: -340px;
    width: 320px;
    height: 100vh;
    background-color: var(--blank-page);
    border-left: 1px solid var(--smudge-gray);
    z-index: 99;
    padding: 60px 30px 30px;
    transition: right 0.3s ease-out;
    overflow-y: auto;
}

.nav-overlay.open {
    right: 0;
}

.nav-panel-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: 1.4rem;
    letter-spacing: 0.08em;
    color: var(--ink-black);
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--smudge-gray);
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 1rem;
}

.nav-link {
    display: flex;
    align-items: baseline;
    text-decoration: none;
    color: var(--ink-black);
    gap: 0.5rem;
}

.nav-link:hover {
    color: var(--lead-pressed);
}

.nav-section-name {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 0.95rem;
    white-space: nowrap;
}

.nav-dots {
    flex: 1;
    border-bottom: 1px dotted var(--smudge-gray);
    min-width: 20px;
    margin-bottom: 4px;
}

.nav-page-num {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: var(--pencil-gray);
    white-space: nowrap;
}

/* ==========================================================================
   TIMELINE
   ========================================================================== */
.timeline {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
    z-index: 1;
}

.timeline-spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px dashed #2b2b2b;
    transform: translateX(-0.5px);
    z-index: 0;
}

/* ==========================================================================
   TIMELINE NODES
   ========================================================================== */
.timeline-node {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: clamp(6rem, 12vh, 10rem);
}

/* Left-aligned nodes */
.node-left {
    flex-direction: row-reverse;
    padding-right: calc(50% + 30px);
}

.node-left .node-connector {
    position: absolute;
    right: calc(50% - 30px);
    top: 16px;
    width: 30px;
    height: 0;
    border-top: 1px solid var(--pencil-gray);
    transform-origin: right center;
    transform: scaleX(0);
    transition: transform 0.3s ease-out;
}

.node-left .node-marker {
    position: absolute;
    right: calc(50% - 16px);
    top: 0;
}

/* Right-aligned nodes */
.node-right {
    padding-left: calc(50% + 30px);
}

.node-right .node-connector {
    position: absolute;
    left: calc(50% - 30px);
    top: 16px;
    width: 30px;
    height: 0;
    border-top: 1px solid var(--pencil-gray);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.3s ease-out;
}

.node-right .node-marker {
    position: absolute;
    left: calc(50% - 16px);
    top: 0;
}

/* Marker animations */
.node-marker {
    z-index: 2;
    transform: scale(0);
    transition: transform 0.4s ease-out;
}

.timeline-node.animate .node-marker {
    transform: scale(1);
}

.timeline-node.animate .node-connector {
    transform: scaleX(1);
    transition-delay: 0.4s;
}

/* Circle marker */
.circle-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--charcoal-graphite);
    background: var(--blank-page);
    margin: 10px;
}

/* Peak marker SVG */
.peak-marker {
    display: block;
}

/* ==========================================================================
   CONTENT CARDS
   ========================================================================== */
.content-card {
    background-color: var(--blank-page);
    max-width: 420px;
    padding: 2rem 2rem 1.5rem;
    position: relative;
    opacity: 0;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    border-top: 1px solid var(--smudge-gray);
    border-left: 1px solid var(--smudge-gray);
    border-right: 1px solid var(--smudge-gray);
}

.node-left .content-card {
    transform: translateX(15px);
    rotate: -0.5deg;
}

.node-right .content-card {
    transform: translateX(-15px);
    rotate: 0.3deg;
}

.timeline-node.animate .content-card {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.7s;
}

/* Torn-edge variations */
.card-tear-1 {
    clip-path: polygon(0% 0%, 100% 0%, 100% 92%, 97% 94%, 93% 91%, 88% 95%, 82% 93%, 78% 96%, 72% 92%, 66% 95%, 60% 93%, 55% 96%, 48% 92%, 42% 95%, 36% 93%, 30% 96%, 24% 92%, 18% 95%, 12% 93%, 6% 96%, 0% 93%);
}

.card-tear-2 {
    clip-path: polygon(0% 0%, 100% 0%, 100% 93%, 96% 95%, 91% 92%, 85% 96%, 80% 93%, 74% 95%, 68% 92%, 62% 96%, 56% 93%, 50% 95%, 44% 92%, 38% 96%, 32% 93%, 26% 95%, 20% 92%, 14% 96%, 8% 93%, 3% 95%, 0% 92%);
}

.card-tear-3 {
    clip-path: polygon(0% 0%, 100% 0%, 100% 94%, 95% 92%, 90% 95%, 84% 93%, 79% 96%, 73% 92%, 67% 95%, 61% 93%, 55% 96%, 49% 92%, 43% 95%, 37% 93%, 31% 96%, 25% 92%, 19% 95%, 13% 93%, 7% 96%, 2% 93%, 0% 95%);
}

.card-tear-4 {
    clip-path: polygon(0% 0%, 100% 0%, 100% 91%, 98% 94%, 94% 92%, 89% 95%, 83% 91%, 77% 94%, 71% 92%, 65% 95%, 59% 91%, 53% 94%, 47% 92%, 41% 95%, 35% 91%, 29% 94%, 23% 92%, 17% 95%, 11% 91%, 5% 94%, 0% 92%);
}

/* Card content typography */
.card-figure {
    display: block;
    font-family: 'Caveat', cursive;
    font-style: italic;
    font-size: clamp(0.9rem, 1.6vw, 1.1rem);
    color: var(--smudge-gray);
    margin-bottom: 0.5rem;
}

.card-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    letter-spacing: 0.08em;
    color: var(--ink-black);
    margin-bottom: 0.3rem;
    line-height: 1.1;
}

.card-date {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.9rem, 1.6vw, 1.1rem);
    color: var(--pencil-gray);
    margin-bottom: 1rem;
}

.card-text {
    color: var(--charcoal-graphite);
    margin-bottom: 0.8rem;
}

.card-text em {
    font-style: italic;
    color: var(--pencil-gray);
}

/* Annotation elements */
.card-annotation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    color: var(--smudge-gray);
}

.annotation-text {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.9rem, 1.6vw, 1.1rem);
    font-style: italic;
}

/* Compass Rose animation */
.compass-rose {
    animation: rotate-compass 4s linear infinite;
    animation-play-state: paused;
}

.card-annotation:hover .compass-rose {
    animation-play-state: running;
}

@keyframes rotate-compass {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Card marginalia */
.card-marginalia {
    position: absolute;
    bottom: 20%;
    right: -50px;
}

.node-left .card-marginalia {
    right: auto;
    left: -50px;
}

.arrow-annotation {
    transition: transform 0.3s ease-out;
}

.arrow-annotation:hover {
    transform: translateX(2px);
}

/* Figure number underline animation */
.card-figure {
    position: relative;
    display: inline-block;
}

.card-figure::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--smudge-gray);
    transition: width 0.3s ease-out;
}

.card-figure:hover::after {
    width: 100%;
}

/* ==========================================================================
   PARCHMENT DIVIDERS
   ========================================================================== */
.parchment-divider {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--erased-gray);
    opacity: 0.5;
    margin: 2rem 0;
}

.ridgeline-divider {
    display: block;
}

/* ==========================================================================
   TIMELINE FOOTER
   ========================================================================== */
.timeline-footer {
    text-align: center;
    padding-top: 4rem;
    position: relative;
}

.footer-marker {
    margin-bottom: 1.5rem;
}

.summit-flag {
    display: inline-block;
}

.footer-text {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--pencil-gray);
    margin-bottom: 0.3rem;
}

.footer-domain {
    font-family: 'Caveat', cursive;
    font-size: 1rem;
    color: var(--smudge-gray);
}

/* ==========================================================================
   BACKGROUND DISTANT RANGE (bottom parallax)
   ========================================================================== */
.bg-distant-range {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0.3;
}

.bg-range-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    .timeline-spine {
        left: 15%;
    }

    .node-left {
        flex-direction: row;
        padding-right: 0;
        padding-left: calc(15% + 30px);
    }

    .node-right {
        padding-left: calc(15% + 30px);
    }

    .node-left .node-marker,
    .node-right .node-marker {
        position: absolute;
        left: calc(15% - 16px);
        right: auto;
        top: 0;
    }

    .node-left .node-connector,
    .node-right .node-connector {
        position: absolute;
        left: calc(15%);
        right: auto;
        top: 16px;
        width: 30px;
        transform-origin: left center;
    }

    .content-card {
        max-width: 100%;
    }

    .node-left .content-card {
        rotate: 0deg;
    }

    .node-right .content-card {
        rotate: 0deg;
    }

    .card-marginalia {
        display: none;
    }

    .nav-tab {
        top: 16px;
        right: 16px;
    }

    .nav-overlay {
        width: 280px;
        right: -300px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .timeline {
        padding: 2rem 1rem 4rem;
    }

    .node-left,
    .node-right {
        padding-left: calc(15% + 20px);
    }

    .content-card {
        padding: 1.5rem 1.5rem 1.2rem;
    }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .hero-title {
        transition: none;
        opacity: 1;
        filter: none;
    }

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

    .distant-range {
        transition: none;
        transform: none;
    }

    .timeline-line-hero line {
        transition: none;
        stroke-dashoffset: 0;
    }

    .node-marker {
        transition: none;
        transform: scale(1);
    }

    .node-connector {
        transition: none;
        transform: scaleX(1) !important;
    }

    .content-card {
        transition: none;
        opacity: 1;
        transform: translateX(0) !important;
    }

    .compass-rose {
        animation: none;
    }

    [data-parallax] {
        transform: none !important;
    }
}