/* ==========================================================
   Kapitel 4 – Sprint 2: Inhaltsseiten, Weissraum und Rhythmus
   ========================================================== */

:root {
  --content-page-top-space: clamp(3rem, 7vw, 2.5rem);
  --content-section-space: clamp(3.5rem, 7vw, 6.5rem);
  --content-flow-space: 1.15em;
  --content-heading-space-before: clamp(2rem, 4vw, 3.5rem);
  --content-heading-space-after: clamp(0.75rem, 1.5vw, 1.15rem);
  --content-reading-width: 48rem;
}

/* Inhaltsseiten beginnen bewusst mit einem ruhigen, grosszuegigen Titelraum. */
.site-wrapper:not(.site-wrapper--front) .site-main {
  padding-block: var(--content-page-top-space) 0;
}

.site-wrapper:not(.site-wrapper--front) .site-content .block-page-title-block {
  margin: 0 0 var(--content-band-gap, var(--content-section-space));
}

.site-wrapper:not(.site-wrapper--front) .block-page-title-block h1 {
  max-width: 18ch;
  margin: 0;
  color: var(--color-heading, #07184f);
  font-family: var(--font-family-base);
  font-size: clamp(2.25rem, 4.5vw, 3.25rem);
  font-weight: var(--font-weight-heading, 600);
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

/* H1 bleibt ohne dekorative Linie; die gelbe Markierung gehoert zu H2. */
.site-wrapper:not(.site-wrapper--front) .block-page-title-block h1::after {
  content: none;
}

/* Einheitlicher Lesefluss fuer redaktionellen Fliesstext. */
.site-wrapper:not(.site-wrapper--front) .site-content :where(
  .field--name-body,
  .text-formatted,
  .is-section__text,
  .is-section__content
) > :where(p, ul, ol, blockquote, table, figure) {
  margin-block: 0 var(--content-flow-space);
}

.site-wrapper:not(.site-wrapper--front) .site-content :where(
  .field--name-body,
  .text-formatted,
  .is-section__text,
  .is-section__content
) > :where(p, ul, ol, blockquote, table, figure):last-child {
  margin-bottom: 0;
}

.site-wrapper:not(.site-wrapper--front) .site-content :where(
  .field--name-body,
  .text-formatted,
  .is-section__text,
  .is-section__content
) > :where(h2, h3, h4) {
  margin-block: var(--content-heading-space-before) var(--content-heading-space-after);
}

.site-wrapper:not(.site-wrapper--front) .site-content :where(
  .field--name-body,
  .text-formatted,
  .is-section__text,
  .is-section__content
) > :where(h2, h3, h4):first-child {
  margin-top: 0;
}

.site-wrapper:not(.site-wrapper--front) .site-content h2 {
  color: var(--color-heading, #07184f);
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: var(--font-weight-heading, 600);
  line-height: 1.15;
  text-wrap: balance;
}

.site-wrapper:not(.site-wrapper--front) .site-content h3 {
  color: var(--color-heading, #07184f);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: var(--font-weight-heading, 600);
  line-height: 1.25;
}

.site-wrapper:not(.site-wrapper--front) .site-content :where(ul, ol) {
  padding-inline-start: 1.4em;
}

.site-wrapper:not(.site-wrapper--front) .site-content li + li {
  margin-top: 0.4em;
}

/* Alle Studio-Layouts teilen denselben Abschnittsrhythmus. */
.site-wrapper:not(.site-wrapper--front) .section--seitenabschnitt {
  padding-block: 0;
}

.site-wrapper:not(.site-wrapper--front) .section--seitenabschnitt + .section--seitenabschnitt {
  margin-top: var(--content-section-space);
}

.site-wrapper:not(.site-wrapper--front) .site-content > :where(.views-element-container, .block-system-main-block) .section--seitenabschnitt:first-child {
  margin-top: 0;
}

.site-wrapper:not(.site-wrapper--front) .section--seitenabschnitt:last-child {
  margin-bottom: 0;
}

.site-wrapper:not(.site-wrapper--front) .is-section-container > .is-section__heading,
.site-wrapper:not(.site-wrapper--front) .is-section__heading {
  margin-bottom: clamp(1.25rem, 2.5vw, 2rem);
}

.site-wrapper:not(.site-wrapper--front) .is-layout--bild_links,
.site-wrapper:not(.site-wrapper--front) .is-layout--bild-links,
.site-wrapper:not(.site-wrapper--front) .is-layout--bild_rechts,
.site-wrapper:not(.site-wrapper--front) .is-layout--bild-rechts {
  gap: clamp(1.5rem, 4vw, 4.5rem);
}

/* Ein reiner Textabschnitt bleibt angenehm lesbar und nicht zu breit. */
.site-wrapper:not(.site-wrapper--front) .is-layout--nur_text,
.site-wrapper:not(.site-wrapper--front) .is-layout--nur-text,
.site-wrapper:not(.site-wrapper--front) .field--name-body {
  max-width: var(--content-reading-width);
}

/* Ruhiger Anschluss des Inhalts an den Footer. */
.site-wrapper:not(.site-wrapper--front) .site-footer {
  margin-top: clamp(5rem, 10vw, 9rem);
}

@media (max-width: 47.99rem) {
  :root {
    --content-page-top-space: clamp(2.25rem, 9vw, 1.75rem);
    --content-section-space: clamp(2.75rem, 11vw, 4.5rem);
  }

  .site-wrapper:not(.site-wrapper--front) .block-page-title-block h1 {
    max-width: none;
    font-size: clamp(2.25rem, 8.5vw, 2.75rem);
  }
}

/* ==========================================================
   Kapitel 4 – Sprint 3B: Variante B, farbige Abschnittsbaender
   ========================================================== */

:root {
  /*
   * Originale RGB-Werte der fuenf Logofarben. Nur die Transparenz
   * des Verlaufs wird veraendert; die Farbwerte selbst bleiben gleich.
   */
  --content-band-green-rgb: 47, 147, 54;
  --content-band-blue-rgb: 49, 75, 155;
  --content-band-red-rgb: 228, 25, 30;
  --content-band-orange-rgb: 241, 137, 8;
  --content-band-yellow-rgb: 245, 216, 1;

  /*
   * Zentrale Testwerte fuer alle Farbbaender:
   * - opacity steuert die Deckkraft am linken Anfang.
   * - gradient-mid bestimmt den Zwischenpunkt.
   * - gradient-end bestimmt, wo die Farbe vollstaendig transparent ist.
   */
  --content-band-opacity: 0.07;
  --content-band-gradient-mid: 75%;
  --content-band-gradient-end: 100%;

  --content-band-padding-inline: clamp(1rem, 3vw, 2.75rem);
  --content-band-padding-block: clamp(2rem, 4vw, 3.75rem);
  --content-band-gap: clamp(1.25rem, 3vw, 2.5rem);
  
  /* Opacity für Präsentation - */
  --content-band-praesentation-opacity: 0.1;
}

/*
 * Variante B gestaltet bewusst jeden redaktionellen Abschnitt als ruhiges,
 * grosszuegiges Farbband. Es entstehen keine Karten: keine Schatten, keine
 * Rahmen und keine abgerundeten Ecken.
 */
.site-wrapper:not(.site-wrapper--front) .content-section-bands {
  width: 100%;
  max-width: none;
}

.site-wrapper:not(.site-wrapper--front) .content-section-band {
  position: relative;
  width: 100%;
  padding: var(--content-band-padding-block) var(--content-band-padding-inline);
  background: linear-gradient(
    90deg,
    rgba(var(--content-band-rgb), var(--content-band-opacity)) 0%,
    rgba(var(--content-band-rgb), calc(var(--content-band-opacity) * 0.55)) var(--content-band-gradient-mid),
    rgba(var(--content-band-rgb), 0) var(--content-band-gradient-end)
  );
}

.site-wrapper:not(.site-wrapper--front) .content-section-band + .content-section-band {
  margin-top: var(--content-band-gap);
}

.site-wrapper:not(.site-wrapper--front) .content-section-band--green,
.content-section-band--1 {
  --content-band-rgb: var(--content-band-green-rgb);
}

.site-wrapper:not(.site-wrapper--front) .content-section-band--blue,
.content-section-band--2 {
  --content-band-rgb: var(--content-band-blue-rgb);
}

.site-wrapper:not(.site-wrapper--front) .content-section-band--red,
.content-section-band--3 {
  --content-band-rgb: var(--content-band-red-rgb);
}

.site-wrapper:not(.site-wrapper--front) .content-section-band--orange,
.content-section-band--4 {
  --content-band-rgb: var(--content-band-orange-rgb);
}

.site-wrapper:not(.site-wrapper--front) .content-section-band--yellow,
.content-section-band--5 {
  --content-band-rgb: var(--content-band-yellow-rgb);
}

/* - Opacity der Präsentation - */
.praesentation-comp .content-section-band {
  background: linear-gradient(
    90deg,
    rgba(var(--content-band-rgb), var(--content-band-praesentation-opacity)) 0%,
    rgba(var(--content-band-rgb), calc(var(--content-band-praesentation-opacity) * 0.55)) var(--content-band-gradient-mid),
    rgba(var(--content-band-rgb), 0) var(--content-band-gradient-end)
  );
}

/* Der Abstand wird vom Farbband gesteuert, nicht mehr von den Sections. */
.site-wrapper:not(.site-wrapper--front) .content-section-band .section--seitenabschnitt {
  margin-block: 0;
  padding-block: 0;
}

.site-wrapper:not(.site-wrapper--front) .content-section-band .section--seitenabschnitt + .section--seitenabschnitt {
  margin-top: 0;
}

/* Redaktionell gesetzte Hintergrundfarben duerfen die Farbfolge ersetzen. */
.site-wrapper:not(.site-wrapper--front) .content-section-band:has(
  .has-background,
  [class*="background-color"],
  [style*="background"]
) {
  background: transparent;
}

@media (max-width: 47.99rem) {
  :root {
    --content-band-padding-inline: clamp(1rem, 5vw, 1.5rem);
    --content-band-padding-block: clamp(1.75rem, 8vw, 2.5rem);
    --content-band-gap: clamp(1rem, 5vw, 1.5rem);
  }
}

/* ==========================================================
   Kapitel 4 – Sprint 4L: Info-Zeilen
   ========================================================== */

/*
 * Gemeinsame Komponente fuer kompakte Inhaltsinformationen.
 * Die Varianten .wann und .verfasst steuern nur Icon und Farbe.
 */
.info-wrapper {
  --info-accent: var(--color-primary, #16731b);
  --info-background: #f3f8f3;
  --info-icon: none;

  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  width: fit-content;
  max-width: 100%;
  margin-block: 1.5rem 2rem;
  padding: 1rem 1.25rem;
  background: var(--info-background);
  color: var(--color-heading, #00245d);
  font-size: clamp(1.075rem, 1.5vw, 1.3rem);
  font-weight: 700;
  line-height: 1.35;
}

.info-wrapper::before {
  content: "";
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  margin-inline-end: 0.45rem;
  background-color: var(--info-accent);
  -webkit-mask-image: var(--info-icon);
  mask-image: var(--info-icon);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.info-wrapper > .datum,
.info-wrapper > .autor-wer {
  display: inline;
  margin: 0;
  padding: 0;
  color: inherit;
  font: inherit;
}

.info-wrapper time {
  color: inherit;
  font: inherit;
}

/* Termin: Kalender und gruener Akzent. */
.info-wrapper.wann {
  --info-accent: var(--color-primary, #16731b);
  --info-background: #f3f8f3;
  --info-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 2v3m10-3v3M3 9h18M5 5h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E");
}

/* Diskussion: Stift, Datum und Autorenangabe in einer Zeile. */
.info-wrapper.verfasst {
  --info-accent: var(--color-secondary, #314b9b);
  --info-background: #f2f5fb;
  --info-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m4 20 4.25-1 10.5-10.5a2.12 2.12 0 0 0-3-3L5.25 16 4 20Zm10.5-13.5 3 3'/%3E%3C/svg%3E");
}

.info-wrapper.verfasst > .autor-wer::before {
  content: "von";
  margin-inline-end: 0.45rem;
  font-weight: 400;
}

@media (max-width: 47.99rem) {
  .info-wrapper {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1.075rem;
  }
}


/* ==========================================================
   Kapitel 4 – Sprint 4M: Teaser-Views
   ========================================================== */

/* Gemeinsamer Kopf fuer Nachrichten- und Terminlisten. */
.teaserview > .view-header {
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.teaserview > .view-header h1 {
  margin-bottom: 0.5rem;
}

.teaserview .zaehler {
  color: var(--color-text-muted, #5b6472);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Die Farbbaender sind in den Views zugleich die Teaser-Karten. */
.teaserview > .view-content > .content-section-band {
  box-sizing: border-box;
}

.teaserview > .view-content > .content-section-band h3 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  line-height: 1.2;
}

.teaserview > .view-content > .content-section-band h3 a {
  color: var(--color-heading, #07184f);
  text-decoration: none;
}

.teaserview > .view-content > .content-section-band h3 a:hover,
.teaserview > .view-content > .content-section-band h3 a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Nachrichten: Bild links, kompletter Textblock rechts. */
.teaserview.nachrichten .teasercontainer {
  display: grid;
  grid-template-columns: minmax(10rem, 18rem) minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.75rem);
  align-items: start;
}

.teaserview.nachrichten .teaserbild {
  min-width: 0;
}

.teaserview.nachrichten .teaserbild a,
.teaserview.nachrichten .teaserbild picture {
  display: block;
}

.teaserview.nachrichten .teaserbild img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: cover;
}

.teaserview.nachrichten .autor-title-body {
  min-width: 0;
}

.teaserview.nachrichten .autor-title-body h3 {
  margin-bottom: 0.75rem;
}

.teaserview.nachrichten .node--view-mode-teaser .info-wrapper {
  width: fit-content;
  margin: 0 0 1rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
}

.teaserview.nachrichten .teasertext {
  max-width: 48rem;
  color: var(--color-text, #20242b);
  line-height: 1.65;
}

.teaserview.nachrichten .teasertext > :last-child {
  margin-bottom: 0;
}

/* Termine: Datum und Titel bilden den Kartenkopf. */
.teaserview.termine .datum-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 2rem);
  align-items: center;
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.teaserview.termine .datum-title .info-wrapper {
  margin: 0;
  white-space: nowrap;
}

/* Der erste Seitenabschnitt wird im View als kompakter Teaser verwendet. */
.teaserview.termine .section-teaser .section--seitenabschnitt {
  margin: 0;
  padding: 0;
  background: transparent;
}

.teaserview.termine .section-teaser .section__inner {
  padding: 0;
}

.teaserview.termine .section-teaser .is-section-container,
.teaserview.termine .section-teaser .is-section-wrapper {
  margin: 0;
  padding: 0;
  background: transparent;
}

.teaserview.termine .section-teaser .is-section {
  gap: clamp(1.25rem, 3vw, 2.75rem);
}

.teaserview.termine .section-teaser .is-section__text {
  line-height: 1.65;
}

.teaserview.termine .section-teaser .is-section__text > :first-child {
  margin-top: 0;
}

.teaserview.termine .section-teaser .is-section__text > :last-child {
  margin-bottom: 0;
}

.teaserview.termine .section-teaser picture,
.teaserview.termine .section-teaser a.colorbox {
  display: block;
}

.teaserview.termine .section-teaser img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Slideshow nur gestalten, wenn sie im Header eines Nachrichten-Views liegt. */
.teaserview.nachrichten > .view-header > .vvj-slideshow {
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.teaserview.nachrichten .media--view-mode-slideshow a,
.teaserview.nachrichten .media--view-mode-slideshow picture {
  display: block;
}

.teaserview.nachrichten .media--view-mode-slideshow img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 7;
  object-fit: cover;
}

/* Archivfilter im Service-Panel. Die bestehende Beschriftung bleibt erhalten. */
.service-panel .archivfilter .form-item {
  margin: 0;
}

.service-panel .archivfilter label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.service-panel .archivfilter select {
  width: 100%;
  min-height: 2.75rem;
}

.service-panel .archivfilter .description {
  margin-top: 0.5rem;
  color: var(--color-text-muted, #5b6472);
  font-size: 0.9rem;
}

/* Smartphone: dieselbe Bild-Text-Systematik wie auf groesseren Displays. */
@media (max-width: 47.99rem) {
  .teaserview.nachrichten .teasercontainer {
    grid-template-columns: minmax(6.5rem, 8.5rem) minmax(0, 1fr);
    gap: 1rem;
  }

  .teaserview.nachrichten .node--view-mode-teaser .info-wrapper {
    width: fit-content;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.875rem;
  }

  .teaserview.nachrichten .teasertext {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .teaserview.termine .datum-title {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem;
    align-items: center;
  }

  .teaserview.termine .datum-title .info-wrapper {
    width: fit-content;
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem;
  }

  .teaserview.termine .section-teaser .is-section {
    gap: 1rem;
  }

  .teaserview.nachrichten .media--view-mode-slideshow img {
    aspect-ratio: 16 / 9;
  }
}
