/* ==========================================================================
   Home page (templates/home.html, static/js/pages/home.js)
   Layout only; every component (card, stat, barlist, canton map, teaser, pill-link) is styled by
   app.css. Colours come from the app.css tokens, so both themes work.
   ========================================================================== */

.home-hero {
  padding-bottom: var(--s-5);
}

.home-hero .eyebrow {
  margin-bottom: var(--s-3);
}

.home-section {
  margin-top: clamp(40px, 6vw, 72px);
}

.home-section--first {
  margin-top: 0;
}

.home-section--last {
  margin-bottom: clamp(40px, 6vw, 72px);
}

.home-section__head {
  margin-bottom: var(--s-4);
}

.home-section__head--row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3) var(--s-4);
}

.home-section__title {
  font-size: var(--fs-2xl);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.home-section__lead {
  max-width: 68ch;
  margin-top: var(--s-2);
  color: var(--text-2);
  font-size: var(--fs-l);
}

/* takeaways are computed from the data: give them room so the swap does not shift the layout */
.home-takeaway {
  min-height: 3em;
}

/* at a glance */

/* six figures: one row when there is room, else 3 x 2, on phones 2 x 3 (never 5 + 1) */

.home-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 1180px) {
  .home-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .home-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .home-stats .stat__value {
    font-size: 1.25rem;
  }
}

/* cantons */

#cantons {
  scroll-margin-top: calc(var(--topbar-h) + var(--s-4));
}

#card-where .card__tools {
  margin-left: 0;
}

#where-metric {
  max-width: 100%;
  overflow-x: auto;
}

.home-where {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@container (min-width: 720px) {
  .home-where {
    grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr);
  }
}

.home-where__map {
  min-width: 0;
}

.home-where__side {
  min-width: 0;
  min-height: 220px;
}

.home-where__side-title {
  margin-bottom: var(--s-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-where__note {
  margin-top: var(--s-2);
}

.home-cantons {
  margin-top: var(--s-5);
}

.home-cantons__title {
  margin-bottom: var(--s-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-cantons__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: var(--s-1) var(--s-4);
  padding: 0;
  list-style: none;
}

.home-cantons__list a {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: 2px 4px;
  border-radius: var(--r-s);
  color: var(--text);
  font-size: var(--fs-m);
  text-decoration: none;
}

.home-cantons__list a:hover {
  background: var(--surface-3);
}

.home-cantons__list .plate {
  min-width: 2.6em;
}

/* fuel shift: reserve the chart's height before it arrives */

.home-chart {
  min-height: 320px;
}

.home-chart > .skeleton--block {
  height: 300px;
}

/* most common cars */

.home-pair {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  align-items: start;
}

.home-pair .card__body {
  min-height: 380px;
}

.home-colours {
  min-height: 92px;
}

/* did you know */

.home-facts {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.home-facts__skeleton {
  height: 168px;
  border-radius: var(--r-l);
}

.home-fact {
  min-height: 168px;
}

#facts-shuffle svg {
  width: 16px;
  height: 16px;
}

/* teasers */

.home-teasers {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

/* popular brands */

.home-brands {
  display: grid;
  gap: var(--s-2);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
  padding: 0;
  list-style: none;
}

.home-brands__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.home-brands__item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
}

.home-brands__name {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-brands__n {
  color: var(--text-3);
  font-size: var(--fs-s);
  font-variant-numeric: tabular-nums;
}

.home-brands__placeholder .skeleton {
  height: 64px;
  margin: 0;
  border-radius: var(--r-m);
}

.home-brands__error {
  grid-column: 1 / -1;
}

@media (prefers-reduced-motion: no-preference) {
  .home-brands__item {
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
  }
}

/* longer German texts: let headings, captions and cards break and hyphenate (hyphens follow
   <html lang>), and let buttons and pills wrap on narrow screens instead of overflowing */
.home .hero__title,
.home-section__title,
.home .stat__label,
.home .stat__sub,
.home .card__title,
.home .card__sub,
.home .teaser__value,
.home .teaser__text,
.home-cantons__list a {
  overflow-wrap: break-word;
  hyphens: auto;
}

.home .stat__label,
.home .stat__sub {
  min-width: 0;
}

@media (max-width: 480px) {
  .home .btn,
  .home .pill-link {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }
}
