/* Created by Content Blocks */

.card {
  /* Reason: establish a size container so the title can scale to the card's own
     width (cqi units below), independent of the viewport */
  container-type: inline-size;
  /* Reason: the kicker (shared .kicker rule in layout.css) sits tight above the
     title inside the header row; the colour comes from the {icon_color}
     utility class in the template, which outranks the components-layer rule. */
  --kicker-gap: 0.2rem;
}

.card__title {
  /* Reason: allow the title to shrink within the flex header and hyphenate long
     German words (e.g. ANSPRECHPARTNER, VERFÜGBARKEIT) at proper syllable
     boundaries instead of overflowing the card.
     overflow-wrap: normal + text-wrap: wrap override the global h1–h4 rule
     (Resources/Public/Css/tailwind.css), whose break-words/text-balance would
     otherwise chop words mid-syllable and pre-empt hyphenation. */
  min-width: 0;
  overflow-wrap: normal;
  -webkit-hyphens: auto;
  hyphens: auto;
  text-wrap: wrap;
  /* Fluid size: scales with card width, capped at the original text-3xl (1.875rem) */
  font-size: clamp(1.25rem, 8cqi, 1.875rem);
  line-height: 1.2;
}

@container (max-width: 340px) {
  /* Reason: on cramped cards the icon sitting beside the title steals enough
     horizontal space to force long words to break. Stack the icon above the title
     (top-left, its own size) so every title line gets the full card width, and trim
     the inner body padding for more room. Threshold is tunable. */
  .card__header {
    flex-direction: column;
    align-items: stretch; /* title fills the full width */
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .card__icon {
    align-self: flex-start; /* icon keeps its own size, parked top-left */
    min-width: 0; /* undo the 5rem reserved column */
    padding-right: 0;
  }

  .card__body {
    padding-left: 0;
    padding-right: 0;
  }
}

.card__heading {
  /* Reason: stack the optional kicker directly above the title so both share the
     same left edge, with the icon centered beside the pair. min-width:0 lets long
     German titles shrink/hyphenate inside the flex row. */
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.card--compact {
  padding: calc(1.25rem * 0.75);
  border-radius: calc(0.375rem * 0.75);
}

.card--compact .card__header {
  margin: calc(1rem * 0.75) 0;
}

.card--compact .card__icon {
  min-width: calc(2.5rem * 0.75);
  min-height: calc(2.5rem * 0.75);
  padding-right: calc(1rem * 0.75);
  border-bottom-left-radius: calc(0.5rem * 0.75);
}

.card--compact .card__title {
  font-size: calc(1.5rem * 0.75);
  line-height: calc(2rem * 0.75);
}

.card--compact .card__body {
  padding-left: calc(0.5rem * 0.75);
  padding-right: calc(0.5rem * 0.75);
  padding-bottom: calc(1rem * 0.75);
}

.card--compact .card__cta {
  padding-left: calc(1.5rem * 0.75);
  padding-right: calc(1.5rem * 0.75);
  padding-bottom: calc(1rem * 0.75);
}

.card--compact .card__button {
  padding: calc(0.75rem * 0.75) calc(1.25rem * 0.75);
  border-radius: calc(0.375rem * 0.75);
}

@media (min-width: 640px) {
  .card--compact .card__icon {
    min-width: calc(5rem * 0.75);
    padding-right: 0;
  }

  .card--compact .card__title {
    font-size: calc(1.875rem * 0.75);
    line-height: calc(2.25rem * 0.75);
  }

  .card--compact .card__body {
    padding-left: calc(1.5rem * 0.75);
    padding-right: calc(1.5rem * 0.75);
  }
}

/* Editorial layout (prototype/assessment-benefits, variant A): no box. A
   hairline on top, a running number with the icon at the right, then title and
   text in the page's own text colour, so the card works on the navy and the
   light page layout alike.

   The number is a CSS counter. It is reset on the element two levels above
   the card — the container grid when cards sit in a 3-Spalten container
   (container > column > card) — so sibling cards count 01, 02, 03 across the
   columns. */
:where(div):has(> div > .card--editorial) {
  counter-reset: card-editorial;
}

.card--editorial {
  counter-increment: card-editorial;
  padding-top: 1.25rem;
  border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}

.card--editorial .card__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  row-gap: 1rem;
  margin: 0;
}

.card--editorial .card__header::before {
  content: counter(card-editorial, decimal-leading-zero);
  grid-column: 1;
  grid-row: 1;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--theme-secondary, #ff7e47);
}

.card--editorial .card__icon {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
}

.card--editorial .card__heading {
  grid-column: 1 / -1;
  grid-row: 2;
}

.card--editorial .card__title {
  text-transform: none;
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.3;
  /* Sentence case leaves no long uppercase compounds to split; balanced
     wrapping reads better than hyphenated breaks. */
  -webkit-hyphens: manual;
  hyphens: manual;
  text-wrap: balance;
}

.card--editorial .card__body {
  margin-top: 0.6rem;
  padding: 0;
  line-height: 1.6;
  color: color-mix(in srgb, currentColor 78%, transparent);
}

.card--editorial .card__body > :last-child {
  margin-bottom: 0;
}

.card--editorial .card__cta {
  padding: 1rem 0 0;
}
