/* ======================================
   longitude.day - Blobitecture + Earth Tones
   ====================================== */

/* --- CSS Custom Properties --- */
:root {
    --bg-parchment: #F5EDD6;
    --surface-terracotta: #C67D4A;
    --surface-sienna: #A85C3B;
    --text-primary: #2B2118;
    --text-secondary: #6B5744;
    --grid-brass: #C4A882;
    --accent-amber: #E8A94D;
    --deep-mahogany: #3D1F0E;
    --highlight-sage: #8B9E6B;

    --ease-organic: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-underline: cubic-bezier(0.4, 0, 0.2, 1);

    /* Blob shapes (8-point border-radius) */
    --blob-1: 30% 70% 70% 30% / 30% 30% 70% 70%;
    --blob-2: 60% 40% 30% 70% / 60% 30% 70% 40%;
    --blob-3: 40% 60% 55% 45% / 45% 55% 45% 55%;
    --blob-4: 70% 30% 50% 50% / 35% 65% 35% 65%;
    --blob-5: 50% 50% 40% 60% / 55% 45% 55% 45%;
    --blob-6: 35% 65% 60% 40% / 40% 60% 40% 60%;
    --blob-7: 55% 45% 35% 65% / 65% 35% 65% 35%;
    --blob-8: 45% 55% 65% 35% / 50% 50% 50% 50%;
    --blob-9: 65% 35% 45% 55% / 55% 45% 55% 45%;
    --blob-10: 38% 62% 58% 42% / 42% 58% 42% 58%;
    --blob-11: 52% 48% 42% 58% / 62% 38% 62% 38%;
    --blob-12: 48% 52% 55% 45% / 38% 62% 38% 62%;

    /* Blob hover shapes */
    --blob-1-hover: 40% 60% 60% 40% / 40% 40% 60% 60%;
    --blob-2-hover: 50% 50% 40% 60% / 50% 40% 60% 50%;
    --blob-3-hover: 50% 50% 45% 55% / 55% 45% 55% 45%;
    --blob-4-hover: 60% 40% 40% 60% / 45% 55% 45% 55%;
    --blob-5-hover: 45% 55% 50% 50% / 50% 50% 50% 50%;
    --blob-6-hover: 45% 55% 50% 50% / 50% 50% 50% 50%;
    --blob-7-hover: 45% 55% 45% 55% / 55% 45% 55% 45%;
    --blob-8-hover: 55% 45% 55% 45% / 45% 55% 45% 55%;
    --blob-9-hover: 55% 45% 55% 45% / 45% 55% 45% 55%;
    --blob-10-hover: 48% 52% 48% 52% / 52% 48% 52% 48%;
    --blob-11-hover: 48% 52% 48% 52% / 52% 48% 52% 48%;
    --blob-12-hover: 52% 48% 48% 52% / 48% 52% 48% 52%;

    --blob-footer: 60% 60% 0% 0% / 20% 20% 0% 0%;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-parchment);
    color: var(--text-primary);
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'opsz' 14;
    font-weight: 350;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

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

/* --- Background Grid --- */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.grid-lines {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image:
        /* Prime Meridian (center, thicker) */
        linear-gradient(to right, transparent calc(50% - 1px), rgba(232, 169, 77, 0.15) calc(50% - 1px), rgba(232, 169, 77, 0.15) calc(50% + 1px), transparent calc(50% + 1px)),
        /* Vertical meridians */
        repeating-linear-gradient(to right, transparent, transparent calc(100% / 12 - 1px), rgba(196, 168, 130, 0.08) calc(100% / 12 - 1px), rgba(196, 168, 130, 0.08) calc(100% / 12), transparent calc(100% / 12)),
        /* Horizontal parallels */
        repeating-linear-gradient(to bottom, transparent, transparent 79px, rgba(196, 168, 130, 0.08) 79px, rgba(196, 168, 130, 0.08) 80px, transparent 80px);
    transition: transform 2s var(--ease-organic);
}

/* Grid intersection dots via pseudo-element */
.grid-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle 2px at center, rgba(196, 168, 130, 0.12) 50%, transparent 50%);
    background-size: calc(100% / 12) 80px;
    background-position: calc(100% / 24) 40px;
}

/* --- Navigation Blob --- */
.nav-blob {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 100;
    background: var(--surface-terracotta);
    border-radius: var(--blob-5);
    padding: 0.6rem 1.2rem;
    box-shadow:
        0 4px 20px rgba(43, 33, 24, 0.2),
        inset 0 2px 12px rgba(43, 33, 24, 0.15);
    filter: url(#leather-noise);
    transition: border-radius 1.2s var(--ease-organic), transform 0.6s var(--ease-organic);
}

.nav-blob:hover {
    border-radius: var(--blob-5-hover);
    transform: scale(1.05);
}

.nav-coord {
    font-family: 'Azeret Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bg-parchment);
    white-space: nowrap;
}

/* --- Blob Base Styles --- */
.blob {
    position: relative;
    box-shadow:
        0 8px 40px rgba(43, 33, 24, 0.15),
        inset 0 2px 12px rgba(43, 33, 24, 0.15);
    transition:
        border-radius 1.2s var(--ease-organic),
        transform 0.6s var(--ease-organic),
        background-color 0.8s var(--ease-organic);
    filter: url(#leather-noise);
}

.blob-1 { border-radius: var(--blob-1); }
.blob-2 { border-radius: var(--blob-2); }
.blob-3 { border-radius: var(--blob-3); }
.blob-4 { border-radius: var(--blob-4); }
.blob-5 { border-radius: var(--blob-5); }
.blob-6 { border-radius: var(--blob-6); }
.blob-7 { border-radius: var(--blob-7); }
.blob-8 { border-radius: var(--blob-8); }
.blob-9 { border-radius: var(--blob-9); }
.blob-10 { border-radius: var(--blob-10); }
.blob-11 { border-radius: var(--blob-11); }
.blob-12 { border-radius: var(--blob-12); }

.blob-1:hover { border-radius: var(--blob-1-hover); }
.blob-2:hover { border-radius: var(--blob-2-hover); }
.blob-3:hover { border-radius: var(--blob-3-hover); }
.blob-4:hover { border-radius: var(--blob-4-hover); }
.blob-5:hover { border-radius: var(--blob-5-hover); }
.blob-6:hover { border-radius: var(--blob-6-hover); }
.blob-7:hover { border-radius: var(--blob-7-hover); }
.blob-8:hover { border-radius: var(--blob-8-hover); }
.blob-9:hover { border-radius: var(--blob-9-hover); }
.blob-10:hover { border-radius: var(--blob-10-hover); }
.blob-11:hover { border-radius: var(--blob-11-hover); }
.blob-12:hover { border-radius: var(--blob-12-hover); }

/* --- Typography --- */
.section-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-variation-settings: 'opsz' 48, 'wdth' 100;
    font-weight: 750;
    font-size: clamp(1.4rem, 3.5vw, 2.4rem);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
}

.hero-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-variation-settings: 'opsz' 48, 'wdth' 100;
    font-weight: 800;
    font-size: clamp(2.2rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.05em;
    margin-bottom: 1.5rem;
}

.letter {
    display: inline-block;
    transition: transform 0.6s var(--ease-organic);
}

/* Wave-like vertical offsets for hero letters */
.letter-l { transform: translateY(0px); }
.letter-o { transform: translateY(6px); }
.letter-n { transform: translateY(10px); }
.letter-g { transform: translateY(8px); }
.letter-i { transform: translateY(3px); }
.letter-t { transform: translateY(-2px); }
.letter-u { transform: translateY(5px); }
.letter-d { transform: translateY(9px); }
.letter-e { transform: translateY(2px); }

.hero-subtitle {
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'opsz' 14;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.8;
    color: var(--text-secondary);
    text-align: center;
    max-width: 38em;
    margin: 0 auto;
}

.narrative-text {
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'opsz' 14;
    font-weight: 350;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    color: var(--text-secondary);
    max-width: 38em;
    margin-bottom: 1.2rem;
}

.narrative-text:last-child {
    margin-bottom: 0;
}

.coord-label {
    font-family: 'Azeret Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-amber);
    display: block;
    margin-bottom: 0.6rem;
}

/* --- Underline Draw Animation --- */
.underline-draw {
    background-image: linear-gradient(var(--accent-amber), var(--accent-amber));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    padding-bottom: 2px;
    transition: background-size 0.8s var(--ease-underline);
}

.underline-draw.is-visible {
    background-size: 100% 2px;
}

/* --- ZONE 1: Hero --- */
.zone {
    position: relative;
    z-index: 1;
}

.zone-hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.hero-blob {
    width: 85%;
    max-width: 900px;
    min-height: 60vh;
    background: radial-gradient(ellipse at 30% 30%, #d99560, var(--surface-terracotta) 60%, #b36a3d);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    animation: breathe 6s var(--ease-organic) infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(0.98); }
    50% { transform: scale(1.02); }
}

/* --- ZONE 2: The Problem --- */
.zone-problem {
    padding: clamp(4rem, 8vw, 8rem) 2rem;
    display: flex;
    flex-direction: column;
    gap: clamp(4rem, 8vw, 8rem);
    align-items: center;
}

.narrative-blob {
    width: min(85%, 700px);
    padding: clamp(2rem, 4vw, 3.5rem);
    background: radial-gradient(ellipse at 30% 30%, #d99560, var(--surface-terracotta) 60%, #b36a3d);
    opacity: 0;
    transform: translateX(-60px);
    transition:
        opacity 1s var(--ease-organic),
        transform 1s var(--ease-organic),
        border-radius 1.2s var(--ease-organic);
}

.narrative-blob.drift-right {
    transform: translateX(60px);
    align-self: flex-end;
}

.narrative-blob.drift-left {
    align-self: flex-start;
}

.narrative-blob.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.narrative-blob.drift-left {
    margin-left: 15%;
}

.narrative-blob.drift-right {
    margin-right: 15%;
}

/* --- Compass Divider --- */
.compass-divider {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
    opacity: 0.5;
    position: relative;
    z-index: 1;
}

.compass-rose {
    transition: transform 1.2s var(--ease-organic);
}

.compass-divider:hover .compass-rose {
    transform: rotate(45deg);
}

/* --- ZONE 3: Meridians --- */
.zone-meridians {
    padding: clamp(4rem, 8vw, 8rem) 2rem;
    text-align: center;
}

.meridians-heading {
    margin-bottom: clamp(3rem, 6vw, 6rem);
    color: var(--text-primary);
}

.meridian-constellation {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.5rem, 3vw, 2.5rem);
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.meridian-blob {
    padding: clamp(1.5rem, 2.5vw, 2.5rem);
    background: radial-gradient(ellipse at 40% 30%, #d99560, var(--surface-terracotta) 60%, #b36a3d);
    text-align: center;
    cursor: default;
    opacity: 0;
    transform: scale(0.85) translateY(30px);
    transition:
        opacity 0.8s var(--ease-organic),
        transform 0.8s var(--ease-organic),
        border-radius 1.2s var(--ease-organic),
        background-color 0.6s var(--ease-organic);
}

.meridian-blob.is-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.meridian-blob:hover {
    transform: scale(1.05);
    background: radial-gradient(ellipse at 40% 30%, #c47f47, var(--surface-sienna) 60%, #8f4e2f);
}

.meridian-degree {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.meridian-name {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.3rem;
}

.meridian-detail {
    font-family: 'Literata', Georgia, serif;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-secondary);
    display: block;
}

/* --- ZONE 4: Resolution --- */
.zone-resolution {
    padding: clamp(4rem, 8vw, 8rem) 2rem;
    display: flex;
    justify-content: center;
}

.resolution-blob {
    width: min(85%, 800px);
    padding: clamp(2.5rem, 5vw, 4rem);
    background: radial-gradient(ellipse at 30% 40%, #5a3018, var(--deep-mahogany) 70%, #2a1008);
    opacity: 0;
    transform: translateY(80px);
    transition:
        opacity 1.2s var(--ease-organic),
        transform 1.2s var(--ease-organic),
        border-radius 1.2s var(--ease-organic);
}

.resolution-blob.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.resolution-blob .section-title {
    color: var(--bg-parchment);
}

.resolution-blob .narrative-text {
    color: rgba(245, 237, 214, 0.8);
}

.resolution-blob .coord-label {
    color: var(--accent-amber);
}

.resolution-blob .underline-draw {
    background-image: linear-gradient(var(--accent-amber), var(--accent-amber));
}

/* --- ZONE 5: Footer --- */
.zone-footer {
    padding: 0 0 0 0;
    margin-top: clamp(4rem, 8vw, 8rem);
}

.footer-blob {
    width: 100%;
    border-radius: var(--blob-footer);
    background: radial-gradient(ellipse at 50% 30%, #4a2812, var(--deep-mahogany) 70%, #1a0b04);
    padding: clamp(4rem, 8vw, 8rem) 2rem clamp(3rem, 5vw, 5rem);
    text-align: center;
    animation: breathe-slow 12s var(--ease-organic) infinite;
    box-shadow:
        0 -8px 40px rgba(43, 33, 24, 0.25),
        inset 0 2px 12px rgba(43, 33, 24, 0.2);
    filter: url(#leather-noise);
}

@keyframes breathe-slow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.005); }
}

.footer-coord {
    font-family: 'Azeret Mono', monospace;
    font-weight: 400;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.06em;
    color: var(--accent-amber);
    display: block;
    margin-bottom: 1.5rem;
}

.footer-text {
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'opsz' 14;
    font-weight: 300;
    font-size: 1rem;
    color: rgba(245, 237, 214, 0.4);
    letter-spacing: 0.1em;
}

/* --- Decorative Route Lines --- */
.route-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 500vh;
    pointer-events: none;
    z-index: 0;
}

.route-path {
    fill: none;
    stroke: var(--grid-brass);
    stroke-width: 1.5;
    stroke-dasharray: 8 4;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s var(--ease-organic);
}

.route-path.is-drawn {
    stroke-dashoffset: 0;
}

/* --- Floating Longitude Markers --- */
.longitude-markers {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lng-marker {
    font-family: 'Azeret Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--grid-brass);
    opacity: 0;
    transform: translateX(20px);
    transition:
        opacity 0.8s var(--ease-organic),
        transform 0.8s var(--ease-organic);
    white-space: nowrap;
}

.lng-marker.is-active {
    opacity: 0.6;
    transform: translateX(0);
}

/* --- Scroll-based background darkening --- */
body.zone-dark {
    background-color: #e8ddc0;
    transition: background-color 2s var(--ease-organic);
}

body.zone-deeper {
    background-color: #d4c8a8;
    transition: background-color 2s var(--ease-organic);
}

body.zone-deepest {
    background-color: #c0b48f;
    transition: background-color 2s var(--ease-organic);
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .meridian-constellation {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
    }

    .narrative-blob.drift-left,
    .narrative-blob.drift-right {
        margin-left: 0;
        margin-right: 0;
        align-self: center;
        width: min(92%, 700px);
    }

    .longitude-markers {
        display: none;
    }

    .hero-blob {
        width: 92%;
    }

    .nav-blob {
        top: 1rem;
        left: 1rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .meridian-constellation {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: clamp(1.8rem, 10vw, 3rem);
    }
}
