/* Experience 4.0.8 — final CLS mitigations (inherits 4.0.7 evidence + stats/compare slots) */
html {
  scrollbar-gutter: stable;
}
body.portal-page {
  overflow-x: clip;
}

.p-brand-logo {
  width: 150px !important;
  height: 32px !important;
  max-height: 32px !important;
  object-fit: contain;
  flex: 0 0 auto;
}
.p-brand-cities {
  width: 72px !important;
  height: 22px !important;
  max-height: 22px !important;
  object-fit: contain;
  flex: 0 0 auto;
}

#cmpPicks.cmp-pick,
.cmp-pick#cmpPicks {
  min-height: 140px;
  contain: layout;
}

.ex-count,
#orgCount,
#peCount,
#pmCount,
#exCount {
  display: inline-block;
  min-width: 10ch;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dc-skel {
  min-height: 440px;
  border-radius: 12px;
  background: linear-gradient(90deg, #eef2f7 0%, #f7fafc 50%, #eef2f7 100%);
  background-size: 200% 100%;
  animation: dc-skel 1.2s ease-in-out infinite;
}
@keyframes dc-skel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dc-skel { animation: none; }
}

#exResults,
#peResults {
  min-height: 280px;
}
#orgResults {
  min-height: 440px !important;
  contain: layout;
  position: relative;
}
#orgLoading.org-loading {
  display: none !important;
}

/* Charts: size before Chart.js paint — targets Vergleich/Statistik CLS > 0.1 */
.st-chart-slot,
.cmp-chart-slot,
.dq-chart-slot,
[data-chart-slot] {
  min-height: 280px;
  height: 280px;
  contain: layout;
}
.st-chart-slot canvas,
.cmp-chart-slot canvas,
.dq-chart-slot canvas,
[data-chart-slot] canvas {
  display: block;
  width: 100% !important;
  height: 260px !important;
}

/* Statistik / Datenqualität tables: reserve header+rows to avoid late reflow */
.st-table-wrap,
.dq-table-wrap,
.cmp-table-wrap {
  min-height: 220px;
  contain: layout;
}

.org-logo {
  width: 72px;
  height: 48px;
  flex: 0 0 72px;
}
.org-card {
  min-height: 120px;
  align-items: start;
}

#pmMap,
.pm-map-wrap {
  min-height: 420px;
  contain: layout;
}
@media (max-width: 768px) {
  #pmMap,
  .pm-map-wrap {
    min-height: 320px;
  }
  .st-chart-slot,
  .cmp-chart-slot,
  .dq-chart-slot,
  [data-chart-slot] {
    min-height: 240px;
    height: 240px;
  }
}

/* Font metric stability for hero/title blocks */
.p-hero h1,
.portal-hero h1,
main h1 {
  min-height: 1.2em;
}

/* 320px: prevent rare header/nav overflow (Phase 13 REVIEW) */
@media (max-width: 360px) {
  .p-header,
  .p-header-inner,
  .p-brand,
  .p-nav {
    max-width: 100%;
  }
  .p-nav-link {
    white-space: normal;
    word-break: break-word;
  }
}

/* 4.0.9: contain profile hero/ranking on narrow viewports */
.hero {
  max-width: 100%;
  overflow: hidden;
}
.hero-banner {
  width: 100% !important;
  max-width: 100% !important;
}
.ranking-table-wrap {
  max-width: 100%;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
