/* /tower-heights: every FAA control tower drawn to scale. Built on the site
   tokens in style.css (--card-bg, --card-border, --text-color), so it follows
   the light/dark theme. Three mark colours, checked as a set on both card
   surfaces for colour-blind separation: towers, the selected tower, and the
   tower it is compared with. Reference objects are a quiet grey. Text never
   wears a mark colour. */

.th-page {
  --th-tower: #2a78d6;
  --th-a: #eb6834;
  --th-b: #1baf7a;
  --th-ref: #a3a9b1;
  --th-soft: rgba(42, 120, 214, 0.08);
  --th-muted: var(--secondary);
  --th-plot-h: 320px;   /* the drawing's height for --th-top feet */
  --th-col: 18px;       /* one tower's slot */
  --th-head: 1.6rem;    /* room above the tallest tower for its value */
  --th-foot: 3.6rem;    /* room under the baseline for the upright labels */
  max-width: 960px;
}
[data-bs-theme="dark"] .th-page {
  --th-tower: #3987e5;
  --th-a: #d95926;
  --th-b: #199e70;
  --th-ref: #737b85;
  --th-soft: rgba(57, 135, 229, 0.12);
}
.th-narrow { max-width: 960px; }
@media (max-width: 575.98px) { .th-page { --th-plot-h: 250px; --th-col: 16px; } }

.hero-section.bg-tower-heights {
  background: radial-gradient(circle at 82% 18%, rgba(57, 135, 229, 0.35), transparent 55%),
              linear-gradient(135deg, #10192b 0%, #1d3557 100%);
  color: #fff;
}
.bg-tower-heights .lead { opacity: 0.85; line-height: 1.5; }

/* ── The hero's skyline ──
   Every tower as a hairline bar, tallest first, stretched to the hero's width.
   The tallest, the middle and the shortest bars take the accent, and each has
   its number in the row above: left, centre and right, where the bars are. */
.th-sky { margin: 1.5rem 0 0; }
.th-sky-calls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 0.35rem; }
.th-sky-calls p { margin: 0; font-size: 0.85rem; line-height: 1.3; opacity: 0.9; }
.th-sky-calls p:nth-child(1) { text-align: left; }
.th-sky-calls p:nth-child(2) { text-align: center; }
.th-sky-calls p:nth-child(3) { text-align: right; }
.th-sky-calls strong { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.15; opacity: 1; }
.th-sky-plot { display: block; width: 100%; height: 150px; border-bottom: 1px solid rgba(255, 255, 255, 0.45); }
.th-sky-all { fill: #5a9ef0; }
.th-sky-pick { fill: #f0763f; }
.th-sky-lead { stroke: rgba(255, 255, 255, 0.5); stroke-width: 1; }
@media (max-width: 575.98px) {
  .th-sky-plot { height: 110px; }
  .th-sky-calls strong { font-size: 1.3rem; }
  .th-sky-calls p { font-size: 0.78rem; }
}

/* ── Sections ── */
.th-section { margin-top: 3rem; }
.th-section.th-first { margin-top: 2rem; }
.th-section > h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.9rem; }
.th-section h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.th-section p { line-height: 1.65; }
.th-page [id] { scroll-margin-top: 5.5rem; }
.th-cite { font-size: 0.85rem; color: var(--th-muted); margin-top: 0.9rem; }

/* ── The lineup ──
   One slot per tower on a shared baseline, tallest first; the strip scrolls
   sideways and the feet axis stays put. A tower is a thin shaft with a wider
   cab at the top, and its full height is the height drawn. Hover or tap for
   the name; the selected tower takes the accent and shows its height. */
.th-lineup {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 1rem 1.1rem 1rem;
  margin: 1.25rem 0 0;
}
.th-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; margin-bottom: 0.75rem; }
.th-controls[hidden] { display: none; }
.th-find { flex: 1 1 16rem; max-width: 22rem; }
.th-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.th-sort-label { font-size: 0.8rem; color: var(--th-muted); margin-right: 0.2rem; }
.th-sort-btn {
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text-color);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
}
.th-sort-btn:hover { border-color: var(--th-muted); }
.th-sort-btn[aria-pressed="true"] { background: var(--text-color); border-color: var(--text-color); color: var(--card-bg); font-weight: 600; }

.th-plot { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); }
.th-plot::after {   /* more towers to the right: the strip fades out until it is scrolled to its end */
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.2rem;
  background: linear-gradient(to right, transparent, var(--card-bg));
  pointer-events: none;
}
.th-plot.th-at-end::after { content: none; }
.th-axis { position: relative; width: 2.7rem; height: var(--th-plot-h); margin-top: var(--th-head); }
.th-axis span {
  position: absolute;
  right: 0.45rem;
  bottom: calc(var(--ft) / var(--th-top) * var(--th-plot-h));
  transform: translateY(50%);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--th-muted);
  white-space: nowrap;
}
.th-scroll { overflow-x: auto; overflow-y: hidden; padding-top: var(--th-head); outline-offset: 2px; scrollbar-width: thin; }
.th-track {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: max-content;
  min-width: 100%;
  height: var(--th-plot-h);
  margin: 0 0 var(--th-foot);
  padding: 0 0.4rem;
  list-style: none;
  border-bottom: 1px solid var(--th-muted);
}
.th-grid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--ft) / var(--th-top) * var(--th-plot-h));
  border-top: 1px solid var(--card-border);
  pointer-events: none;
}
.th-col {
  position: relative;
  flex: 0 0 var(--th-col);
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
}
.th-col[hidden] { display: none; }
.th-col:hover { background: var(--th-soft); }
.th-mark {
  position: relative;
  display: block;
  width: 6px;
  height: calc(var(--ft) / var(--th-top) * var(--th-plot-h));
  background: var(--th-tower);
  border-radius: 1px 1px 0 0;
}
.th-mark::before {   /* the cab: wider than the shaft, flaring upward, inside the tower's height */
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 12px;
  height: 7px;
  transform: translateX(-50%);
  background: inherit;
  clip-path: polygon(0 0, 100% 0, 82% 100%, 18% 100%);
}
.th-ref { cursor: default; }
.th-ref .th-mark { background: var(--th-ref); border-radius: 3px 3px 0 0; }
.th-ref .th-mark::before { content: none; }
.th-id {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  writing-mode: vertical-rl;
  transform: translateX(-50%) rotate(180deg);
  font-size: 0.625rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--th-muted);
  white-space: nowrap;
}
.th-ref .th-id { font-style: italic; }
.th-val {   /* the selected tower's height, on its cap */
  position: absolute;
  bottom: calc(var(--ft) / var(--th-top) * var(--th-plot-h) + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-color);
  background: var(--card-bg);
  padding: 0 2px;
  white-space: nowrap;
  z-index: 1;
}
.th-col.th-sel .th-mark { background: var(--th-a); }
.th-col.th-sel .th-id { color: var(--text-color); font-weight: 700; }

/* Ordered by year or by level, the towers fall into bands (a decade, a level). Each band starts
   with a hairline through the plot, and a row under the tower labels names it. A name stays at
   the left edge of the strip while its band is scrolled through, so there is always one in view. */
.th-band-start::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: -2rem;
  left: 0;
  border-left: 1px solid var(--card-border);
  pointer-events: none;
}
.th-bands {
  display: flex;
  width: max-content;
  height: 1.5rem;
  margin-top: calc(2rem - var(--th-foot));   /* up into the room under the baseline, below the tower labels */
  padding: 0 0.4rem;
}
.th-bands:empty { display: none; }
.th-bands > div {
  flex: 0 0 auto;
  width: calc(var(--n) * var(--th-col));
  border-left: 1px solid var(--card-border);
  overflow: clip;   /* not hidden: that would stop the name sticking */
}
.th-bands span {
  position: sticky;
  left: 0;
  display: inline-block;
  padding: 0.3rem 0.5rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-color);
  white-space: nowrap;
}

.th-tip {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -100%);
  background: var(--text-color);
  color: var(--card-bg);
  border-radius: 0.35rem;
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}
.th-tip[hidden] { display: none; }
.th-tip strong { margin-right: 0.35rem; }

.th-answer {
  margin: 0.75rem 0 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--th-a);
  background: var(--th-soft);
  line-height: 1.55;
}
.th-answer[hidden] { display: none; }
.th-answer .th-links { display: block; margin-top: 0.3rem; font-size: 0.9rem; }
.th-answer .th-links a + a { margin-left: 1rem; }

/* ── Compare two towers ── */
.th-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 1rem 1.1rem 1.1rem;
}
.th-pick label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }
.th-key { width: 0.7rem; height: 0.7rem; border-radius: 2px; }
.th-key-a { background: var(--th-a); }
.th-key-b { background: var(--th-b); }
.th-duel { grid-column: 1 / -1; }
.th-duel-plot {
  --th-duel-h: 210px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  height: calc(var(--th-duel-h) + 1.6rem);
  border-bottom: 1px solid var(--th-muted);
  margin-top: 0.5rem;
}
.th-duel-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.th-duel-val { font-size: 1.05rem; font-weight: 800; line-height: 1; margin-bottom: 0.35rem; }
.th-duel-col .th-mark { width: 14px; height: calc(var(--ft) / var(--th-top) * var(--th-duel-h)); border-radius: 2px 2px 0 0; }
.th-duel-col .th-mark::before { width: 30px; height: 14px; }
.th-duel-a .th-mark { background: var(--th-a); }
.th-duel-b .th-mark { background: var(--th-b); }
.th-duel-names { display: grid; grid-template-columns: 1fr 1fr; text-align: center; font-weight: 700; margin: 0.45rem 0 0; }
.th-duel-names a { color: inherit; }
.th-duel-line { margin: 0.9rem 0 0.6rem; line-height: 1.55; }
.th-duel-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.th-duel-table th, .th-duel-table td { padding: 0.4rem 0.25rem; border-top: 1px solid var(--card-border); text-align: center; font-variant-numeric: tabular-nums; }
.th-duel-table th { text-align: left; font-weight: 500; color: var(--th-muted); width: 34%; }

/* ── Typical height by decade and by level: two small column charts ── */
.th-charts { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1.25rem; }
@media (min-width: 768px) { .th-charts { grid-template-columns: 1fr 1fr; } }
.th-chart {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 1rem 1.1rem 0.8rem;
  margin: 0;
}
.th-chart figcaption { margin-bottom: 2.1rem; }   /* room for a column's readout above the plot */
.th-bars { --th-bars-h: 130px; position: relative; display: flex; align-items: flex-end; height: calc(var(--th-bars-h) + 1.5rem);   /* both charts share one scale and one baseline */ list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--th-muted); }
.th-bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; border-radius: 0.4rem 0.4rem 0 0; outline-offset: 2px; cursor: default; }
.th-bar-value { font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 0.2rem; }
.th-bar-fill { display: block; width: min(24px, 62%); height: calc(var(--v) / var(--th-max) * var(--th-bars-h)); background: var(--th-tower); border-radius: 4px 4px 0 0; }
.th-bar-label { position: absolute; top: calc(100% + 0.3rem); font-size: 0.75rem; color: var(--th-muted); white-space: nowrap; }
.th-bars { margin-bottom: 1.6rem; }
.th-tight { display: none; }
@media (max-width: 575.98px) { .th-wide { display: none; } .th-tight { display: inline; } }
.th-bar-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%);
  background: var(--text-color);
  color: var(--card-bg);
  border-radius: 0.35rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.th-bar-tip strong { margin-right: 0.35rem; }
.th-bar:hover .th-bar-tip, .th-bar:focus .th-bar-tip { opacity: 1; visibility: visible; }
.th-bar:hover .th-bar-fill, .th-bar:focus .th-bar-fill { filter: brightness(1.12); }
.th-numbers { margin-top: 0.4rem; font-size: 0.85rem; }
.th-numbers summary { color: var(--th-muted); cursor: pointer; width: max-content; }
.th-numbers table { width: 100%; max-width: 360px; margin-top: 0.5rem; border-collapse: collapse; }
.th-numbers th, .th-numbers td { padding: 0.3rem 0; border-bottom: 1px solid var(--card-border); text-align: right; font-variant-numeric: tabular-nums; }
.th-numbers th:first-child { text-align: left; }
.th-numbers thead th { font-weight: 600; color: var(--th-muted); }
.th-numbers tbody th { font-weight: 400; }

/* ── The ranking ── */
.th-rank {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 0.5rem 1.1rem;
}
.th-rank ol { list-style: none; margin: 0; padding: 0; }
@media (min-width: 768px) { .th-rank ol { columns: 2; column-gap: 2.5rem; } }
.th-rank li { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--card-border); break-inside: avoid; }
.th-rank-n { flex: 0 0 1.6rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--th-muted); }
.th-rank-name { flex: 1 1 auto; min-width: 0; }
.th-rank-name small { display: block; color: var(--th-muted); }
.th-rank-ft { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-all { margin-top: 1rem; }
.th-all summary { cursor: pointer; width: max-content; font-weight: 600; }
.th-all table { margin-top: 0.75rem; font-variant-numeric: tabular-nums; }
