/* ============================================================
   Section: roles_accordion — layout "cards" (Kacheln).
   Static tile grid of the same roles the accordion shows: image on top,
   no number, no expand interaction. The accordion layout itself stays in
   homepage-sections.css / fullstack-extra.css (.prg-accordion / .prg-card).

   Card anatomy: media -> title + subtitle -> description -> facts -> CTA.
   The whole card is the hit area (stretched link on .da-rc__cta).
   Type follows the design tokens: 16px "smaller" body step, one secondary
   grey (#627B84), navy headlines, coral CTA.
   ============================================================ */

.da-rc {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.da-rc--2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.da-rc--4col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

/* Group label, mirroring the nav's "Umschulungen (IHK)" group
   (.da-nav-group-label / .da-nav-divider in header-nav.css). */
.da-rc__group-label {
  font-family: "Figtree", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #124658;
  margin: 0 0 16px;
}
/* Optional one-liner under the label: format + funding of the whole group. */
.da-rc__group-label:has(+ .da-rc__group-text) {
  margin-bottom: 6px;
}
.da-rc__group-text {
  max-width: 760px;
  font-size: 16px;
  line-height: 1.6;
  color: #627b84;
  margin: 0 0 24px;
}
/* Proximity does the grouping: tight gap label -> own tiles (16px),
   wide gap between groups (96px), no divider line. */
.da-rc-group + .da-rc-group {
  margin-top: 96px;
}

.da-rc__card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 32px;
  background: #ffffff;
  overflow: hidden;
  transition: transform 0.25s ease;
}
/* Hover only for real pointers (PP-1942), see cta-button.css. */
@media (hover: hover) and (pointer: fine) {
  .da-rc__card:hover {
    transform: translateY(-4px);
  }
}
/* Keyboard focus lands on the CTA; show the ring on the whole card. */
.da-rc__card:has(.da-rc__cta:focus-visible) {
  outline: 3px solid #fd5b4f;
  outline-offset: 4px;
}
.da-rc__cta:focus-visible {
  outline: none;
}

/* Program photos are portrait (homepage .prg-card crops) — cropped to a
   landscape header here, anchored near the top so faces stay in frame. */
.da-rc__media {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 12px 12px 0;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, #f3eee9 0%, #e8ddd4 100%);
}
/* Wide 2-column tiles: flatter image so the text isn't pushed down. */
.da-rc--2col .da-rc__media {
  aspect-ratio: 2 / 1;
}
.da-rc__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  transition: transform 0.4s ease;
}
@media (hover: hover) and (pointer: fine) {
  .da-rc__card:hover .da-rc__img {
    transform: scale(1.03);
  }
}
/* Same "KI-generiert" badge as the accordion (.prg-card__ai-badge). */
.da-rc__ai-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 9999px;
  background: rgba(18, 70, 88, 0.55);
  backdrop-filter: blur(2px);
  color: #ffffff;
  font-family: "Figtree", sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.da-rc__ai-badge svg {
  width: 9px;
  height: 12px;
  flex-shrink: 0;
}

.da-rc__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px 32px 28px;
}

.da-rc__title {
  font-family: "Figtree", sans-serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #124658;
  margin: 0 0 6px;
}

.da-rc__subtitle {
  font-family: "Figtree", sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: #4a6b77;
}

.da-rc__desc {
  font-size: 16px;
  line-height: 1.6;
  color: #627b84;
  margin: 12px 0 20px;
}

/* Key facts (Dauer, Zeitmodell) as pills, pinned above the CTA so they
   line up for comparison across cards instead of trailing the description. */
.da-rc .da-rc__facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: auto 0 24px;
}
.da-rc .da-rc__facts li {
  display: inline-flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 6px 12px;
  border-radius: 9999px;
  background: rgba(18, 70, 88, 0.07); /* navy tint, #F5F7F7 is too faint on white */
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: #2f4753;
}
.da-rc .da-rc__facts li::before,
.da-rc .da-rc__facts li::marker {
  content: none;
}

/* Text-CTA instead of six coral pills side by side. */
.da-rc__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  font-family: "Figtree", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: #fd5b4f;
  text-decoration: none;
}
.da-rc__cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.da-rc__cta-arrow {
  display: inline-flex;
  transition: transform 0.18s;
}
@media (hover: hover) and (pointer: fine) {
  .da-rc__card:hover .da-rc__cta {
    color: #e04a3f;
  }
  .da-rc__card:hover .da-rc__cta-arrow {
    transform: translateX(3px);
  }
}

/* 4 in a row: narrow tiles (~280px) -> tighter padding, smaller type. */
.da-rc--4col .da-rc__media {
  aspect-ratio: 4 / 3;
}
.da-rc--4col .da-rc__body {
  padding: 20px 24px 24px;
}
.da-rc--4col .da-rc__title {
  font-size: 20px;
}
.da-rc--4col .da-rc__cta {
  font-size: 16px;
}

/* Layout "banner": roles side by side, each card with a portrait image on
   the left and the text on the right (program photos are portrait crops).
   .da-rc.da-rc--banner: beats the generic .da-rc breakpoint rules further down. */
.da-rc.da-rc--banner {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.da-rc.da-rc--banner .da-rc__card {
  display: grid;
  grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
  border-radius: 32px;
}
@media (hover: hover) and (pointer: fine) {
  .da-rc.da-rc--banner .da-rc__card:hover {
    transform: translateY(-2px);
  }
}
/* Image fills the full card height -> always portrait next to the text. */
.da-rc.da-rc--banner .da-rc__media {
  aspect-ratio: auto;
  min-height: 300px;
  margin: 12px 0 12px 12px;
}
.da-rc.da-rc--banner .da-rc__img {
  object-position: center 20%;
}
/* Title pinned to the top, facts + CTA to the bottom -> both line up
   across neighbouring cards regardless of description length. */
.da-rc.da-rc--banner .da-rc__body {
  justify-content: flex-start;
  padding: 28px 28px 28px 28px;
}
.da-rc.da-rc--banner .da-rc__title {
  font-size: 24px;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.da-rc.da-rc--banner .da-rc__desc {
  font-size: 15px;
  margin: 10px 0 18px;
}
.da-rc.da-rc--banner .da-rc__facts {
  margin: auto 0 20px;
}
.da-rc.da-rc--banner .da-rc__facts li {
  font-size: 14px;
  padding: 5px 10px;
}
/* Tablet: one banner per row, still image left. */
@media (max-width: 1100px) {
  .da-rc.da-rc--banner {
    grid-template-columns: minmax(0, 1fr);
  }
  .da-rc.da-rc--banner .da-rc__card {
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  }
}
/* Mobile: image on top. */
@media (max-width: 700px) {
  .da-rc.da-rc--banner .da-rc__card {
    grid-template-columns: minmax(0, 1fr);
  }
  .da-rc.da-rc--banner .da-rc__media {
    aspect-ratio: 4 / 3;
    min-height: 0;
    margin: 12px 12px 0;
  }
  .da-rc.da-rc--banner .da-rc__body {
    padding: 22px 24px 26px;
  }
  .da-rc.da-rc--banner .da-rc__title {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .da-rc__card,
  .da-rc__img,
  .da-rc__cta-arrow {
    transition: none;
  }
  .da-rc__card:hover,
  .da-rc__card:hover .da-rc__img {
    transform: none;
  }
}

@media (max-width: 1200px) {
  .da-rc--4col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }
}
@media (max-width: 1100px) {
  .da-rc {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .da-rc--2col .da-rc__media {
    aspect-ratio: 16 / 9;
  }
}
@media (max-width: 700px) {
  .da-rc,
  .da-rc--2col,
  .da-rc--4col {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .da-rc__card {
    border-radius: 24px;
  }
  .da-rc__media {
    border-radius: 16px;
  }
  .da-rc-group + .da-rc-group {
    margin-top: 64px;
  }
  .da-rc__body {
    padding: 20px 24px 24px;
  }
  .da-rc__title {
    font-size: 22px;
  }
}

/* ============================================================
   Layout "accordion" with more than 4 roles (.prg-accordion--many).
   The homepage accordion is built for 4 cards (flex-grow 5:1); with 6 the
   open card gets too narrow and long short-titles overflow the collapsed
   rails. Desktop only — below 1223px homepage-sections.css switches the
   accordion to a stacked grid anyway.
   ============================================================ */
@media (min-width: 1223px) {
  .da-ki-roles .prg-accordion--many {
    gap: 12px;
  }
  .da-ki-roles .prg-accordion--many .prg-card {
    flex: 0 0 88px;
  }
  .da-ki-roles .prg-accordion--many .prg-card.is-open {
    flex: 1 1 88px;
  }
  .da-ki-roles .prg-accordion--many .prg-card__expanded {
    grid-template-columns: minmax(0, 280px) 1fr;
  }
  .da-ki-roles .prg-accordion--many .prg-card__body h3 {
    font-size: 30px;
  }
  /* Collapsed rail: title runs bottom-to-top so long titles fit. */
  .da-ki-roles .prg-accordion--many .prg-card__compact h3 {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
  }
}

/* Accordion facts: icon and text were glued together. */
.da-ki-roles .prg-card__body ul li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.da-ki-roles .prg-card__body ul li + li {
  margin-top: 6px;
}
.da-ki-roles .prg-card__body ul li img {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Collapsed rail (4-card layout): long German titles like
   "Softwareentwickler" are wider than the rail — hyphenate instead of clipping. */
.da-ki-roles .prg-card__compact-title {
  max-width: 100%;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}

/* Titelgröße "Klein" (.da-ki-roles--sub): follow-up section that continues
   the previous one — header reads as a subtitle, not a new H2 chapter. */
.da-ki-roles--sub .da-overview-title > div {
  font-size: 14px;
  line-height: 18px;
  margin-bottom: 8px;
}
/* Heading styled as body text (da-text-big), accent without coral/italic. */
.da-ki-roles--sub .da-overview-title h2 {
  font-size: 22px;
  font-weight: 400;
  line-height: 36px;
  letter-spacing: 0;
  color: #4a6b77;
  margin-bottom: 0;
}
.da-ki-roles--sub .da-overview-title h2 em {
  font-style: normal;
  font-weight: inherit;
  color: inherit;
}
/* Without intro the cards would sit directly under the heading. */
.da-ki-roles--sub .da-overview-title:not(:has(+ .da-text-big)) {
  margin-bottom: 28px;
}
.da-ki-roles--sub .da-text-big {
  font-size: 17px;
  line-height: 1.6;
  margin: 10px 0 28px;
}
@media (max-width: 700px) {
  .da-ki-roles--sub .da-overview-title h2 {
    font-size: 18px;
    line-height: 28px;
  }
}
/* Sub-section directly after another roles section: 80px gap (56px mobile).
   The previous section's own md:mb-44 would win the margin collapse, so it
   is dropped for this pairing. */
.wp-block-lazyblock-roles-accordion:has(+ .wp-block-lazyblock-roles-accordion .da-ki-roles--sub) .da-ki-roles {
  margin-bottom: 0;
}
.da-ki-roles--sub {
  margin-top: 80px;
}
@media (max-width: 767px) {
  .da-ki-roles--sub {
    margin-top: 56px;
  }
}

/* VSL page rhythm: 180px between neighbouring sections (desktop).
   value-prop -> roles: value-prop ends with 100px padding (+5px line-height),
   so the roles section adds 75px on top. */
@media (min-width: 801px) {
  .wp-block-lazyblock-value-prop + .wp-block-lazyblock-roles-accordion .da-ki-roles {
    padding-top: 75px;
  }
  /* roles -> next-steps: md:mb-44 (176px) -> 180px. */
  .wp-block-lazyblock-roles-accordion:has(+ .wp-block-lazyblock-next-steps) .da-ki-roles {
    margin-bottom: 180px;
  }
}

/* Tag pills from the subtitle: only used by the VSL mobile card below. */
.da-ki-roles .da-rc-tags {
  display: none;
}

/* ------------------------------------------------------------
   Mobile (<= 620px) program cards on the VSL page: same card as the
   homepage programs on mobile (home-programs.php + homepage-sections.css):
   tag pills, title, description next to a narrow portrait photo, facts with
   clock / wallet icons, full-width CTA. Scoped to the BG landing pages
   (body:has(.da-ec): VSL + Standard variant):
   fullstack-extra.css (loaded later, same specificity) styles the KI landing
   pages' cards differently on purpose.
   ------------------------------------------------------------ */
@media (max-width: 620px) {
  body:has(.da-ec) .da-ki-roles .prg-accordion {
    margin-left: 0;
    margin-right: 0;
  }
  body:has(.da-ec) .da-ki-roles .prg-card {
    border-radius: 32px;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__expanded {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    grid-template-areas: "tags media" "title media" "desc media" "meta meta" "cta cta";
    column-gap: 14px;
    row-gap: 10px;
    align-items: start;
    padding: 20px 20px 22px;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__media {
    grid-area: media;
    float: none;
    width: 120px;
    height: 225px;
    min-height: 0;
    margin: 0;
    border-radius: 20px;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__ai-badge {
    top: auto;
    right: auto;
    left: 8px;
    bottom: 8px;
    padding: 4px 7px;
    font-size: 9.5px;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__body {
    display: contents;
  }
  body:has(.da-ec) .da-ki-roles .prg-card .da-rc-tags {
    grid-area: tags;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  body:has(.da-ec) .da-ki-roles .prg-card .da-rc-tag {
    padding: 7px 12px;
    border: 0;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  /* Farben nur auf hellen Seiten (PP-2010): auf Dark gelten die Pillen-/Text-
     farben aus theme-dark.css, das Layout oben bleibt für beide. */
  body:not(.da-page-dark):has(.da-ec) .da-ki-roles .prg-card .da-rc-tag {
    background: #f5f7f7;
    color: #4c5f66;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__body > h3 {
    grid-area: title;
    position: static; /* fullstack-extra.css pins it over the photo */
    margin: 0;
    font-size: 22px;
    hyphens: auto;
  }
  body:has(.da-ec) .da-ki-roles .da-rc-sub {
    display: none;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__body > .da-rc-desc {
    grid-area: desc;
    display: block;
    margin: 0;
    font-size: 14.5px;
    line-height: 1.55;
  }
  body:has(.da-ec) .da-ki-roles .da-rc-facts {
    grid-area: meta;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 6px 0 0;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__body .da-rc-facts li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.3;
  }
  body:not(.da-page-dark):has(.da-ec) .da-ki-roles .prg-card__body .da-rc-facts li {
    color: #124658;
  }
  body:has(.da-ec) .da-ki-roles .da-rc-facts li img {
    display: none;
  }
  body:has(.da-ec) .da-ki-roles .da-rc-facts li::before {
    content: "";
    flex: 0 0 18px;
    height: 18px;
    background: #fd5b4f;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  body:has(.da-ec) .da-ki-roles .da-rc-facts li + li::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h13a1 1 0 0 1 1 1v3'/%3E%3Cpath d='M3 7v10a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1H5a2 2 0 0 1-2-1Z'/%3E%3Ccircle cx='17' cy='13.5' r='1.2' fill='black'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h13a1 1 0 0 1 1 1v3'/%3E%3Cpath d='M3 7v10a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1H5a2 2 0 0 1-2-1Z'/%3E%3Ccircle cx='17' cy='13.5' r='1.2' fill='black'/%3E%3C/svg%3E");
  }
  body:has(.da-ec) .da-ki-roles .prg-card__body > .prg-card__cta {
    grid-area: cta;
    justify-self: stretch;
    justify-content: center;
    margin-top: 12px;
  }
}

/* <= 420px: homepage small-phone values (narrower photo, tighter padding,
   20px title) so long titles like "Softwareentwickler" fit next to it. */
@media (max-width: 420px) {
  body:has(.da-ec) .da-ki-roles .prg-card__expanded {
    grid-template-columns: minmax(0, 1fr) 100px;
    column-gap: 12px;
    row-gap: 8px;
    padding: 18px 16px 20px;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__media {
    width: 100px;
    height: 190px;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__body > h3 {
    font-size: 20px;
    overflow-wrap: break-word;
  }
  body:has(.da-ec) .da-ki-roles .prg-card__body > .da-rc-desc {
    font-size: 14px;
  }
}

/* Mobile intro paragraph: da-text-big keeps its 36px line-height at 18px. */
@media (max-width: 800px) {
  .da-ki-roles .da-text-big {
    line-height: 1.6;
  }
}

/* ------------------------------------------------------------
   Mobile (<= 620px) banner cards (Umschulung): layout of the program cards
   above (title + description next to a narrow portrait photo), content
   styled like their own desktop version: subtitle line, facts as grey
   pills, coral text CTA (whole card stays clickable via ::after).
   ------------------------------------------------------------ */
.da-rc .da-rc-tags {
  display: none;
}
@media (max-width: 620px) {
  .da-rc.da-rc--banner .da-rc__card {
    grid-template-columns: minmax(0, 1fr) 120px;
    grid-template-areas: "title media" "sub media" "desc media" "facts facts" "cta cta";
    column-gap: 14px;
    row-gap: 10px;
    align-items: start;
    padding: 20px 20px 22px;
    border-radius: 32px;
  }
  .da-rc.da-rc--banner .da-rc__media {
    grid-area: media;
    width: 120px;
    height: 225px;
    aspect-ratio: auto;
    min-height: 0;
    margin: 0;
    border-radius: 20px;
  }
  .da-rc.da-rc--banner .da-rc__ai-badge {
    top: auto;
    right: auto;
    left: 8px;
    bottom: 8px;
    padding: 4px 7px;
    font-size: 9.5px;
  }
  .da-rc.da-rc--banner .da-rc__body {
    display: contents;
  }
  .da-rc.da-rc--banner .da-rc__title {
    grid-area: title;
    margin: 0;
    font-size: 22px;
    hyphens: auto; /* lang="de" on the grid -> "Anwendungs-entwicklung" */
    hyphenate-limit-chars: 10 4 4;
  }
  .da-rc.da-rc--banner .da-rc__subtitle {
    grid-area: sub;
    font-size: 14.5px;
    line-height: 1.4;
  }
  .da-rc.da-rc--banner .da-rc__desc {
    grid-area: desc;
    max-width: none;
    margin: 0;
    font-size: 14.5px;
    line-height: 1.55;
  }
  .da-rc.da-rc--banner .da-rc__facts {
    grid-area: facts;
    margin: 6px 0 0;
  }
  .da-rc.da-rc--banner .da-rc__cta {
    grid-area: cta;
    margin-top: 8px;
  }
}
@media (max-width: 420px) {
  .da-rc.da-rc--banner .da-rc__card {
    grid-template-columns: minmax(0, 1fr) 100px;
    column-gap: 12px;
    row-gap: 8px;
    padding: 18px 16px 20px;
  }
  .da-rc.da-rc--banner .da-rc__media {
    width: 100px;
    height: 190px;
  }
  .da-rc.da-rc--banner .da-rc__title {
    font-size: 20px;
  }
  .da-rc.da-rc--banner .da-rc__desc {
    font-size: 14px;
  }
}
