/* History keeps its evening cards; the person-page ruler becomes a month
   guide to the dates on the page, including undated records. */
.history-layout {
  display: grid; grid-template-columns: 0 minmax(0, 1fr); gap: 0;
  padding: 0 var(--pad); align-items: start;
}
.history-layout.has-history-dates {
  grid-template-columns: clamp(5.25rem, 8vw, 8rem) minmax(0, 1fr);
  gap: clamp(1.25rem, 2.75vw, 3rem);
}
.history-rail-slot { align-self: stretch; min-width: 0; }
.history-content { min-width: 0; }
.history-layout .histbody { padding: 0 0 1rem; }
.history-layout .hfront { padding-left: 0; padding-right: 0; }
.history-content .morewrap { padding-left: 0; padding-right: 0; }
.history-content .morewrap > .sfail { padding-left: 0; padding-right: 0; }
.history-layout .hnight { scroll-margin-top: calc(var(--topH, 0px) + 1.5rem); }
.history-layout .hn-b { flex-wrap: wrap; }
.history-layout .hs-hero { max-width: 100%; }
.history-layout .hn-rest { flex-basis: 12rem; }
.history-layout .hn-h { flex-wrap: wrap; }
.ht-rail { position: sticky; top: calc(var(--topH, 0px) + 1.25rem); padding: .2rem 0 1.5rem; z-index: 2; }
.ht-kicker {
  display: block; font-size: .6667rem; font-weight: 800; letter-spacing: .2em;
  color: var(--dimmer); margin-bottom: .8rem;
}
.ht-current { display: flex; flex-direction: column; gap: .2rem; margin-bottom: 1rem; }
.ht-current strong { font-size: 1.7333rem; line-height: 1.05; font-weight: 750; letter-spacing: -.05em; }
.ht-current span { font-size: .7333rem; color: var(--dim); font-weight: 600; letter-spacing: .06em; }
.ht-scrub {
  position: relative; width: 100%; min-width: 44px;
  height: min(50vh, 28rem, max(6rem, calc(100svh - var(--topH, 0px) - var(--tabsH, 0px) - 13rem)));
  cursor: ns-resize; touch-action: none; outline: none;
}
.ht-scrub:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: var(--r-s); }
.ht-ticks { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-around; }
.ht-tick { position: relative; flex: 1 1 0; min-height: 0; }
.ht-tick::before {
  content: ''; position: absolute; top: 50%; left: 0; height: 1px;
  width: calc(.7rem + var(--ht-weight) * .18rem); background: var(--dimmer);
  transform: translateY(-50%); transition: width .2s var(--ease), background .2s var(--ease);
}
.ht-tick.is-year::before { height: 2px; background: var(--dim); }
.ht-tick.is-active::before { width: 1.7rem; height: 2px; background: var(--fg); box-shadow: 0 0 12px #fff4; }
.ht-tick-label {
  position: absolute; left: 2.15rem; top: 50%; transform: translateY(-50%);
  font-size: .6667rem; font-weight: 650; letter-spacing: .025em; color: var(--dimmer);
  white-space: nowrap; opacity: 0; transition: color .2s, opacity .2s;
}
.ht-tick.has-label .ht-tick-label, .ht-tick.is-active .ht-tick-label { opacity: 1; }
.ht-tick.is-active .ht-tick-label { color: var(--fg); }
.ht-marker {
  position: absolute; top: var(--ht-active-pos, 0%); left: 1.7rem; width: .3rem; height: .3rem;
  border-radius: 50%; background: var(--fg); transform: translateY(-50%); pointer-events: none;
  box-shadow: 0 0 12px #fff6;
}
.ht-preview {
  position: absolute; z-index: 4; left: calc(100% + .55rem); top: var(--ht-preview-pos, 0%);
  width: clamp(10rem, 19vw, 15rem); padding: .85rem 1rem; display: grid; gap: .2rem;
  border-radius: var(--r-m); background: var(--glass); border: 1px solid var(--line-hi);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); box-shadow: 0 18px 40px #0008;
  opacity: 0; transform: translateY(-50%) translateX(-.4rem); pointer-events: none;
  transition: opacity .18s var(--ease), transform .22s var(--ease);
}
.ht-scrub.is-previewing .ht-preview { opacity: 1; transform: translateY(-50%) translateX(0); }
.ht-preview strong { font-size: 1.0667rem; letter-spacing: -.025em; }
.ht-preview small { color: var(--dim); font-size: .7333rem; }
.ht-preview > span { color: var(--dim); font-size: .8rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ht-coverage, .ht-range { display: block; color: var(--dimmer); font-size: .6667rem; line-height: 1.4; }
.ht-coverage { margin-top: .9rem; font-weight: 700; }
.ht-range { margin-top: .15rem; }
.ht-help { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ht-rail.is-single .ht-scrub { display: none; }
.ht-rail.is-single .ht-current strong { font-size: 1.4rem; }
@media (pointer: coarse) { .ht-scrub { min-width: 48px; } }
/* The side guide leaves room for readable artwork on narrow displays. */
@media (max-width: 700px) {
  .history-layout.has-history-dates { grid-template-columns: 3rem minmax(0, 1fr); gap: .9rem; }
  .ht-kicker { font-size: .5333rem; letter-spacing: .1em; }
  .ht-current strong { font-size: 1.2rem; }
  .ht-current span { font-size: .6667rem; }
  .ht-tick-label { left: 1.1rem; font-size: .6rem; }
  .ht-tick::before { width: .65rem; }
  .ht-tick.is-active::before { width: .75rem; }
  .ht-marker { left: .75rem; width: .2rem; height: .2rem; }
  .ht-coverage { font-size: .6rem; }
  .ht-range { display: none; }
  .ht-rail.is-single .ht-current strong { font-size: .8rem; }
  .history-layout .hn-h > span { flex-shrink: 1; font-size: .8667rem; }
  .history-layout .hn-h { gap: .35rem .6rem; }
  .history-layout .hn-gap { gap: .5rem; }
  .history-layout .hn-gap span { font-size: .6rem; letter-spacing: .04em; }
  .history-layout .hs-it { grid-template-columns: min(5rem, 30%) minmax(0, 1fr); }
  .ht-preview { width: min(14rem, 65vw); }
}
@media (max-height: 600px) {
  .ht-rail { top: calc(var(--topH, 0px) + .5rem); padding-bottom: .5rem; }
  .ht-kicker { margin-bottom: .35rem; }
  .ht-current { margin-bottom: .5rem; flex-direction: row; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
  .ht-current strong { font-size: 1.2rem; }
  .ht-scrub { height: max(4rem, calc(100svh - var(--topH, 0px) - var(--tabsH, 0px) - 8.5rem)); }
  .ht-range { display: none; }
  .ht-coverage { margin-top: .45rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ht-tick::before, .ht-tick-label, .ht-preview { transition: none; }
}
