/* ==========================================================================
   site/downloads – Downloadbereich Patienteninformationen
   Kacheln + Liste (umschaltbar), Themenfilter, Galerie im Overlay.
   Schriftgrößen für p, Headlines und Eyebrow kommen aus der Haupt-CSS.
   Abstände in px, kein clamp.
   ========================================================================== */
.sdl {
  --sdl-petrol: #2c5569;
  --sdl-petrol-dark: #1f4152;
  --sdl-ink: #1e3340;
  --sdl-muted: #5b6b74;
  --sdl-tint: #eef3f5;
  --sdl-tint-strong: #e2ebef;
  --sdl-line: #dfe7eb;
  --sdl-columns: 3;
  --sdl-gap: 28px;
  --sdl-radius: 20px;
  position: relative;
}
.sdl[data-columns="2"] { --sdl-columns: 2; }
.sdl[data-columns="4"] { --sdl-columns: 4; --sdl-gap: 24px; }

/* Kategoriefarben (Punkt vor dem Thema) */
.sdl [data-cat="pflege"] { --cat: #3f86ad; }
.sdl [data-cat="notfall"] { --cat: #c4573e; }
.sdl [data-cat="nachsorge"] { --cat: #4f8a64; }
.sdl [data-cat="kiefer"] { --cat: #a77b3c; }
.sdl [data-cat="schnarchen"] { --cat: #6b62a8; }
.sdl [data-cat="kosten"] { --cat: #6f7f88; }
.sdl__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat, var(--sdl-petrol));
}

/* Screenreader-Text */
.sdl__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Icons (SVG aus dem assets-Ordner, Farbe = currentColor) */
.sdl__icon {
  display: inline-block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: no-repeat center / contain;
  mask: no-repeat center / contain;
}
.sdl__icon--download { -webkit-mask-image: url("icon-download.svg"); mask-image: url("icon-download.svg"); }
.sdl__icon--eye { -webkit-mask-image: url("icon-eye.svg"); mask-image: url("icon-eye.svg"); }
.sdl__icon--grid { -webkit-mask-image: url("icon-grid.svg"); mask-image: url("icon-grid.svg"); }
.sdl__icon--list { -webkit-mask-image: url("icon-list.svg"); mask-image: url("icon-list.svg"); }
.sdl__icon--close { -webkit-mask-image: url("icon-close.svg"); mask-image: url("icon-close.svg"); }
.sdl__icon--chevron { -webkit-mask-image: url("icon-chevron.svg"); mask-image: url("icon-chevron.svg"); }

/* ==========================================================================
   Kopf
   ========================================================================== */
.sdl__header {
  max-width: 760px;
  margin: 0 0 40px;
}
.sdl__heading { margin: 0 0 16px; }
.sdl__intro > :last-child { margin-bottom: 0; }

/* ==========================================================================
   Werkzeugleiste: Filter links, Anzahl + Ansicht rechts
   ========================================================================== */
.sdl__toolbar {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  margin: 0 0 32px;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--sdl-line);
}
.sdl__filter {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 560px;
  gap: 8px;
  min-width: 0;
}
.sdl__filter[hidden] { display: none; }

.sdl__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 40px;
  background: var(--sdl-tint);
  color: var(--sdl-ink);
  font: inherit;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.sdl__chip[hidden] { display: none; }
.sdl__count {
  color: var(--sdl-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.sdl__count:empty { display: none; }
@media (hover: hover) {
  .sdl__chip:hover { background: var(--sdl-tint-strong); }
}
.sdl__chip[aria-pressed="true"] {
  background: var(--sdl-petrol);
  color: #ffffff;
}
.sdl__chip[aria-pressed="true"] .sdl__count { color: rgba(255, 255, 255, .7); }
.sdl__chip[aria-pressed="true"] .sdl__dot { box-shadow: 0 0 0 2px #ffffff; }

.sdl__toolbar-end {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}
.sdl__status {
  margin: 0;
  color: var(--sdl-muted);
  white-space: nowrap;
}
.sdl__status:empty { display: none; }

/* Ansichtswechsel als Segment-Schalter */
.sdl__switch {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: 40px;
  background: var(--sdl-tint);
}
.sdl__switch[hidden] { display: none; }
.sdl__switch-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 30px;
  background: transparent;
  color: var(--sdl-muted);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.sdl__switch-btn[aria-pressed="true"] {
  background: #ffffff;
  color: var(--sdl-petrol);
  box-shadow: 0 1px 4px rgba(31, 65, 82, .16);
}
@media (hover: hover) {
  .sdl__switch-btn[aria-pressed="false"]:hover { color: var(--sdl-petrol); }
}

.sdl__chip:focus-visible,
.sdl__switch-btn:focus-visible,
.sdl__actions a:focus-visible,
.sdl-lb__btn:focus-visible,
.sdl-lb__download:focus-visible {
  outline: 3px solid var(--sdl-petrol);
  outline-offset: 3px;
}

/* ==========================================================================
   Gemeinsame Bausteine
   ========================================================================== */
.sdl__grid {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sdl__item {
  margin: 0;
  padding: 0;
}
.sdl__item::before { content: none; display: none; }
.sdl__item[hidden] { display: none; }

.sdl__thumb {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--sdl-tint);
  cursor: zoom-in;
}
.sdl__thumb img {
  display: block;
  max-width: none;
}
.sdl__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(31, 65, 82, .9);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.4;
}
.sdl__title {
  margin: 0;
  color: var(--sdl-petrol-dark);
  overflow-wrap: break-word;
}
.sdl__text {
  margin: 0;
  color: var(--sdl-muted);
}
.sdl__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.sdl__tags:not(:has(.sdl__tag)) { display: none; }
.sdl__tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--sdl-ink);
  font-size: 13px;
  line-height: 1.4;
}
.sdl__meta {
  margin: 0;
  color: var(--sdl-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Aktionen: Ansehen (Kontur) + Herunterladen (gefüllt) */
.sdl__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sdl .sdl__actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  margin: 0;
  padding: 0 18px;
  border-radius: 44px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.sdl .sdl__actions .sdl__view {
  width: 44px;
  padding: 0;
  border: 1px solid var(--sdl-line);
  background: #ffffff;
  color: var(--sdl-petrol);
}
.sdl .sdl__actions .sdl__view .sdl__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.sdl .sdl__actions .sdl__download {
  border: 1px solid var(--sdl-petrol);
  background: var(--sdl-petrol);
  color: #ffffff;
}
@media (hover: hover) {
  .sdl .sdl__actions .sdl__view:hover { border-color: var(--sdl-petrol); background: var(--sdl-tint); }
  .sdl .sdl__actions .sdl__download:hover { border-color: var(--sdl-petrol-dark); background: var(--sdl-petrol-dark); }
}

/* ==========================================================================
   KACHELN
   ========================================================================== */
.sdl:not([data-layout="list"]) .sdl__listhead { display: none; }

.sdl:not([data-layout="list"]) .sdl__grid {
  display: grid;
  grid-template-columns: repeat(var(--sdl-columns), minmax(0, 1fr));
  gap: var(--sdl-gap);
}
.sdl:not([data-layout="list"]) .sdl__card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--sdl-line);
  border-radius: var(--sdl-radius);
  background: #ffffff;
  overflow: hidden;
  transition: box-shadow .3s ease, transform .3s ease;
}
/* Vorschau wie ein Blatt Papier auf hellem Grund */
.sdl:not([data-layout="list"]) .sdl__thumb {
  aspect-ratio: 4 / 3;
  padding: 28px 28px 0;
}
.sdl:not([data-layout="list"]) .sdl__thumb img {
  width: 100%;
  height: auto;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 12px 32px rgba(31, 65, 82, .16);
  transition: transform .4s ease;
}
@media (hover: hover) {
  .sdl:not([data-layout="list"]) .sdl__card:hover {
    box-shadow: 0 20px 44px rgba(31, 65, 82, .12);
    transform: translateY(-4px);
  }
  .sdl:not([data-layout="list"]) .sdl__card:hover .sdl__thumb img { transform: translateY(-6px); }
}
.sdl:not([data-layout="list"]) .sdl__body {
  display: grid;
  flex-grow: 1;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "tags tags"
    "title title"
    "text text"
    "meta actions";
  row-gap: 10px;
  column-gap: 12px;
  padding: 24px;
}
.sdl:not([data-layout="list"]) .sdl__tags { grid-area: tags; }
.sdl:not([data-layout="list"]) .sdl__title { grid-area: title; }
.sdl:not([data-layout="list"]) .sdl__text {
  grid-area: text;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sdl:not([data-layout="list"]) .sdl__meta {
  grid-area: meta;
  align-self: center;
  margin-top: 12px;
}
.sdl:not([data-layout="list"]) .sdl__actions {
  grid-area: actions;
  margin-top: 12px;
}
/* Schmale Karten: Format über den Buttons, Download-Button volle Breite */
.sdl:not([data-layout="list"]) .sdl__card { container-type: inline-size; }
@container (max-width: 360px) {
  .sdl:not([data-layout="list"]) .sdl__body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "tags"
      "title"
      "text"
      "meta"
      "actions";
  }
  .sdl:not([data-layout="list"]) .sdl__meta { margin-top: 8px; }
  .sdl:not([data-layout="list"]) .sdl__actions { margin-top: 4px; }
  .sdl:not([data-layout="list"]) .sdl__actions .sdl__download { flex: 1 1 auto; }
}

/* ==========================================================================
   LISTE (Tabellenaufbau mit festen Spalten)
   ========================================================================== */
.sdl[data-layout="list"] {
  --sdl-list-cols: 64px minmax(0, 1fr) 210px 112px 152px;
}
.sdl[data-layout="list"] .sdl__listhead {
  display: grid;
  grid-template-columns: var(--sdl-list-cols);
  column-gap: 24px;
  padding: 0 16px 12px;
  color: var(--sdl-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.sdl[data-layout="list"] .sdl__listhead-title { grid-column: 1 / span 2; }
.sdl[data-layout="list"] .sdl__toolbar { margin-bottom: 24px; }

.sdl[data-layout="list"] .sdl__grid {
  display: block;
  border-top: 1px solid var(--sdl-line);
}
.sdl[data-layout="list"] .sdl__card {
  display: grid;
  grid-template-columns: var(--sdl-list-cols);
  grid-template-areas:
    "thumb title tags meta actions"
    "thumb text tags meta actions";
  align-items: center;
  column-gap: 24px;
  row-gap: 2px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--sdl-line);
  transition: background-color .2s ease;
}
@media (hover: hover) {
  .sdl[data-layout="list"] .sdl__card:hover { background: #f6f9fa; }
}
.sdl[data-layout="list"] .sdl__body { display: contents; }

.sdl[data-layout="list"] .sdl__thumb {
  grid-area: thumb;
  width: 64px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--sdl-line);
  border-radius: 6px;
  background: #ffffff;
}
.sdl[data-layout="list"] .sdl__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.sdl[data-layout="list"] .sdl__badge { display: none; }

/* Titel in Fließtextgröße der Seite, nur kräftiger */
.sdl[data-layout="list"] .sdl__title {
  grid-area: title;
  align-self: end;
  font: inherit;
  font-weight: 600;
}
.sdl[data-layout="list"] .sdl__text {
  grid-area: text;
  align-self: start;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sdl[data-layout="list"] .sdl__body:not(:has(.sdl__text)) .sdl__title {
  grid-row: 1 / span 2;
  align-self: center;
}
.sdl[data-layout="list"] .sdl__tags {
  grid-area: tags;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.sdl[data-layout="list"] .sdl__tag { font-size: 14px; }
.sdl[data-layout="list"] .sdl__meta { grid-area: meta; }
.sdl[data-layout="list"] .sdl__actions {
  grid-area: actions;
  justify-content: flex-end;
}
.sdl[data-layout="list"] .sdl__actions a {
  width: 44px;
  padding: 0;
}
.sdl[data-layout="list"] .sdl__actions .sdl__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sdl__empty {
  margin: 24px 0 0;
  color: var(--sdl-muted);
}
.sdl__empty[hidden] { display: none; }

/* ==========================================================================
   GALERIE (Overlay)
   ========================================================================== */
.sdl-lb {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffffff;
  overflow: hidden;
}
.sdl-lb[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  animation: sdl-lb-in .25s ease;
}
.sdl-lb::backdrop {
  background: rgba(14, 30, 39, .9);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
@keyframes sdl-lb-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sdl-lb__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
}
.sdl-lb__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.sdl-lb__counter {
  color: rgba(255, 255, 255, .65);
  font-size: 13px;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}
.sdl-lb__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sdl-lb__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.sdl-lb__tags .sdl__tag { color: rgba(255, 255, 255, .8); }
.sdl-lb__tools {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
}
.sdl .sdl-lb__download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin: 0;
  padding: 0 20px;
  border: 0;
  border-radius: 44px;
  background: #ffffff;
  color: var(--sdl-petrol-dark);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.sdl-lb__btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #ffffff;
  cursor: pointer;
  transition: background-color .2s ease;
}
@media (hover: hover) {
  .sdl-lb__btn:hover { background: rgba(255, 255, 255, .24); }
}

.sdl-lb__stage {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8px 104px 48px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sdl-lb__img {
  display: block;
  width: 100%;
  max-width: 920px;
  height: auto;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  transition: opacity .2s ease;
}
.sdl-lb__img.is-loading { opacity: .25; }

.sdl-lb__nav {
  position: fixed;
  top: 50%;
  width: 56px;
  height: 56px;
  transform: translateY(-50%);
}
.sdl-lb__nav[hidden] { display: none; }
.sdl-lb__prev { left: 28px; }
.sdl-lb__next { right: 28px; }
.sdl-lb__prev .sdl__icon { transform: rotate(180deg); }
.sdl-lb__nav .sdl__icon { width: 22px; height: 22px; }

html.sdl-lb-open { overflow: hidden; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1199px) {
  .sdl[data-columns="4"] { --sdl-columns: 3; }
  .sdl[data-layout="list"] { --sdl-list-cols: 56px minmax(0, 1fr) 190px 104px 100px; }
  .sdl[data-layout="list"] .sdl__thumb { width: 56px; }
}

@media (max-width: 991px) {
  .sdl { --sdl-columns: 2; --sdl-gap: 20px; }
  .sdl[data-columns="4"] { --sdl-columns: 2; }

  /* Liste: Formatspalte entfällt */
  .sdl[data-layout="list"] { --sdl-list-cols: 56px minmax(0, 1fr) 180px 100px; }
  .sdl[data-layout="list"] .sdl__card {
    grid-template-areas:
      "thumb title tags actions"
      "thumb text tags actions";
  }
  .sdl[data-layout="list"] .sdl__meta,
  .sdl[data-layout="list"] .sdl__listhead-format { display: none; }

  .sdl-lb__stage { padding: 8px 88px 40px; }
}

@media (max-width: 767px) {
  .sdl__header { margin-bottom: 28px; }

  .sdl__toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding-bottom: 20px;
  }
  /* Filter als wischbare Zeile */
  .sdl__filter {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding-right: 24px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .sdl__filter::-webkit-scrollbar { display: none; }
  .sdl__chip { flex-shrink: 0; }
  .sdl__toolbar-end {
    justify-content: space-between;
    width: 100%;
    margin-left: 0;
  }

  /* Liste: kompakte Zeilen */
  .sdl[data-layout="list"] .sdl__listhead { display: none; }
  .sdl[data-layout="list"] .sdl__card {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb title actions"
      "thumb tags actions";
    column-gap: 14px;
    row-gap: 6px;
    padding: 14px 0;
  }
  .sdl[data-layout="list"] .sdl__thumb { width: 48px; }
  .sdl[data-layout="list"] .sdl__text { display: none; }
  .sdl[data-layout="list"] .sdl__title,
  .sdl[data-layout="list"] .sdl__body:not(:has(.sdl__text)) .sdl__title { grid-row: auto; align-self: end; }
  .sdl[data-layout="list"] .sdl__tags {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-self: start;
  }
  .sdl[data-layout="list"] .sdl__tag { font-size: 13px; }
  .sdl[data-layout="list"] .sdl__actions { gap: 6px; }
  .sdl[data-layout="list"] .sdl__actions a { width: 40px; height: 40px; }

  /* Galerie: Navigation unten */
  .sdl-lb__bar { padding: 12px 16px; gap: 12px; }
  .sdl-lb__title { font-size: 16px; white-space: normal; }
  .sdl-lb__tags { display: none; }
  .sdl .sdl-lb__download { width: 44px; padding: 0; justify-content: center; }
  .sdl .sdl-lb__download .sdl__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .sdl-lb__stage { padding: 4px 12px 96px; }
  .sdl-lb__nav {
    top: auto;
    bottom: 20px;
    transform: none;
    background: rgba(255, 255, 255, .18);
  }
  .sdl-lb__prev { left: calc(50% - 68px); }
  .sdl-lb__next { right: calc(50% - 68px); }
}

@media (max-width: 575px) {
  .sdl { --sdl-columns: 1; }
  .sdl[data-columns="2"],
  .sdl[data-columns="4"] { --sdl-columns: 1; }
  .sdl:not([data-layout="list"]) .sdl__body { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sdl *,
  .sdl-lb { transition: none !important; animation: none !important; }
}
