/* ==========================================================================
   Data interactives -- timeline, ranked bars, stat strip, reading progress.

   Consumes the paper-surface tokens defined in css/insights.css (--ins-*);
   this file defines no palette of its own, so a theme change there carries
   here. Every block is styled to be legible BEFORE JavaScript runs: the
   server already rendered the SVG, the bars and the final stat values, and
   js/interactives.js only sorts, filters and animates what is already here.
   ========================================================================== */

.ins-ix {
  max-width: var(--ins-measure);
  margin: 2.6rem auto;
  padding: 1.5rem 1.4rem 1.2rem;
  background: var(--ins-paper-raised);
  border: 1px solid var(--ins-line);
  border-top: 3px solid var(--ins-ink);
}

.ins-ix-title {
  font-family: var(--ins-serif);
  font-size: 1.4rem;
  line-height: 1.2;
  color: var(--ins-ink);
  margin-bottom: 0.35rem;
}

.ins-ix-sub,
.ins-ix-scope {
  font-family: var(--ins-sans);
  font-size: 0.9rem;
  color: var(--ins-ink-muted);
  max-width: 62ch;
}

.ins-ix-scope { margin-top: 0.8rem; }

.ins-ix-source {
  font-family: var(--ins-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--ins-ink-faint);
  margin-top: 1rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--ins-line);
}

.ins-ix-src {
  font-family: var(--ins-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ins-red);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  white-space: nowrap;
}
.ins-ix-src:hover { color: var(--ins-red-dark); }

/* --------------------------------------------------------------------------
   Shared fallback list. This is the layer that carries the numbers as TEXT.
   It is never hidden on small screens and never hidden when JS is off -- on
   wide screens with JS the chart leads and this becomes a source table.
   -------------------------------------------------------------------------- */
.ins-ix-list {
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ins-ink-muted);
}
.ins-ix-list > li {
  padding: 0.45rem 0;
  border-top: 1px solid var(--ins-line);
}
.ins-ix-li-name { color: var(--ins-ink); font-weight: 600; }

/* --------------------------------------------------------------------------
   towers-timeline -- server-rendered inline SVG.
   Scrolls horizontally inside its own container rather than shrinking the
   type below legibility; the page body never scrolls sideways.
   -------------------------------------------------------------------------- */
.ins-ix-figure {
  margin-top: 1.2rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.ins-ix-figure svg {
  display: block;
  width: 100%;
  min-width: 880px;
  height: auto;
}

.ins-ix-axis { stroke: var(--ins-ink); stroke-width: 1.5; }
.ins-ix-grid { stroke: var(--ins-line); stroke-width: 1; }
.ins-ix-stem { stroke: var(--ins-line-strong); stroke-width: 1.5; }
/* Hairline from the axis to the caption's lane; deliberately fainter than
   the stem, which is the one carrying the height. */
.ins-ix-leader { stroke: var(--ins-line); stroke-width: 1; }
.ins-ix-dot  { fill: var(--ins-red); }
.ins-ix-tick {
  fill: var(--ins-ink-faint);
  font-family: var(--ins-mono);
  font-size: 11px;
  text-anchor: middle;
}
.ins-ix-label {
  fill: var(--ins-ink);
  font-family: var(--ins-sans);
  font-size: 11.5px;
  font-weight: 600;
}
.ins-ix-val {
  fill: var(--ins-ink-muted);
  font-family: var(--ins-mono);
  font-size: 10.5px;
}
.ins-ix-mark.is-dim { opacity: 0.35; }
.ins-ix-mark.is-on .ins-ix-dot { fill: var(--ins-ink); r: 6; }

/* --------------------------------------------------------------------------
   europe-tallest -- ranked bars. Grid so rank, name, bar and value align
   across every row regardless of name length.
   -------------------------------------------------------------------------- */
.ins-ix-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 1.1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--ins-line);
}
.ins-ix-ctrl-group { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.ins-ix-ctrl-label {
  font-family: var(--ins-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ins-ink-faint);
}
.ins-ix-btn {
  font-family: var(--ins-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  background: transparent;
  border: 1px solid var(--ins-line-strong);
  color: var(--ins-ink-muted);
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}
.ins-ix-btn:hover { border-color: var(--ins-ink); color: var(--ins-ink); }
/* Pressed state carries a written cue (the border + weight), never colour alone. */
.ins-ix-btn[aria-pressed="true"] {
  border-color: var(--ins-ink);
  background: var(--ins-ink);
  color: var(--ins-paper-raised);
  font-weight: 600;
}

.ins-ix-bars { list-style: none; margin: 1.1rem 0 0; padding: 0; }
.ins-ix-bar-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(8.5rem, 13rem) 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.42rem 0;
  border-top: 1px solid var(--ins-line);
}
.ins-ix-bar-rank {
  font-family: var(--ins-mono);
  font-size: 0.72rem;
  color: var(--ins-ink-faint);
  text-align: right;
}
.ins-ix-bar-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ins-ink);
  line-height: 1.25;
  min-width: 0;
}
.ins-ix-bar-meta {
  display: block;
  font-family: var(--ins-mono);
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--ins-ink-faint);
  letter-spacing: 0.02em;
}
.ins-ix-bar-track {
  display: block;
  height: 13px;
  background: var(--ins-paper);
  border: 1px solid var(--ins-line);
  min-width: 40px;
}
.ins-ix-bar-fill {
  display: block;
  height: 100%;
  background: var(--ins-red);
  transition: width 420ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
/* EU/UK rows read differently from the wider-Europe rows, and the row still
   states its city and country in text, so colour is never the only signal. */
.ins-ix-bar-row[data-group="eu"] .ins-ix-bar-fill,
.ins-ix-bar-row[data-group="uk"] .ins-ix-bar-fill { background: var(--ins-ink); }
.ins-ix-bar-val {
  font-family: var(--ins-mono);
  font-size: 0.76rem;
  color: var(--ins-ink);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   by-numbers -- statistic strip. Also a <ul>, so it is a real list.
   -------------------------------------------------------------------------- */
.ins-ix-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--ins-line);
  border: 1px solid var(--ins-line);
  margin-top: 1.2rem;
}
.ins-ix-stats > li {
  background: var(--ins-paper-raised);
  border-top: 0;
  padding: 1.1rem 1rem;
}
.ins-ix-stat-num {
  display: block;
  font-family: var(--ins-serif);
  font-size: clamp(1.7rem, 4.4vw, 2.5rem);
  line-height: 1.05;
  color: var(--ins-ink);
  font-variant-numeric: tabular-nums;
}
.ins-ix-stat-affix { color: var(--ins-red); }
.ins-ix-stat-label {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ins-ink-muted);
}

/* --------------------------------------------------------------------------
   reading-progress -- fixed top rule. aria-hidden decoration only.
   -------------------------------------------------------------------------- */
.ins-ix-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9000;
  background: transparent;
  pointer-events: none;
}
.ins-ix-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ins-red);
  transform-origin: left center;
}

/* --------------------------------------------------------------------------
   Break OUT of the article's reading measure on wide screens. A 15-marker
   timeline squeezed into a 700px text column has to scroll sideways on a
   desktop, which is a defect, not a feature. Centred on the column, capped at
   the edition measure AND at the viewport, so it can never cause the page body
   to scroll horizontally. `transform` here is safe: the reading-progress bar
   is .ins-ix-progress, a sibling of .ins-ix, so no position:fixed descendant
   gets a new containing block.
   -------------------------------------------------------------------------- */
@media (min-width: 1080px) {
  .ins-article-body > .ins-ix {
    width: min(var(--ins-measure), calc(100vw - 4rem));
    margin-left: 50%;
    transform: translateX(-50%);
  }
}

/* -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .ins-ix { padding: 1.2rem 1rem 1rem; margin: 2rem auto; }
  .ins-ix-title { font-size: 1.2rem; }
  .ins-ix-bar-row { grid-template-columns: 1.4rem 1fr auto; row-gap: 0.3rem; }
  /* The bar track drops to its own full-width row rather than being squeezed
     to a stub next to a wrapped building name. */
  .ins-ix-bar-track { grid-column: 1 / -1; }
  .ins-ix-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 400px) {
  .ins-ix-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .ins-ix-bar-fill { transition: none; }
}

@media print {
  .ins-ix-progress,
  .ins-ix-controls { display: none !important; }
  .ins-ix { break-inside: avoid; background: none; }
}
