/* The infinite-canvas timeline. World coordinates live on #world;
   nodes counter-scale via --inv so type stays a constant screen size. */

body.timeline-page { overflow: hidden; height: 100vh; }

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
#stage.dragging { cursor: grabbing; }

#world {
  position: absolute;
  left: 0; top: 0;
  transform-origin: 0 0;
  --inv: 1;
}

/* ---------- big header over the canvas ---------- */
.canvas-head {
  position: fixed;
  top: 78px;
  left: 30px;
  z-index: 30;
  text-align: left;
  pointer-events: none;
  width: min(620px, calc(100vw - 320px));
  transition: opacity 0.5s ease;
}
@media (max-width: 640px) {
  .canvas-head { width: calc(100vw - 48px); top: 64px; left: 24px; }
}
.canvas-head h1 {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.2;
}
.canvas-head p {
  margin-top: 10px;
  font-size: clamp(14px, 1.6vw, 17px);
  font-style: italic;
  line-height: 1.55;
  color: var(--ink-soft);
}
/* who made the museum, with a link home (2026-11-28); the head ignores the pointer, the link takes it */
.canvas-head p.credit {
  margin-top: 14px;
  font-size: 13px;
  font-style: normal;
  letter-spacing: 0.08em;
}
.canvas-head .credit a { color: var(--ink-soft); pointer-events: auto; }
.head-away .canvas-head .credit a,
.tier-2 .canvas-head .credit a { pointer-events: none; }
/* get out of the way once the visitor is exploring: fades as soon as any
   map content slides under it (head-away, set per camera frame), and at
   the deepest zoom tier regardless */
.head-away .canvas-head,
.tier-2 .canvas-head { opacity: 0; }

/* ---------- year axis ---------- */
.axis-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--hairline);
  opacity: 0.85;
}
.axis-label {
  position: absolute;
  transform: translateX(-50%) scale(var(--inv));
  transform-origin: top center;
  font-size: 15.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--bronze);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- period bands ---------- */
.band {
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--pc) 60%, transparent);
  background: color-mix(in srgb, var(--pc) 13%, transparent);
  box-shadow: inset 0 3px 0 var(--pc);
  border-radius: 3px;
  transition: opacity 0.45s ease;
}
[data-theme="dark"] .band {
  border-color: color-mix(in srgb, var(--pc) 55%, transparent);
  background: color-mix(in srgb, var(--pc) 20%, transparent);
  box-shadow: inset 0 3px 0 color-mix(in srgb, var(--pc) 80%, #EAE4D6);
}
.band-name { color: color-mix(in srgb, var(--pc) 72%, var(--ink)); }
[data-theme="dark"] .band-name { color: color-mix(in srgb, var(--pc) 45%, var(--ink)); }
.band-label {
  position: absolute;
  left: 10px;
  top: 8px;
  transform: scale(var(--inv));
  transform-origin: top left;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  /* paper backing so a label overhanging a neighbor band never garbles */
  background: rgba(var(--paper), 0.88);
  padding: 2px 7px 3px;
  margin: -2px -7px -3px;
  border-radius: 2px;
  width: fit-content;
}
.band-label small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
/* zoomed all the way out, keep labels compact so dense clusters stay legible */
.tier-0 .band-label { font-size: 10.5px; letter-spacing: 0.08em; }
.tier-0 .band-label small { font-size: 9.5px; letter-spacing: 0.08em; }

/* one-line period identity, revealed as you zoom in */
.band-summary {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  transform: scale(var(--inv));
  transform-origin: bottom left;
  font-size: 13px;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 460px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}
.tier-1 .band-summary,
.tier-2 .band-summary { opacity: 0.9; }
.tier-1 .band.narrow .band-summary { opacity: 0; }
.tier-2 .band.narrow .band-summary { opacity: 0.9; }

/* ---------- artist nodes ---------- */
.artist-node {
  position: absolute;
  /* dot-anchored: the colored dot marks the artist's exact spot in the band.
     --grow (set per camera frame) scales the node up at deep zoom */
  transform: translate(-10px, -50%) scale(calc(var(--inv) * var(--grow, 1)));
  transform-origin: 10px center;
  display: flex;
  align-items: center;
  gap: 9px;
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  text-align: left;
  padding: 4px 6px;
}
.artist-node.flip {
  flex-direction: row-reverse;
  transform: translate(calc(-100% + 10px), -50%) scale(calc(var(--inv) * var(--grow, 1)));
  transform-origin: calc(100% - 10px) center;
  text-align: right;
}
.artist-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pc, var(--bronze));
  flex-shrink: 0;
  transition: transform 0.25s;
  box-shadow: 0 0 0 3px rgba(var(--paper), 0.75);
}
[data-theme="dark"] .artist-dot {
  background: color-mix(in srgb, var(--pc, var(--bronze)) 75%, #EAE4D6);
}
.artist-portrait {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid color-mix(in srgb, var(--pc, var(--bronze-soft)) 65%, transparent);
  filter: grayscale(45%);
  display: none;
  flex-shrink: 0;
  background: rgba(var(--paper), 1);
}
.artist-name {
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  white-space: nowrap;
  line-height: 1.2;
}
.artist-years {
  display: none;
  font-size: 11.5px;
  font-style: italic;
  color: var(--ink-soft);
  white-space: nowrap;
}
.artist-node:hover .artist-name { color: var(--bronze); }
.artist-node:hover .artist-dot { transform: scale(1.5); }
.artist-node:focus-visible { outline: 1px solid var(--bronze); outline-offset: 3px; }

/* ---------- semantic zoom tiers ---------- */
/* zoomed all the way out: bare dots still mark every artist, so the bands
   read as inhabited and zooming in has a visible promise */
.tier-0 .artist-node { opacity: 0.55; }
.tier-0 .artist-node .artist-name { display: none; }
.tier-1 .artist-node,
.tier-2 .artist-node {
  opacity: 1;
  pointer-events: auto;
}
/* mid zoom: dot + compact surname; close zoom: portrait + full name + dates */
.an-full { display: none; }
.tier-2 .an-full { display: inline; }
.tier-2 .an-short { display: none; }
.tier-2 .artist-dot { display: none; }
.tier-2 .artist-portrait { display: block; }
.tier-2 .artist-years { display: block; }

/* dimming for filters */
.filtered .band { opacity: 0.22; }
.filtered .artist-node { opacity: 0.12; }
.tier-0.filtered .artist-node { opacity: 0; }
.filtered .band.focus { opacity: 1; }
.tier-1.filtered .artist-node.focus,
.tier-2.filtered .artist-node.focus { opacity: 1; }

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: 74px;
  right: 26px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.hud-zoom { display: flex; gap: 8px; }

.hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  font-size: 13.5px;
  font-style: italic;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  opacity: 0.8;
  transition: opacity 1s;
  pointer-events: none;
  white-space: nowrap;
}
.hint.faded { opacity: 0; }

/* ---------- filter panel ---------- */
.filter-panel {
  position: fixed;
  top: 130px;
  right: 26px;
  z-index: 50;
  width: min(340px, calc(100vw - 40px));
  max-height: min(62vh, 560px);
  overflow-y: auto;
  background: rgba(var(--paper), 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid var(--bronze-soft);
  box-shadow: 0 18px 60px rgba(28, 26, 23, 0.18);
  padding: 20px 22px 18px;
  transform-origin: top right;
}
.filter-panel[hidden] { display: none; }
.filter-panel.opening { animation: panel-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.filter-panel .fp-item { animation: item-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes item-in {
  from { opacity: 0; transform: translateY(-7px); }
  to { opacity: 1; transform: translateY(0); }
}

.fp-heading {
  font-size: 11.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bronze);
  margin: 14px 0 8px;
}
.fp-search {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--hairline);
  background: none;
  font-family: var(--en);
  font-size: 17px;
  padding: 6px 2px 8px;
  color: var(--ink);
  outline: none;
}
.fp-search:focus { border-bottom-color: var(--bronze); }
.fp-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: none;
  background: none;
  padding: 7px 4px;
  font-size: 16.5px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.2s;
}
.fp-item:hover { color: var(--bronze); }
.fp-item .fp-sub {
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fp-item.active { color: var(--bronze); }
.fp-item.active::before { content: "✦ "; font-size: 11px; }
.fp-swatch {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: baseline;
}
.fp-clear {
  margin-top: 12px;
  width: 100%;
  border: 1px solid var(--hairline);
  background: none;
  padding: 9px;
  font-size: 12.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--ink-soft);
  transition: border-color 0.25s, color 0.25s;
}
.fp-clear:hover { border-color: var(--bronze); color: var(--bronze); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .m-nav { padding: 14px 18px 10px; gap: 12px; }
  .m-nav-links { display: none; }
  .m-nav-call { margin-left: auto; }
  .hud { top: auto; bottom: 24px; right: 18px; }
  .hint {
    bottom: 140px; /* clear of the HUD pills pinned bottom-right */
    font-size: 12.5px;
    white-space: normal;
    text-align: center;
    width: min(320px, calc(100vw - 48px));
  }
  .filter-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 62vh;
    border-left: none;
    border-right: none;
    border-bottom: none;
    transform-origin: bottom center;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  @keyframes panel-in {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
