/*
 * tosogu-sammlung: Darstellung der Bausteine.
 * Farben und Schriften kommen aus dem Theme: Kadence stellt seine Farbpalette als
 * --global-palette1 bis --global-palette9 bereit. Ändert sich die Palette im Customizer,
 * ändern sich diese Bausteine mit.
 */

.tsg-raster,
.tsg-kacheln,
.tsg-register,
.tsg-nachbarn,
.tsg-alle,
.tsg-liste,
.tsg-gruppenhinweis {
  --tsg-text: var(--global-palette3, #1f1d1b);
  --tsg-leise: var(--global-palette5, #6b655e);
  --tsg-linie: var(--global-palette7, #e4e0da);
  --tsg-grund: var(--global-palette8, #f6f4f1);
  --tsg-akzent: var(--global-palette1, #7a4b2a);
  --tsg-weiss: var(--global-palette9, #ffffff);
}

/* Karten und Raster */
.tsg-raster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: 2rem 1.5rem;
  margin: 1.5rem 0 2rem;
}
.tsg-karte {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--tsg-text);
  text-decoration: none;
}
.tsg-karte[hidden] { display: none; }
.tsg-karte-bild {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  background: var(--tsg-grund);
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.tsg-raster .tsg-karte-bild img {
  display: block;
  width: 100%;
  height: 100% !important;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.4s ease;
}
.tsg-karte:hover .tsg-karte-bild img { transform: scale(1.03); }
.tsg-karte-titel { font-weight: 600; line-height: 1.3; }
.tsg-karte:hover .tsg-karte-titel { color: var(--tsg-akzent); }
.tsg-karte-meta { font-size: 0.875em; color: var(--tsg-leise); line-height: 1.4; }

/* Kacheln */
.tsg-kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0 2rem;
}
.tsg-kacheln.tsg-klein { grid-template-columns: repeat(auto-fill, minmax(min(45%, 10rem), 1fr)); gap: 1rem; }
.tsg-kachel {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--tsg-text);
  text-decoration: none;
}
.tsg-kachel-bild {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--tsg-grund);
  overflow: hidden;
}
.tsg-klein .tsg-kachel-bild { aspect-ratio: 1 / 1; }
.tsg-kacheln .tsg-kachel-bild img { display: block; width: 100%; height: 100% !important; max-height: 100%; object-fit: cover; }
.tsg-kachel-name {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-weight: 600;
}
.tsg-kachel:hover .tsg-kachel-name > span:first-child { color: var(--tsg-akzent); }
.tsg-kachel-text { font-size: 0.9em; color: var(--tsg-leise); line-height: 1.5; }
.tsg-gruppen .tsg-kachel {
  border: 1px solid var(--tsg-linie);
  padding: 1.25rem 1.25rem 1.1rem;
}
.tsg-zahl {
  font-size: 0.85em;
  font-weight: 400;
  color: var(--tsg-leise);
  font-variant-numeric: tabular-nums;
}

/* Listen nach Schule, Epoche, Material */
.tsg-liste ul { list-style: none; margin: 0.5rem 0 1.5rem; padding: 0; }
.tsg-liste li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--tsg-linie);
}
.tsg-liste li .tsg-zahl { margin-left: auto; }
.tsg-liste li.tsg-unter { padding-left: 1.25rem; }
.tsg-muster {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  background: var(--tsg-m, transparent);
  border: 1px solid rgba(0, 0, 0, 0.15);
  margin-right: 0.35em;
  vertical-align: -0.05em;
  flex: none;
}

/* Brotkrumen, Begriffsseiten */
.tsg-brotkrumen,
.tsg-begriffsseite {
  --tsg-text: var(--global-palette3, #1f1d1b);
  --tsg-leise: var(--global-palette5, #6b655e);
  --tsg-linie: var(--global-palette7, #e4e0da);
  --tsg-grund: var(--global-palette8, #f6f4f1);
  --tsg-akzent: var(--global-palette1, #7a4b2a);
  --tsg-weiss: var(--global-palette9, #ffffff);
}
.tsg-brotkrumen {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  margin: 0 0 1.25rem;
  font-size: 0.85em;
  color: var(--tsg-leise);
}
.tsg-brotkrumen a { color: var(--tsg-leise); text-decoration: none; }
.tsg-brotkrumen a:hover { color: var(--tsg-akzent); text-decoration: underline; }
.tsg-begriffsseite { margin: 2rem 0 3rem; }
.tsg-seitenkopf { max-width: 44rem; margin-bottom: 1.5rem; }
.tsg-achse {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tsg-leise);
}
.tsg-seitentitel { margin: 0 0 1rem; }
.tsg-begriffstext { color: var(--tsg-text); line-height: 1.6; }
.tsg-begriffstext p { margin: 0 0 0.75rem; }
.tsg-unterbegriffe { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0 0 1rem; }
.tsg-unterbegriffe a { color: var(--tsg-text); text-decoration: none; border-bottom: 1px solid var(--tsg-linie); }
.tsg-unterbegriffe a:hover { color: var(--tsg-akzent); border-color: currentColor; }
.tsg-begriffsseite .tsg-trefferzeile { margin-top: 0; }
.tsg-begriffsseite .navigation.pagination { margin-top: 1rem; }

.tsg-mit-rand { width: min(72rem, 100% - 2rem); margin-inline: auto; }

/* Objektseite: Teile des Inhalts im Hausformat */
.tsg-metazeile { color: var(--global-palette5, #6b655e); font-size: 0.95em; letter-spacing: 0.01em; }
.tsg-etikett-titel {
  margin-top: 3rem !important;
  padding-top: 1.25rem;
  border-top: 1px solid var(--global-palette7, #e4e0da);
  font-size: 1.15em !important;
}
.tsg-etikett { font-size: 0.95em; color: var(--global-palette4, #3b3632); }

/* Objektseite */
.tsg-inschrift {
  float: right;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.5rem 2rem;
  padding-left: 1.5rem;
  border-left: 1px solid var(--global-palette7, #e4e0da);
}
.tsg-inschrift-text {
  writing-mode: vertical-rl;
  font-size: 1.6rem;
  letter-spacing: 0.15em;
  line-height: 1.2;
}
.tsg-inschrift-art {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--global-palette5, #6b655e);
}
@media (max-width: 40rem) {
  .tsg-inschrift {
    float: none;
    flex-direction: row;
    align-items: baseline;
    margin: 0 0 1.5rem;
    padding: 0 0 0.75rem;
    border-left: 0;
    border-bottom: 1px solid var(--global-palette7, #e4e0da);
  }
  .tsg-inschrift-text { writing-mode: horizontal-tb; font-size: 1.3rem; }
}

.tsg-kleintitel {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tsg-leise);
  margin: 0 0 1rem;
}
.tsg-register {
  clear: both;
  margin: 3rem 0 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--tsg-linie);
}
.tsg-register dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0;
}
.tsg-register dt { color: var(--tsg-leise); font-size: 0.9em; }
.tsg-register dd { margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.tsg-register dd a { text-decoration: none; }
.tsg-register dd a:hover { text-decoration: underline; }
@media (max-width: 30rem) {
  .tsg-register dl { grid-template-columns: 1fr; gap: 0.1rem; }
  .tsg-register dd { margin-bottom: 0.6rem; }
}

.tsg-gruppenhinweis {
  display: block;
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--tsg-linie);
  color: var(--tsg-text);
  text-decoration: none;
}
.tsg-gruppenhinweis span { display: block; font-size: 0.85em; color: var(--tsg-leise); }
.tsg-gruppenhinweis strong { display: block; margin-top: 0.2rem; }
.tsg-gruppenhinweis:hover strong { color: var(--tsg-akzent); }

.tsg-verwandt { margin-top: 3rem; }
.tsg-nachbarn {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--tsg-linie);
}
.tsg-nachbarn a { display: flex; flex-direction: column; gap: 0.2rem; color: var(--tsg-text); text-decoration: none; }
.tsg-nachbarn a span:first-child { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tsg-leise); }
.tsg-nachbarn a:hover span:last-child { color: var(--tsg-akzent); }
.tsg-nachbarn .tsg-nach { text-align: right; align-items: flex-end; }

/* Alle Stücke: Filter und Suche */
.tsg-filter { margin: 1rem 0 0.5rem; }
.tsg-suche { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1.25rem; max-width: 28rem; }
.tsg-suche label { font-size: 0.85em; color: var(--tsg-leise); }
.tsg-suche input { width: 100%; }
.tsg-chipgruppen { display: flex; flex-direction: column; gap: 0.6rem; }
.tsg-chipgruppe { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.tsg-chipgruppe > span { min-width: 4.5rem; font-size: 0.85em; color: var(--tsg-leise); }
/* Themes gestalten Knöpfe kräftig; für die leisen Filter gelten deshalb diese Werte vorrangig. */
.tsg-alle button.tsg-chip {
  font: inherit;
  font-size: 0.875em !important;
  line-height: 1.2 !important;
  min-height: 0 !important;
  padding: 0.3rem 0.8rem !important;
  border: 1px solid var(--tsg-linie) !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: var(--tsg-text) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  cursor: pointer;
  box-shadow: none !important;
}
.tsg-alle button.tsg-chip:hover { border-color: var(--tsg-leise) !important; }
.tsg-alle button.tsg-chip[aria-pressed='true'] { background: var(--tsg-text) !important; border-color: var(--tsg-text) !important; color: var(--tsg-weiss) !important; }
.tsg-trefferzeile { display: flex; align-items: baseline; gap: 1rem; margin: 1rem 0 0; font-size: 0.9em; color: var(--tsg-leise); }
.tsg-alle button.tsg-leise {
  font: inherit;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  color: var(--tsg-akzent) !important;
  text-decoration: underline;
  text-transform: none !important;
  cursor: pointer;
  box-shadow: none !important;
}
.tsg-alle button.tsg-leise:hover { color: var(--tsg-text) !important; }
.tsg-alle [hidden] { display: none !important; }
.tsg-leer { color: var(--tsg-leise); }

.tsg-karte:focus-visible,
.tsg-kachel:focus-visible,
.tsg-gruppenhinweis:focus-visible,
.tsg-nachbarn a:focus-visible,
.tsg-chip:focus-visible,
.tsg-leise:focus-visible {
  outline: 2px solid var(--global-palette1, #7a4b2a);
  outline-offset: 3px;
}

/* Galerie auf Objektseiten: ein einzelnes Bild in der letzten Reihe wächst nicht auf volle Breite. */
.wp-block-gallery.has-nested-images.tsg-galerie figure.wp-block-image:not(#tsg) { flex-grow: 0; }
/* Einzelbilder im Text stehen mittig, auch wenn sie schmaler sind als die Spalte. */
.single-tsg_objekt .entry-content > figure.wp-block-image { text-align: center; }
.single-tsg_objekt .entry-content > figure.wp-block-image img { margin-inline: auto; }
