/* /aging-atc: how old the FAA's facilities and equipment are. One reading
   column on the site tokens in style.css (--card-bg, --card-border,
   --text-color), so it follows the light/dark theme; the three facility
   groups keep the site's map colours. */

.aa-page {
  --aa-accent: #8a4b12;
  --aa-accent-soft: rgba(154, 91, 30, 0.09);
  --aa-muted: var(--secondary);
  --aa-plot-h: 200px;
  max-width: 820px;
}
[data-bs-theme="dark"] .aa-page {
  --aa-accent: #f0b46a;
  --aa-accent-soft: rgba(240, 180, 106, 0.1);
}
.aa-narrow { max-width: 820px; }

.hero-section.bg-aging-atc {
  background: radial-gradient(circle at 85% 20%, rgba(240, 180, 106, 0.22), transparent 55%),
              linear-gradient(135deg, #1c1a22 0%, #4a3324 100%);
  color: #fff;
}
.bg-aging-atc .lead { opacity: 0.85; line-height: 1.5; }

/* Facility groups: the site's map colours. Marks carry them; text never does. */
.aa-g-tower    { --aa-tone: var(--color-tower); }
.aa-g-approach { --aa-tone: var(--color-tracon); }
.aa-g-center   { --aa-tone: var(--color-center); }

/* ── Three headline numbers ── */
.aa-tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) { .aa-tiles { grid-template-columns: repeat(3, 1fr); } }
.aa-tile {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-top: 4px solid var(--aa-tone);
  border-radius: 0 0 0.6rem 0.6rem;
  padding: 0.9rem 1rem 0.8rem;
}
.aa-tile p { margin: 0; }
.aa-tile-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--aa-muted);
}
.aa-tile-value { font-size: 2.25rem; font-weight: 800; line-height: 1.15; }
.aa-tile-value small { font-size: 0.95rem; font-weight: 600; color: var(--aa-muted); }
.aa-tile-note { font-size: 0.9rem; line-height: 1.45; margin-top: 0.3rem !important; }

/* ── How old is your facility? The site's facility search, answered in place ── */
.aa-lookup {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 1rem 1.1rem 1.1rem;
  margin-bottom: 1.5rem;
}
.aa-lookup label { display: block; font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.aa-lookup-answer {
  margin: 0.85rem 0 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--aa-accent);
  background: var(--aa-accent-soft);
  line-height: 1.55;
}
.aa-lookup-answer a:last-child { display: block; width: max-content; margin-top: 0.3rem; font-size: 0.9rem; }

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

/* ── Facilities by decade: stacked columns ──
   Thin columns on one baseline, a 2px gap between segments, the total on each
   cap. Hover, tap or tab to a column for its breakdown; the table under the
   chart has every number. */
.aa-chart {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 1.1rem 1.2rem 0.9rem;
  margin: 1.5rem 0 0;
}
.aa-chart figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1.25rem;
  margin-bottom: 2.4rem;   /* room for a column's breakdown above the plot */
}
.aa-chart h3 { margin: 0; font-size: 1rem; }
.aa-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.aa-legend li { display: flex; align-items: center; gap: 0.4rem; }
.aa-key { width: 0.7rem; height: 0.7rem; border-radius: 2px; background: var(--aa-tone); }

.aa-plot {
  position: relative;   /* a column's breakdown reads out above the plot, centred */
  display: flex;
  align-items: flex-end;
  list-style: none;
  margin: 0;
  padding: 0;
}
.aa-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  border-radius: 0.4rem;
  outline-offset: 2px;
  cursor: default;
}
.aa-col-total { font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 0.25rem; }
.aa-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 24px;
}
.aa-seg {
  display: block;
  height: calc(var(--aa-v) / var(--aa-max) * var(--aa-plot-h));
  min-height: 3px;
  background: var(--aa-tone);
}
.aa-seg:first-child { border-radius: 4px 4px 0 0; }
.aa-col-label {
  width: 100%;
  margin-top: 0;
  padding-top: 0.35rem;
  border-top: 1px solid var(--card-border);
  font-size: 0.8rem;
  color: var(--aa-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.aa-tip {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: max-content;
  max-width: 100%;
  padding: 0.25rem 0.65rem;
  border-radius: 0.4rem;
  background: var(--text-color);
  color: var(--card-bg);
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.aa-tip strong { margin-right: 0.35rem; }
.aa-col:hover .aa-tip, .aa-col:focus .aa-tip { opacity: 1; visibility: visible; }
.aa-col:hover .aa-seg, .aa-col:focus .aa-seg { filter: brightness(1.12); }
.aa-tight { display: none; }
@media (max-width: 480px) {   /* a phone: narrower columns, and '60s for 1960s */
  .aa-stack { width: 18px; }
  .aa-wide { display: none; }
  .aa-tight { display: inline; }
}

.aa-numbers { margin-top: 0.9rem; font-size: 0.85rem; }
.aa-numbers summary { color: var(--aa-muted); cursor: pointer; width: max-content; }
.aa-numbers table { width: 100%; max-width: 460px; margin-top: 0.5rem; border-collapse: collapse; }
.aa-numbers th, .aa-numbers td { padding: 0.3rem 0; border-bottom: 1px solid var(--card-border); text-align: right; font-variant-numeric: tabular-nums; }
.aa-numbers th:first-child { text-align: left; }
.aa-numbers thead th { font-weight: 600; color: var(--aa-muted); }
.aa-numbers tbody th { font-weight: 400; }

/* ── The oldest and the newest towers ── */
.aa-lists {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}
@media (min-width: 768px) { .aa-lists { grid-template-columns: 1fr 1fr; } }
.aa-list {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 1rem 1.1rem 0.5rem;
}
.aa-list h3 { margin: 0 0 0.4rem; }
.aa-list ol { list-style: none; margin: 0; padding: 0; }
.aa-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--card-border);
  line-height: 1.35;
}
.aa-list li:last-child { border-bottom: 0; }
.aa-list-name small { display: block; color: var(--aa-muted); font-size: 0.8rem; }
.aa-list-year { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Equipment: a table that stacks on a phone ── */
.aa-equipment { width: 100%; margin: 1.25rem 0 1rem; border-collapse: collapse; font-size: 0.95rem; }
.aa-equipment th, .aa-equipment td { padding: 0.6rem 0.75rem 0.6rem 0; border-bottom: 1px solid var(--card-border); text-align: left; vertical-align: top; line-height: 1.45; }
.aa-equipment thead th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--aa-muted);
}
.aa-equipment tbody th { font-weight: 700; width: 31%; }
.aa-equipment tbody th small { display: block; margin-top: 0.15rem; font-size: 0.8rem; font-weight: 400; line-height: 1.35; color: var(--aa-muted); }
.aa-equipment td:last-child { padding-right: 0; }
@media (max-width: 640px) {
  .aa-equipment thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .aa-equipment, .aa-equipment tbody, .aa-equipment tr, .aa-equipment th, .aa-equipment td { display: block; width: auto; }
  .aa-equipment tr { padding: 0.7rem 0; border-bottom: 1px solid var(--card-border); }
  .aa-equipment th, .aa-equipment td { padding: 0; border: 0; }
  .aa-equipment tbody th { width: auto; }
  .aa-equipment td { margin-top: 0.25rem; }
  .aa-equipment td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--aa-muted);
  }
}
