/* ============================
   longitude.quest — styles.css
   Japanese-minimal navigation meditation
   ============================ */

:root {
    /* Palette — horizon to twilight */
    --horizon-light: #d4e0e8;
    --horizon-mid: #b8c8d4;
    --dusk-warm: #e0d8e4;
    --twilight-deep: #c4b8d8;
    --midnight-hint: #8a80a0;
    --text-primary: #2a2a38;
    --text-secondary: #6a6a7a;
    --horizon-line-color: #8a8a9a;
    --horizon-line-opacity: 0.30;
    --instrument-outline: #5a5a6a;
    --globe-meridian: #6a7a8a;
    --globe-meridian-opacity: 0.40;

    /* Typography */
    --font-display: 'Italiana', serif;
    --font-body: 'Crimson Pro', serif;
    --font-mono: 'DM Mono', monospace;

    /* Spacing */
    --section-gap: clamp(80px, 15vh, 200px);
    --column-width: 32em;

    /* Globe scroll multiplier */
    --scroll-velocity: 0;
}

/* ============================
   Reset & Base
   ============================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--text-primary);
    background: linear-gradient(
        180deg,
        var(--horizon-light) 0%,
        var(--horizon-mid) 25%,
        var(--dusk-warm) 50%,
        var(--twilight-deep) 80%,
        var(--midnight-hint) 100%
    );
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================
   Opening Section
   ============================ */

.section-opening {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.title-longitude {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(40px, 8vw, 100px);
    color: var(--text-primary);
    letter-spacing: 0.04em;
    line-height: 1.1;
    opacity: 0;
    transition: opacity 800ms ease;
}

.title-longitude.visible {
    opacity: 1;
}

.title-quest {
    display: block;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(14px, 2vw, 22px);
    color: var(--text-secondary);
    letter-spacing: 0.15em;
    text-transform: lowercase;
    font-variant: small-caps;
    margin-top: 0.3em;
    opacity: 0;
    transition: opacity 800ms ease;
}

.title-quest.visible {
    opacity: 1;
}

/* Horizon Line */
.horizon-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 1px;
    background: var(--horizon-line-color);
    opacity: var(--horizon-line-opacity);
    width: 0%;
    transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
}

#horizon-line-top {
    top: 50%;
    margin-top: 28px;
}

#horizon-line-bottom {
    bottom: 40%;
}

.horizon-line.drawn {
    width: 100%;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 600ms ease;
    animation: pulse-indicator 3s ease-in-out infinite;
}

.scroll-indicator.visible {
    opacity: 0.5;
}

@keyframes pulse-indicator {
    0%, 100% { opacity: 0; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.5; transform: translateX(-50%) translateY(4px); }
}

.scroll-indicator.visible {
    animation: pulse-indicator-active 3s ease-in-out infinite;
}

@keyframes pulse-indicator-active {
    0%, 100% { opacity: 0.3; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.6; transform: translateX(-50%) translateY(4px); }
}

/* ============================
   Content Sections — Shared
   ============================ */

.section-problem,
.section-solution,
.section-horizon {
    position: relative;
    padding: var(--section-gap) 24px;
}

.content-column {
    max-width: var(--column-width);
    margin: 0 auto;
    text-align: center;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(28px, 5vw, 56px);
    color: var(--text-primary);
    letter-spacing: 0.03em;
    margin-bottom: clamp(40px, 8vh, 80px);
}

.body-text {
    font-family: var(--font-body);
    font-size: clamp(16px, 1.6vw, 19px);
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: clamp(32px, 6vh, 64px);
    text-align: left;
}

.body-text.contemplative {
    font-weight: 300;
}

.body-text.factual {
    font-weight: 500;
}

/* Blur-focus entrance */
[data-blur] {
    filter: blur(4px);
    opacity: 0.7;
    transition: filter 800ms ease, opacity 800ms ease;
}

[data-blur].in-focus {
    filter: blur(0px);
    opacity: 1;
}

/* ============================
   Coordinate Labels
   ============================ */

.coord-label {
    position: absolute;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    opacity: 0.3;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.coord-left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.coord-right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
}

/* ============================
   CSS Scientific Instruments
   ============================ */

.instrument {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin: clamp(24px, 4vh, 48px) auto;
    position: relative;
}

/* Sextant — arc + arm + mirror triangle */
.instrument-sextant {
    width: 56px;
    height: 56px;
}

.sextant-arc {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 24px;
    border: 1px solid var(--instrument-outline);
    border-bottom: none;
    border-radius: 48px 48px 0 0;
}

.sextant-arm {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-30deg);
    width: 1px;
    height: 40px;
    background: var(--instrument-outline);
}

.sextant-mirror {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border: 1px solid var(--instrument-outline);
    background: transparent;
}

/* Chronometer — circle + hands + ticks */
.instrument-chronometer {
    width: 52px;
    height: 52px;
}

.chrono-face {
    position: absolute;
    inset: 0;
    border: 1px solid var(--instrument-outline);
    border-radius: 50%;
}

.chrono-hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    background: var(--instrument-outline);
}

.chrono-hand-hour {
    width: 1px;
    height: 14px;
    transform: translateX(-50%) rotate(-30deg);
}

.chrono-hand-minute {
    width: 1px;
    height: 19px;
    transform: translateX(-50%) rotate(60deg);
}

.chrono-tick {
    position: absolute;
    background: var(--instrument-outline);
}

.chrono-tick-12 {
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 5px;
}

.chrono-tick-3 {
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 5px;
    height: 1px;
}

.chrono-tick-6 {
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 5px;
}

.chrono-tick-9 {
    top: 50%;
    left: 4px;
    transform: translateY(-50%);
    width: 5px;
    height: 1px;
}

/* Compass — ring + needle + marks */
.instrument-compass {
    width: 52px;
    height: 52px;
}

.compass-ring {
    position: absolute;
    inset: 0;
    border: 1px solid var(--instrument-outline);
    border-radius: 50%;
}

.compass-needle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(15deg);
    width: 1px;
    height: 30px;
    background: linear-gradient(
        to bottom,
        var(--instrument-outline) 0%,
        var(--instrument-outline) 50%,
        var(--text-secondary) 50%,
        var(--text-secondary) 100%
    );
}

.compass-mark {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 7px;
    color: var(--instrument-outline);
    letter-spacing: 0;
}

.compass-n {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-e {
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
}

.compass-s {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-w {
    top: 50%;
    left: 5px;
    transform: translateY(-50%);
}

/* ============================
   CSS Globe
   ============================ */

.globe-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(40px, 8vh, 80px) 0;
}

.globe {
    position: relative;
    width: clamp(160px, 30vw, 280px);
    height: clamp(160px, 30vw, 280px);
    border-radius: 50%;
    overflow: hidden;
    animation: globe-rotate 30s linear infinite;
}

@keyframes globe-rotate {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

.globe-surface {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 35%,
        var(--horizon-light) 0%,
        var(--horizon-mid) 40%,
        var(--dusk-warm) 70%,
        var(--twilight-deep) 100%
    );
}

.globe-meridians {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    opacity: var(--globe-meridian-opacity);
    background: repeating-conic-gradient(
        from 0deg,
        var(--globe-meridian) 0deg,
        transparent 2deg,
        transparent 15deg,
        var(--globe-meridian) 15deg,
        transparent 17deg,
        transparent 30deg
    );
}

.globe-highlight {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.05) 30%,
        transparent 60%
    );
}

.globe-shadow {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(
        circle at 75% 70%,
        transparent 30%,
        rgba(42, 42, 56, 0.15) 70%,
        rgba(42, 42, 56, 0.30) 100%
    );
    box-shadow:
        inset -4px -4px 20px rgba(42, 42, 56, 0.12),
        4px 8px 24px rgba(42, 42, 56, 0.15);
}

/* ============================
   Closing Section — The Horizon
   ============================ */

.section-horizon {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.closing-content {
    text-align: center;
    padding: var(--section-gap) 24px;
}

.closing-text {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(24px, 4vw, 48px);
    color: var(--text-primary);
    letter-spacing: 0.03em;
    opacity: 0.85;
}

#horizon-line-bottom {
    position: relative;
    opacity: 0.5;
}

#horizon-line-bottom.drawn {
    width: 100%;
}

/* ============================
   Responsive adjustments
   ============================ */

@media (max-width: 768px) {
    .coord-label {
        display: none;
    }

    .content-column {
        padding: 0 8px;
    }

    .body-text {
        text-align: left;
    }

    .globe {
        width: clamp(140px, 60vw, 240px);
        height: clamp(140px, 60vw, 240px);
    }
}

@media (max-width: 480px) {
    .section-heading {
        font-size: clamp(24px, 8vw, 36px);
    }

    .title-longitude {
        font-size: clamp(32px, 12vw, 60px);
    }
}
