:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --ink: #27362f;
  --muted: #657169;
  --hadean: #e9d8c6;
  --archean: #d9e3d4;
  --proterozoic: #cedee2;
  --phanerozoic: #e6e7cc;
  --rule: #27362f26;
  --eon-columns: minmax(0, .5363fr) minmax(0, 1.531fr) minmax(0, 1.9612fr) minmax(0, .5388fr);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
body.dark {
  color-scheme: dark;
  --paper: #171e1b;
  --ink: #edf0e5;
  --muted: #b5beb4;
  --hadean: #493a31;
  --archean: #2d4136;
  --proterozoic: #2a3c45;
  --phanerozoic: #3d422f;
  --rule: #edf0e52b;
}
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; }
.site-header { position: relative; height: 92px; padding: 0 4vw; display: flex; align-items: center; gap: 24px; }
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 25px; font-weight: 650; letter-spacing: -1.3px; }
.brand-orbit { width: 24px; height: 24px; border: 1px solid currentColor; border-radius: 50%; background: linear-gradient(120deg, transparent 48%, var(--ink) 49%, var(--ink) 52%, transparent 53%); }
.language-control { margin-left: auto; }
.language-control select { max-width: 145px; border: 1px solid var(--rule); border-radius: 30px; background: var(--paper); color: var(--ink); padding: 10px; font: inherit; font-size: 12px; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.theme-toggle { border: 1px solid var(--rule); border-radius: 30px; background: transparent; color: inherit; padding: 10px 16px; font: inherit; font-size: 12px; cursor: pointer; }
.theme-toggle span { margin-left: 12px; font-size: 17px; }
.timeline-stage { position: relative; }
.playback-overlay { position: absolute; z-index: 3; inset: 0; pointer-events: none; overflow: hidden; }
.playback-age { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 36px; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap; }
.content-pointer { position: absolute; top: 0; bottom: 0; left: clamp(0px, var(--playback-progress, 0%), calc(100% - 1px)); width: 1px; background: var(--ink); opacity: .5; }
.timeline { display: flex; height: calc(100svh - 232px); min-height: 480px; overflow-x: auto; overflow-y: hidden; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--muted) var(--paper); }
.eon { position: relative; flex: 0 0 calc(var(--duration) * 125vw); overflow: hidden; padding: 30px 5vw; isolation: isolate; }
.hadean { --duration: .5363; background: var(--hadean); }
.archean { --duration: 1.531; background: var(--archean); }
.proterozoic { --duration: 1.9612; background: var(--proterozoic); }
.phanerozoic { --duration: .5388; background: var(--phanerozoic); }
.boundary { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.boundary-line { width: 100px; height: 1px; background: var(--rule); }
.eon-content { position: relative; z-index: 1; max-width: 510px; margin-top: clamp(35px, 9vh, 110px); }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .19em; margin: 0 0 24px; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(48px, 5.8vw, 90px); line-height: 1.05; letter-spacing: -.05em; margin: 0 0 16px; }
h1 a, h2 a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .12em; text-decoration-color: var(--rule); }
h1 a:hover, h2 a:hover, h1 a:focus-visible, h2 a:focus-visible { text-decoration-color: currentColor; }
.date { font-size: 12px; letter-spacing: .025em; margin-bottom: 26px; color: var(--muted); }
.description { max-width: 390px; font-size: 16px; line-height: 1.8; }
.eon-detail { display: flex; align-items: center; gap: 12px; margin-top: 30px; font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.detail-line { height: 1px; width: 40px; background: currentColor; }
/* Each image fills the opening of its eon, then blends into the timeline color. */
.eon::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  width: min(100%, 1100px);
  height: 100%;
  pointer-events: none;
  background-image: var(--illustration);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  opacity: .4;
  mask-image: linear-gradient(to right, #0004, #000 65%, transparent);
}
.hadean { --illustration: url("../images/hadean.jpg"); }
.archean { --illustration: url("../images/archean.jpg"); }
.proterozoic { --illustration: url("../images/proterozoic.jpg"); }
.phanerozoic { --illustration: url("../images/phanerozoic.jpg"); }
body.dark .eon::after { opacity: .3; }
.scroll-hint { position: absolute; bottom: 23px; left: 5vw; font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.scroll-hint span { margin-left: 18px; }
.present { position: absolute; right: 20px; top: 30px; font-size: 11px; writing-mode: vertical-rl; }
.timeline-footer { height: 140px; padding: 22px 4vw 16px; }
.timeline-caption, .timeline-endpoints { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.timeline-caption { margin-bottom: 10px; align-items: center; gap: 12px; }
.timeline-caption span:first-of-type { letter-spacing: .17em; }
.timeline-caption span:last-child { margin-left: auto; }
.play-toggle, .rewind-toggle { flex-shrink: 0; width: 28px; height: 28px; border: 1px solid var(--rule); border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 11px; cursor: pointer; }
.rewind-toggle { font-size: 19px; }
.play-toggle:hover, .rewind-toggle:hover { border-color: var(--ink); }
nav { position: relative; display: grid; grid-template-columns: var(--eon-columns); width: 100%; }
.eon-nav::after { content: ""; position: absolute; top: -5px; bottom: -5px; left: clamp(0px, var(--playback-progress, 0%), calc(100% - 1px)); width: 1px; background: var(--ink); box-shadow: 0 0 0 1px var(--paper); pointer-events: none; }
nav a { flex: var(--duration) 1 0; min-width: 0; background: var(--color); padding: 13px 8px; text-align: center; text-decoration: none; font-size: 12px; overflow-wrap: anywhere; border-bottom: 2px solid transparent; }
nav a:hover, nav a[aria-current] { border-bottom-color: var(--ink); }
.nav-hadean { --duration: .5363; --color: var(--hadean); }
.nav-archean { --duration: 1.531; --color: var(--archean); }
.nav-proterozoic { --duration: 1.9612; --color: var(--proterozoic); }
.nav-phanerozoic { --duration: .5388; --color: var(--phanerozoic); }
.timeline-endpoints { margin-top: 10px; font-size: 9px; }
@media (max-width: 1100px) {
  .playback-age { position: static; transform: none; order: 4; flex-basis: 100%; }
  .site-header { gap: 12px; flex-wrap: wrap; height: auto; min-height: 92px; padding-top: 12px; padding-bottom: 12px; }
}
@media (max-height: 700px) and (orientation: landscape) {
  .site-header { height: 64px; }
  .timeline { height: calc(100svh - 174px); min-height: 310px; }
  .timeline-footer { height: 110px; padding-top: 6px; }
  .timeline-caption { margin-bottom: 4px; }
  .eon-content { margin-top: 24px; }
  .eyebrow { margin-bottom: 12px; }
  h1, h2 { font-size: 48px; }
  .date { margin-bottom: 12px; }
  .description { font-size: 13px; line-height: 1.6; }
  .eon-detail { margin-top: 15px; }
  .scroll-hint { display: none; }
}
@media (max-width: 767px) and (orientation: landscape) {
  .eon { flex-basis: calc(var(--duration) * 180vw); }
}
@media (max-width: 767px) and (orientation: portrait) {
  .playback-overlay { position: fixed; top: 0; bottom: 132px; }
  .playback-age { font-size: 28px; }
  .content-pointer { left: 0; right: 0; top: clamp(0px, var(--playback-progress, 0%), calc(100% - 1px)); bottom: auto; height: 1px; width: auto; }
  .site-header { min-height: 110px; height: auto; padding: 14px 6vw; flex-wrap: wrap; gap: 10px; }
  .wordmark { flex-basis: auto; }
  .language-control { flex-basis: calc(100% - 155px); }
  .language-control { margin-left: 0; }
  .theme-toggle { margin-left: auto; }
  .wordmark { font-size: 23px; }
  .timeline { display: block; height: auto; min-height: 0; overflow: visible; padding-bottom: 132px; }
  .eon { min-height: calc(var(--duration) * 1050px); padding: 30px 8vw 70px; scroll-margin-top: 0; }
  .eon-content { margin-top: 68px; }
  h1, h2 { font-size: clamp(43px, 11vw, 74px); }
  .description { font-size: 15px; }
  .eon::after { width: 100%; height: min(100%, 700px); background-position: 65% top; opacity: .25; mask-image: linear-gradient(to bottom, #0009, #0004 65%, transparent); }
  body.dark .eon::after { opacity: .2; }
  .timeline-footer { position: fixed; z-index: 5; bottom: 0; width: 100%; height: 132px; padding: 15px 4vw; background: var(--paper); border-top: 1px solid var(--rule); }
  .timeline-caption span:last-child { display: none; }
  .timeline-caption { margin-bottom: 6px; }
  nav a { flex: 1; font-size: 10px; padding: 12px 2px; }
  .scroll-hint { left: 8vw; bottom: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .timeline { scroll-behavior: auto; }
}

.eon-span { display: block; margin-top: 14px; font-family: inherit; font-size: 14px; line-height: 1.5; letter-spacing: 0; color: var(--muted); }

/* Era boundaries follow the same time scale as their parent eon. */
.era-marker { position: absolute; top: 65px; bottom: 0; left: var(--era-position); width: 1px; border-left: 1px solid var(--rule); pointer-events: none; }
.era-marker span, .era-marker small { position: absolute; left: 12px; bottom: 32px; white-space: nowrap; color: var(--muted); font-size: 11px; }
.era-marker span { color: var(--ink); font-size: clamp(18px, 1.6vw, 24px); font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.era-marker small { bottom: 12px; font-size: 9px; }
.era-nav { margin-bottom: 6px; }
.era-nav-group { display: grid; min-width: 0; background: var(--color); }
.era-nav-group.nav-hadean { grid-template-columns: minmax(0, 1fr); }
.era-nav-group.nav-archean { grid-template-columns: minmax(0, 431fr) minmax(0, 400fr) minmax(0, 400fr) minmax(0, 300fr); }
.era-nav-group.nav-proterozoic { grid-template-columns: minmax(0, 900fr) minmax(0, 600fr) minmax(0, 461.2fr); }
.era-nav-group.nav-phanerozoic { grid-template-columns: minmax(0, 286.898fr) minmax(0, 185.902fr) minmax(0, 66fr); }
.era-nav a { min-width: 0; padding: 8px 2px; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--rule); }
.timeline-footer { height: 180px; }
.timeline { height: calc(100svh - 272px); }
@media (max-height: 700px) and (orientation: landscape) {
  .timeline-footer { height: 150px; }
  .timeline { height: calc(100svh - 214px); }
}
@media (max-width: 767px) and (orientation: portrait) {
  .timeline { height: auto; padding-bottom: 172px; }
  .timeline-footer { height: 172px; }
  .playback-overlay { bottom: 172px; }
  .era-nav-group { flex: 1; }
  .era-marker { top: var(--era-position); bottom: auto; left: 0; width: 100%; height: 1px; border-left: 0; border-top: 1px solid var(--rule); }
  .era-marker span { top: 8px; bottom: auto; left: auto; right: 8vw; }
  .era-marker small { top: 36px; bottom: auto; left: auto; right: 8vw; }
  .era-nav a { font-size: 11px; }
}
