/* ===================================================================
   Plugin „Mediathek" — Frontend
   Design-Tokens des Themes (style.css). Wird über die head-Region geladen
   (Detailseite) bzw. auf Seiten mit [[MEDIATHEK]]. Keine externen Assets (GDPR).

   Kategorie-Akzente: jede Dateiart bekommt eine eigene Akzentfarbe für Icon,
   Typ-Badge und Hover — so ist die Art auf einen Blick erkennbar, statt eines
   uniformen grauen Rasters.
   =================================================================== */

.mt-overview,
.mt-attachments { --mt-accent: var(--blue); }

/* Die Mediathek wird in .page-content eingebettet (Übersicht/Anhänge per
   Shortcode, Detailseite im .mt-detail__body). Dessen Theme-Regeln (page.css,
   lädt VOR diesem CSS) treffen sonst unsere UI-Elemente über den generischen
   Selektor `.page-content a` (Spezifität 0,1,1):
     • text-decoration:underline → Karten-Links, Download-Button, Filter-Chips
       & Blättern-Links werden unterstrichen (der gemeldete „alles unterstrichen"-
       Effekt);
     • color:var(--blue) → überschreibt unsere gewollten Farben (weißer
       Button-Text, graue Filter-Chips) mit Blau, weil 0,1,1 unsere
       Element-Regeln (0,1,0) schlägt.
   Beide hier für die Mediathek-Container zurücknehmen. Die Selektoren spiegeln
   dieselbe Spezifität (0,1,1) und stehen NACH page.css → gewinnen. Kinder mit
   eigener Farbe (Titel/Meta/Badges/__action-Span) sind nicht betroffen, da
   `.page-content a` nur den <a> selbst färbt. */
.mt-overview a,
.mt-attachments a,
.mt-detail a {
  text-decoration: none;
  color: inherit;
}

/* Elemente mit BEWUSSTER Eigenfarbe müssen die Theme-Link-Farbe (0,1,1) und den
   inherit-Reset oben schlagen → auf (0,2,0) heben, indem der Wrapper mitzielt. */
.mt-overview .mt-filter__item,
.mt-attachments .mt-filter__item { color: var(--text-mid); }
.mt-overview .mt-filter__item.is-active,
.mt-attachments .mt-filter__item.is-active { color: #fff; }
.mt-overview .mt-pagination__prev,
.mt-overview .mt-pagination__next { color: var(--blue); }
.mt-detail .mt-detail__button { color: #fff; }

.mt-overview img,
.mt-attachments img,
.mt-detail img {
  margin: 0;
  box-shadow: none;
}

/* Kategorie-Akzentfarben (Karte setzt die Variable je Typ). */
.mt-card--document { --mt-accent: #1450a3; }
.mt-card--image    { --mt-accent: #0f9d58; }
.mt-card--archive  { --mt-accent: #8a5a00; }
.mt-card--video    { --mt-accent: #c2410c; }
.mt-card--audio    { --mt-accent: #7c3aed; }

/* ----- Themen-Filter ----- */
.mt-filter {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 28px;
}
.mt-filter__item {
  font-family: var(--ff-head); font-weight: 700; font-size: 14px;
  padding: 8px 16px; border-radius: 999px;
  border: 1.5px solid var(--line);
  color: var(--text-mid); background: var(--bg);
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.mt-filter__item:hover,
.mt-filter__item:focus-visible { color: var(--blue); border-color: var(--blue); }
.mt-filter__item.is-active {
  color: #fff; background: var(--blue); border-color: var(--blue);
}

.mt-overview__intro { margin: 0 0 28px; color: var(--text-mid); max-width: 68ch; }

/* ----- Karten-Grid ----- */
.mt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.mt-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ----- Datei-Karte ----- */
.mt-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.mt-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
  border-color: color-mix(in srgb, var(--mt-accent) 40%, var(--line));
}
/* Farbiger Akzentstreifen links, erscheint beim Hover. */
.mt-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--mt-accent); opacity: 0; transition: opacity .2s ease;
}
.mt-card:hover::before { opacity: 1; }

.mt-card__link {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  color: inherit;
}

/* Visueller Kopf: entweder Bild-Thumbnail oder Kategorie-Icon auf Tönung. */
.mt-card__visual {
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--mt-accent) 8%, var(--bg-soft));
  overflow: hidden;
}
.mt-card__thumb { width: 100%; height: 100%; object-fit: cover; }
.mt-card__icon { width: 56px; height: 56px; color: var(--mt-accent); }
.mt-card__type {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--ff-head); font-weight: 700; font-size: 11px;
  letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: var(--mt-accent);
  padding: 4px 9px; border-radius: 6px;
}

.mt-card__body { padding: 16px 18px 6px; }
.mt-card__title {
  margin: 0 0 6px; font-family: var(--ff-head); font-weight: 800;
  font-size: 17px; line-height: 1.3; color: var(--blue-ink);
}
.mt-card__meta {
  margin: 0; font-size: 13.5px; color: var(--text-mid);
  display: flex; gap: 7px; align-items: center; flex-wrap: wrap;
}

.mt-card__action {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 10px 18px 16px;
  font-family: var(--ff-head); font-weight: 700; font-size: 14px;
  color: var(--mt-accent);
}
.mt-card__action svg { width: 17px; height: 17px; }

.mt-empty { color: var(--text-mid); font-size: 16px; }

/* ----- Pagination ----- */
.mt-pagination {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin-top: 34px;
}
.mt-pagination__prev,
.mt-pagination__next {
  font-family: var(--ff-head); font-weight: 700; font-size: 14.5px;
  color: var(--blue); padding: 8px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); transition: border-color .18s ease, color .18s ease;
}
.mt-pagination__prev:hover,
.mt-pagination__next:hover { border-color: var(--blue); }
.mt-pagination__status { font-size: 14px; color: var(--text-mid); }

/* ----- Anhänge (kompakte Überschrift) ----- */
.mt-attachments { margin: 26px 0; }
.mt-attachments__heading {
  margin: 0 0 16px; font-family: var(--ff-head); font-weight: 800;
  font-size: 22px; color: var(--blue-ink);
  padding-left: 14px; border-left: 4px solid var(--orange);
}

/* ===================================================================
   Detailseite
   =================================================================== */
.mt-detail__head { margin-bottom: 22px; }
.mt-detail__badge {
  display: inline-block; margin-bottom: 12px;
  font-family: var(--ff-head); font-weight: 700; font-size: 12px;
  letter-spacing: .05em; text-transform: uppercase;
  color: #fff; background: var(--blue); padding: 5px 12px; border-radius: 6px;
}
.mt-detail__badge--image   { background: #0f9d58; }
.mt-detail__badge--archive { background: #8a5a00; }
.mt-detail__badge--video   { background: #c2410c; }
.mt-detail__badge--audio   { background: #7c3aed; }
.mt-detail__date { margin: 0; color: var(--text-mid); font-size: 14.5px; }

.mt-detail__preview {
  margin: 0 0 28px; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-soft);
}
.mt-detail__preview img { width: 100%; height: auto; }

.mt-detail__media { margin: 0 0 28px; }
.mt-detail__media video { width: 100%; border-radius: var(--r-md); background: #000; display: block; }
.mt-detail__media--audio audio { width: 100%; }

.mt-detail__body { margin: 0 0 30px; }

/* Prominenter Download-Block. */
.mt-detail__download {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 22px 24px; border-radius: var(--r-md);
  background: var(--bg-soft); border: 1px solid var(--line);
}
.mt-detail__button {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--ff-head); font-weight: 800; font-size: 16px;
  color: #fff; background: var(--orange);
  padding: 14px 26px; border-radius: var(--r-sm);
  box-shadow: 0 10px 22px -10px rgba(243, 146, 0, .8);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.mt-detail__button:hover,
.mt-detail__button:focus-visible {
  background: var(--orange-deep); transform: translateY(-1px);
  box-shadow: 0 14px 26px -10px rgba(224, 127, 0, .9);
}
.mt-detail__button svg { width: 20px; height: 20px; }
.mt-detail__fileinfo { margin: 0; color: var(--text-mid); font-size: 14.5px; font-weight: 600; }

/* Kleine Bildschirme: Download-Block gestapelt. */
@media (max-width: 560px) {
  .mt-detail__download { flex-direction: column; align-items: stretch; }
  .mt-detail__button { justify-content: center; }
}
