/**
 * Town banner. Band colour from the province (.province-<code> sets
 * --province / --province-ink in css/style.css); grey band when the town
 * has no province code.
 */

.tc-town-banner {
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.tc-town-banner__band {
  /* Lets the title size itself to the band's width (cqi units below). */
  container-type: inline-size;
  padding: 16px 16px 14px;
  background: var(--province, #e9ecef);
  color: var(--province-ink, #212529);
}

.tc-town-banner__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tc-town-banner__badge {
  display: inline-block;
  margin-bottom: 18px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff;
  color: #212529;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* The name stays on one line in a fixed-height line box, so the band is
   the same height for every town and province. Long names shrink to fit:
   Courier is monospaced (each letter 0.6em wide), so the size that fits
   is the band width divided by (letters x 0.62); --chars comes from the
   template. Anything still too long ends in an ellipsis. */
.tc-town-banner .tc-town-banner__title {
  height: 2.75rem;
  margin: 2px 0 0;
  max-width: none;
  overflow: hidden;
  font-family: "Courier New", Courier, monospace;
  font-size: min(2.125rem, calc(100cqi / (var(--chars, 10) * 0.62))); /* up to 34px */
  font-weight: 400;
  line-height: 2.75rem;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

.tc-town-banner h2.tc-town-banner__title,
.tc-town-banner h3.tc-town-banner__title {
  font-size: min(1.875rem, calc(100cqi / (var(--chars, 10) * 0.62))); /* up to 30px */
}

/* Town and province pages, every screen size: the band's colour runs to
   both edges of the screen while the name stays lined up with the page
   content. The colour is a box-shadow spread sideways (clip-path stops
   it spreading up and down); shadows never cause sideways scrolling.
   .tc-town is the wrapper in taxonomy-term--canadian-towns.html.twig. */
.tc-town > .tc-town-banner {
  overflow: visible;
  border: 0;
  border-radius: 0;
}

.tc-town > .tc-town-banner .tc-town-banner__band {
  /* No side padding, so the name lines up with the page text below. */
  padding-inline: 0;
  box-shadow: 0 0 0 100vmax var(--province, #e9ecef);
  clip-path: inset(0 -100vmax);
}

.tc-town-banner__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 16px;
}

.tc-town-banner__meta {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bs-secondary-color, #6c757d);
}

.tc-town-banner__actions {
  display: flex;
  gap: 10px;
}

/* Nothing to show under the band: no meta line and no actions. */
.tc-town-banner__actions:not(:has(*)) {
  display: none;
}

.tc-town-banner__body:not(:has(.tc-town-banner__meta)):not(:has(.tc-town-banner__actions > *)) {
  display: none;
}
