/*
 * Callbooks.org: timelines (Edition Line). The year strips on the home page, search results and
 * call sign page, and the address bands on the call sign page. Drawn by src/timeline.ts, class
 * prefix tl-. Loaded after style.css, which supplies --ink, --ink-2, --needle, --hair, --paper-2,
 * --radius and --sans. Colors only through custom properties.
 */

:root {
  --lit: #28506e;
  --dim: #aebccb;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --lit: #94bfe0;
    --dim: #3b4f61;
  }
}

:root[data-theme="dark"] {
  --lit: #94bfe0;
  --dim: #3b4f61;
}

/* ---- year strips ---- */

.tl { margin: 0.9rem 0 0; }

.tl-svg { display: block; width: 100%; max-width: 100%; height: auto; }
.tl-narrow { display: none; }

@media (max-width: 600px) {
  .tl-wide { display: none; }
  .tl-narrow { display: block; }
}

.tl-base { stroke: var(--ink); stroke-width: 2; }
.tl-tick { stroke: var(--ink-2); stroke-width: 1; }
.tl-tick.maj { stroke: var(--ink); stroke-width: 1.6; }
.tl-num {
  font-family: var(--sans);
  fill: var(--ink-2);
  text-anchor: middle;
  font-variant-numeric: tabular-nums lining-nums;
}
.tl-ed, .tl-lit { fill: var(--lit); }
.tl-dim { fill: var(--dim); }
.tl-needle { fill: var(--needle); }
.tl-nlbl {
  font-family: var(--sans);
  font-weight: 700;
  fill: var(--needle);
  font-variant-numeric: tabular-nums lining-nums;
}

.tl-cap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  padding-top: 0.4rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ink-2);
}
.tl-key { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ink); }
.tl-key i { display: inline-block; flex: none; width: 7px; height: 16px; background: var(--lit); }
.tl-key i.dim { height: 11px; background: var(--dim); }
.tl-key i.ndl { width: 3px; height: 18px; background: var(--needle); }
.tl-key i.sel { width: 7px; height: 18px; background: var(--needle); }
.tl-aside { flex-basis: 100%; }

/* Years chosen as a search filter, and the mark that follows the pointer or the arrow keys. */
.tl-sel, .tl-hover { fill: var(--needle); }
.tl-hover { pointer-events: none; }

/* With app.js: the strip takes focus and shows a card for one year. */
.tl[data-tl] { position: relative; }
.tl-live .tl-svg, .tl-pick .tl-svg { touch-action: manipulation; }
.tl-pick .tl-svg { cursor: pointer; }
.tl-tip {
  position: absolute;
  z-index: 2;
  min-width: 11rem;
  max-width: min(20rem, 100%);
  padding: 0.5rem 0.7rem 0.55rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-top: 3px solid var(--needle);
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.4;
  pointer-events: none;
}
.tl-tip.pinned { pointer-events: auto; }
.tl-tip-y {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
}
.tl-tip p { margin: 0.15rem 0 0; color: var(--ink-2); }
.tl-tip dl { display: grid; gap: 0.05rem; margin: 0.2rem 0 0; }
.tl-tip dl div { display: flex; justify-content: space-between; gap: 1rem; }
.tl-tip dt { color: var(--ink-2); }
.tl-tip dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
.tl-tip ul {
  margin: 0.35rem 0 0;
  padding: 0.35rem 0 0;
  border-top: 1px solid var(--hair);
  list-style: none;
  color: var(--ink-2);
  font-size: 0.8125rem;
}
.tl-tip-act { display: inline-block; margin-top: 0.35rem; font-weight: 600; }

/* ---- search results: the chosen years ---- */

.chosen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--needle);
  border-left-width: 4px;
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
  text-decoration: none;
}
.chip:hover { background: var(--paper-2); }
.chip span { color: var(--ink-2); font-weight: 400; }
.chosen-clear { margin-left: 0.25rem; }

/* In the compact search form: untick a year to drop it from the next search. */
.narrow-years {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0.6rem 0 0;
  padding: 0;
  border: 0;
}
.narrow-years legend { flex-basis: 100%; padding: 0 0 0.2rem; font-size: 0.9rem; font-weight: 500; }
.narrow-years label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums lining-nums;
}

/* ---- call sign page: sections and address bands ---- */

.tl-sec { margin-block: 1.5rem 2rem; }
.tl-sec > h2 { border-bottom: 2px solid var(--ink); padding-bottom: 0.2rem; margin-bottom: 0.5rem; }

.tl-rows { margin-top: 0.6rem; }

.tl-band {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--hair);
}
.tl-lbl { min-width: 0; overflow-wrap: anywhere; }
.tl-lbl b { display: block; font-weight: 600; }
.tl-lbl small {
  display: block;
  font-size: 0.875rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums lining-nums;
}

.tl-track { position: relative; height: 1.9rem; background: var(--paper-2); border-radius: var(--radius); }
.tl-bar { position: absolute; top: 0.4rem; bottom: 0.4rem; min-width: 3px; background: var(--lit); border-radius: 2px; }

.tl-axis { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1rem; }
.tl-ticks { position: relative; height: 1.75rem; }
.tl-ticks span {
  position: absolute;
  top: 0.35rem;
  transform: translateX(-50%);
  font-size: 0.8125rem;
  line-height: 1.2;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums lining-nums;
}
.tl-ticks span:first-child { transform: none; }
.tl-ticks span:last-child { transform: translateX(-100%); }
/* A long axis labels the decades only, and drops its two end labels, which would crowd the next decade. */
.tl-ticks.dense span:not(.t10),
.tl-ticks.dense span:first-child,
.tl-ticks.dense span:last-child { display: none; }

.tl-note { margin: 0.6rem 0 0; font-size: 0.875rem; color: var(--ink-2); }

@media (max-width: 600px) {
  .tl-band { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
  .tl-axis { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .tl-axis > span { display: none; }
  .tl-ticks span:not(.t10),
  .tl-ticks.dense span:not(.t20) { display: none; }
}
