/* ===========================================================================
   The Ascent
   ===========================================================================
   Standalone: this page has no site chrome, so it carries its own reset and
   its own type. Dark, because a ridge at dawn is dark, and because the words
   have to sit over a moving canvas without either fighting the other.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&family=Newsreader:opsz,wght@6..72,300;6..72,400&display=swap');

:root {
    --asc-ink:   #eef3fa;
    --asc-soft:  #a8b6c9;
    /*
     | Measured, not judged by eye.
     |
     | This was #6d7d92, which is 4.32:1 on the page's ground — under the 4.5
     | that small text needs, and it is only ever used on small text: the
     | eyebrow labels, the fact captions, the scroll cue and the provenance
     | note at the foot. The one tone on the page that had to be readable at
     | 13px was the one below standard. #7d8da2 is 5.36:1 and reads the same.
     */
    --asc-faint: #7d8da2;
    --asc-sky:   #0e1622;
    --asc-flame: #ef8821;
    --asc-snow:  #ffffff;
    --asc-display: 'Bricolage Grotesque', system-ui, sans-serif;
    --asc-text: 'Newsreader', Georgia, serif;
}

* { box-sizing: border-box; }

body.asc {
    margin: 0; background: var(--asc-sky); color: var(--asc-ink);
    font-family: var(--asc-text); font-size: 17px; line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* The canvas sits still and the page scrolls over it. */
#asc-stage {
    position: fixed; inset: 0; width: 100%; height: 100%;
    display: block; z-index: 0;
}

/* A wash over the canvas so white text is readable wherever the ridge happens
   to be bright. Without it the altitude readout disappears against snow. */
/*
 | The wash the words sit on, which follows the sky.
 |
 | --asc-veil is written every frame from the scene's own sky luminance: near
 | 0.3 at midnight, near 0.9 at noon. Without it a white card is unreadable at
 | noon and the same card is a grey slab at night — one fixed value cannot
 | serve a background that changes by design.
 */
.asc-veil {
    --asc-veil: .55;
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background:
        linear-gradient(to right,
            rgba(10, 16, 26, calc(var(--asc-veil) * .95)) 0%,
            rgba(10, 16, 26, calc(var(--asc-veil) * .42)) 46%,
            rgba(10, 16, 26, 0) 74%),
        linear-gradient(to bottom,
            rgba(10, 16, 26, calc(var(--asc-veil) * .7)) 0%,
            rgba(10, 16, 26, 0) 24%,
            rgba(10, 16, 26, 0) 74%,
            rgba(10, 16, 26, calc(var(--asc-veil) * .85)) 100%);
    transition: none;   /* it is redrawn every frame; a transition would lag it */
}

/* ------------------------------------------------------------------- top -- */
.asc-top {
    position: fixed; top: 0; left: 0; right: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 1rem clamp(1rem, 3vw, 2.2rem);
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
    font-family: var(--asc-display);
}
.asc-back {
    display: inline-flex; align-items: center; gap: .5em;
    color: var(--asc-ink); text-decoration: none;
    font-size: .82rem; font-weight: 600; letter-spacing: .02em;
    padding: .5em .95em; border-radius: 999px;
    background: rgba(14, 22, 34, .55); border: 1px solid rgba(238, 243, 250, .18);
    backdrop-filter: blur(8px);
}
.asc-back:hover { background: rgba(14, 22, 34, .8); }
.asc-brand {
    font-size: .68rem; font-weight: 600; letter-spacing: .18em;
    text-transform: uppercase; color: var(--asc-faint);
}
@media (max-width: 640px) { .asc-brand { display: none; } }

/* ------------------------------------------------------------------- hud -- */
.asc-hud {
    position: fixed; right: clamp(1rem, 3vw, 2.2rem); top: 50%; z-index: 20;
    transform: translateY(-50%);
    display: flex; flex-direction: column; align-items: flex-end; gap: .35rem;
    font-family: var(--asc-display);
    opacity: 0; transition: opacity .6s ease;
}
/* Only once the scene is running — a readout over a blank canvas is furniture. */
body.asc-live .asc-hud { opacity: 1; }

.asc-hud__alt {
    font-size: clamp(1.6rem, 1.2rem + 2vw, 2.6rem); font-weight: 800;
    letter-spacing: -.02em; line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 20px rgba(0, 0, 0, .6);
}
.asc-hud__alt small { font-size: .42em; color: var(--asc-soft); margin-left: .15em; }
.asc-hud__day {
    font-size: .7rem; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase; color: var(--asc-soft);
    font-variant-numeric: tabular-nums;
}
/* The climb so far, as a line filling upward. */
.asc-hud__bar {
    width: 3px; height: clamp(6rem, 18vh, 11rem); margin-top: .6rem;
    background: rgba(238, 243, 250, .16); border-radius: 999px;
    display: flex; align-items: flex-end;
}
.asc-hud__bar i {
    display: block; width: 100%; height: 0;
    background: linear-gradient(to top, var(--asc-flame), #ffd9a8);
    border-radius: 999px;
}
@media (max-width: 560px) {
    .asc-hud { top: auto; bottom: 1.2rem; transform: none; flex-direction: row; align-items: center; gap: .8rem; }
    .asc-hud__bar { width: 5rem; height: 3px; margin: 0; align-items: stretch; }
    .asc-hud__bar i { width: 0; height: 100%; background: linear-gradient(to right, var(--asc-flame), #ffd9a8); }
}

/* ---------------------------------------------------------------- scroll -- */
.asc-scroll { position: relative; z-index: 10; }

.asc-open { min-height: 100vh; display: grid; place-items: center; position: relative; padding: 6rem 1.2rem 4rem; }
.asc-open__img {
    position: absolute; inset: 0; background-size: cover; background-position: center;
    opacity: .28; filter: saturate(.7);
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 78%);
            mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 78%);
}
.asc-open__inner { position: relative; max-width: 46rem; text-align: center; }

.asc-eyebrow {
    margin: 0 0 1rem; font-family: var(--asc-display);
    font-size: .72rem; font-weight: 600; letter-spacing: .28em;
    text-transform: uppercase; color: var(--asc-flame);
}
.asc-open h1 {
    margin: 0 0 1.6rem; font-family: var(--asc-display); font-weight: 800;
    font-size: clamp(2rem, 1.2rem + 4.4vw, 4.4rem); line-height: 1.02;
    letter-spacing: -.03em; text-wrap: balance;
}

.asc-facts {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 1.2rem clamp(1.4rem, 4vw, 3rem); margin: 0 0 2.4rem;
}
.asc-facts div { text-align: center; }
.asc-facts dt {
    font-family: var(--asc-display); font-size: .64rem; font-weight: 600;
    letter-spacing: .16em; text-transform: uppercase; color: var(--asc-faint);
    margin-bottom: .3em;
}
.asc-facts dd {
    margin: 0; font-family: var(--asc-display); font-weight: 800;
    font-size: clamp(1.3rem, 1rem + 1.4vw, 2rem); letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.asc-facts dd small { font-size: .5em; color: var(--asc-soft); margin-left: .1em; }

.asc-cue {
    margin: 0; font-family: var(--asc-display); font-size: .78rem;
    letter-spacing: .16em; text-transform: uppercase; color: var(--asc-faint);
}
.asc-cue span { display: block; font-size: 1.3rem; animation: ascNudge 2.4s ease-in-out infinite; }
@keyframes ascNudge { 0%,100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(6px); opacity: 1; } }

/* ------------------------------------------------------------------ days -- */
/*
 | A screen per day, and the card on the left.
 |
 | The camera's own subject sits to the right of centre, so the reading column
 | is kept off it rather than laid across it.
 */
.asc-day { min-height: 100vh; display: flex; align-items: center; padding: 4rem clamp(1.2rem, 4vw, 3rem); }

.asc-card {
    max-width: 30rem; padding: 1.6rem 1.8rem;
    background: rgba(14, 22, 34, .62);
    border: 1px solid rgba(238, 243, 250, .14);
    border-left: 3px solid var(--asc-flame);
    border-radius: 4px; backdrop-filter: blur(10px);
    opacity: 0; transform: translateY(22px);
    transition: opacity .7s cubic-bezier(.22,.8,.28,1), transform .7s cubic-bezier(.22,.8,.28,1);
}
.asc-day.is-in .asc-card { opacity: 1; transform: none; }

.asc-card__day {
    margin: 0 0 .5em; font-family: var(--asc-display);
    font-size: .68rem; font-weight: 600; letter-spacing: .2em;
    text-transform: uppercase; color: var(--asc-flame);
}
.asc-card h2 {
    margin: 0 0 .8rem; font-family: var(--asc-display); font-weight: 800;
    font-size: clamp(1.2rem, 1rem + 1.1vw, 1.8rem); line-height: 1.18;
    letter-spacing: -.02em; text-wrap: balance;
}
.asc-card__alt {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .9rem; margin: 0;
    font-family: var(--asc-display);
}
.asc-card__alt strong {
    font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.asc-card__alt small { font-size: .5em; color: var(--asc-soft); margin-left: .08em; }

.asc-up, .asc-down, .asc-hold, .asc-peak {
    font-size: .72rem; font-weight: 700; letter-spacing: .06em;
    padding: .28em .7em; border-radius: 999px;
}
.asc-up   { color: #ffd2a3; background: rgba(239, 136, 33, .16); }
.asc-down { color: #a9d8ff; background: rgba(60, 130, 200, .16); }
.asc-hold { color: var(--asc-faint); background: rgba(238, 243, 250, .07); }
.asc-peak { color: #0e1622; background: var(--asc-snow); }

/* ------------------------------------------------------------------- end -- */
.asc-end { min-height: 100vh; display: grid; place-items: center; padding: 5rem 1.2rem; }
.asc-end__inner { max-width: 38rem; text-align: center; }
.asc-end h2 {
    margin: 0 0 .6rem; font-family: var(--asc-display); font-weight: 800;
    font-size: clamp(1.6rem, 1.2rem + 2vw, 2.6rem); letter-spacing: -.025em;
}
.asc-end p { margin: 0 0 1.8rem; color: var(--asc-soft); }

.asc-end__go { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; }
.asc-btn {
    display: inline-block; padding: .85em 1.7em; border-radius: 999px;
    text-decoration: none; font-family: var(--asc-display); font-weight: 700; font-size: .92rem;
    color: var(--asc-ink); border: 1px solid rgba(238, 243, 250, .28);
}
.asc-btn:hover { background: rgba(238, 243, 250, .1); }
.asc-btn--go { background: var(--asc-flame); border-color: var(--asc-flame); color: #17202e; }
.asc-btn--go:hover { background: #ffa347; color: #17202e; }

/* Where the numbers came from. Quiet, and present. */
.asc-note {
    margin: 2.4rem auto 0; max-width: 34rem;
    font-size: .82rem; line-height: 1.55; color: var(--asc-faint);
}

@media (prefers-reduced-motion: reduce) {
    .asc-card { opacity: 1; transform: none; transition: none; }
    .asc-cue span { animation: none; }
}

/* The hour of the day, under the day count. */
.asc-hud__hour {
    font-family: var(--asc-display); font-size: .64rem; font-weight: 600;
    letter-spacing: .22em; text-transform: uppercase;
    color: var(--asc-flame); margin-top: .1rem;
}
@media (max-width: 560px) { .asc-hud__hour { margin-top: 0; } }

/* ===========================================================================
   Real terrain
   ===========================================================================
   The elevation tiles are a network round trip, so the page says it is
   fetching them. The drawn ridge is already on screen underneath — this is a
   mountain arriving, not a page waiting.
   ========================================================================= */
.asc-loading .asc-hud::after {
    content: 'Loading terrain';
    display: block; margin-top: .55rem;
    font-family: var(--asc-display, system-ui);
    font-size: .62rem; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
    animation: asc-pulse 1.6s ease-in-out infinite;
}
@keyframes asc-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* Once the ground is real, say so — quietly, and only here. A visualisation
   that will not say what it is made of is one nobody should trust. */
.asc-real .asc-hud__day::after {
    content: 'SRTM';
    margin-left: .5em; padding: .1em .35em;
    font-size: .55rem; font-weight: 800; letter-spacing: .1em;
    color: rgba(255, 255, 255, .6);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}

@media (prefers-reduced-motion: reduce) {
    .asc-loading .asc-hud::after { animation: none; opacity: .7; }
}

/* ===========================================================================
   Letting the mountain through
   ===========================================================================
   The page read as "dark and white": a near-solid slate panel down the left
   half with white cards on it, and the scene barely visible behind either.
   Two things were doing it — a veil that reached 0.90 at noon, now a third of
   that, and cards deep enough to be a wall of their own.

   The card is glass now rather than a panel: dark enough to hold white text
   at noon, clear enough that the ridge behind it is part of the picture. It
   is the difference between a slide deck over a photograph and a window.
   ========================================================================= */
.asc-card {
    background: rgba(12, 19, 30, .38);
    backdrop-filter: blur(14px) saturate(1.15);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    border-color: rgba(238, 243, 250, .10);
    /* The text was relying on the panel for contrast; it carries its own now,
       so the panel does not have to be opaque. */
    text-shadow: 0 1px 14px rgba(6, 10, 18, .55);
    box-shadow: 0 18px 50px -28px rgba(0, 0, 0, .8);
}

/* A browser without backdrop-filter gets the old weight rather than
   unreadable text over a bright sky. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .asc-card { background: rgba(12, 19, 30, .72); }
}

/* The opening panel and the closing one sit over the full-bleed photograph and
   were the darkest things on the page. */
.asc-open__inner, .asc-end__inner { text-shadow: 0 2px 18px rgba(6, 10, 18, .6); }

/* The readout was competing with the cards for the same corner of the sky. */
.asc-hud { text-shadow: 0 1px 12px rgba(6, 10, 18, .65); }
