/* The Deep Past. Every class here starts with pr- (page: past). */
body.pr { background: #05060b; }
.pr-sec { --accent: var(--amber); }
#hero { --accent: #ff9a47; padding: 0; }
#where { --accent: var(--cyan); }
#drift { --accent: #6ef0c0; }
#life { --accent: var(--lime); }
#extinct { --accent: var(--red); }
#carbon { --accent: var(--amber); }
#outro { --accent: var(--magenta); }

.pr-sec canvas { touch-action: pan-y; }

/* ---------- 01 time ruler (tall section, sticky stage) ---------- */
.pr-run { position: relative; }
.pr-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: #02030a; }
.pr-stage canvas.pr-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pr-hero-top { position: absolute; z-index: 3; left: var(--gutter); right: var(--gutter); top: clamp(56px, 9vh, 90px); pointer-events: none; }
.pr-hero-top .sec__kicker { margin-bottom: 10px; }
.pr-ago { font-family: var(--f-mono); font-weight: 600; font-size: var(--step-4); line-height: 1; letter-spacing: -.02em; color: var(--ink); text-shadow: 0 0 40px var(--glow, rgba(255,154,71,.45)); font-variant-numeric: tabular-nums; }
.pr-ago small { display: block; font-size: var(--step-0); font-weight: 400; color: var(--ink-2); letter-spacing: .06em; margin-top: 8px; text-shadow: none; }
.pr-card { position: absolute; z-index: 3; left: var(--gutter); bottom: clamp(70px, 12vh, 120px); max-width: min(440px, calc(100vw - 2 * var(--gutter))); background: linear-gradient(180deg, rgba(10,13,24,.7), rgba(10,13,24,.85)); border: 1px solid var(--line); border-left: 3px solid var(--glow, var(--accent)); border-radius: 14px; padding: 18px 20px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: border-color .4s; }
.pr-card h2 { font-family: var(--f-display); font-weight: 700; font-size: var(--step-2); line-height: 1.05; margin: 0 0 8px; }
.pr-card p { margin: 0; color: var(--ink-2); font-size: var(--step--1); line-height: 1.5; }
.pr-card a { display: inline-block; margin-top: 10px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.pr-card .pr-cal { margin-top: 10px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; color: var(--ink-3); }
.pr-card .pr-cal b { color: var(--glow, var(--accent)); font-weight: 600; }
.pr-card a[hidden] { display: none; }
.pr-track { position: absolute; z-index: 3; left: var(--gutter); right: var(--gutter); bottom: 28px; height: 28px; }
.pr-track__line { position: absolute; left: 0; right: 0; top: 13px; height: 2px; background: linear-gradient(90deg, rgba(255,255,255,.5), rgba(255,255,255,.12) 40%, rgba(255,255,255,.12)); border-radius: 2px; }
.pr-track i { position: absolute; top: 8px; width: 2px; height: 12px; margin-left: -1px; background: var(--ink-3); transition: background .3s, transform .3s; }
.pr-track i.is-done { background: var(--ink-2); }
.pr-track i.is-now { background: var(--glow, var(--accent)); transform: scaleY(1.7); box-shadow: 0 0 12px var(--glow, var(--accent)); }
.pr-track__pin { position: absolute; top: 4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--glow, var(--accent)); box-shadow: 0 0 16px 3px var(--glow, var(--accent)); }
.pr-track__ends { position: absolute; left: 0; right: 0; top: -2px; display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; color: var(--ink-3); text-transform: uppercase; }
.pr-hint { position: absolute; z-index: 3; right: var(--gutter); top: clamp(62px, 10vh, 100px); font-family: var(--f-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); animation: pr-bob 2s ease-in-out infinite; transition: opacity .4s; }
.pr-hint.is-gone { opacity: 0; }
@keyframes pr-bob { 50% { transform: translateY(6px); } }

/* ---------- shared chapter layout ---------- */
.pr-grid { display: grid; grid-template-columns: minmax(280px, 5fr) 7fr; gap: clamp(20px, 4vw, 56px); align-items: start; }
.pr-grid > .pr-globe { position: sticky; top: 10vh; }
@media (max-width: 900px) { .pr-grid > .pr-globe { position: static; } }
.pr-grid--flip { grid-template-columns: 7fr minmax(280px, 5fr); }
@media (max-width: 900px) { .pr-grid, .pr-grid--flip { grid-template-columns: 1fr; } }
.pr-globe { position: relative; width: 100%; aspect-ratio: 1; max-width: 640px; margin: 0 auto; }
.pr-globe canvas { width: 100%; height: 100%; cursor: grab; }
.pr-globe canvas:active { cursor: grabbing; }
.pr-globe__tag { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); background: rgba(4,5,10,.6); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; white-space: nowrap; pointer-events: none; }

.pr-field { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 18px; }
.pr-field select, .pr-btn {
  font: inherit; font-size: 14px; color: var(--ink); background: rgba(255,255,255,.05); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 10px 16px; cursor: pointer; transition: background .2s, border-color .2s, transform .2s;
}
.pr-field select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.pr-field select option { background: #0f1324; color: var(--ink); }
.pr-btn:hover, .pr-btn:focus-visible { background: rgba(255,255,255,.1); border-color: var(--accent); }
.pr-btn--go { background: var(--accent); color: #05060b; border-color: transparent; font-weight: 600; }
.pr-btn--go:hover { background: var(--accent); filter: brightness(1.12); transform: translateY(-1px); }
.pr-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.pr-big { font-family: var(--f-mono); font-weight: 600; font-size: var(--step-3); line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pr-big small { font-size: .38em; font-weight: 400; color: var(--ink-2); letter-spacing: .02em; margin-left: .3em; }
/* fixed boxes: the numbers and text change as time moves, but nothing around them may move */
.pr-big { display: flex; align-items: baseline; white-space: nowrap; height: 1.15em; }
.pr-big .pr-big__n { display: inline-block; min-width: 3.1ch; text-align: right; }
.pr-read { color: var(--ink-2); margin: 10px 0 18px; font-size: var(--step-0); height: 8.2em; overflow: hidden; }
.pr-read b { color: var(--ink); font-weight: 500; }
.pr-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.pr-mini .card { padding: 12px 14px; height: 5.6rem; overflow: hidden; }
.pr-mini .stat__value { font-size: var(--step-0); height: 1.5em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pr-range { width: 100%; accent-color: var(--accent); height: 28px; cursor: pointer; }
.pr-ruler { position: relative; height: 22px; border-radius: 6px; overflow: hidden; display: flex; margin: 6px 0 4px; border: 1px solid var(--line); }
.pr-ruler span { display: block; height: 100%; font-size: 9px; line-height: 22px; text-align: center; color: rgba(0,0,0,.75); font-family: var(--f-mono); overflow: hidden; white-space: nowrap; }
.pr-ruler-wrap { position: relative; }
.pr-ruler-wrap .pr-ruler__x { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); pointer-events: none; }
.pr-ruler-note { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; color: var(--ink-3); text-transform: uppercase; }

.pr-fossils { margin-top: 6px; min-height: 16em; }
.pr-fossils .card { padding: 16px 18px; }
.pr-fossils h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pr-fossils ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: var(--step--1); color: var(--ink-2); }
.pr-fossils li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 5px; }
.pr-fossils li b { color: var(--ink); font-weight: 500; }
.pr-fossils p { margin: 0; color: var(--ink-2); font-size: var(--step--1); }

.pr-cap { height: 5.6em; overflow: hidden; color: var(--ink); font-size: var(--step-1); font-weight: 300; line-height: 1.35; margin: 12px 0 14px; }
.pr-credit { position: absolute; z-index: 3; right: var(--gutter); bottom: 54px; max-width: min(380px, 60vw); text-align: right; font-size: 10px; line-height: 1.4; color: var(--ink-3); pointer-events: none; }
@media (max-width: 760px) { .pr-credit { display: none; } }
.pr-legend { display: flex; flex-wrap: wrap; gap: 12px 18px; font-size: 12px; color: var(--ink-2); margin-top: 12px; }
.pr-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------- 04 life ---------- */
.pr-chart { position: relative; width: 100%; height: clamp(300px, 52vh, 520px); }
.pr-chart canvas { width: 100%; height: 100%; display: block; }
.pr-tip { position: absolute; z-index: 5; pointer-events: none; background: rgba(8,10,20,.92); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; font-size: 12px; color: var(--ink-2); transform: translate(-50%, -110%); white-space: nowrap; opacity: 0; transition: opacity .15s; }
.pr-tip b { color: var(--ink); font-weight: 600; display: block; font-size: 13px; }
.pr-tip.is-on { opacity: 1; }
.pr-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 700px) { .pr-stats { grid-template-columns: 1fr; } }
.pr-note { font-size: var(--step--1); color: var(--ink-3); max-width: 70ch; margin-top: 14px; }

/* ---------- 05 extinction ---------- */
.pr-ex { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 4vw, 48px); align-items: start; }
@media (max-width: 900px) { .pr-ex { grid-template-columns: 1fr; } }
.pr-ex-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 16px; }
.pr-ex-tabs button { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; cursor: pointer; text-align: center; line-height: 1.2; transition: .25s var(--ease-out); }
.pr-ex-tabs button b { display: block; font-family: var(--f-mono); font-size: var(--step--1); font-weight: 600; }
.pr-ex-tabs button span { font-size: 10px; color: var(--ink-3); font-family: var(--f-mono); letter-spacing: .04em; }
.pr-ex-tabs button[aria-selected="true"] { border-color: var(--red); background: rgba(255,90,95,.12); transform: translateY(-3px); }
.pr-ex-field { position: relative; }
.pr-ex-field canvas { width: 100%; height: auto; aspect-ratio: 1.15; border-radius: var(--radius); border: 1px solid var(--line); background: radial-gradient(ellipse at 50% 100%, rgba(255,90,95,.1), rgba(4,5,10,0) 70%), #070914; }
.pr-ex-field .pr-ex-pct { position: absolute; left: 16px; top: 12px; font-family: var(--f-mono); font-weight: 600; font-size: var(--step-3); line-height: 1; color: var(--ink); text-shadow: 0 0 30px rgba(255,90,95,.6); pointer-events: none; }
.pr-ex-field .pr-ex-pct small { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 400; text-shadow: none; margin-top: 4px; }
.pr-ex-info h3 { font-family: var(--f-display); font-size: var(--step-2); font-weight: 700; margin: 0 0 4px; line-height: 1.05; }
.pr-ex-info .pr-ex-when { font-family: var(--f-mono); color: var(--red); font-size: var(--step--1); letter-spacing: .1em; margin-bottom: 14px; display: block; }
.pr-ex-info dl { margin: 0; display: grid; gap: 12px; }
.pr-ex-info dt { font-family: var(--f-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
.pr-ex-info dd { margin: 0; color: var(--ink-2); font-size: var(--step-0); }
.pr-ex-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.07); overflow: hidden; margin: 6px 0 4px; }
.pr-ex-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--red)); transition: width 1.2s var(--ease-out); }

/* ---------- 06 carbon (sticky stage) ---------- */
#carbon { padding: 0; }
.pr-co-run { position: relative; }
.pr-co-stage { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: clamp(56px, 8vh, 90px) 0 24px; overflow: hidden; }
.pr-co-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 32px; margin-bottom: 8px; }
.pr-co-head .sec__title { margin: 0; font-size: var(--step-2); }
.pr-co-now { text-align: right; }
.pr-co-now .pr-big { color: var(--amber); text-shadow: 0 0 40px rgba(255,181,71,.4); }
.pr-co-now .pr-co-sub { font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; color: var(--ink-3); text-transform: uppercase; }
.pr-co-chart { position: relative; flex: 1; min-height: 240px; }
.pr-co-chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pr-co-note { min-height: 3.6em; color: var(--ink-2); font-size: var(--step-0); max-width: 74ch; margin-top: 8px; }
.pr-co-note b { color: var(--ink); font-weight: 500; }
.pr-co-steps { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pr-co-steps i { font-style: normal; font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; transition: .3s; }
.pr-co-steps i.is-on { color: var(--ink); border-color: var(--amber); }

/* ---------- 07 outro ---------- */
.pr-recap { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 28px; }
.pr-recap .card p { margin: 0; font-size: var(--step--1); }
.pr-recap .card h3 { color: var(--accent); font-family: var(--f-mono); letter-spacing: .1em; text-transform: uppercase; font-size: 11px; }
.pr-doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
@media (max-width: 700px) { .pr-doors { grid-template-columns: 1fr; } }
.pr-doors a { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; background: var(--panel); transition: .4s var(--ease-out); }
.pr-doors a:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.pr-doors a b { font-family: var(--f-display); font-size: var(--step-1); display: block; margin-bottom: 4px; }
.pr-doors a span { color: var(--ink-2); font-size: var(--step--1); }
.pr-year { display: flex; flex-wrap: wrap; gap: 6px 18px; font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.pr-year b { color: var(--ink); font-weight: 600; }

@media (max-width: 760px) {
  .pr-ago { font-size: clamp(2.3rem, 11vw, 3.4rem); }
  .pr-hint { display: none; }
  .pr-card { bottom: 66px; padding: 14px 16px; }
  .pr-card p { font-size: 13px; }
  .pr-mini { grid-template-columns: 1fr 1fr 1fr; }
  .pr-ex-tabs button span { display: none; }
  .pr-co-head .sec__title { font-size: var(--step-1); }
  .pr-co-now { text-align: left; }
}
