/* longitude.quest — cinematic, paper-aged navigator's reverie
   Five-swatch flat palette, no gradients, condensed typography.
   --------------------------------------------------------------- */

:root {
    /* Palette */
    --teal:        #1B2A3A;  /* Watchroom Teal — the night */
    --orange:      #E76A2B;  /* Tungsten Orange — the lamp */
    --cream:       #F2EADC;  /* Vellum Cream — the paper */
    --ink:         #2A2622;  /* Charcoal Ink — the line */
    --slate:       #7C8B92;  /* Slate Sea — the silence */

    /* Typography */
    --display: "Bebas Neue", "Oswald", "Arial Narrow", sans-serif;
    --body: "Saira Condensed", "Roboto Condensed", "Helvetica Neue", sans-serif;
    --italic: "Cormorant Garamond", "Times New Roman", serif;

    /* Geometry */
    --letterbox: 12vh;          /* 2.39:1 cinematic letterbox */
    --frame-h: 76vh;
    --hairline: 1px;
    --tracking: 0.18em;

    /* Easing */
    --ease-set: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--teal);
    color: var(--cream);
    font-family: var(--body);
    font-weight: 300;
    font-size: 16px;
    line-height: 1.55;
    cursor: none;
    overflow-x: hidden;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* a/button reset */
a { color: inherit; text-decoration: none; cursor: none; }
button { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: none; }

/* Hide the SVG defs */
.paper-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Custom crosshair cursor ----- */
.crosshair {
    position: fixed;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    transition: opacity 220ms linear;
}

.crosshair .cx-h,
.crosshair .cx-v {
    position: absolute;
    background: var(--cream);
    transition: background 200ms linear, transform 200ms var(--ease-set);
}

.crosshair .cx-h {
    top: 7.5px;
    left: 0;
    width: 16px;
    height: 1px;
}

.crosshair .cx-v {
    top: 0;
    left: 7.5px;
    width: 1px;
    height: 16px;
}

.crosshair.over .cx-h,
.crosshair.over .cx-v {
    background: var(--orange);
}

.crosshair.over .cx-h { transform: scaleX(1.4); }
.crosshair.over .cx-v { transform: scaleY(1.4); }

/* ----- Meridian (the only navigation) ----- */
.meridian {
    position: fixed;
    top: 0;
    left: 50vw;
    width: 0;
    height: 100vh;
    z-index: 50;
    pointer-events: none;
    transform: translateX(-50%);
}

.meridian-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100vh;
    background: var(--slate);
    opacity: 0.55;
    transform: translateX(-0.5px);
}

.tick {
    position: absolute;
    left: 0;
    transform: translate(-50%, -50%);
    width: 80px;
    text-align: center;
    pointer-events: auto;
    font-family: var(--body);
    font-weight: 300;
    font-size: 10px;
    letter-spacing: 0.16em;
    color: var(--slate);
    transition: color 200ms linear;
}

.tick .tick-mark {
    display: block;
    width: 9px;
    height: 1px;
    background: var(--slate);
    margin: 0 auto 6px;
    transition: background 200ms linear, width 200ms var(--ease-set);
}

.tick .tick-label {
    display: block;
    font-variant-numeric: tabular-nums;
}

.tick.is-active {
    color: var(--orange);
}

.tick.is-active .tick-mark {
    background: var(--orange);
    width: 14px;
}

/* Distribute eleven ticks evenly down the viewport */
.tick[data-shot="1"]  { top: 6vh; }
.tick[data-shot="2"]  { top: 14.8vh; }
.tick[data-shot="3"]  { top: 23.6vh; }
.tick[data-shot="4"]  { top: 32.4vh; }
.tick[data-shot="5"]  { top: 41.2vh; }
.tick[data-shot="6"]  { top: 50vh; }
.tick[data-shot="7"]  { top: 58.8vh; }
.tick[data-shot="8"]  { top: 67.6vh; }
.tick[data-shot="9"]  { top: 76.4vh; }
.tick[data-shot="10"] { top: 85.2vh; }
.tick[data-shot="11"] { top: 94vh; }

/* On cream sections, color the meridian darker */
.shot.cream ~ .meridian { /* placeholder for theming sibling */ }

/* ----- The Shot (one section per viewport) ----- */
.shot {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    height: 100vh;
    display: block;
    overflow: hidden;
}

.shot.teal {
    background: var(--teal);
    color: var(--cream);
}

.shot.cream {
    background: var(--cream);
    color: var(--ink);
}

/* Letterbox bands */
.letterbox {
    position: absolute;
    left: 0;
    width: 100vw;
    height: var(--letterbox);
    background: #0E1620;
    z-index: 4;
    pointer-events: none;
}

.shot.cream .letterbox {
    background: #1B2028;
}

.letterbox.top { top: 0; }
.letterbox.bottom { bottom: 0; }

/* The 76vh content frame */
.frame {
    position: absolute;
    top: var(--letterbox);
    left: 0;
    width: 100vw;
    height: var(--frame-h);
    padding: 0 6vw;
}

.shot-meta {
    position: absolute;
    top: 1.6vh;
    left: 6vw;
    font-family: var(--body);
    font-weight: 300;
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--slate);
    display: flex;
    gap: 1.4em;
}

.shot-meta .shot-num { font-variant-numeric: tabular-nums; }

/* Horizon rule (the section divider) */
.horizon {
    position: absolute;
    left: 6vw;
    right: 6vw;
    top: 38.2%;
    height: 0;
    margin: 0;
    border: 0;
    border-top: 1px solid var(--ink);
    transform-origin: 0 50%;
    transform: scaleX(0);
    transition: transform 1.4s var(--ease-set);
    z-index: 3;
}

.shot.teal .horizon { border-top-color: var(--cream); opacity: 0.62; }
.shot.cream .horizon { border-top-color: var(--ink); opacity: 0.85; }

.shot.is-revealed .horizon { transform: scaleX(1); }

.horizon.emphatic {
    border-top-width: 1px;
}

/* Frame grid layouts */
.frame-grid {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: 1.5vw;
    row-gap: 2vh;
    align-items: end;
    padding-bottom: 5vh;
}

.frame-grid.empty { display: block; }

.frame-grid.stack {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    gap: 2.6vh;
}

.frame-grid.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4vh 0;
    gap: 4vh;
}

.frame-grid.final {
    justify-content: center;
}

.frame-grid.prime {
    gap: 5vh;
}

.frame-grid.log {
    align-items: flex-start;
    text-align: left;
    padding: 4vh 8vw;
    gap: 2vh;
}

/* ----- Paper-aged texture overlay (cream sections) ----- */
.shot.paper {
    background-color: var(--cream);
}

.shot.paper::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image:
        radial-gradient(120% 90% at 50% 50%, rgba(42,38,34,0) 0%, rgba(42,38,34,0) 56%, rgba(42,38,34,0.10) 86%, rgba(42,38,34,0.16) 100%),
        repeating-radial-gradient(circle at 23% 41%, rgba(42,38,34,0.018) 0px, rgba(42,38,34,0.018) 1px, transparent 1px, transparent 3px),
        repeating-linear-gradient(43deg, rgba(42,38,34,0.022) 0px, rgba(42,38,34,0.022) 1px, transparent 1px, transparent 4px),
        repeating-linear-gradient(127deg, rgba(231,106,43,0.014) 0px, rgba(231,106,43,0.014) 1px, transparent 1px, transparent 5px);
    mix-blend-mode: multiply;
}

.shot.paper::after {
    /* edge foxing */
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    box-shadow:
        inset 0 0 80px rgba(42,38,34,0.12),
        inset 0 0 140px rgba(42,38,34,0.05);
}

/* ----- Shot 1: MERIDIAN (compass) ----- */
.compass-wrap {
    grid-column: 1 / span 12;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 4vh;
    height: 50vh;
}

.compass {
    width: 22vw;
    min-width: 240px;
    max-width: 360px;
    height: auto;
    overflow: visible;
}

.compass .ring,
.compass .ring.sub {
    fill: none;
    stroke: var(--cream);
    stroke-width: 1;
    opacity: 0.78;
}

.compass .ring.sub {
    opacity: 0.32;
    stroke-dasharray: 1 4;
}

.compass .pivot {
    fill: var(--orange);
}

.compass .cardinal {
    fill: var(--cream);
    font-family: var(--display);
    font-size: 14px;
    letter-spacing: 0.16em;
}

.compass .compass-card {
    transform-origin: 0 0;
    animation: compass-rot 150s linear infinite;  /* 0.4 rpm */
}

.compass .needle {
    stroke: var(--orange);
    stroke-width: 1.2;
    stroke-linecap: round;
    transform-origin: 0 0;
    animation: needle-rot 150s linear infinite reverse;
}

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

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

.compass .ticks-32 line {
    stroke: var(--cream);
    stroke-width: 0.7;
}

/* Above-the-fold horizon-text */
.horizon-text {
    grid-column: 1 / span 12;
    align-self: center;
    text-align: center;
    margin: 0;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3.4vw, 3.4rem);
    letter-spacing: var(--tracking);
    line-height: 1.1;
    color: var(--cream);
    text-transform: uppercase;
    padding-top: 4vh;
}

/* ----- Body copy (the reckon-lines) ----- */
.reckon-line {
    font-family: var(--body);
    font-weight: 300;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.6;
    color: var(--ink);
    max-width: 56ch;
    margin: 0;
    letter-spacing: 0.01em;
}

.shot.teal .reckon-line, .reckon-line.teal-body {
    color: var(--cream);
}

.reckon-line.small {
    font-size: 0.95rem;
    color: var(--slate);
}

.reckon-line.italic em,
.italic em,
em {
    font-family: var(--italic);
    font-style: italic;
    font-weight: 400;
    color: inherit;
    letter-spacing: 0.005em;
}

/* ----- The unfold toggle (the only buttons besides ticks) ----- */
.unfold {
    font: inherit;
    color: inherit;
    border-bottom: 1px solid var(--orange);
    padding-bottom: 1px;
    transition: color 220ms linear, border-color 220ms linear;
    line-height: inherit;
    display: inline;
}

.unfold:hover { color: var(--orange); }

.unfold[aria-expanded="true"] {
    color: var(--orange);
    border-bottom-style: dashed;
}

.folded {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    max-width: 0;
    max-height: 0;
    opacity: 0;
    transform: translateY(-4px);
    transition:
        max-height 600ms var(--ease-set),
        max-width 600ms var(--ease-set),
        opacity 480ms linear 80ms,
        transform 600ms var(--ease-set),
        margin 600ms var(--ease-set);
    color: var(--slate);
    font-family: var(--italic);
    font-style: italic;
    font-weight: 400;
    font-size: 0.95em;
    letter-spacing: 0.005em;
    margin: 0;
    will-change: max-height, max-width, opacity;
}

.shot.teal .folded { color: var(--slate); }

.folded[hidden] { display: inline-block; }

.folded.is-open {
    max-width: 100%;
    max-height: 12em;
    opacity: 1;
    transform: translateY(0);
    margin: 0 0.1em;
    display: block;
    width: 100%;
    padding: 0.6em 0 0;
    border-top: 1px dashed rgba(124,139,146,0.4);
}

/* ----- Shot 3: CHRONOMETER ----- */
.chrono-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2vh;
}

.chrono {
    width: 26vw;
    min-width: 260px;
    max-width: 380px;
    height: auto;
    overflow: visible;
}

.chrono .dial {
    fill: none;
    stroke: var(--cream);
    stroke-width: 1;
    opacity: 0.62;
}

.chrono .dial.outer { opacity: 0.92; }
.chrono .dial.balance { opacity: 0.32; stroke-dasharray: 2 5; }
.chrono .dial.pivot { fill: var(--orange); stroke: none; }

.chrono .roman {
    fill: var(--cream);
    font-family: var(--display);
    font-size: 11px;
    letter-spacing: 0.16em;
    opacity: 0.92;
}

.chrono .maker {
    fill: var(--slate);
    font-family: var(--body);
    font-size: 6px;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    opacity: 0.7;
}

.chrono .chrono-ticks line {
    stroke: var(--cream);
    stroke-width: 0.6;
}

.chrono .second-hand {
    stroke: var(--orange);
    stroke-width: 1.2;
    stroke-linecap: round;
    transform-origin: 0 0;
}

.chrono-caption {
    font-family: var(--body);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--slate);
    margin: 0;
}

/* ----- Shot 4: SEXTANT ----- */
.sextant-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sextant {
    width: 38vw;
    min-width: 320px;
    max-width: 540px;
    height: auto;
    overflow: visible;
}

.sextant .arc {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1;
    opacity: 0.92;
}

.sextant .index-arm {
    stroke: var(--orange);
    stroke-width: 1.4;
    stroke-linecap: round;
    transform-origin: 0 140px;
    transform: rotate(-60deg);
    transition: transform 90ms linear;
}

.sextant .sx-pivot {
    fill: var(--orange);
}

.sextant .sextant-ticks line {
    stroke: var(--ink);
    stroke-width: 0.7;
}

.sextant .deg-label {
    fill: var(--slate);
    font-family: var(--body);
    font-size: 9px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.sextant .deg-readout {
    fill: var(--orange);
    font-family: var(--display);
    font-size: 16px;
    letter-spacing: 0.18em;
    font-variant-numeric: tabular-nums;
}

/* ----- Shot 5: HORIZON (empty stage) ----- */
.horizon-shot .horizon { top: 50%; }

/* ----- Shot 6: STAR CHART ----- */
.starchart-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.starchart {
    width: 26vw;
    min-width: 260px;
    max-width: 380px;
    height: auto;
    overflow: visible;
}

.starchart .ring {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1;
    opacity: 0.85;
}

.starchart .ring.sub {
    opacity: 0.34;
    stroke-dasharray: 1 4;
}

.starchart .declination-ticks line {
    stroke: var(--ink);
    stroke-width: 0.6;
    opacity: 0.55;
}

.starchart .star-dot {
    fill: var(--ink);
}

.starchart .star-label {
    fill: var(--slate);
    font-family: var(--body);
    font-size: 8px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.pinhole {
    position: absolute;
    top: calc(var(--letterbox) + 2vh);
    left: 8vw;
    width: 2px;
    height: 2px;
    background: var(--ink);
    border-radius: 50%;
    z-index: 5;
}

/* ----- Shot 7: PARALLAX (the fold-crease shot) ----- */
.fold-crease {
    position: absolute;
    left: 0;
    right: 0;
    top: 61.8%; /* golden section */
    height: 1px;
    background: rgba(255,255,255,0.55);
    box-shadow:
        0 -1px 2px rgba(42,38,34,0.06),
        0  1px 2px rgba(42,38,34,0.06);
    z-index: 2;
    pointer-events: none;
}

.footnote-title {
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    letter-spacing: 0.32em;
    color: var(--ink);
    margin: 0;
    text-transform: uppercase;
}

/* ----- Shot 8: PRIME MERIDIAN ----- */
.prime-wrap {
    position: relative;
    width: 100%;
    height: 56vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prime-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 56vh;
    background: var(--cream);
    transform: translateX(-50%);
    opacity: 0.85;
}

.prime-tick {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 1px;
    background: var(--orange);
    transform: translate(-50%, -50%);
}

.prime-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(18px, -50%);
    font-family: var(--display);
    font-size: 14px;
    letter-spacing: 0.22em;
    color: var(--orange);
}

.prime-anno {
    position: absolute;
    bottom: 4vh;
    left: 50%;
    transform: translate(-50%, 0);
    font-family: var(--body);
    font-weight: 300;
    font-size: 9px;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    color: var(--slate);
}

/* ----- Shot 9: DRIFT ----- */
.drift-date {
    font-family: var(--italic);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--slate);
    margin: 0 0 1vh 0;
    letter-spacing: 0.02em;
}

/* ----- Shot 10: OBSERVATION (captain's log) ----- */
.log-heading {
    font-family: var(--body);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--slate);
    margin: 0;
}

.log-body {
    font-family: var(--italic);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 1.35vw, 1.2rem);
    line-height: 1.65;
    color: var(--ink);
    max-width: 60ch;
    margin: 0;
    letter-spacing: 0.005em;
    position: relative;
    z-index: 3;
}

.coffee-ring {
    position: absolute;
    top: 60%;
    left: 64%;
    width: 3.2vw;
    height: 3.2vw;
    min-width: 38px;
    min-height: 38px;
    border: 1.5px solid rgba(112, 64, 28, 0.32);
    border-radius: 50%;
    box-shadow:
        inset 0 0 12px rgba(112, 64, 28, 0.12),
        0 0 6px rgba(112, 64, 28, 0.08);
    background: radial-gradient(circle, rgba(112,64,28,0.04) 0%, rgba(112,64,28,0.10) 70%, rgba(112,64,28,0) 100%);
    pointer-events: none;
    z-index: 2;
    transform: rotate(-7deg);
}

/* Tiny imperfection on the ring to read as hand-drawn */
.coffee-ring::after {
    content: "";
    position: absolute;
    inset: 4%;
    border-top: 1px dashed rgba(112,64,28,0.18);
    border-radius: 50%;
    transform: rotate(36deg);
}

/* ----- Shot 11: PORT ----- */
.port-word {
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(4rem, 9vw, 9rem);
    letter-spacing: 0.22em;
    color: var(--cream);
    margin: 0;
    text-transform: uppercase;
    text-align: center;
    line-height: 1;
}

/* ----- Reveal animation (entrance discipline) ----- */
.shot {
    --reveal: 0;
}

.shot .frame > .frame-grid > * {
    opacity: 1;
}

/* Initial small fade for content (single beat, no stagger) */
.shot .frame-grid {
    opacity: 0.001;
    transition: opacity 1s linear 200ms;
}

.shot.is-revealed .frame-grid {
    opacity: 1;
}

/* ----- Responsive (gentle) ----- */
@media (max-width: 720px) {
    :root {
        --letterbox: 8vh;
        --frame-h: 84vh;
    }

    .meridian {
        opacity: 0.4;
    }

    .tick {
        font-size: 9px;
        width: 60px;
    }

    .tick .tick-label {
        display: none;
    }

    .horizon-text {
        font-size: clamp(1.2rem, 5vw, 2rem);
        padding: 0 4vw;
    }

    .reckon-line {
        font-size: 1rem;
        padding: 0 4vw;
    }

    .frame {
        padding: 0 4vw;
    }

    .compass, .chrono, .starchart {
        width: 60vw;
        min-width: 200px;
    }

    .sextant {
        width: 80vw;
        min-width: 260px;
    }

    .crosshair { display: none; }
    html, body { cursor: auto; }
    a, button { cursor: pointer; }
}

@media (prefers-reduced-motion: reduce) {
    .compass .compass-card,
    .compass .needle,
    .chrono .second-hand {
        animation: none;
    }

    .horizon {
        transition: none;
        transform: scaleX(1);
    }

    .frame-grid { opacity: 1; transition: none; }

    .folded { transition: none; }
}
