/* Text | Media block — Figma 308-6963 & 215-5281. Exact desktop values; responsive below. */
.sun-textmedia {
  padding: clamp(48px, 6vw, 80px) 0;
}
.sun-textmedia__inner {
  box-sizing: border-box;
  /* True 1280 content (→ 616px columns, Figma); 24px gutter on smaller screens. */
  width: min(1280px, 100% - 48px);
  margin-inline: auto;
  display: flex;
  gap: 48px;
  align-items: stretch;
}
/* Media_left orientation: swap column order. */
.sun-textmedia--flip .sun-textmedia__inner { flex-direction: row-reverse; }

.sun-textmedia__col { min-width: 0; }
.sun-textmedia__col--text {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}
/* Top-align when the content has expandables (accordion) so the heading doesn't
   jump vertically as items open/close. */
.sun-textmedia__col--text:has(.sun-textmedia__accordion) { justify-content: flex-start; }
.sun-textmedia__col--media { flex: 1 1 0; align-self: flex-start; }

/* --- Heading (two-tone, 32/40) --- */
.sun-textmedia__heading {
  margin: 0 0 16px;
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: 32px;
  line-height: 40px;
  letter-spacing: -0.16px;
}
.sun-textmedia__heading-main  { color: var(--sun-secondary); }   /* #132140 */
.sun-textmedia__heading-muted { color: var(--sun-bluegrey); }    /* #4f5563 */
.sun-textmedia__heading-muted--orange { color: var(--sun-primary); }

/* Scroll reveal (opt-in per block): the phrase starts in muted grey (#b6bac4,
   the theme default) and ORANGE wipes in word by word — the static muted colour
   above only applies without the reveal. See theme.css. */
.sun-textmedia__heading-muted.sun-accent-reveal {
  --sun-accent-hi: var(--sun-primary);
  color: var(--sun-primary);          /* static fallback = the end state */
}

/* Large variant — Branchen intro (Figma 1264-13307): H2 48/56, 18px medium
   copy, 48px rhythm, optional primary CTA. */
.sun-textmedia--large .sun-textmedia__heading {
  margin-bottom: 32px;
  font-size: clamp(32px, 3.75vw, 48px);
  line-height: 1.1667;
  letter-spacing: -0.48px;
}
.sun-textmedia--large .sun-textmedia__wysiwyg {
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
}
/* Medium variant — Technologie (Figma 1267-27059): H3 40/48 -0.2px, 18px regular
   navy copy, 24px rhythm; pairs with a checklist on a flat illustration. */
.sun-textmedia--medium .sun-textmedia__heading {
  margin-bottom: 8px;
  font-size: clamp(28px, 3.125vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.2px;
}
.sun-textmedia--medium .sun-textmedia__wysiwyg {
  font-size: 18px;
  line-height: 24px;
  color: var(--sun-secondary);
}
.sun-textmedia--medium .sun-textmedia__cl-text { color: var(--sun-secondary); }
.sun-textmedia__cta-row { margin: 32px 0 0; }
.sun-textmedia .sun-textmedia__cta-icon { width: 16px; height: 16px; }

.sun-textmedia__content { display: flex; flex-direction: column; gap: 16px; }

/* --- Accordion (Figma 215-5281) --- */
.sun-textmedia__accordion {
  background: var(--sun-border);                 /* #efefef */
  overflow: clip;
}
.sun-textmedia__acc-item {
  position: relative;
  padding: 0 24px;
  border-bottom: 1px solid var(--sun-muted);     /* #b6bac4 */
}
.sun-textmedia__acc-item:last-child { border-bottom: 0; }
/* Active line grows in left→right over the grey divider. */
.sun-textmedia__acc-item::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 100%; height: 1px;
  background: var(--sun-primary);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .45s ease;
}
.sun-textmedia__acc-item[data-open] {
  background: var(--sun-base);
}
.sun-textmedia__acc-item[data-open]::after { transform: scaleX(1); }
.sun-textmedia__acc-q { margin: 0; }
.sun-textmedia__acc-btn {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  padding: 24px 0;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--sun-secondary);
}
.sun-textmedia__acc-summary {
  flex: 1 1 auto;
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: 24px;
  line-height: 32px;
  color: var(--sun-secondary);                   /* #132140 */
}
.sun-textmedia .sun-textmedia__acc-caret {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  color: var(--sun-secondary);
  transition: transform .2s ease;
}
.sun-textmedia__acc-item[data-open] .sun-textmedia__acc-caret { transform: rotate(180deg); }
.sun-textmedia__acc-panel { padding-bottom: 24px; }
.sun-textmedia__acc-panel[hidden] { display: none; }
.sun-textmedia__acc-details,
.sun-textmedia__acc-details p {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  color: var(--sun-bluegrey);                    /* #4f5563 */
}
.sun-textmedia__acc-details p + p { margin-top: 12px; }
.sun-textmedia__acc-details strong { font-weight: 600; color: var(--sun-secondary); }
/* Bullet lists from the editor render as the orange checklist (same check
   glyph as .sun-textmedia__cl-check, painted via mask so it takes the colour). */
.sun-textmedia__acc-details ul {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sun-textmedia__acc-details ul:first-child { margin-top: 0; }
.sun-textmedia__acc-details li {
  position: relative;
  padding-left: 34px;                            /* icon 24 + 10 gap */
  color: var(--sun-secondary);                   /* #132140 */
}
.sun-textmedia__acc-details li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  background: var(--sun-primary);                /* #ff710a */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z'/%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 256 256'%3E%3Cpath d='M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sun-textmedia__acc-details ol { margin: 12px 0 0; padding-left: 20px; }
.sun-textmedia__acc-details ol:first-child { margin-top: 0; }

/* --- Rich text --- */
.sun-textmedia__wysiwyg { font-size: 16px; line-height: 24px; color: var(--sun-bluegrey); }
.sun-textmedia__wysiwyg > :first-child { margin-top: 0; }
.sun-textmedia__wysiwyg > :last-child { margin-bottom: 0; }

/* --- Icon list (Figma 308-6963) --- */
.sun-textmedia__iconlist { list-style: none; margin: 0; padding: 0; }
.sun-textmedia__il-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--sun-muted);     /* #b6bac4 */
}
.sun-textmedia__il-item:last-child { border-bottom: 0; }
.sun-textmedia__il-head { display: flex; align-items: center; gap: 16px; }
.sun-textmedia .sun-textmedia__il-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  color: var(--sun-secondary);                   /* #132140 */
}
.sun-textmedia__il-title {
  margin: 0;
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: 24px;
  line-height: 32px;
  color: var(--sun-secondary);
}
.sun-textmedia__il-text { padding-left: 48px; }   /* icon 32 + gap 16 — on the container only */
.sun-textmedia__il-text,
.sun-textmedia__il-text p {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  color: var(--sun-bluegrey);                    /* #4f5563 */
}

/* --- Checklist (orange check + line, values mirror the .sun-webapp checklist) --- */
.sun-textmedia__cl-intro {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 24px;
  color: var(--sun-bluegrey);                    /* #4f5563 */
}
.sun-textmedia__checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sun-textmedia__cl-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;                                     /* icon 24 + 10 = 34px text indent */
}
/* Descendant selector beats the global `.sun-icon { width: 1em }` from
   tokens.css, which is enqueued after per-block CSS. */
.sun-textmedia .sun-textmedia__cl-check {
  flex: 0 0 auto;
  display: block;
  width: 24px;
  height: 24px;
  color: var(--sun-primary);                     /* #ff710a */
  fill: currentColor;
}
.sun-textmedia__cl-text {
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: var(--sun-secondary);                   /* #132140 */
}

/* --- Media column --- fixed aspect box so it never stretches to the text height.
   For the accordion switch the template overrides the ratio with the widest
   slide's own, so the panel hugs the image instead of leaving a white band
   above and below it (the slides are stacked absolutely, so the panel needs an
   intrinsic ratio and cannot simply follow content height). */
.sun-textmedia__media {
  position: relative;
  align-self: flex-start;
  width: 100%;
  aspect-ratio: var(--sun-textmedia-media-ratio, 616 / 480);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
/* Transparent-by-nature media (motion bundle, inline SVG, Rive) sits directly on
   the section background. The white plate is for photos and video, where it is
   the letterbox — behind an animation with an alpha channel it just shows
   through. Opt out rather than in, so a briefed background stays possible. */
.sun-textmedia__media--plain {
  background: transparent;
}
/* The single image is a normal block in the flow: the panel already carries the
   asset's own ratio (emitted by the template), so the image fills it exactly at
   its natural proportions. No object-fit -- nothing to crop, nothing to letterbox. */
.sun-textmedia__media-img {
  display: block;
  width: 100%;
  height: auto;
}
/* Video and Rive have no intrinsic ratio to hand the panel, so they stay
   absolute and fit themselves into the 616/480 default. */
.sun-textmedia__video,
.sun-textmedia__rive {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Inline SVG media (e.g. technologie-signet-anim.svg): fills the panel, keeps its viewBox ratio. */
.sun-textmedia__svg { position: absolute; inset: 0; }
.sun-textmedia__svg svg { display: block; width: 100%; height: 100%; }

/* Accordion-linked media: stacked slides, crossfade to the open item's image. */
.sun-textmedia__media-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .4s ease;
}
.sun-textmedia__media-slide.is-active { opacity: 1; }
/* Slides are the one case that does need object-fit: they are stacked absolutely
   for the crossfade, so they cannot size the panel, and the panel carries the
   WIDEST slide's ratio. `scale-down` is `contain` capped at `none`, so each
   slide keeps its own proportions, is never enlarged past its intrinsic size,
   and a narrower one letterboxes at the sides against the white card. */
.sun-textmedia__media-slide .sun-textmedia__media-img {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: scale-down;
}
@media (prefers-reduced-motion: reduce) {
  .sun-textmedia__media-slide { transition: none; }
}
.sun-textmedia__media-empty {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--sun-muted), var(--sun-border));
}

/* Flat media (checklist rows): transparent cut-out illustrations sit directly
   on the section background — no white card. The image sizes itself (see above),
   so there is nothing to un-crop here. */
.sun-textmedia--flat-media .sun-textmedia__media {
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

/* --- Responsive --- */
@media (max-width: 860px) {
  .sun-textmedia__inner,
  .sun-textmedia--flip .sun-textmedia__inner {
    flex-direction: column;
    gap: 32px;
  }
  /* stretch: desktop align-self:flex-start would give the column 0 width here */
  .sun-textmedia__col--media { order: 2; align-self: stretch; }
  /* flip variant keeps its image ABOVE the text on mobile (Figma 369-9125) */
  .sun-textmedia--flip .sun-textmedia__col--media { order: 0; }
  .sun-textmedia__media {
    align-self: auto;
    height: auto;
    min-height: 0;
    aspect-ratio: var(--sun-textmedia-media-ratio, 616 / 480);
  }
  .sun-textmedia__heading { font-size: 28px; line-height: 36px; }
  .sun-textmedia__acc-summary,
  .sun-textmedia__il-title { font-size: 20px; line-height: 28px; }
}
@media (max-width: 480px) {
  .sun-textmedia__acc-btn { gap: 12px; }
}

/* ---- Accent background variant (Figma 326-4476) ----------------------- */
.sun-textmedia--bg-accent    { background: var(--sun-accent); }
.sun-textmedia--bg-secondary { background: var(--sun-secondary); }
.sun-textmedia--inverted .sun-textmedia__heading-main,
.sun-textmedia--inverted .sun-textmedia__heading-muted,
.sun-textmedia--inverted .sun-textmedia__wysiwyg { color: var(--sun-base); }

/* Accordion on accent (Figma 326-4476): collapsed rows are transparent with
   WHITE text and soft white dividers; only the OPEN item becomes a white card. */
.sun-textmedia--inverted .sun-textmedia__accordion {
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sun-textmedia--inverted .sun-textmedia__acc-item,
.sun-textmedia--inverted .sun-textmedia__acc-item:last-child {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, .45);
  border-radius: 0;
}
.sun-textmedia--inverted .sun-textmedia__acc-btn,
.sun-textmedia--inverted .sun-textmedia__acc-summary,
.sun-textmedia--inverted .sun-textmedia .sun-textmedia__acc-caret,
.sun-textmedia--inverted .sun-textmedia__acc-caret { color: var(--sun-base); }
.sun-textmedia--inverted .sun-textmedia__acc-item[data-open] {
  background: var(--sun-base);
  border-radius: 4px 4px 0 0;                     /* top only — square bottom so the orange line sits flush */
  border-bottom: 0;                               /* drop the 1px divider entirely — a transparent border still
                                                     paints white bg beneath it, leaving a sliver below the line */
}
.sun-textmedia--inverted .sun-textmedia__acc-item[data-open] .sun-textmedia__acc-btn,
.sun-textmedia--inverted .sun-textmedia__acc-item[data-open] .sun-textmedia__acc-summary,
.sun-textmedia--inverted .sun-textmedia__acc-item[data-open] .sun-textmedia__acc-caret { color: var(--sun-secondary); }
.sun-textmedia--inverted .sun-textmedia__acc-item::after {
  bottom: 0;
  border-radius: 0;                               /* flush with the square bottom — no rounded white sliver below */
}

/* Icon list on accent: white text, translucent dividers, white icons. */
.sun-textmedia--inverted .sun-textmedia__il-title,
.sun-textmedia--inverted .sun-textmedia__il-text { color: var(--sun-base); }
.sun-textmedia--inverted .sun-textmedia__il-item { border-bottom-color: rgba(255, 255, 255, .35); }

/* Checklist on accent: white copy, white checks (orange reads muddy on blue). */
.sun-textmedia--inverted .sun-textmedia__cl-intro,
.sun-textmedia--inverted .sun-textmedia__cl-text { color: var(--sun-base); }
.sun-textmedia--inverted .sun-textmedia .sun-textmedia__cl-check,
.sun-textmedia--inverted .sun-textmedia__cl-check { color: var(--sun-base); }
