/* EarthCARE ATLAS — presentation page. Dark-only visual essay.
 * Identity inherited from the viewer (www/earthcare_atlas/style.css):
 * same palette, Inter + Fira Code, teal signature underline. */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Inter:wght@400;500;600&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
    --bg:          #1E1E1E;
    --border:      #3A3A3A;
    --text:        #F1F5F9;
    --text-muted:  #94A3B8;
    --teal:        #0A938F;
    --amber:       #F59E0B;
    --blue:        #2E77A8;
    --font-ui:     "Inter", "Fira Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono:   "Fira Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --content-w:   1400px;
    --gutter:      clamp(1.25rem, 4vw, 3rem);
}

/* ── Base ───────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Anchor scrolling is driven by nav.js (computed target + smooth scroll);
 * scroll anchoring is disabled so Chrome doesn't "correct" the position
 * mid-animation while below-the-fold images lazy-load (visible as bounce
 * or landing on the wrong section). */
html { overflow-anchor: none; }

body {
    background: var(--bg);
    overflow-x: clip;   /* the full-bleed hero backdrop must not add h-scroll */
    color: var(--text);
    font-family: var(--font-ui);
    font-size: clamp(1rem, 0.35vw + 0.9rem, 1.125rem);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; height: auto; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* ── Topbar (logo + section tags) ───────────────────────────────── */
.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem 2.5rem;
    max-width: var(--content-w);
    margin-inline: auto;
    padding: 1.5rem var(--gutter) 0;
}

.topbar__home { display: block; flex-shrink: 0; }

.topbar__logo {
    width: clamp(280px, 26vw, 360px);
    display: block;
    overflow: visible;
}

.hero__logo-earthcare { fill: var(--text-muted); }
.hero__logo-atlas     { fill: var(--text); }

.topbar__nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.7rem 1.15rem;
    max-width: 56rem;
    padding-top: 0.35rem;
}

.topbar__nav a {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.35em;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.topbar__nav a:hover {
    color: var(--teal);
    text-decoration-color: var(--teal);
}

/* Scroll hint under the tags — a slow, quiet nudge toward the demo. */
.hero__scroll {
    display: block;
    width: fit-content;
    margin: clamp(1.75rem, 4vh, 2.5rem) auto 0;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    text-decoration: none;
    animation: hero-scroll-hint 2.2s ease-in-out infinite;
    transition: color 0.15s ease;
}

.hero__scroll:hover { color: var(--teal); }

@keyframes hero-scroll-hint {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(6px); }
}

/* ── Hero ───────────────────────────────────────────────────────── */
.hero {
    position: relative;
    max-width: 70rem;
    margin-inline: auto;
    padding: clamp(4rem, 12vh, 8rem) var(--gutter) clamp(1.25rem, 3vh, 2rem);
    text-align: center;
}

/* Orbital-sunrise backdrop, anchored to the hero's bottom so the limb arc
 * always sits under the badge regardless of viewport height. The SVG opens
 * at --bg and fades back to --bg at its bottom edge, so both the mid-page
 * top cut (behind the topbar) and the hand-off to the video are seamless. */
.hero::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -280px;
    bottom: -160px;
    width: 100vw;
    transform: translateX(-50%);
    background: url("hero-horizon.svg") center bottom / cover no-repeat;
    pointer-events: none;
    z-index: -1;
}

.hero h1 {
    font-size: clamp(2.75rem, 6vw, 4.6rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.12;
    text-wrap: balance;
}

.hero__stats {
    margin: clamp(1.5rem, 4vh, 2.5rem) auto 0;
    max-width: 55rem;
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    line-height: 1.9;
    color: var(--text-muted);
}

.hero__note {
    margin: clamp(1.5rem, 4vh, 2.25rem) auto 0;
    max-width: 55rem;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.7;
    color: var(--text-muted);
}

.hero__badge {
    display: inline-block;
    margin-top: clamp(2rem, 5vh, 3rem);
    padding: 0.4em 1.1em;
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 999px;
    background: rgba(12, 10, 8, 0.55);   /* keeps the amber text readable over the sunrise glow */
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--amber);
}

/* ── Video ──────────────────────────────────────────────────────── */
.video-block {
    width: min(100% - 2 * var(--gutter), var(--content-w));
    margin: clamp(1rem, 2.5vh, 1.75rem) auto 0;
}

.video-block video {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #000;
}

/* ── Essay sections ─────────────────────────────────────────────── */
.essay-section {
    width: min(100% - 2 * var(--gutter), var(--content-w));
    margin-inline: auto;
    padding-block-start: clamp(6rem, 20vh, 14rem);
}

/* Signature: the logo's teal underline, echoed above every kicker. */
.kicker::before {
    content: "";
    display: block;
    width: 2.25rem;
    height: 2px;
    margin-bottom: 1rem;
    background: var(--teal);
    border-radius: 1px;
}

.kicker {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--teal);
}

.essay-section h2 {
    margin-top: 0.75rem;
    font-size: clamp(2.2rem, 5.5vw, 4.5rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.05;
    text-wrap: balance;
}

.sub {
    margin-top: 1.25rem;
    max-width: 68ch;
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    line-height: 1.6;
    color: var(--text-muted);
}

.shot {
    margin-top: clamp(2rem, 5vh, 3.5rem);
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* Centered variation — the closing "explore → export" beat. */
.essay-section--center { text-align: center; }
.essay-section--center .kicker::before { margin-inline: auto; }
.essay-section--center .sub { margin-inline: auto; }

/* Per-section "back to top" link, tucked under the imagery. */
.to-top {
    display: block;
    width: fit-content;
    margin: clamp(1.5rem, 3vh, 2rem) 0 0 auto;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.to-top:hover { color: var(--teal); }

.essay-section--center .to-top { margin-inline: auto; }

/* ── Gallery (crossfade) ────────────────────────────────────────── */
/* The gallery box carries the section spacing; its images must NOT,
 * because non-first frames are absolutely positioned over the first. */
.gallery { margin-top: clamp(2rem, 5vh, 3.5rem); }
.gallery .shot { margin-top: 0; }

.gallery__frames { position: relative; }

.gallery__frames img {
    transition: opacity 0.6s ease;
}

/* Non-first images stack on top of the first (which defines the height). */
.gallery__frames img:not(:first-child) {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: contain;
    opacity: 0;
}

/* JS-enabled state: the active image wins, everything else fades out. */
.gallery.js-on .gallery__frames img { opacity: 0; }
.gallery.js-on .gallery__frames img.is-active { opacity: 1; }

.gallery__dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.1rem;
}

.gallery__dot {
    width: 26px;
    height: 26px;
    padding: 8px;
    border: 0;
    border-radius: 50%;
    background: var(--border);
    background-clip: content-box;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.gallery__dot:hover { background-color: var(--text-muted); }
.gallery__dot.is-active { background-color: var(--teal); }

/* ── Close ──────────────────────────────────────────────────────── */
.close {
    margin-top: clamp(6rem, 20vh, 14rem);
    padding: clamp(3rem, 8vh, 5rem) var(--gutter) clamp(4rem, 10vh, 6rem);
    border-top: 1px solid var(--border);
    text-align: center;
}

.close__logo {
    width: 170px;
    margin-inline: auto;
    opacity: 0.75;
    overflow: visible;
}

.close__line {
    margin-top: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.close__line a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.close__line a:hover {
    color: var(--teal);
    text-decoration-color: var(--teal);
}

/* ── Motion preferences ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .gallery__frames img { transition: none; }
    .hero__scroll { animation: none; }
}
