/* === HERO === */
.naf-back-link {
    position: fixed; top: 16px; left: 16px; z-index: 1500;
    color: var(--text-secondary); text-decoration: none;
    display: inline-flex; gap: 6px; align-items: center;
    font-size: 14px; transition: color .2s;
}
.naf-back-link:hover { color: var(--text-primary); }

.naf-hero {
    position: relative; min-height: 100vh;
    display: grid; place-items: center;
    padding: 48px 20px 60px;
}
.naf-hero-content { position: relative; z-index: 2; max-width: 720px; text-align: center; }
.naf-hero-eyebrow {
    text-transform: uppercase; letter-spacing: .25em;
    font-size: 12px; color: var(--text-secondary);
    margin: 0 0 12px;
}
.naf-hero-title {
    font-size: clamp(40px, 7vw, 76px); font-weight: 700;
    margin: 0 0 18px; letter-spacing: -.02em;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 60%, var(--danger) 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 60px rgba(239, 68, 68, .15); /* var(--danger) = #ef4444 */
}
.naf-hero-lede {
    font-size: clamp(15px, 2vw, 18px); color: var(--text-secondary);
    line-height: 1.7; margin: 0 0 32px;
}
.naf-start-btn {
    display: inline-flex; gap: 10px; align-items: center;
    padding: 18px 36px; border: none; border-radius: 14px;
    font-family: inherit; font-size: 17px; font-weight: 600;
    color: #fff; cursor: pointer;
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    box-shadow: 0 0 30px rgba(239, 68, 68, .35), 0 8px 30px rgba(0,0,0,.4);
    transition: transform .2s, box-shadow .2s;
}
.naf-start-btn:hover { transform: translateY(-2px); box-shadow: 0 0 40px rgba(239, 68, 68, .5), 0 12px 40px rgba(0,0,0,.5); }
.naf-start-btn:active { transform: translateY(0); }
.naf-hero-citations { margin: 28px 0 0; font-size: 12px; color: var(--text-secondary); opacity: .7; }
.naf-hero-map {
    position: absolute; inset: 0; z-index: 1;
    opacity: .25; filter: grayscale(.7) brightness(.6);
    pointer-events: none;
}

/* === CINEMATIC OVERLAY === */
.naf-cinematic {
    position: fixed; inset: 0; z-index: 1000;
    background: #000;
}
.naf-cinematic.is-active {
    /* Active state — lets us crossfade in. */
}
.naf-map { position: absolute; inset: 0; }

/* HUD — top-of-viewport */
.naf-hud-top {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; align-items: center; gap: 24px;
    padding: 20px 28px;
    background: linear-gradient(to bottom, rgba(0,0,0,.7), rgba(0,0,0,0));
    pointer-events: none;
    z-index: 1100;
}
.naf-year {
    font-size: clamp(40px, 6vw, 72px); font-weight: 700;
    color: #fff; letter-spacing: -.02em;
    text-shadow: 0 0 30px rgba(0,0,0,.8);
    font-variant-numeric: tabular-nums;
}
.naf-progress {
    flex-basis: 200px; height: 2px;
    margin-left: auto;
    background: rgba(255,255,255,.15);
    overflow: hidden; border-radius: 2px;
}
.naf-progress-bar {
    height: 100%; width: 0%;
    background: var(--danger);
    transition: width .4s ease-out;
}

/* Narrative panel — desktop side, mobile bottom-sheet (T10 polishes mobile) */
.naf-narrative {
    position: absolute; right: 24px; bottom: 100px;
    width: 380px; max-width: calc(100vw - 48px);
    padding: 24px 28px;
    background: rgba(15, 23, 42, .9);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    color: #fff;
    z-index: 1100;
    transform: translateY(20px); opacity: 0;
    transition: transform .5s ease-out, opacity .5s ease-out;
}
.naf-narrative.is-visible { transform: translateY(0); opacity: 1; }
.naf-narrative-eyebrow { font-size: 12px; color: var(--danger); text-transform: uppercase; letter-spacing: .2em; margin-bottom: 6px; }
/* All red accents on this page resolve to var(--danger) = #ef4444 (dark-theme value at base.css:35).
   MapLibre paint properties (T6/T7) hardcode #ef4444 because expressions don't resolve CSS vars. */
.naf-narrative-title   { font-size: 18px; font-weight: 500; margin: 0 0 10px; line-height: 1.35; color: rgba(255,255,255,.85); font-style: italic; }

/* Hero block — earthquake identity is the visual anchor of every event slide.
   Magnitude badge + place + date sit at the top, dominating the poetic title. */
.naf-narrative-hero {
    display: flex; gap: 14px; align-items: center;
    margin: 6px 0 14px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(239,68,68,.14) 0%, rgba(239,68,68,.06) 100%);
    border: 1px solid rgba(239,68,68,.28);
    border-radius: 12px;
}
.naf-narrative-hero[hidden] { display: none; }
.naf-hero-mag {
    flex-shrink: 0;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #fff;
    padding: 8px 13px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: .03em;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 4px 12px rgba(239,68,68,.35), inset 0 1px 0 rgba(255,255,255,.18);
    line-height: 1;
    text-align: center;
    min-width: 64px;
}
.naf-hero-text { flex: 1; min-width: 0; }
.naf-hero-place {
    font-size: 20px; font-weight: 700;
    color: #fff;
    line-height: 1.15;
    margin-bottom: 3px;
    letter-spacing: -.005em;
}
.naf-hero-date {
    font-size: 12.5px;
    color: rgba(255,255,255,.7);
    letter-spacing: .04em;
    font-variant-numeric: tabular-nums;
}

/* Fault-name labels — show on intro + fault_features chapters to ground the
   viewer in the tectonic geography. Anchored to fixed [lng, lat] via MapLibre Marker. */
.naf-fault-name {
    background: rgba(15, 23, 42, .82);
    color: rgba(252, 165, 165, .96);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    box-shadow: 0 2px 8px rgba(0,0,0,.5);
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid rgba(252,165,165,.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.naf-narrative-body    { font-size: 14px; line-height: 1.7; color: var(--text-secondary); margin: 0; }
.naf-narrative-deeplink { display: inline-block; margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; }
.naf-narrative-deeplink:hover { text-decoration: underline; }

/* Magnitude label pinned to the mainshock dot via MapLibre Marker. */
.naf-mag-label {
    background: rgba(239, 68, 68, .95);
    color: #fff;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 700; font-size: 13px;
    letter-spacing: .04em;
    box-shadow: 0 2px 10px rgba(0,0,0,.6), 0 0 0 2px rgba(0,0,0,.35);
    white-space: nowrap;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

/* Coulomb stress color-bar legend — sits in the lower-left when an event
   chapter is showing the Coulomb raster. Matches the diverging blue–white–
   red palette used by coulomb-stress.js with Stein 1997 ±2 bar saturation. */
.naf-coulomb-legend {
    position: absolute;
    bottom: 90px; left: 16px;
    z-index: 1100;
    background: rgba(15, 23, 42, .82);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px;
    padding: 8px 10px 9px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
    min-width: 220px;
    pointer-events: none;
    transition: opacity .4s ease-out;
}
.naf-coulomb-legend[hidden] { display: none; }
.naf-legend-title {
    font-size: 10.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.7);
    margin-bottom: 6px;
}
.naf-legend-bar {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right,
        rgb(  5,  48,  97)  0%,
        rgb( 33, 102, 172) 10%,
        rgb( 67, 147, 195) 20%,
        rgb(146, 197, 222) 30%,
        rgb(209, 229, 240) 40%,
        rgb(247, 247, 247) 50%,
        rgb(253, 219, 199) 60%,
        rgb(244, 165, 130) 70%,
        rgb(214,  96,  77) 80%,
        rgb(178,  24,  43) 90%,
        rgb(103,   0,  31) 100%
    );
    border: 1px solid rgba(255,255,255,.1);
}
.naf-legend-axis {
    display: flex; justify-content: space-between;
    margin-top: 3px;
    font-size: 10px;
    color: rgba(255,255,255,.65);
    font-variant-numeric: tabular-nums;
    letter-spacing: .03em;
}
.naf-legend-sub {
    display: flex; justify-content: space-between;
    margin-top: 1px;
    font-size: 9.5px;
    color: rgba(255,255,255,.5);
    letter-spacing: .04em;
}
.naf-legend-neg { color: rgba(96, 165, 250, .95); }
.naf-legend-pos { color: rgba(252, 165, 165, .95); }

/* Coulomb stress transfer halo — appears on the next-to-rupture location
   ~3s after the current event renders, indicating where stress jumped.
   Replaced by the actual rupture when the next chapter fires. */
.naf-stress-halo {
    position: relative;
    pointer-events: none;
    width: 0; height: 0;  /* anchor 'center' on the marker; halo is absolute */
}
.naf-stress-pulse {
    position: absolute; left: 50%; top: 50%;
    width: 80px; height: 80px; margin: -40px 0 0 -40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251,146,60,.55) 0%, rgba(251,146,60,.15) 55%, rgba(251,146,60,0) 75%);
    animation: naf-stress-pulse 1.8s ease-out infinite;
    will-change: transform, opacity;
}
@keyframes naf-stress-pulse {
    0%   { transform: scale(.4); opacity: 0; }
    35%  { opacity: .95; }
    100% { transform: scale(1.5); opacity: 0; }
}
.naf-stress-label {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, 38px);
    background: rgba(251, 146, 60, .96);
    color: #1d1d35;
    padding: 3px 9px; border-radius: 999px;
    font-weight: 700; font-size: 11px;
    letter-spacing: .04em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* Controls — flex column so chapter counter sits below the button row */
.naf-controls {
    position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: rgba(0,0,0,.6); padding: 8px 14px 6px;
    border-radius: 24px; border: 1px solid rgba(255,255,255,.08);
    z-index: 1100;
}
.naf-ctrl-row { display: flex; gap: 8px; }
.naf-chapter-wrap {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 6px; min-width: 130px;
}
.naf-chapter {
    font-size: 10.5px; color: rgba(255,255,255,.55);
    letter-spacing: .18em; padding-top: 1px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.naf-chapter-timer {
    display: flex; align-items: center; gap: 8px;
    opacity: 0.9;
}
.naf-chapter-timer-track {
    flex: 1; height: 2px;
    background: rgba(255,255,255,.12);
    border-radius: 2px; overflow: hidden;
}
.naf-chapter-timer-fill {
    height: 100%; width: 0%;
    background: var(--danger, #ef4444);
    transition: width .12s linear;
    will-change: width;
}
.naf-chapter-timer-text {
    font-size: 9.5px;
    color: rgba(255,255,255,.55);
    letter-spacing: .08em;
    font-variant-numeric: tabular-nums;
    min-width: 24px; text-align: right;
}
.naf-chapter-timer.is-paused .naf-chapter-timer-text { color: rgba(250,204,21,.85); }
.naf-chapter-timer.is-done   .naf-chapter-timer-fill { background: rgba(255,255,255,.25); }
.naf-ctrl {
    width: 44px; height: 44px; border: none; border-radius: 50%;
    background: rgba(255,255,255,.08); color: #fff; cursor: pointer;
    font-size: 20px; line-height: 1; transition: background .15s, transform .15s;
}
.naf-ctrl:hover { background: rgba(255,255,255,.18); transform: scale(1.06); }
.naf-ctrl--exit { background: rgba(239, 68, 68, .25); } /* var(--danger) */
.naf-ctrl--exit:hover { background: rgba(239, 68, 68, .45); }

/* Reduced-motion: kill non-essential transitions */
@media (prefers-reduced-motion: reduce) {
    .naf-narrative, .naf-progress-bar, .naf-ctrl, .naf-start-btn {
        transition: none !important;
    }
}

/* T10: mobile responsive polish */
@media (max-width: 768px) {
    .naf-hero { padding: 80px 16px 40px; }
    .naf-hero-title { font-size: clamp(36px, 10vw, 56px); }
    .naf-narrative {
        right: 12px; left: 12px; bottom: 84px;
        width: auto; max-width: none;
        padding: 16px 18px;
        border-radius: 14px;
    }
    .naf-narrative-title { font-size: 18px; }
    .naf-narrative-body  { font-size: 13px; line-height: 1.6; }
    .naf-hud-top { padding: 14px 16px; gap: 12px; }
    .naf-year { font-size: clamp(28px, 8vw, 44px); }
    .naf-progress { flex: 1; }
    .naf-controls {
        bottom: 10px; padding: 6px 10px 4px;
    }
    .naf-ctrl-row { gap: 6px; }
    .naf-ctrl { width: 38px; height: 38px; font-size: 17px; }
    .naf-chapter { font-size: 10px; }
}

@media (max-width: 400px) {
    .naf-narrative { bottom: 76px; padding: 14px 14px; }
    .naf-narrative-title { font-size: 17px; }
}
