/* =====================================================================
   3dit WebGL Scatter Gallery
   Zentrale Stellschrauben — überschreibbar unter
   Design → Customizer → Zusätzliches CSS, z. B.:
     .tdg-gallery { --gallery-bg: #111; --gallery-ink: #eee; }
   ===================================================================== */
.tdg-gallery {
  --gallery-bg: #e9e9e9;
  --gallery-ink: #000000;
  --gallery-accent: #ebff00;
  --gallery-card: #f4f4f4;
  --gallery-muted: #666666;
  /* War #929292 (2,83:1 auf --gallery-card, verfehlt WCAG AA für Text —
     derselbe Fehler, den WP bei #949494 bewusst vermeidet). Jetzt gleich
     --gallery-muted: 5,74:1, besteht sicher. */
  --gallery-subtle: #666666;
  /* Pillen sind das tragende Bauteil: weich getönt, randlos, vollrund. */
  --pill-bg: rgba(217, 217, 217, 0.72);
  --pill-bg-hover: rgba(200, 200, 200, 0.92);
  --pill-border: transparent;
  position: relative;
  width: 100%;
  height: var(--tdg-height, 100vh);
  background: var(--gallery-bg);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  color-scheme: light;
  /* ui-rounded liefert auf Apple-Geräten SF Pro Rounded — die abgerundete
     Grotesk, die dieser Gestaltung zugrunde liegt. Sonst greift die
     Systemschrift. Lizenzierte Hausschrift hier eintragen. */
  font-family: var(--gallery-font, ui-rounded, "SF Pro Rounded", "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Arial, sans-serif);
  font-weight: 500;
  letter-spacing: -0.03em;
}

/* =====================================================================
   PILLE — eine Bauform für alles: Filter, Marken, Aktionen, Blättern
   ===================================================================== */
.tdg-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.03em;
  line-height: 1;
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--gallery-ink);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.18s ease, color 0.18s ease;
}
.tdg-pill:hover { background: var(--pill-bg-hover); }
.tdg-pill:focus-visible {
  outline: 2px solid var(--gallery-ink);
  outline-offset: 2px;
}
.tdg-pill[hidden] { display: none; }

/* Runder Symbol-Chip am Pillenanfang */
.tdg-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: -6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
}
.tdg-pill-icon svg { width: 12px; height: 12px; display: block; }
.tdg-pill-text { min-width: 0; }

/* Die eine betonte Aktion je Beitrag — das Neongelb bleibt ihr vorbehalten */
.tdg-pill-accent .tdg-pill-icon { background: var(--gallery-accent); }
.tdg-pill-accent:hover { background: var(--gallery-ink); color: #fff; }

/* =====================================================================
   TASTATUR- UND SCREENREADER-ZUGANG
   Die Galerie ist ein <canvas> und damit für Tastatur und Screenreader
   leer. Diese Liste enthält jeden Beitrag als echten Link: optisch
   ausgeblendet, aber fokussierbar. Bewusst NICHT display:none — das
   nähme sie aus der Tab-Reihenfolge und dem Barrierefreiheitsbaum.
   ===================================================================== */
.tdg-a11y-list {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  list-style: none;
}
/* Beim Tabben sichtbar werden, damit sehende Tastaturnutzer sehen,
   wo sie sind. */
.tdg-a11y-list:focus-within {
  z-index: 6;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 82%);
  height: auto;
  max-height: 60%;
  overflow-y: auto;
  clip-path: none;
  white-space: normal;
  padding: 10px;
  border-radius: 12px;
  border: 0;
  background: var(--gallery-card, #f4f4f4);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16);
}
.tdg-a11y-list a {
  display: block;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--gallery-ink);
  font-size: 13px;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.tdg-a11y-list a:focus-visible {
  outline: 2px solid var(--gallery-ink);
  outline-offset: 1px;
  background: var(--pill-bg);
}
.tdg-canvas:focus-visible {
  outline: 2px solid var(--gallery-ink);
  outline-offset: -3px;
}
/* 100vh rechnet auf Mobilbrowsern die einklappende Adressleiste mit — der
   untere Rand (und damit die Bedienhinweise) landet außerhalb des sichtbaren
   Bereichs. dvh misst den tatsächlich sichtbaren Ausschnitt. Das Widget setzt
   --tdg-height-dvh nur, wenn die Höhe in vh eingestellt ist; Pixelhöhen
   bleiben unangetastet. In @supports gekapselt, damit ältere Browser die
   vh-Zeile darüber behalten. */
@supports (height: 100dvh) {
  .tdg-gallery { height: var(--tdg-height-dvh, var(--tdg-height, 100dvh)); }
}

.tdg-gallery.dragging { cursor: grabbing; }
.tdg-gallery.reader-open { cursor: default; }
.tdg-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

/* Filter und Legende weichen zurück, sobald der Reader offen ist */
.tdg-gallery.reader-open .tdg-filters,
.tdg-gallery.reader-open .tdg-controls {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* =====================================================================
   LADEANZEIGE — Galerie, einzelne Kacheln und Beitragsinhalt
   ===================================================================== */
.tdg-spinner {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.18);
  border-top-color: var(--gallery-ink, #000);
  animation: tdg-spin 0.7s linear infinite;
}

/* Ladehinweis über der Galerie, solange die ersten Bilder unterwegs sind */
.tdg-loader {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--pill-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--gallery-muted);
  font-size: 13px;
  letter-spacing: -0.03em;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s;
}
/* Nur sichtbar, solange das Widget lädt — die Klasse setzt das Skript. */
.tdg-gallery:not(.is-loading) .tdg-loader {
  opacity: 0;
  visibility: hidden;
}

/* Spinner im Beitrag, solange dessen Inhalt nachgeladen wird */
.tdg-reader-loader {
  position: absolute;
  left: 50%;
  top: 92px;
  transform: translateX(-50%);
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}
.tdg-reader[aria-busy="true"] .tdg-reader-loader {
  opacity: 1;
  visibility: visible;
}

@keyframes tdg-spin { to { transform: rotate(360deg); } }

/* Ohne Bewegung: der Ring steht still, bleibt aber als Zustand sichtbar. */
@media (prefers-reduced-motion: reduce) {
  .tdg-spinner { animation-duration: 2.4s; }
}

/* =====================================================================
   STEUERUNGS-LEGENDE
   ===================================================================== */
/* Die Legende ist selbst eine Pille — sie sitzt in derselben Bauform wie
   die Filter darüber, damit die Fläche als ein System liest. */
.tdg-controls {
  position: absolute;
  left: 50%;
  /* Abstand zur Safe Area (iPhone-Homeindicator) einrechnen */
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 3;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--pill-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--gallery-muted);
  pointer-events: none;
  transition: opacity 0.5s ease;
  font-size: 12px;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.tdg-controls .ctrl { display: flex; align-items: center; gap: 6px; }
/* Der Zoom-Hinweis richtet sich nach der Eingabeart, nicht nach der
   Bildschirmbreite: ein Tablet am Schreibtisch hat eine Maus, ein großes
   Handy nicht. */
.tdg-controls .ctrl-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .tdg-controls .ctrl-mouse { display: none; }
  .tdg-controls .ctrl-touch { display: flex; }
}
.tdg-controls svg { width: 14px; height: 14px; flex: 0 0 auto; }

/* =====================================================================
   BEWEGUNGS-SCHALTER (auto-rotierende Inhalte brauchen eine Steuerung)
   ===================================================================== */
.tdg-motion-toggle {
  position: absolute;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 0;
  background: var(--pill-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--gallery-ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s ease, color 0.2s ease;
}
.tdg-motion-toggle:hover { background: var(--pill-bg-hover); }
.tdg-motion-toggle:focus-visible { outline: 2px solid var(--gallery-ink); outline-offset: 2px; }
.tdg-motion-toggle svg { width: 14px; height: 14px; }
.tdg-motion-toggle .icon-play { display: none; }
.tdg-motion-toggle .icon-pause { display: block; }
.tdg-motion-toggle.is-paused .icon-play { display: block; }
.tdg-motion-toggle.is-paused .icon-pause { display: none; }
.tdg-gallery.reader-open .tdg-motion-toggle { opacity: 0; pointer-events: none; }

/* =====================================================================
   KATEGORIEFILTER
   ===================================================================== */
.tdg-filters {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 3;
}
.filter-pill {
  font-family: inherit;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.03em;
  line-height: 1;
  padding: 9px 15px;
  border-radius: 999px;
  border: 0;
  background: var(--pill-bg);
  -webkit-backdrop-filter: blur(8px); /* Safari */
  backdrop-filter: blur(8px);
  color: var(--gallery-ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.18s ease, color 0.18s ease;
}
.filter-pill:hover { background: var(--pill-bg-hover); }
.filter-pill:focus-visible { outline: 2px solid var(--gallery-ink); outline-offset: 2px; }
.filter-pill.active { background: var(--gallery-ink); color: #fff; }

/* =====================================================================
   INLINE-READER — der Beitrag öffnet sich im Widget, nicht auf neuer Seite
   ===================================================================== */
/* Der Beitrag legt sich als Karte über die Galerie — dahinter bleibt die
   Galerie sichtbar, nur weichgezeichnet. Das hält den Ort im Blick, von dem
   der Beitrag stammt. */
.tdg-reader {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(233, 233, 233, 0.62);
  -webkit-backdrop-filter: blur(22px) saturate(0.7);
  backdrop-filter: blur(22px) saturate(0.7);
  color: var(--gallery-ink);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.tdg-reader.open { opacity: 1; }
.tdg-reader[hidden] { display: none; }

.tdg-reader-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.tdg-reader-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  /* Schwarz wie ein aktiver Kategorie-Tab */
  border: 0;
  background: var(--gallery-ink);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s ease, color 0.2s ease;
}
.tdg-reader-close:hover { background: var(--gallery-muted); }
.tdg-reader-close:focus-visible { outline: 2px solid var(--gallery-ink); outline-offset: 2px; }
.tdg-reader-close svg { width: 16px; height: 16px; }

/* Einheitliche, kompakte Beitrags-Darstellung.
   Dieselben Klassen nutzt das Single-Post-Template — dadurch sieht ein
   direkt aufgerufener Beitrag exakt aus wie der Reader. */
/* Die Beitragskarte: helle Fläche auf der weichgezeichneten Galerie. */
.tdg-article {
  max-width: 1100px;
  margin: 46px auto 64px;
  padding: 26px;
  border-radius: 12px;
  background: var(--gallery-card);
  transform: translateY(14px);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.tdg-reader.open .tdg-article { transform: translateY(0); }

/* Kopfzeile: Titel links, Datum rechts auf gleicher Grundlinie */
.tdg-article-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.tdg-reader-title,
.tdg-article h1 {
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin: 0;
  min-width: 0;
  /* verhindert einzelne Wörter auf der letzten Zeile */
  text-wrap: balance;
}
.tdg-reader-meta {
  flex: 0 0 auto;
  font-size: clamp(15px, 1.6vw, 20px);
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--gallery-subtle);
  white-space: nowrap;
}

/* Kopfbereich: Text links, Pillen direkt daneben. Die Medien darunter
   nutzen die volle Kartenbreite — so bleibt rechts keine tote Fläche. */
.tdg-article-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.tdg-article-intro > .tdg-reader-body {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}
/* Ohne Text rücken die Pillen nach links, statt rechts allein zu stehen */
.tdg-article-intro > .tdg-reader-body[hidden] ~ .tdg-reader-aside { margin-left: 0; }

.tdg-reader-aside {
  flex: 0 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.tdg-reader-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tdg-reader-tags[hidden] { display: none; }
.tdg-reader-tags .tdg-pill { max-width: 100%; }
.tdg-reader-tags .tdg-pill-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tdg-reader-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tdg-reader-lead:empty { display: none; }
.tdg-reader-lead img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 34px;
}

.tdg-reader-body {
  max-width: 68ch;
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -0.02em;
  color: var(--gallery-muted);
}
.tdg-reader-body[hidden] { display: none; }
.tdg-reader-body > * { margin: 0 0 1em; }
.tdg-reader-body > *:last-child { margin-bottom: 0; }
.tdg-reader-body h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--gallery-ink);
  margin-top: 1.7em;
  letter-spacing: -0.03em;
}
.tdg-reader-body ul { padding-left: 1.15em; }
.tdg-reader-body li { margin-bottom: 0.35em; }

/* Medienraster — 2-3 Spalten, je nach Menge des Beitragsinhalts.
   --tdg-cols setzt das JS bzw. PHP passend zur Anzahl der Medien. */
.tdg-reader-media {
  display: grid;
  grid-template-columns: repeat(var(--tdg-cols, 3), minmax(0, 1fr));
  gap: 10px;
}
.tdg-reader-media[hidden] { display: none; }

.tdg-media-cell {
  margin: 0;
  min-width: 0;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.05);
}
.tdg-media-cell img,
.tdg-media-cell video {
  display: block;
  width: 100%;
  height: auto;
}

/* Bilder sind anklickbar und öffnen die Datei selbst. Das Zoom-Zeichen
   macht das sichtbar, ohne dass ein Beschriftungs-Overlay das Bild verdeckt. */
.tdg-media-link {
  display: block;
  cursor: zoom-in;
  touch-action: manipulation;
}
.tdg-media-link img { transition: opacity 0.18s ease; }
.tdg-media-link:hover img { opacity: 0.86; }
.tdg-media-link:focus-visible {
  outline: 2px solid var(--gallery-ink);
  outline-offset: 2px;
}
/* Videos und Einbettungen füllen immer die volle Rasterbreite — auf jeder
   Layoutgröße, vom Handy bis zum Desktop. */
.tdg-media-video,
.tdg-media-embed { grid-column: 1 / -1; }

.tdg-media-video video {
  width: 100%;
  height: auto;
  display: block;
}

.tdg-media-embed {
  position: relative;
  /* Format der Einbettung; --tdg-ar setzt das Skript je Medium. */
  aspect-ratio: var(--tdg-ar, 16 / 9);
  /* Ein Hochkant-Video über die volle Breite würde sonst weit höher als der
     Bildschirm — deshalb über die Höhe deckeln. Die Breite folgt dem Format
     (--tdg-arn ist dasselbe Verhältnis als Zahl), das Bild bleibt unverzerrt. */
  width: 100%;
  max-width: calc(78dvh * var(--tdg-arn, 1.7778));
  /* justify-self statt auto-Rand: ein Rasterelement mit auto-Rand verliert
     die Streckung und fiele auf Breite 0 zusammen. */
  justify-self: center;
}
.tdg-media-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}


/* =====================================================================
   RESPONSIV
   ===================================================================== */
@media (max-width: 1024px) {
  .tdg-filters { top: 16px; left: 16px; right: 16px; gap: 6px; }
  .filter-pill { font-size: 12px; padding: 8px 13px; }

  .tdg-article { margin: 40px 16px 48px; padding: 20px; }
  /* Schmaler: Pillen unter den Text statt daneben */
  .tdg-article-intro {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .tdg-reader-aside { justify-content: flex-start; }

  .tdg-reader-media {
    grid-template-columns: repeat(var(--tdg-cols-tablet, 2), minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  /* Wischen bewegt die Galerie — auch senkrecht. Vorher gab pan-y das
     senkrechte Wischen an die Seite zurück; auf einer bildschirmfüllenden
     Galerie fühlte sich das an, als ließe sie sich nicht richtig bewegen.
     Der Reader scrollt trotzdem: er liegt darüber und setzt touch-action
     für sich selbst zurück. */
  .tdg-gallery { touch-action: none; }

  /* Bedienelemente aus den Systemleisten heraushalten: oben Statusleiste
     und Notch, unten Safaris Werkzeugleiste bzw. der Homeindicator.
     Ohne die Safe-Area-Abstände lagen die Filter unter der Uhrzeit. */
  .tdg-filters {
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    gap: 6px;
    padding: 0 max(10px, env(safe-area-inset-left, 0px)) 0 max(10px, env(safe-area-inset-right, 0px));
    /* Bei vielen Kategorien waagerecht schieben statt umbrechen */
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Die Leiste selbst darf gewischt werden, die Galerie darunter nicht */
    touch-action: pan-x;
    overscroll-behavior-x: contain;
  }
  .tdg-filters::-webkit-scrollbar { display: none; }
  .filter-pill { font-size: 12px; padding: 8px 13px; flex: 0 0 auto; }

  /* Die Legende wurde rechts abgeschnitten ("Klick ="). Auf schmalen
     Schirmen bleibt nur der Hinweis, der auf Touch überhaupt zutrifft —
     gewischt wird, nicht gescrollt oder geklickt. */
  .tdg-controls {
    gap: 10px;
    font-size: 11px;
    padding: 8px 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100% - 76px);
  }
  .tdg-controls svg { width: 13px; height: 13px; }
  /* Sehr schmal: nur die beiden Gesten, das Antippen erklärt sich selbst */
  .tdg-controls .ctrl:last-child { display: none; }

  .tdg-motion-toggle {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  /* Reader: eigene Scrollfläche, deshalb Gesten hier wieder freigeben */
  .tdg-reader-scroll { touch-action: pan-y; }

  .tdg-reader-close {
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    width: 40px;
    height: 40px;
  }
  .tdg-article {
    margin: calc(60px + env(safe-area-inset-top, 0px)) 10px
            calc(28px + env(safe-area-inset-bottom, 0px));
    padding: 16px;
    border-radius: 10px;
  }
  .tdg-article-head {
    /* Untereinander — nebeneinander bliebe für den Titel zu wenig Platz. */
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 10px;
  }
  .tdg-reader-title { font-size: 20px; line-height: 1.15; }
  .tdg-reader-meta { font-size: 13px; }
  .tdg-reader-lead img { margin-bottom: 16px; }
  .tdg-reader-body {
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 12px;
  }
  .tdg-article-intro { gap: 10px; margin-bottom: 12px; }

  /* Pillen ohne graue Fläche: auf dem kleinen Schirm zählt jeder Millimeter,
     und die Fläche trug nichts bei — Symbol und Wort genügen. */
  .tdg-reader-aside {
    justify-content: flex-start;
    width: 100%;
    gap: 6px 14px;
  }
  .tdg-reader-tags { gap: 6px 14px; }
  .tdg-reader-nav { gap: 6px 14px; }
  .tdg-reader-aside .tdg-pill {
    background: none;
    padding: 2px 0;
    font-size: 12.5px;
    color: var(--gallery-muted);
  }
  .tdg-reader-aside .tdg-pill:hover { background: none; color: var(--gallery-ink); }
  .tdg-reader-aside .tdg-pill-icon {
    background: none;
    width: 14px;
    height: 14px;
    margin-left: 0;
  }
  .tdg-reader-aside .tdg-pill-icon svg { width: 11px; height: 11px; }

  /* Beitragsbilder in zwei Spalten — ein einspaltiges Band wirkte auf dem
     Handy endlos. Videos und Einbettungen bleiben volle Breite. */
  .tdg-reader-media {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
}

/* Sehr flache Fenster (Handy quer) */
@media (max-height: 480px) {
  .tdg-controls { bottom: 8px; }
  .tdg-article { padding-top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .tdg-reader,
  .tdg-article { transition: none; }
  .tdg-article { transform: none; }
}

/* =====================================================================
   EINHEITLICHE BEITRAGSSEITE (Direktaufruf, Single-Post-Template)
   Gleiche Optik wie der Reader, nur ohne Overlay-Rahmen.
   ===================================================================== */
/* Nur Rückfallwerte (Fallback in var()), damit dieselben Variablen greifen,
   die auch die Galerie nutzt — im Customizer gesetzte Farben wirken hier
   also ebenfalls. Vorher waren die Farben hier fest verdrahtet. */
.tdg-single {
  --gallery-bg: #e9e9e9;
  --gallery-ink: #000000;
  --gallery-accent: #ebff00;
  --gallery-card: #f4f4f4;
  --gallery-muted: #666666;
  --gallery-subtle: #666666;
  --pill-bg: rgba(217, 217, 217, 0.72);
  --pill-bg-hover: rgba(200, 200, 200, 0.92);
  --pill-border: transparent;
  background: var(--gallery-bg);
  color: var(--gallery-ink);
  color-scheme: light;
  font-family: var(--gallery-font, ui-rounded, "SF Pro Rounded", "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Arial, sans-serif);
  font-weight: 500;
  letter-spacing: -0.03em;
}
.tdg-single .tdg-article { transform: none; margin-top: 22px; }
.tdg-single .tdg-reader-back {
  /* Zurück-Link ist die Umkehrung des Schließen-Knopfes im Reader */
  display: inline-flex;
  align-items: center;
  margin: 22px auto 0;
  max-width: 1100px;
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--pill-bg);
  font-size: 13px;
  letter-spacing: -0.03em;
  color: var(--gallery-ink);
  text-decoration: none;
  transition: background 0.18s ease;
}
.tdg-single .tdg-reader-back:hover { background: var(--pill-bg-hover); }
.tdg-single .tdg-reader-back:focus-visible { outline: 2px solid var(--gallery-ink); outline-offset: 2px; }

/* Navigation mehrseitiger Beiträge (<!--nextpage-->) */
.tdg-page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 36px;
  font-size: 13px;
  /* gleich breite Ziffern, damit die Seitenzahlen nicht zappeln */
  font-variant-numeric: tabular-nums;
}
.tdg-page-links a,
.tdg-page-links > span {
  min-width: 34px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 0;
  background: var(--pill-bg, rgba(217, 217, 217, 0.72));
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.tdg-page-links > span {
  background: var(--gallery-ink, #000);
  color: #fff;
}

/* Kommentarbereich — bewusst schlicht, damit er das Raster nicht stört */
.tdg-comments {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 32px 72px;
}
@media (max-width: 640px) {
  .tdg-comments { padding: 0 16px 48px; }
}

/* =====================================================================
   EINFÜHRUNG — kurze Bedienhilfe beim ersten Besuch
   Liegt über der Galerie, hält sie aber nicht auf: die Beiträge laden
   dahinter weiter. Bewegt wird ausschließlich transform/opacity, damit
   die Animation auf der GPU läuft und das Laden nicht ausbremst.
   ===================================================================== */
.tdg-intro {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px
           max(16px, env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--gallery-bg, #e9e9e9) 72%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 1;
  transition: opacity 0.45s ease, visibility 0.45s;
}
/* Ausblenden statt entfernen — so bleibt der Platz stabil und es flackert nicht */
.tdg-intro.is-weg {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.tdg-intro[hidden] { display: none; }

.tdg-intro-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: min(560px, 100%);
  padding: 26px 28px 22px;
  border-radius: 16px;
  background: var(--gallery-card, #f4f4f4);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.tdg-intro-title {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--gallery-ink);
  text-wrap: balance;
}

.tdg-intro-steps {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
}
.tdg-intro-step {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--gallery-muted);
  /* Nacheinander hereinschieben. Die Sichtbarkeit haengt bewusst NICHT an
     der Animation: laeuft sie nicht (abgeschaltet, Seite im Hintergrund,
     alter Browser), steht der Text trotzdem lesbar da — dann eben ohne
     Bewegung. Animiert wird deshalb nur die Verschiebung, nie die Deckkraft. */
  opacity: 1;
  animation: tdg-intro-auf 0.45s ease backwards;
}
.tdg-intro-step:nth-child(1) { animation-delay: 0.15s; }
.tdg-intro-step:nth-child(2) { animation-delay: 0.55s; }
.tdg-intro-step:nth-child(3) { animation-delay: 0.95s; }

@keyframes tdg-intro-auf {
  from { transform: translateY(8px); }
}

.tdg-intro-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--pill-bg);
  color: var(--gallery-ink);
}
.tdg-intro-glyph svg { width: 28px; height: 28px; display: block; overflow: visible; }
.tdg-intro-text { display: block; }

/* Je nach Eingabeart die passende Formulierung — nicht nach Breite */
.tdg-intro-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .tdg-intro-maus  { display: none; }
  .tdg-intro-touch { display: block; }
}

/* --- die drei Gesten ------------------------------------------------ */
/* Ziehen: die Hand wandert hin und her */
.tdg-g-hand   { animation: tdg-ziehen 1.9s ease-in-out infinite; }
.tdg-g-pfeile { opacity: 0.35; }
@keyframes tdg-ziehen {
  0%, 100% { transform: translateX(-7px); }
  50%      { transform: translateX(7px); }
}
/* Zoom: die Lupe pulsiert */
.tdg-g-lupe, .tdg-g-plus { animation: tdg-zoomen 1.9s ease-in-out infinite; transform-origin: 24px 24px; }
@keyframes tdg-zoomen {
  0%, 100% { transform: scale(0.86); }
  50%      { transform: scale(1.08); }
}
/* Öffnen: der Zeiger tippt die Kachel an */
.tdg-g-zeiger { animation: tdg-tippen 1.9s ease-in-out infinite; transform-origin: 22px 26px; }
.tdg-g-kachel { animation: tdg-kachel 1.9s ease-in-out infinite; transform-origin: 20px 20px; }
@keyframes tdg-tippen {
  0%, 55%, 100% { transform: translate(0, 0); }
  70%           { transform: translate(-3px, -3px); }
}
@keyframes tdg-kachel {
  0%, 60%, 100% { transform: scale(1); opacity: 1; }
  75%           { transform: scale(1.06); opacity: 0.75; }
}

/* Fortschritt bis zum automatischen Ausblenden */
.tdg-intro-balken {
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--gallery-ink) 12%, transparent);
  overflow: hidden;
}
.tdg-intro-balken span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--gallery-ink);
  transform-origin: left center;
  transform: scaleX(0);
  animation: tdg-intro-lauf var(--tdg-intro-dauer, 3500ms) linear forwards;
}
@keyframes tdg-intro-lauf { to { transform: scaleX(1); } }

@media (max-width: 640px) {
  .tdg-intro-card { padding: 20px 18px 18px; gap: 14px; border-radius: 14px; }
  .tdg-intro-title { font-size: 15px; }
  .tdg-intro-steps { gap: 6px; }
  .tdg-intro-step { font-size: 11.5px; }
  .tdg-intro-glyph { width: 44px; height: 44px; }
  .tdg-intro-glyph svg { width: 23px; height: 23px; }
}

/* Ohne Bewegung: alles sofort sichtbar, nichts zappelt. Der Hinweis
   bleibt als Information erhalten und blendet weiterhin von selbst aus. */
@media (prefers-reduced-motion: reduce) {
  .tdg-intro-step { opacity: 1; transform: none; animation: none; }
  .tdg-g-hand, .tdg-g-lupe, .tdg-g-plus, .tdg-g-zeiger, .tdg-g-kachel { animation: none; }
  .tdg-intro-balken span { animation-duration: var(--tdg-intro-dauer, 3500ms); }
}
