:root {
  color-scheme: light;
  --paper: #f5f0e6;
  --ink: #25251f;
  --muted: #61594e;
  --accent: #79522d;
  --rule: #c9beac;
  --mount: #ebe3d5;
  --stage-matte: #e8dfcf;
  --stage-halo: #fffcf3;
  --mono: "Space Mono", ui-monospace, monospace;
  --display: "Bodoni Moda", Georgia, serif;
  --gutter: clamp(20px, 4vw, 76px);
  color: var(--ink);
  background: var(--paper);
  font-family: "Inter Tight", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #14161c;
  --ink: #f7eee1;
  --muted: #c8bdaf;
  --accent: #e7c49a;
  --rule: #514b48;
  --mount: #21242c;
  --stage-matte: #101218;
  --stage-halo: #292730;
}
* { box-sizing: border-box; }
body, h1, h2, p, figure { margin: 0; }
a { color: inherit; }
button { color: inherit; font: inherit; }
a:focus-visible, button:focus-visible, .timeline-track:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
[hidden] { display: none !important; }
.career-bar {
  height: 52px;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--rule);
  font: .69rem var(--mono);
  text-transform: uppercase;
  letter-spacing: .09em;
}
.career-bar a { text-decoration: none; width: fit-content; }
.career-theme, .timeline-actions button {
  border: 1px solid var(--rule);
  background: var(--paper);
  border-radius: 99px;
  cursor: pointer;
}
.career-theme, .timeline-actions button { width: 36px; height: 36px; font-size: 1rem; }
.career-theme { justify-self: end; }
.career-theme span::before { content: "☾"; }
[data-theme="dark"] .career-theme span::before { content: "☼"; }
.chapter-meta, .chapter-role, .detail-count, .ruler-heading, .ruler-years, .atlas-header {
  font: .77rem/1.4 var(--mono);
  letter-spacing: .035em;
}
.career-bar { border-bottom: 0; }
.career-detail { position: relative; min-height: 0; }
.detail-bar {
  min-height: 46px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding-inline: 4px;
}
.detail-count { grid-column: 2; color: var(--accent); }
.timeline-actions { display: flex; gap: 6px; justify-self: end; }
.timeline-actions button:disabled { opacity: .35; cursor: default; }
.timeline-actions button:hover:enabled { background: var(--mount); }
.detail-index {
  position: relative;
  z-index: 2;
  min-width: 0;
  background: var(--mount);
  padding: 13px clamp(12px, 2vw, 25px) 8px;
  border-radius: 18px;
}
.ruler-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--muted); margin-bottom: 9px; }
.ruler-heading > :first-child { color: var(--ink); font-size: .93rem; font-weight: 700; }
.timeline-hint { font-size: .74rem; }
.chapter-nav { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.ruler { min-width: 820px; padding-right: 4px; }
.ruler-years { display: grid; grid-template-columns: repeat(11, 1fr); color: var(--muted); font-size: .79rem; }
.ruler-years span { padding-left: 3px; }
.ruler-markers { position: relative; height: 59px; margin-top: 3px; }
.ruler-range {
  position: absolute;
  left: var(--start);
  width: var(--span);
  top: calc(3px + var(--lane) * 28px);
  height: 25px;
  display: grid;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  isolation: isolate;
}
.ruler-range::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1px 0;
  background: color-mix(in srgb, var(--accent) 19%, var(--mount));
  border-radius: 7px;
  transition: background 260ms ease, box-shadow 260ms ease;
}
.ruler-range span { padding-inline: 7px; white-space: nowrap; font: 650 .8rem/1 "Inter Tight", system-ui, sans-serif; }
.ruler-range:is([href="#salzburg"], [href="#bath"]) span { min-width: 0; white-space: normal; padding-inline: 3px; }
.ruler-range--short span { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); padding-left: 6px; }
.ruler-range--short::after { content: ""; position: absolute; inset: -2px -18px -2px -3px; }
.ruler-range--label-before span { left: auto; right: 100%; padding-inline: 0 6px; }
.ruler-range--label-before::after { inset-inline: -18px -3px; }
@media (max-width: 1100px) {
  .ruler-range span { font-size: .72rem; }
}
@media (761px <= width <= 950px) and (orientation: landscape) {
  .ruler-range[href="#nairobi"] span { width: 88px; white-space: normal; text-align: right; }
}
.ruler-range:is(:hover, :focus-visible)::before { background: color-mix(in srgb, var(--accent) 34%, var(--mount)); }
.ruler-range[aria-current] { color: var(--paper); }
.ruler-range--short[aria-current] { color: var(--accent); }
.ruler-range[aria-current]::before { background: var(--accent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.ruler-playhead {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  transform: translateX(calc(var(--playhead, 0px) - 2px));
  background: var(--accent);
}
.stage-atmosphere { display: none; }
.timeline-track { position: relative; min-width: 0; min-height: 0; }
.chapter-meta {
  grid-area: meta;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--accent);
  font-size: clamp(.82rem, 1.03vw, 1rem);
}
.chapter-meta span:last-child { color: var(--muted); }
.chapter-photos { grid-area: photos; position: relative; min-width: 0; min-height: 0; }
.chapter-photos[data-count] {
  overflow: hidden;
  border-radius: clamp(12px, 1.8vw, 22px);
  background: var(--mount);
}
.chapter-photos figure {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 720ms ease, visibility 720ms;
}
.chapter-photos figure:first-child, .chapter-photos figure.is-visible { opacity: 1; visibility: visible; }
.chapter-photos.is-cycling figure:not(.is-visible) { opacity: 0; visibility: hidden; }
.chapter-photos img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.photo-controls {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
}
.photo-controls button {
  display: grid;
  place-items: center;
  min-width: 29px;
  min-height: 29px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: .74rem;
}
.photo-controls button[aria-pressed="true"] { background: var(--accent); color: var(--paper); }
.chapter-body { grid-area: text; min-height: 0; min-width: 0; align-self: center; }
.chapter-role { color: var(--accent); font-weight: 650; }
.chapter-body h2 { margin: 7px 0 11px; font: 600 clamp(2rem, 3.15vw, 4.35rem)/.98 var(--display); letter-spacing: -.045em; overflow-wrap: break-word; text-wrap: pretty; }
.chapter-body p:not(.chapter-role) { font-size: clamp(.89rem, 1.14vw, 1.13rem); line-height: 1.48; color: var(--muted); }
.chapter-body p + p { margin-top: .7em; }
.career-atlas {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 9px;
  padding: 12px;
  border-radius: 20px;
  background: var(--mount);
}
.atlas-header { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); }
.atlas-header a { text-underline-offset: 3px; white-space: nowrap; }
.atlas-place { color: var(--ink); font-size: clamp(.88rem, 1.1vw, 1.05rem); font-weight: 650; }
.atlas-view { display: block; width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 12px; }
.career-footer { display: flex; justify-content: space-between; gap: 20px; padding: 0 var(--gutter) 14px; font-size: .82rem; }
.career-footer a { text-decoration-color: var(--accent); text-underline-offset: 4px; }

.career-intro-page body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}
.career-intro-page .career-bar { flex-shrink: 0; }
.career-intro {
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(38px, 7vh, 80px) var(--gutter) clamp(54px, 11vh, 110px);
  background: radial-gradient(ellipse 52rem 25rem at 50% 46%, var(--stage-halo), transparent 72%);
}
.career-intro-copy { width: min(100%, 38rem); text-align: center; }
.career-intro-route { display: block; width: 9rem; height: auto; margin: 0 auto 1.2rem; color: var(--accent); }
.career-intro h1 {
  margin-bottom: clamp(19px, 3.5vh, 29px);
  font: 600 clamp(2.7rem, 7.6vw, 5.35rem)/.98 var(--display);
  letter-spacing: -.055em;
  text-wrap: balance;
}
.career-intro p {
  max-width: 31rem;
  margin-inline: auto;
  color: var(--muted);
  font-size: clamp(1.04rem, 1.48vw, 1.25rem);
  line-height: 1.55;
  text-wrap: pretty;
}
.career-intro p + p { margin-top: .7em; }
.career-intro-start {
  display: inline-flex;
  align-items: center;
  gap: .8em;
  min-height: 48px;
  margin-top: clamp(25px, 4.5vh, 40px);
  padding: .6em 1.3em;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  transition: border-color 180ms ease, background 180ms ease;
}
.career-intro-start span { color: var(--accent); transition: transform 180ms ease; }
.career-intro-start:hover { border-color: var(--accent); background: var(--mount); }
.career-intro-start:hover span { transform: translateX(3px); }
@media (prefers-reduced-motion: no-preference) {
  .career-intro-copy { animation: career-intro-in 650ms ease-out both; }
  @keyframes career-intro-in {
    from { opacity: .55; transform: translateY(7px); }
  }
}

@media (min-width: 761px) and (orientation: landscape) {
  .career-timeline-page { overflow: hidden; }
  .career-timeline-page body { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .career-timeline-page main { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
  .career-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(215px, 26%);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: clamp(9px, 1.8vh, 21px) clamp(12px, 1.8vw, 25px);
    margin-inline: var(--gutter);
    padding-bottom: clamp(21px, 5vh, 56px);
    isolation: isolate;
  }
  .detail-bar { grid-row: 1; grid-column: 1 / -1; }
  .detail-index { grid-row: 3; grid-column: 1 / -1; }
  .ruler { min-width: 0; }
  .career-atlas { grid-row: 2; grid-column: 2; align-self: center; height: min(100%, 360px); }
  .stage-atmosphere, .timeline-track { grid-area: 2 / 1; }
  .stage-atmosphere {
    display: block;
    position: relative;
    pointer-events: none;
    overflow: hidden;
    border-radius: 22px;
    background: radial-gradient(ellipse at var(--stage-light, 50%) 45%, var(--stage-halo), var(--stage-matte) 80%);
  }
  .timeline-track {
    display: flex;
    gap: 2vw;
    padding: 0 4%;
    overflow: hidden;
    border-radius: 22px;
    cursor: grab;
  }
  .timeline-track.is-dragging { cursor: grabbing; user-select: none; }
  .chapter { flex: 0 0 100%; min-width: 0; height: 100%; padding-block: clamp(7px, 1.3vh, 16px); perspective: 1500px; }
  .chapter-shell {
    height: 100%;
    display: grid;
    grid-template: auto minmax(0, 1fr) / minmax(0, .94fr) minmax(0, 1fr);
    grid-template-areas: "meta meta" "photos text";
    gap: 8px clamp(12px, 2vw, 32px);
    padding: clamp(8px, 1.5vh, 20px) clamp(8px, 1.2vw, 20px);
    opacity: var(--frame-opacity, .33);
    transform: translate3d(0, var(--frame-y, 14px), 0) rotateY(var(--frame-yaw, 0deg)) scale(var(--frame-scale, .88));
  }
  .chapter:first-child .chapter-shell { --frame-opacity: 1; --frame-y: 0px; --frame-scale: 1; }
  .chapter-body {
    padding-block: 5px;
    max-height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    opacity: var(--copy-opacity, 1);
    transform: translate3d(var(--copy-x, 0px), 0, 0);
  }
  #bath-title { font-size: clamp(1.55rem, min(2.65vw, 4.5vh), 3.85rem); }
  .chapter-photos {
    align-self: center;
    height: min(100%, 36vh);
    transform: translate3d(var(--photo-x, 0px), 0, 0) scale(var(--photo-scale, 1));
    clip-path: inset(0 var(--iris-right, 0%) 0 var(--iris-left, 0%) round 20px);
  }
  .chapter-photos[data-layout="portrait"] { width: min(100%, 275px); justify-self: center; }
  .chapter-photos img { filter: grayscale(var(--desaturation, 0)); }
  .timeline-track.is-dragging .chapter-photos { clip-path: none; }
}

@media (min-width: 761px) and (orientation: landscape) and (max-height: 680px) {
  .career-bar { height: 47px; }
  .career-detail { padding-bottom: 20px; gap: 7px 13px; }
  .detail-bar { min-height: 39px; }
  .detail-index { padding-block: 8px 5px; }
  .ruler-heading { margin-bottom: 5px; }
  @media (min-height: 581px) {
    #lunar-x .chapter-shell { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); }
  }
  .chapter-body h2 { font-size: clamp(1.55rem, 4.65vh, 2.8rem); margin-block: 3px 6px; }
  .chapter-body p:not(.chapter-role) { font-size: .86rem; line-height: 1.38; }
  .chapter-role { font-size: .71rem; }
  .chapter-meta { font-size: .76rem; }
}
@media (min-width: 761px) and (orientation: landscape) and (max-height: 580px) {
  .career-detail { padding-bottom: 12px; row-gap: 4px; }
  .detail-bar { min-height: 36px; }
  .chapter { padding-block: 5px; }
  .chapter-shell { grid-template-columns: minmax(0, .44fr) minmax(0, 1fr); padding-block: 5px; }
  .chapter-body { padding-block: 3px; }
  .chapter-body p:not(.chapter-role) { font-size: .82rem; }
  .career-atlas { padding: 9px; }
  .ruler-markers { height: 55px; }
}
@media (max-width: 760px), (orientation: portrait) {
  .career-bar { padding-inline: 15px; font-size: .61rem; }
  .career-detail { display: flex; flex-direction: column; }
  .detail-bar { order: 0; position: sticky; top: 0; z-index: 3; padding-right: 15px; background: var(--paper); }
  .career-atlas { order: 1; position: sticky; top: 46px; z-index: 2; margin: 8px 15px 0; min-height: 195px; grid-template-rows: auto 128px auto; }
  .timeline-track { order: 2; padding: 13px 15px 0; }
  .detail-index { display: none; }
  .chapter { position: relative; padding: 13px 0 35px; scroll-margin-top: 248px; }
  .chapter-meta { margin-bottom: 10px; }
  .chapter-photos { height: clamp(165px, 58vw, 390px); }
  .chapter-body { padding-top: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
