/* longitude.quest - Midnight Blue Cartographic Design */

/* ========================================
   CSS Custom Properties
   ======================================== */
:root {
    --bg-primary: #0b1120;
    --bg-secondary: #111d33;
    --meridian-blue: #4a6fa5;
    --highlight-blue: #7eb8da;
    --text-primary: #c8d6e5;
    --text-secondary: #6b7c93;
    --brass-accent: #d4a853;
    --font-headline: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-accent: 'Cormorant Garamond', serif;
    --gutter: 24px;
    --meridian-width: 120px;
}

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

html {
    scroll-behavior: smooth;
    background: var(--bg-primary);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.72;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    overflow-x: hidden;
}

/* ========================================
   Main Container & Meridian Spine
   ======================================== */
#meridian-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

#meridian-page::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--meridian-blue) 5%,
        var(--meridian-blue) 95%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* ========================================
   Coordinate Ticker
   ======================================== */
#coordinate-ticker {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    padding: 8px 14px;
    background: rgba(11, 17, 32, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(74, 111, 165, 0.2);
    border-radius: 2px;
}

#ticker-value {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

/* ========================================
   Section Base
   ======================================== */
.section {
    position: relative;
    width: 100%;
    padding: 120px 0;
}

.section-fullscreen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   Section 1: The Question (Hero)
   ======================================== */
.meridian-zone {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    z-index: 2;
}

.meridian-svg {
    width: 2px;
    height: 100%;
}

#intro-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawMeridian 1.8s cubic-bezier(0.25, 0.1, 0.25, 1.0) 0.5s forwards;
}

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

.section-content--center {
    text-align: center;
    z-index: 3;
    position: relative;
}

.hero-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 48px;
    opacity: 0;
    animation: fadeInUp 1.2s ease 2.3s forwards;
}

.hero-longitude {
    font-family: var(--font-headline);
    font-weight: 500;
    font-size: clamp(3rem, 7vw, 5.5rem);
    letter-spacing: 0.12em;
    color: var(--text-primary);
    text-transform: uppercase;
    line-height: 1.1;
}

.hero-quest {
    font-family: var(--font-headline);
    font-weight: 300;
    font-size: clamp(3rem, 7vw, 5.5rem);
    letter-spacing: 0.12em;
    color: var(--brass-accent);
    line-height: 1.1;
}

.hero-epigraph {
    max-width: 560px;
    margin: 0 auto;
    opacity: 0;
    animation: fadeInUp 1s ease 3s forwards;
}

.hero-epigraph em {
    font-family: var(--font-accent);
    font-weight: 300;
    font-style: italic;
    font-size: 1.4rem;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    display: block;
    margin-bottom: 12px;
    line-height: 1.6;
}

.epigraph-attribution {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    display: block;
}

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

/* ========================================
   Waypoints
   ======================================== */
.waypoint {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
    z-index: 5;
}

.compass-rose {
    width: 32px;
    height: 32px;
    animation: spinCompass 30s linear infinite;
}

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

.waypoint-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--meridian-blue);
    margin-top: 12px;
}

.waypoint.in-view .compass-rose {
    animation: spinCompass 30s linear infinite, pulseWaypoint 3.33s ease-in-out infinite;
}

@keyframes pulseWaypoint {
    0%, 100% { opacity: 0.7; transform: rotate(0deg) scale(1); }
    50% { opacity: 1; transform: rotate(180deg) scale(1.15); }
}

/* ========================================
   Section 2: The Grid
   ======================================== */
.meridian-line-continuous {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: var(--meridian-blue);
    transform: translateX(-50%);
    z-index: 1;
}

.globe-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
    position: relative;
    z-index: 2;
}

.globe-wireframe {
    width: 320px;
    height: 320px;
    max-width: 80vw;
}

.globe-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.globe-path.animate-in {
    stroke-dashoffset: 0;
}

/* Content Panels */
.content-panel {
    position: relative;
    max-width: 380px;
    padding: 40px 32px;
    background: var(--bg-secondary);
    border: 1px solid rgba(74, 111, 165, 0.15);
    z-index: 3;
    opacity: 0;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.panel-west {
    margin-left: calc(var(--gutter) * 2);
    margin-right: auto;
    transform: translateX(-60px);
}

.panel-east {
    margin-right: calc(var(--gutter) * 2);
    margin-left: auto;
    margin-top: 60px;
    transform: translateX(60px);
}

.content-panel.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.section-heading {
    font-family: var(--font-headline);
    font-weight: 500;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-subheading {
    font-family: var(--font-accent);
    font-weight: 300;
    font-style: italic;
    font-size: 1.2rem;
    letter-spacing: 0.02em;
    color: var(--highlight-blue);
    margin-bottom: 24px;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    color: var(--text-primary);
    margin-bottom: 16px;
}

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

/* ========================================
   Section 3: The Territory (City Panels)
   ======================================== */
.city-panel {
    position: relative;
    width: 100%;
    margin-bottom: 80px;
    overflow: hidden;
}

.city-photo {
    width: 100%;
    height: 60vh;
    position: relative;
    overflow: hidden;
    clip-path: inset(0 50% 0 50%);
    transition: clip-path 1.2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.city-photo.reveal {
    clip-path: inset(0 0 0 0);
}

.city-photo-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.city-photo--greenwich {
    background: var(--bg-secondary);
}

.city-photo--greenwich .city-photo-overlay {
    background: linear-gradient(135deg, rgba(11, 17, 32, 0.6) 0%, rgba(74, 111, 165, 0.3) 100%);
}

.city-photo--osaka {
    background: var(--bg-secondary);
}

.city-photo--osaka .city-photo-overlay {
    background: linear-gradient(135deg, rgba(11, 17, 32, 0.5) 0%, rgba(74, 111, 165, 0.35) 100%);
}

.city-photo--newyork {
    background: var(--bg-secondary);
}

.city-photo--newyork .city-photo-overlay {
    background: linear-gradient(135deg, rgba(11, 17, 32, 0.55) 0%, rgba(74, 111, 165, 0.25) 100%);
}

/* City grid pattern (generated procedural background) */
.city-grid-pattern {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.4;
}

.city-photo--greenwich .city-grid-pattern {
    background:
        repeating-linear-gradient(0deg, transparent, transparent 30px, rgba(74, 111, 165, 0.15) 30px, rgba(74, 111, 165, 0.15) 31px),
        repeating-linear-gradient(90deg, transparent, transparent 45px, rgba(74, 111, 165, 0.1) 45px, rgba(74, 111, 165, 0.1) 46px),
        radial-gradient(ellipse at 50% 60%, rgba(74, 111, 165, 0.2) 0%, transparent 70%);
}

.city-photo--osaka .city-grid-pattern {
    background:
        repeating-linear-gradient(0deg, transparent, transparent 18px, rgba(126, 184, 218, 0.12) 18px, rgba(126, 184, 218, 0.12) 19px),
        repeating-linear-gradient(90deg, transparent, transparent 18px, rgba(126, 184, 218, 0.12) 18px, rgba(126, 184, 218, 0.12) 19px),
        repeating-linear-gradient(45deg, transparent, transparent 40px, rgba(74, 111, 165, 0.08) 40px, rgba(74, 111, 165, 0.08) 41px),
        radial-gradient(circle at 40% 50%, rgba(126, 184, 218, 0.25) 0%, transparent 50%);
}

.city-photo--newyork .city-grid-pattern {
    background:
        repeating-linear-gradient(0deg, transparent, transparent 22px, rgba(74, 111, 165, 0.18) 22px, rgba(74, 111, 165, 0.18) 23px),
        repeating-linear-gradient(90deg, transparent, transparent 60px, rgba(74, 111, 165, 0.12) 60px, rgba(74, 111, 165, 0.12) 61px),
        linear-gradient(135deg, rgba(74, 111, 165, 0.15) 0%, transparent 40%, rgba(126, 184, 218, 0.1) 60%, transparent 80%),
        radial-gradient(ellipse at 30% 40%, rgba(212, 168, 83, 0.08) 0%, transparent 60%);
}

.city-label {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 32px 24px;
}

.city-coord {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--meridian-blue);
    margin-bottom: 8px;
}

.city-name {
    display: block;
    font-family: var(--font-headline);
    font-weight: 500;
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.city-detail {
    display: block;
    font-family: var(--font-accent);
    font-weight: 300;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* ========================================
   Section 4: The Resolution
   ======================================== */
#section-resolution {
    padding-bottom: 200px;
}

.resolution-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 24px;
}

.city-dots {
    width: 200px;
    height: 250px;
    margin-bottom: 60px;
}

.city-dot {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.city-dot.animate-in {
    opacity: 1;
    animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { r: 4; }
    50% { r: 6; }
}

.final-compass-container {
    margin-bottom: 48px;
}

.final-compass-rose {
    width: 120px;
    height: 120px;
    animation: spinCompass 30s linear infinite;
}

.compass-draw-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.compass-draw-path.animate-in {
    stroke-dashoffset: 0;
}

.longitude-labels {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 24px;
    max-width: 600px;
    margin-bottom: 60px;
}

.longitude-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--meridian-blue);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    white-space: nowrap;
}

.longitude-label.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.longitude-label em {
    font-family: var(--font-accent);
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: 4px;
}

.resolution-text {
    text-align: center;
    max-width: 480px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.resolution-text.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.resolution-text em {
    font-family: var(--font-accent);
    font-weight: 300;
    font-style: italic;
    font-size: 1.4rem;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    display: block;
    margin-bottom: 12px;
    line-height: 1.6;
}

/* ========================================
   Coordinate Navigation
   ======================================== */
#coord-nav {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 24px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#coord-nav.visible {
    opacity: 1;
    pointer-events: auto;
}

.coord-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 6px 12px;
    transition: transform 0.3s ease;
}

.coord-nav-item:hover {
    transform: scale(1.05);
}

.coord-readout {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--meridian-blue);
    transition: color 0.3s ease;
}

.coord-nav-item:hover .coord-readout {
    color: var(--highlight-blue);
}

.coord-name {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.coord-nav-item:hover .coord-name {
    max-height: 30px;
    opacity: 1;
}

.coord-nav-item.active .coord-readout {
    color: var(--highlight-blue);
}

/* ========================================
   Responsive: Mobile
   ======================================== */
@media (max-width: 768px) {
    #meridian-page::after {
        left: 24px;
        transform: none;
    }

    .meridian-line-continuous {
        left: 24px;
        transform: none;
    }

    .meridian-zone {
        left: 24px;
        transform: none;
    }

    .waypoint {
        align-items: flex-start;
        padding-left: 24px;
    }

    .panel-west,
    .panel-east {
        margin-left: 48px;
        margin-right: 24px;
        max-width: none;
    }

    .panel-east {
        margin-top: 40px;
    }

    .hero-longitude,
    .hero-quest {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .hero-epigraph em {
        font-size: 1.1rem;
    }

    .globe-container {
        padding-left: 48px;
    }

    .globe-wireframe {
        width: 240px;
        height: 240px;
    }

    #coord-nav {
        left: auto;
        right: 24px;
        top: auto;
        bottom: 80px;
        transform: none;
    }

    .city-photo {
        height: 40vh;
    }

    .longitude-labels {
        gap: 8px 16px;
    }

    .longitude-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .hero-longitude,
    .hero-quest {
        font-size: clamp(1.8rem, 12vw, 2.8rem);
        letter-spacing: 0.08em;
    }

    .content-panel {
        padding: 24px 20px;
    }

    .section-heading {
        font-size: 1rem;
    }

    .city-name {
        font-size: clamp(1.6rem, 6vw, 2.4rem);
    }
}
