/**
 * ags.css – AG-Seite im Entwurf-D-Look
 *
 * Der Seiteninhalt besteht aus normalen Gutenberg-Blöcken (Gruppe, Tabelle,
 * Liste), die über CSS-Klassen gestaltet werden – so bleibt die Seite im
 * Editor pflegbar. Geladen wird diese Datei nur auf Seiten, deren Inhalt die
 * Klasse "thr-ags" enthält (siehe functions.php, Block 4c).
 *
 * Bausteine (Klassen im Editor unter "Erweitert → Zusätzliche CSS-Klasse(n)"):
 *   thr-ags                 äußere Gruppe um den ganzen Inhalt
 *   thr-ags-lede            Einleitungsabsatz
 *   thr-ags-woche           Tabelle "Wochenübersicht"
 *   thr-ags-grid            Gruppe, die alle AG-Karten enthält
 *   thr-ag-card is-forest   eine AG-Karte (Farbe: is-forest | is-moss | is-terracotta | is-ochre)
 *   thr-ag-tag              Wochentag oben in der Karte
 *   thr-ag-fakten           Liste mit Wann/Wo/Für wen/Leitung
 *
 * Selektoren beginnen mit '#primary .entry-content .thr-ags', damit sie die
 * Parent-Theme-Regeln ('#primary .page .entry-content table td' u. a.) sicher schlagen.
 *
 * Farben: Tokens aus startseite.css (Entwurf D), alle Text-Töne ≥ 4,5:1 auf Weiß.
 * Die Wegweiser-Farbe ist nur Zierde (Balken/Punkt) – der Wochentag steht immer
 * auch als Text da (WCAG 1.4.1).
 */

#primary .entry-content .thr-ags {
	--ink: #1d2a20;
	--ink-soft: #415662;
	--green-950: #2b3111;
	--green-800: #424b1b;
	--green-700: #596624;
	--green-100: #f0f4e1;
	--bg-alt: #eaeef0;
	--line: rgba(65, 86, 98, .22);
	--radius-m: 18px;
	--radius-s: 10px;
	--shadow: 0 20px 45px -25px rgba(23, 37, 28, .35);
	--accent: var(--green-700);
	--tint: var(--green-100);
	color: var(--ink);
	max-width: 1140px;
	margin: 0 auto 40px;
}

/* ---------- Einleitung ---------- */
#primary .entry-content .thr-ags .thr-ags-lede {
	font-size: 1.15rem;
	line-height: 1.6;
	color: var(--ink-soft);
	max-width: 62ch;
	margin: 0 0 28px;
}

#primary .entry-content .thr-ags h2.wp-block-heading {
	font-size: clamp(1.4rem, 2.4vw, 1.9rem);
	margin: 40px 0 18px;
	display: flex;
	align-items: center;
	gap: 12px;
}
#primary .entry-content .thr-ags h2.wp-block-heading::before {
	content: "";
	width: 12px; height: 12px;
	border-radius: 50%;
	background: var(--green-700);
	flex-shrink: 0;
}

/* ---------- Wochenübersicht (Tabelle) ---------- */
#primary .entry-content .thr-ags .thr-ags-woche {
	margin: 0 0 12px;
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: var(--radius-m);
	background: #fff;
	box-shadow: var(--shadow);
}
#primary .entry-content .thr-ags .thr-ags-woche table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	font-size: .98rem;
	border: 0;
}
#primary .entry-content .thr-ags .thr-ags-woche th,
#primary .entry-content .thr-ags .thr-ags-woche td {
	text-align: left;
	padding: 13px 16px;
	border: 0;
	border-bottom: 1px solid var(--line);
	vertical-align: top;
}
#primary .entry-content .thr-ags .thr-ags-woche thead th {
	background: var(--green-800);
	color: #fff;
	font-weight: 700;
	font-size: .85rem;
	letter-spacing: .05em;
	text-transform: uppercase;
}
#primary .entry-content .thr-ags .thr-ags-woche tbody tr:nth-child(even) td { background: #f7f8f3; }
#primary .entry-content .thr-ags .thr-ags-woche tbody tr:last-child td { border-bottom: 0; }
#primary .entry-content .thr-ags .thr-ags-woche td:first-child { font-weight: 700; color: var(--green-800); white-space: nowrap; }

/* ---------- Karten-Raster ----------
   WICHTIG: Speichert man die Seite im Block-Editor, legt WordPress bei diesem
   (klassischen) Theme um jeden Gruppen-Inhalt einen zusaetzlichen Rahmen
   <div class="wp-block-group__inner-container">. Alle Regeln unten gelten
   deshalb fuer BEIDE Varianten: mit und ohne diesen inneren Rahmen.

   Flexbox statt Grid, damit eine unvollstaendige letzte Reihe mittig steht
   (symmetrisch): Desktop 4 + 3, mittlere Breite 3 + 3 + 1, Tablet 2er-Reihen. */
#primary .entry-content .thr-ags .thr-ags-grid,
#primary .entry-content .thr-ags .thr-ags-grid > .wp-block-group__inner-container {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: stretch;
	gap: 24px;
}
#primary .entry-content .thr-ags .thr-ags-grid > .wp-block-group__inner-container { width: 100%; margin: 0; }

#primary .entry-content .thr-ags .thr-ag-card {
	flex: 0 0 100%;
	position: relative;
	background: #fff;
	border: 1px solid var(--line);
	border-top: 6px solid var(--accent);
	border-radius: var(--radius-m);
	box-shadow: var(--shadow);
	padding: 22px 24px 20px;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
#primary .entry-content .thr-ags .thr-ag-card > .wp-block-group__inner-container {
	flex: 1 1 auto;
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
#primary .entry-content .thr-ags .thr-ag-card > .wp-block-group__inner-container > * { margin: 0; }
#primary .entry-content .thr-ags .thr-ag-card > .wp-block-group__inner-container > .thr-ag-fakten { margin-top: auto; }

@media (min-width: 700px) {
	#primary .entry-content .thr-ags .thr-ag-card { flex-basis: calc((100% - 24px) / 2); }
}
@media (min-width: 1000px) {
	#primary .entry-content .thr-ags .thr-ag-card { flex-basis: calc((100% - 2 * 24px) / 3); }
}
@media (min-width: 1240px) {
	#primary .entry-content .thr-ags .thr-ag-card { flex-basis: calc((100% - 3 * 24px) / 4); padding: 20px 20px 18px; }
}
#primary .entry-content .thr-ags .thr-ag-card.is-forest     { --accent: #596624; --tint: #f0f4e1; }
#primary .entry-content .thr-ags .thr-ag-card.is-moss       { --accent: #5c6b45; --tint: #eef1e8; }
#primary .entry-content .thr-ags .thr-ag-card.is-terracotta { --accent: #a4522f; --tint: #f3e2d3; }
#primary .entry-content .thr-ags .thr-ag-card.is-ochre      { --accent: #8a6a2e; --tint: #f4ecdb; }

#primary .entry-content .thr-ags .thr-ag-card > * { margin: 0; }

#primary .entry-content .thr-ags .thr-ag-card p.thr-ag-tag {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--tint);
	color: var(--ink);
	border-radius: 999px;
	padding: 4px 12px 4px 10px;
	font-size: .78rem;
	font-weight: 800;
	letter-spacing: .07em;
	text-transform: uppercase;
}
#primary .entry-content .thr-ags .thr-ag-card p.thr-ag-tag::before {
	content: "";
	width: 9px; height: 9px;
	border-radius: 50%;
	background: var(--accent);
	flex-shrink: 0;
}

#primary .entry-content .thr-ags .thr-ag-card h3.wp-block-heading {
	font-size: 1.3rem;
	line-height: 1.25;
	margin: 2px 0 0;
}
#primary .entry-content .thr-ags .thr-ag-card p {
	color: var(--ink-soft);
	font-size: .98rem;
	line-height: 1.55;
}

#primary .entry-content .thr-ags .thr-ag-fakten {
	list-style: none;
	padding: 12px 0 0;
	margin: auto 0 0;          /* Fakten unten bündig, auch bei unterschiedlich langen Texten */
	border-top: 1px solid var(--line);
	display: grid;
	gap: 6px;
	font-size: .95rem;
}
#primary .entry-content .thr-ags .thr-ag-fakten li {
	margin: 0;
	padding: 0;
	list-style: none;
	background: none;           /* Parent-Theme setzt ein Aufzaehlungs-Bild als Hintergrund */
	color: var(--ink);
}
#primary .entry-content .thr-ags .thr-ag-fakten li::before { content: none; }
#primary .entry-content .thr-ags .thr-ag-fakten strong { color: var(--green-800); }

#primary .entry-content .thr-ags .thr-ag-card a {
	color: var(--green-700);
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---------- Hinweis unten ---------- */
#primary .entry-content .thr-ags .thr-ags-hinweis {
	margin-top: 30px;
	background: var(--bg-alt);
	border-radius: var(--radius-m);
	padding: 18px 22px;
	color: var(--ink);
}

/* ---------- Kontrastmodus (html.thr-contrast aus der sitewide Toolbar) ---------- */
html.thr-contrast #primary .entry-content .thr-ags .thr-ag-card,
html.thr-contrast #primary .entry-content .thr-ags .thr-ags-woche {
	border: 2px solid #000 !important;
	box-shadow: none !important;
}
html.thr-contrast #primary .entry-content .thr-ags .thr-ags-woche thead th {
	background: #000 !important;
	color: #fff !important;
}
html.thr-contrast #primary .entry-content .thr-ags .thr-ag-card p.thr-ag-tag,
html.thr-contrast #primary .entry-content .thr-ags .thr-ags-woche tbody tr td,
html.thr-contrast #primary .entry-content .thr-ags .thr-ags-hinweis {
	background: #fff !important;
}
html.thr-contrast #primary .entry-content .thr-ags .thr-ag-card p.thr-ag-tag { border: 1px solid #000; }

/* Handy: Tabelle mit festen Spaltenbreiten, damit sie ohne seitliches Scrollen passt.
   Lange Wörter enthalten im Inhalt weiche Trennstellen (&shy;), z. B. "Schüler&shy;bibliothek". */
@media (max-width: 620px) {
	#primary .entry-content .thr-ags .thr-ags-woche table { table-layout: fixed; }
	#primary .entry-content .thr-ags .thr-ags-woche th,
	#primary .entry-content .thr-ags .thr-ags-woche td {
		padding: 9px 7px;
		font-size: .85rem;
		overflow-wrap: break-word;
	}
	#primary .entry-content .thr-ags .thr-ags-woche th:first-child  { width: 23%; }
	#primary .entry-content .thr-ags .thr-ags-woche th:nth-child(2) { width: 31%; }
	#primary .entry-content .thr-ags .thr-ags-woche th:nth-child(3) { width: 21%; }
	#primary .entry-content .thr-ags .thr-ags-woche thead th { font-size: .72rem; letter-spacing: .03em; }
	#primary .entry-content .thr-ags .thr-ag-card { padding: 18px 18px 16px; }
}
