/**
 * Startseite – nur dieser Seitentyp.
 * Container: #st-homepage-page, #st-homepage-content, #st-homepage-news, #st-homepage-lead, #st-homepage-grid
 * Karten: .category-card (Basis in st-category-layout.css)
 */

.st-page--homepage #st_body {
  padding-inline: clamp(
    10px,
    calc(10px + (100vw - var(--st-logo-vw-min, 380px)) * 90 / 1676),
    100px
  ) !important;
  box-sizing: border-box;
}

#st-homepage-page {
  width: 100%;
  box-sizing: border-box;
}

/* Wetter/Ticker: #st_chrome_weather, #st_chrome_trading in st-content-layout.css */

#st-homepage-content {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Hero: Page-BG 2056×1290 → has-hero-page-bg in st-content-layout.css */
.st-page--homepage {
  --st-hero-stage-height: min(56svh, 56dvh, 720px);
}

/* Hero-Meta: einheitlich in st-content-layout.css + st-homepage-main-offset.js */

.st-page--homepage.st-page {
  row-gap: var(--st-hero-layout-gap);
}

/* News-Block (View st_startseite block_6) in #sidebar-box-main */
#sidebar-box-main #st-homepage-news {
  display: flex;
  flex-direction: column;
  gap: var(--st-space-20, 20px);
  width: 100%;
  min-width: 0;
  margin: 20px 0;
  padding: 0;
  box-sizing: border-box;
}

#st-homepage-lead {
  width: 100%;
  min-width: 0;
}

#st-homepage-lead .views-field,
#st-homepage-lead .field-content {
  display: block;
  width: 100%;
}

#st-homepage-lead .category-card__media-box {
  width: 100%;
  height: auto;
  max-width: min(1170px, 100%);
  margin-inline: auto;
}

#st-homepage-lead .category-card__media-box img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 980 / 400;
  object-fit: cover;
}

/* Lead: Kategorie + Titel als Overlay auf dem Bild (siehe preprocess). */
#st-homepage-lead .category-card--lead-overlay .category-card__media {
  position: relative;
  display: block;
  overflow: hidden;
}

#st-homepage-lead .category-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(0 0 0 / 0%) 30%, rgb(0 0 0 / 70%) 100%);
}

#st-homepage-lead .category-card__media-overlay {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: var(--st-space-10, 10px);
  padding: var(--st-space-20);
  box-sizing: border-box;
  pointer-events: none;
}

#st-homepage-lead .category-card__media-overlay a {
  pointer-events: auto;
}

#st-homepage-lead .category-card__media-overlay .category-card__meta {
  margin: 0;
  padding: 0;
  color: rgb(255 255 255 / 90%);
}

#st-homepage-lead .category-card__media-overlay .category-card__meta a {
  color: inherit;
}

#st-homepage-lead .category-card__media-overlay .category-card__meta a:hover {
  color: #fff;
}

#st-homepage-lead .category-card__media-overlay .category-card__title {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.25;
  font-weight: 700;
  color: #fff;
}

#st-homepage-lead .category-card__media-overlay .category-card__title a {
  color: #fff;
  text-decoration: none;
}

#st-homepage-lead .category-card__media-overlay .category-card__title a:hover {
  color: rgb(255 255 255 / 88%);
}

#sidebar-box-main #st-homepage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  column-gap: 20px;
  row-gap: 20px;
  align-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#sidebar-box-main #st-homepage-grid > li {
  display: flex;
  min-width: 0;
  min-height: 100%;
  padding-inline: 0;
}

#sidebar-box-main #st-homepage-grid .category-card {
  flex: 1 1 auto;
  width: 100%;
}

@media (max-width: 900px) {
  #sidebar-box-main #st-homepage-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 901px) and (max-width: 1024px) {
  #sidebar-box-main #st-homepage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/*
 * Startseiten-Platzhalter-Node (/node/1, Typ page, ohne Body): nur Routing,
 * Inhalt kommt aus Views – nicht layouten.
 */
.st-page--homepage #sidebar-box-main .node--type-page.node--view-mode-full,
.st-page--homepage #sidebar-box-main article.node--view-mode-full.node--type-page {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
}

/*
 * Solo .page-wrapper setzt --r-tx/#262d38 und h1–h3 auf dunkle Farben – im Dark Mode
 * wäre das dunkle Schrift auf dunklem ST-Hintergrund. Region-Variablen wie #category_body.
 */
.page-wrapper.st-page--homepage {
  --r-tx: var(--st-text);
  --r-h1: var(--st-text);
  --r-lk: var(--st-link);
  --r-lk-h: var(--st-link-hover, var(--st-accent));
}

html[data-color-scheme='dark'] .page-wrapper.st-page--homepage,
body.darkmode--activated .page-wrapper.st-page--homepage {
  --r-tx: var(--st-text);
  --r-h1: var(--st-text);
  --r-lk: var(--st-link);
  --r-lk-h: var(--st-link-hover, var(--st-accent));
  --r-bg: transparent;
}

html[data-color-scheme='dark'] .page-wrapper.st-page--homepage #sidebar-box-main .region-inner.main-box-inner,
html[data-color-scheme='dark'] .page-wrapper.st-page--homepage #st-homepage-news,
body.darkmode--activated .page-wrapper.st-page--homepage #sidebar-box-main .region-inner.main-box-inner,
body.darkmode--activated .page-wrapper.st-page--homepage #st-homepage-news {
  color: var(--st-text);
}

/* Höhere Spezifität als Solo .page-wrapper h2 a */
.page-wrapper.st-page--homepage #st-homepage-news .category-card__title,
.page-wrapper.st-page--homepage #st-homepage-news .category-card__title a,
.page-wrapper.st-page--homepage #st-homepage-news .category-card__meta,
.page-wrapper.st-page--homepage #st-homepage-news .category-card__teaser,
.page-wrapper.st-page--homepage #st-homepage-news .category-card__author,
.page-wrapper.st-page--homepage #st-homepage-news .category-card__author a,
.page-wrapper.st-page--homepage #st-homepage-news .grid-category,
.page-wrapper.st-page--homepage #st-homepage-news .grid-category a {
  color: var(--st-text-muted);
}

.page-wrapper.st-page--homepage #st-homepage-news .category-card__title,
.page-wrapper.st-page--homepage #st-homepage-news .category-card__title a {
  color: var(--st-link);
  font-weight: 700;
}

.page-wrapper.st-page--homepage #st-homepage-news .category-card__title a:hover,
.page-wrapper.st-page--homepage #st-homepage-news .category-card__more a {
  color: var(--st-link-hover, var(--st-accent));
}

html[data-color-scheme='dark'] .page-wrapper.st-page--homepage #st-homepage-news .category-icon,
html[data-color-scheme='dark'] .page-wrapper.st-page--homepage #st-homepage-news .grid-category,
body.darkmode--activated .page-wrapper.st-page--homepage #st-homepage-news .category-icon,
body.darkmode--activated .page-wrapper.st-page--homepage #st-homepage-news .grid-category {
  --st-category-icon-color: var(--st-text);
}

html[data-color-scheme='dark'] .page-wrapper.st-page--homepage #st_headline_1,
body.darkmode--activated .page-wrapper.st-page--homepage #st_headline_1 {
  --r-tx: var(--st-text);
  --r-h1: var(--st-text);
  color: var(--st-text);
}
