/*
Theme Name: TVO – TV Obertürkheim
Theme URI: https://www.tvo-online.de
Description: Modernes, responsives Block-Theme für den TV Obertürkheim mit umschaltbarem Farbschema (Hell / Rot) und Bannern je Sportart.
Author: TV Obertürkheim
Version: 1.0.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: tvo
*/

/* ---------- Farbschema ---------- */
:root {
	--tvo-accent: #e13f41;
	--tvo-accent-dark: #c31819;
	--tvo-bg: #ffffff;
	--tvo-surface: #f4f4f5;
	--tvo-ink: #1d1d1f;
	--tvo-muted: #5b5b60;
	--tvo-line: #e4e4e7;
	--tvo-link: #c31819;
	--tvo-header-bg: rgba(255, 255, 255, .92);
	--tvo-banner-bg: #ffffff;
	--tvo-banner-fade: 255, 255, 255;
	--tvo-footer-bg: #1d1d1f;
	--tvo-card-bg: #ffffff;
	--tvo-card-ink: #1d1d1f;
	--tvo-logo-fill: transparent;
	--tvo-logo-line: #e13f41;
	--tvo-photo-opacity: .6;
	--tvo-photo-blend: multiply;
	color-scheme: light;
}
:root[data-theme="rot"] {
	--tvo-bg: #a8171a;
	--tvo-surface: #8f1012;
	--tvo-ink: #ffffff;
	--tvo-muted: #ffd9d9;
	--tvo-line: rgba(255, 255, 255, .28);
	--tvo-link: #ffffff;
	--tvo-header-bg: rgba(143, 16, 18, .95);
	--tvo-banner-bg: #c31819;
	--tvo-banner-fade: 195, 24, 25;
	--tvo-footer-bg: #6f0b0d;
	--tvo-logo-fill: transparent;
	--tvo-logo-line: #ffffff;
	--tvo-photo-opacity: .45;
	--tvo-photo-blend: luminosity;
	color-scheme: dark;
}

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { text-underline-offset: .18em; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--tvo-accent); outline-offset: 2px; }
:root[data-theme="rot"] :focus-visible { outline-color: #fff; }

/* ---------- Kopfzeile ---------- */
header.wp-block-template-part { position: sticky; top: 0; z-index: 50; }
.admin-bar header.wp-block-template-part { top: 32px; }
@media (max-width: 782px) { .admin-bar header.wp-block-template-part { top: 46px; } }
.tvo-header {
	display: flex; align-items: center; gap: clamp(12px, 2vw, 28px);
	padding: 10px clamp(16px, 3vw, 40px);
	background: var(--tvo-header-bg);
	-webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--tvo-line);
	color: var(--tvo-ink);
}
.tvo-logo { display: inline-flex; line-height: 0; flex: none; }
.tvo-logo svg { height: 40px; width: auto; display: block;
	--tvo-fill: var(--tvo-logo-fill); --tvo-line: var(--tvo-logo-line); }
.tvo-menu { margin-left: auto; position: relative; }
.tvo-menu ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(4px, 1vw, 14px); }
.tvo-menu a { display: block; padding: 8px 12px; border-radius: 999px; color: var(--tvo-ink);
	text-decoration: none; font-weight: 650; letter-spacing: .01em; }
.tvo-menu a:hover { background: var(--tvo-surface); }
.tvo-menu a[aria-current] { background: var(--tvo-accent); color: #fff; }
:root[data-theme="rot"] .tvo-menu a:hover { background: rgba(255, 255, 255, .2); }
:root[data-theme="rot"] .tvo-menu a[aria-current] { background: #fff; color: var(--tvo-accent-dark); }
/* Trainingszeiten */
.tvo-training label { display: inline-flex; gap: 10px; align-items: center; margin-bottom: 16px; font-weight: 600; }
.tvo-training select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--tvo-line, #c8c8cc); }
.tvo-table-wrap { overflow-x: auto; }
.tvo-training table { width: 100%; border-collapse: collapse; background: var(--tvo-card-bg); color: var(--tvo-card-ink); border-radius: 12px; overflow: hidden; }
.tvo-training th, .tvo-training td { text-align: left; padding: 10px 14px; border-bottom: 1px solid rgba(128,128,128,.25); white-space: nowrap; }
.tvo-training table th { background: var(--tvo-accent); color: #fff; }
.tvo-training tr[hidden] { display: none; }
/* Spielpläne */
.tvo-spielplan { margin-bottom: 32px; }
.tvo-sp-links { display: flex; flex-wrap: wrap; gap: 10px; }
.tvo-article a.tvo-sp-link { display: inline-block; padding: 10px 20px; border-radius: 999px; background: var(--tvo-accent); color: #fff; text-decoration: none; font-weight: 600; }
.tvo-article a.tvo-sp-link:hover, .tvo-article a.tvo-sp-link:focus-visible { background: var(--tvo-accent-dark); color: #fff; }
.tvo-sp-link::after { content: " \2197"; }
/* Kontaktkarten */
p.tvo-contact { background: var(--tvo-card-bg); color: var(--tvo-card-ink); border-radius: 12px; padding: 16px 20px; margin: 0 0 14px; line-height: 1.6; }
p.tvo-contact a { color: inherit; }
/* Archiv-Kacheln */
.tvo-archive-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: clamp(16px, 2vw, 28px); margin-top: 24px; }
.tvo-archive-cards .tvo-card h2 { font-size: 1.25rem; margin: 0; }
.tvo-archive-cards .tvo-card h2 a { color: var(--tvo-card-ink); text-decoration: none; }
.tvo-archive-cards .tvo-card h2 a:hover { color: var(--tvo-accent-dark); }
.tvo-archive-cards .tvo-card p { margin: 0; color: #3a3a40; }
.tvo-archive-cards .tvo-card-date { font-size: .85rem; color: #6b6b72; margin-top: auto; }
/* Seiten einer Abteilung */
.tvo-pages { margin: 0 0 24px; }
.tvo-pages ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tvo-pages a { display: block; padding: 6px 14px; border: 1px solid var(--tvo-line); border-radius: 999px;
	color: var(--tvo-ink); text-decoration: none; font-size: .9rem; }
.tvo-pages a:hover { background: var(--tvo-surface); }
.tvo-pages a[aria-current] { background: var(--tvo-accent); border-color: var(--tvo-accent); color: #fff; }
.tvo-burger { display: none; align-items: center; justify-content: center; width: 44px; height: 44px;
	border: 1px solid var(--tvo-line); background: transparent; color: var(--tvo-ink);
	border-radius: 12px; cursor: pointer; }
.tvo-burger svg { width: 22px; height: 22px; }

/* Umschalter Hell / Rot */
.tvo-toggle { display: inline-flex; flex: none; padding: 3px; border: 1px solid var(--tvo-line); border-radius: 999px;
	background: var(--tvo-surface); cursor: pointer; font: inherit; color: var(--tvo-ink); }
.tvo-toggle span { padding: 5px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; line-height: 1.2; }
:root:not([data-theme="rot"]) .tvo-toggle span:first-child { background: var(--tvo-accent); color: #fff; }
:root[data-theme="rot"] .tvo-toggle span:last-child { background: #fff; color: var(--tvo-accent-dark); }

@media (max-width: 860px) {
	.tvo-burger { display: inline-flex; }
	.tvo-menu ul { display: none; position: absolute; right: 0; top: calc(100% + 12px); min-width: 230px;
		flex-direction: column; gap: 2px; padding: 10px; background: var(--tvo-bg);
		border: 1px solid var(--tvo-line); border-radius: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, .25); }
	.tvo-menu.is-open ul { display: flex; }
	.tvo-menu a { padding: 12px 14px; border-radius: 10px; }
	.tvo-toggle span { padding: 5px 9px; }
}

/* ---------- Banner ---------- */
.tvo-banner { position: relative; height: clamp(200px, 32vw, 420px); overflow: hidden;
	background: var(--tvo-banner-bg); isolation: isolate; color: var(--tvo-ink); }
.tvo-banner .photo { position: absolute; top: 0; bottom: 0; width: 72%; height: 100%;
	object-fit: cover; object-position: var(--pos);
	opacity: var(--tvo-photo-opacity); mix-blend-mode: var(--tvo-photo-blend); filter: grayscale(1) contrast(1.05); }
.tvo-banner.side-left .photo { right: 0;
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 38%); mask-image: linear-gradient(to right, transparent 0, #000 38%); }
.tvo-banner.side-right .photo { left: 0;
	-webkit-mask-image: linear-gradient(to left, transparent 0, #000 38%); mask-image: linear-gradient(to left, transparent 0, #000 38%); }
.tvo-banner .brand { position: absolute; z-index: 1; top: 50%; transform: translateY(-50%); display: grid; gap: .35rem;
	padding: 0 clamp(16px, 5vw, 72px); }
.tvo-banner.side-left .brand { left: 0; justify-items: start; text-align: left; }
.tvo-banner.side-right .brand { right: 0; justify-items: end; text-align: right; }
.tvo-banner .brand .logo svg { display: block; height: clamp(64px, 13vw, 170px); width: auto;
	--tvo-fill: var(--tvo-logo-fill); --tvo-line: var(--tvo-logo-line);
	filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .2)); }
.tvo-banner .name { font-weight: 800; letter-spacing: .02em; font-size: clamp(1.15rem, 3.2vw, 2.4rem); line-height: 1.05; }
.tvo-banner .name span { color: var(--tvo-accent); }
:root[data-theme="rot"] .tvo-banner .name span { color: #fff; }
.tvo-banner .sport { font-weight: 600; letter-spacing: .25em; text-transform: uppercase;
	font-size: clamp(.7rem, 1.4vw, 1rem); color: var(--tvo-muted); }
:root[data-theme="rot"] .tvo-banner .sport { color: #fff; }

/* Gesamtverein: fünf überlappende Streifen */
.tvo-banner.is-club { height: clamp(240px, 38vw, 500px); }
.tvo-banner.is-club .strip { position: absolute; inset: 0; }
.tvo-banner.is-club .p { position: absolute; top: 0; height: 100%; width: 27%; left: calc(var(--i) * 18.25%);
	object-fit: cover; object-position: var(--x) var(--y);
	opacity: var(--tvo-photo-opacity); mix-blend-mode: var(--tvo-photo-blend); filter: grayscale(1) contrast(1.05);
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 32%, #000 68%, transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 32%, #000 68%, transparent 100%); }
.tvo-banner.is-club .p:first-child { -webkit-mask-image: linear-gradient(to right, #000 0, #000 68%, transparent 100%);
	mask-image: linear-gradient(to right, #000 0, #000 68%, transparent 100%); }
.tvo-banner.is-club .p:last-child { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32%, #000 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 32%, #000 100%); }
.tvo-banner.is-club::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
	background: linear-gradient(to top, rgba(var(--tvo-banner-fade), .96) 0, rgba(var(--tvo-banner-fade), .7) 32%, rgba(var(--tvo-banner-fade), 0) 62%); }
.tvo-banner.is-club .brand { left: 0; right: 0; top: auto; bottom: 0; transform: none; justify-items: center; text-align: center;
	padding-bottom: clamp(10px, 2.2vw, 28px); }
.tvo-banner.is-club .brand .logo svg { height: clamp(56px, 10vw, 130px); }
.tvo-banner.is-club .sport { font-size: clamp(.6rem, 1.1vw, .85rem); }

@media (max-width: 560px) {
	.tvo-banner { height: clamp(220px, 62vw, 300px); }
	.tvo-banner .photo { left: 0 !important; right: 0 !important; width: 100%; height: 75%; bottom: auto;
		-webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%) !important;
		mask-image: linear-gradient(to bottom, #000 55%, transparent 100%) !important; }
	.tvo-banner .brand, .tvo-banner.side-left .brand, .tvo-banner.side-right .brand { left: 0; right: 0; top: auto; bottom: 0;
		transform: none; justify-items: center; text-align: center; padding: 0 16px 14px; }
	.tvo-banner .brand .logo svg { height: 56px; }
	/* Hochkant: Fotos über die volle Bannerhöhe, Schrift im Bild, letzte Zeile schließt mit dem Banner ab */
	.tvo-banner.is-club { height: clamp(260px, 72vw, 300px); border-bottom: 3px solid var(--tvo-accent); }
	:root[data-theme="rot"] .tvo-banner.is-club { border-bottom-color: #fff; }
	.tvo-banner.is-club .p { top: 3%; height: 66%; width: 31%; left: calc(var(--i) * 17.25%); }
	.tvo-banner.is-club::after { background: linear-gradient(to top, rgba(var(--tvo-banner-fade), .97) 0, rgba(var(--tvo-banner-fade), .9) 30%, rgba(var(--tvo-banner-fade), 0) 62%); }
	.tvo-banner.is-club .brand .logo svg { height: 42px; }
	.tvo-banner.is-club .brand { gap: .15rem; padding-bottom: 6px; }
	.tvo-banner.is-club .name { font-size: 1.1rem; }
	.tvo-banner.is-club .sport { font-size: .56rem; letter-spacing: .04em; white-space: nowrap; line-height: 1.1; }
}

/* ---------- Inhalt ---------- */
.tvo-main { padding-block: clamp(24px, 4vw, 56px); }
.tvo-section-title { margin: 0 0 1.2rem; font-size: clamp(1.6rem, 3vw, 2.3rem); }
.tvo-section-title::after { content: ""; display: block; width: 56px; height: 4px; border-radius: 4px;
	background: var(--tvo-accent); margin-top: .5rem; }
:root[data-theme="rot"] .tvo-section-title::after { background: #fff; }

/* News-Karten */
.tvo-cards { gap: clamp(16px, 2vw, 28px); }
.tvo-card { background: var(--tvo-card-bg); color: var(--tvo-card-ink); border-radius: 16px; overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 10px 28px rgba(0, 0, 0, .08);
	display: flex; flex-direction: column; border-top: 4px solid var(--tvo-accent);
	transition: transform .2s ease, box-shadow .2s ease; }
.tvo-card:hover { transform: translateY(-3px); box-shadow: 0 2px 6px rgba(0, 0, 0, .12), 0 16px 36px rgba(0, 0, 0, .14); }
.tvo-card a { color: var(--tvo-accent-dark); }
.tvo-card .wp-block-post-title a { color: var(--tvo-card-ink); text-decoration: none; }
.tvo-card .wp-block-post-title a:hover { color: var(--tvo-accent-dark); }
.tvo-card .wp-block-post-featured-image img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.tvo-card .tvo-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.tvo-card .wp-block-post-terms a { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 800;
	text-decoration: none; color: var(--tvo-accent-dark); }
.tvo-card .wp-block-post-date { font-size: .85rem; color: #6b6b72; margin-top: auto; }
.tvo-card .wp-block-post-excerpt { margin: 0; color: #3a3a40; }
.tvo-card .wp-block-post-excerpt__more-link { font-weight: 700; text-decoration: none; }

/* Beitrag und Seite */
.tvo-article { background: var(--tvo-card-bg); color: var(--tvo-card-ink); border-radius: 20px;
	padding: clamp(20px, 4vw, 48px); box-shadow: 0 10px 40px rgba(0, 0, 0, .12); }
.tvo-article a { color: var(--tvo-accent-dark); }
.tvo-article h1, .tvo-article h2, .tvo-article h3 { color: var(--tvo-card-ink); }
.tvo-article .wp-block-post-title { margin-top: 0; }
.tvo-article .tvo-meta { color: #6b6b72; font-size: .9rem; display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.tvo-article .tvo-meta a { text-decoration: none; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; }
.tvo-article img { border-radius: 10px; }
.tvo-article table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.tvo-article th, .tvo-article td { padding: .55rem .7rem; border-bottom: 1px solid #e4e4e7; text-align: left; }
.tvo-article th { background: #f4f4f5; }
.tvo-article .wp-block-post-navigation-link a { font-weight: 700; text-decoration: none; }

/* Seitenwechsel */
.wp-block-query-pagination { margin-top: 2rem; gap: .5rem; }
.wp-block-query-pagination a, .wp-block-query-pagination .page-numbers { padding: .5rem .9rem; border-radius: 999px;
	border: 1px solid var(--tvo-line); text-decoration: none; color: var(--tvo-ink); font-weight: 650; }
.wp-block-query-pagination .current { background: var(--tvo-accent); border-color: var(--tvo-accent); color: #fff; }
:root[data-theme="rot"] .wp-block-query-pagination .current { background: #fff; color: var(--tvo-accent-dark); }

/* Suche */
.wp-block-search__input { border-radius: 999px; padding: .6rem 1rem; border: 1px solid var(--tvo-line); }
.wp-block-search__button { border-radius: 999px; background: var(--tvo-accent); color: #fff; border: 0; padding: .6rem 1.2rem; font-weight: 700; }

/* ---------- Fußzeile ---------- */
.tvo-footer { background: var(--tvo-footer-bg); color: #fff; padding: clamp(28px, 5vw, 64px) clamp(16px, 4vw, 48px) 28px; }
.tvo-footer a { color: #fff; text-decoration: none; opacity: .88; }
.tvo-footer a:hover { opacity: 1; text-decoration: underline; }
.tvo-footer .tvo-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: clamp(20px, 4vw, 56px);
	max-width: 1200px; margin: 0 auto; }
.tvo-footer h2 { font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; margin: 0 0 .8rem; color: #ffb3b4; }
.tvo-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.tvo-footer .tvo-logo svg { height: 56px; --tvo-fill: #1d1d1f; --tvo-line: #fff; }
.tvo-footer .tvo-copy { max-width: 1200px; margin: 28px auto 0; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .18);
	font-size: .85rem; opacity: .75; }
@media (max-width: 720px) { .tvo-footer .tvo-footer-grid { grid-template-columns: 1fr; } }

/* Bildergalerie: Großansicht */
.tvo-lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
	background: rgba(0, 0, 0, .92); }
.tvo-lightbox[hidden] { display: none; }
html.tvo-lb-open { overflow: hidden; }
.tvo-lightbox figure { margin: 0; max-width: 100vw; max-height: 100vh; padding: 56px 72px; box-sizing: border-box;
	display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tvo-lightbox img { max-width: 100%; max-height: calc(100vh - 130px); object-fit: contain; border-radius: 4px; }
.tvo-lightbox figcaption { color: #fff; opacity: .75; font-size: .9rem; }
.tvo-lightbox button { position: absolute; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px;
	border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; }
.tvo-lightbox button:hover { background: var(--tvo-accent); }
.tvo-lightbox button:focus-visible { outline: 3px solid #fff; }
.tvo-lightbox svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tvo-lightbox .lb-close { top: 14px; right: 14px; }
.tvo-lightbox .lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.tvo-lightbox .lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.tvo-lightbox.single .lb-prev, .tvo-lightbox.single .lb-next { display: none; }
@media (max-width: 600px) {
	.tvo-lightbox figure { padding: 64px 8px 24px; }
	.tvo-lightbox .lb-prev, .tvo-lightbox .lb-next { top: auto; bottom: 16px; transform: none; }
	.tvo-lightbox .lb-prev { left: 16px; }
	.tvo-lightbox .lb-next { right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.tvo-card, .tvo-card:hover { transition: none; transform: none; }
}
