/* TBG-Bausteine: Block-Stile, Sichtbarkeit, Details-Fenster, Suche */

/* ---------- Sichtbarkeit ---------- */
@media (max-width: 767px) { .tbg-hide-mobile { display: none !important; } }
@media (min-width: 768px) { .tbg-hide-desktop { display: none !important; } }
.tbg-ss-block + .tbg-ss-block .tbg-ss-facts { margin-top: -60px; }
.tbg-ss-block-kennzahlen:first-child .tbg-ss-facts { margin-top: 24px; }
.tbg-ss-tzsec { padding: 40px 0; }
.tbg-ss-tzsec .tbg-ss-tz { max-width: 760px; }

/* ---------- Block-Stile für Standard-Blöcke ---------- */
.wp-block-group.is-style-tbg-karte { background: #fff; border: 1px solid #f1dfdb; border-radius: var(--tbg-radius, 18px); padding: clamp(20px, 4vw, 40px); box-shadow: 0 10px 34px rgba(163, 22, 11, .08); margin-block: 24px; }
.wp-block-group.is-style-tbg-rot { background: linear-gradient(135deg, var(--tbg-primary, #e0301a), var(--tbg-dark, #a3160b)); color: #fff; border-radius: 18px; padding: clamp(20px, 4vw, 44px); }
.wp-block-group.is-style-tbg-rot :is(h1, h2, h3, h4, p, a, li) { color: #fff !important; }
.wp-block-heading.is-style-tbg-akzent::after { content: ""; display: block; width: 56px; height: 4px; margin-top: 12px; border-radius: 4px; background: var(--tbg-primary, #e0301a); }
.has-text-align-center.is-style-tbg-akzent::after { margin-inline: auto; }
.wp-block-button.is-style-tbg-button .wp-block-button__link { background: var(--tbg-primary, #e0301a); color: #fff; border-radius: var(--tbg-btn-radius, 999px); font-weight: 700; padding: .8em 1.6em; box-shadow: 0 8px 20px rgba(224, 48, 26, .25); }
.wp-block-button.is-style-tbg-button .wp-block-button__link:hover { background: var(--tbg-dark, #a3160b); }
.wp-block-image.is-style-tbg-ganz { position: relative; overflow: hidden; border-radius: 18px; background: #f6e9e6; }
.wp-block-image.is-style-tbg-ganz img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.wp-block-table.is-style-tbg-tabelle table { border-collapse: collapse; border-radius: 12px; overflow: hidden; width: 100%; }
.wp-block-table.is-style-tbg-tabelle th { background: var(--tbg-primary, #e0301a); color: #fff; }
.wp-block-table.is-style-tbg-tabelle td, .wp-block-table.is-style-tbg-tabelle th { padding: 10px 12px; border: 0; border-bottom: 1px solid #f1dfdb; }
.wp-block-table.is-style-tbg-tabelle tr:nth-child(even) td { background: #fff7f5; }

/* ---------- Hero-Optionen ---------- */
.tbg-ss-hero { display: flex; align-items: center; }
.tbg-ss-hero > .tbg-ss-hero-inner { width: 100%; }
.tbg-ss-hero.is-center .tbg-ss-hero-inner { text-align: center; display: flex; flex-direction: column; align-items: center; }
.tbg-ss-hero.is-center .tbg-ss-hero-title, .tbg-ss-hero.is-center .tbg-ss-hero-text { margin-left: auto; margin-right: auto; }
.tbg-ss-hero.is-center .tbg-ss-actions { justify-content: center; }
.tbg-ss-hero-title mark, .tbg-ss-hero-text mark { background: none; color: inherit; }

/* ---------- Abteilungen: Buttons + Details ---------- */
.tbg-ss-dept-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tbg-ss-dept-actions .tbg-ss-dept-cta { flex: 1 1 auto; }
.tbg-ss-btn-soft { background: #fff; color: var(--tbg-primary) !important; border: 2px solid color-mix(in srgb, var(--tbg-primary) 35%, #fff); cursor: pointer; font-family: inherit; }
.tbg-ss-btn-soft:hover { border-color: var(--tbg-primary); background: color-mix(in srgb, var(--tbg-primary) 6%, #fff); }
@media (min-width: 900px) { .tbg-ss-dept-actions .tbg-ss-dept-cta { flex: 0 0 auto; } }

.tbg-dlg { position: fixed; inset: 0; z-index: 100001; display: flex; align-items: flex-end; justify-content: center; }
.tbg-dlg[hidden] { display: none; }
.tbg-dlg-backdrop { position: absolute; inset: 0; background: rgba(20, 6, 4, .55); opacity: 0; transition: opacity .25s ease; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.tbg-dlg-panel {
	position: relative; width: 100%; max-width: 820px; max-height: 92vh; display: flex; flex-direction: column;
	background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
	transform: translateY(100%); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1d1d1f;
}
.tbg-dlg.is-open .tbg-dlg-backdrop { opacity: 1; }
.tbg-dlg.is-open .tbg-dlg-panel { transform: none; }
@media (min-width: 760px) {
	.tbg-dlg { align-items: center; padding: 24px; }
	.tbg-dlg-panel { border-radius: 22px; transform: translateY(30px) scale(.97); opacity: 0; transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .25s ease; }
	.tbg-dlg.is-open .tbg-dlg-panel { opacity: 1; }
}
.tbg-dlg-grip { width: 44px; height: 5px; border-radius: 5px; background: #ddd; margin: 10px auto 0; flex: none; }
@media (min-width: 760px) { .tbg-dlg-grip { display: none; } }
.tbg-dlg-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 12px; border-bottom: 1px solid #f1dfdb; }
.tbg-dlg-head h2 { flex: 1; margin: 0; font-size: 22px; line-height: 1.2; font-weight: 800; }
.tbg-dlg-x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #f6e9e6; color: #a3160b; font-size: 18px; cursor: pointer; flex: none; }
.tbg-dlg-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 20px 8px; overscroll-behavior: contain; }
.tbg-dlg-body img { max-width: 100%; height: auto; border-radius: 12px; }
.tbg-dlg-body .tbg-ss-tz { margin-top: 0; }
.tbg-dlg-content > *:first-child { margin-top: 0; }
.tbg-dlg-foot { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid #f1dfdb; display: flex; gap: 10px; }
.tbg-dlg-foot .tbg-ss-btn { flex: 1; }
.tbg-dlg-loading { padding: 30px 0; text-align: center; color: #888; }
.tbg-dlg-loading::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid #f1dfdb; border-top-color: #e0301a; animation: tbgspin .8s linear infinite; }
@keyframes tbgspin { to { transform: rotate(360deg); } }
html.tbg-noscroll, html.tbg-search-open { overflow: hidden; }

/* ---------- Suche ---------- */
.tbg-search-trigger {
	display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0 6px;
	border-radius: 50%; border: 0; background: color-mix(in srgb, var(--tbg-primary, #e0301a) 10%, #fff); color: var(--tbg-primary, #e0301a);
	cursor: pointer; transition: transform .15s ease, background .15s ease, color .15s ease; padding: 0;
}
.tbg-search-trigger:hover { background: var(--tbg-primary, #e0301a); color: #fff; transform: scale(1.06); }
.tbg-search-trigger.is-floating { position: fixed; top: 14px; right: 14px; z-index: 9990; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); background: #fff; }
body.admin-bar .tbg-search-trigger.is-floating { top: 60px; }

.tbg-search { position: fixed; inset: 0; z-index: 100002; display: flex; justify-content: center; align-items: flex-start; }
.tbg-search[hidden] { display: none; }
.tbg-search-backdrop { position: absolute; inset: 0; background: rgba(20, 6, 4, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s ease; }
.tbg-search-panel {
	position: relative; width: 100%; max-width: 720px; margin: 0; max-height: 100vh; display: flex; flex-direction: column;
	background: #fff; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1d1d1f;
	transform: translateY(-14px); opacity: 0; transition: transform .22s ease, opacity .2s ease; border-radius: 0 0 20px 20px;
}
@media (min-width: 760px) { .tbg-search-panel { margin-top: 9vh; max-height: 80vh; border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); } }
.tbg-search.is-open .tbg-search-backdrop { opacity: 1; }
.tbg-search.is-open .tbg-search-panel { transform: none; opacity: 1; }
.tbg-search-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 2px solid var(--tbg-primary, #e0301a); }
.tbg-search-ico { color: var(--tbg-primary, #e0301a); display: flex; }
.tbg-search-input { flex: 1; min-width: 0; border: 0 !important; outline: 0 !important; box-shadow: none !important; font-size: 19px !important; padding: 10px 4px !important; background: transparent !important; color: #1d1d1f; }
.tbg-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.tbg-search-close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #f6e9e6; color: #a3160b; font-size: 17px; cursor: pointer; flex: none; }
.tbg-search-status { margin: 0; padding: 10px 18px 4px; font-size: 13px; color: #777; }
.tbg-search.is-loading .tbg-search-status::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px; vertical-align: -1px; border-radius: 50%; border: 2px solid #f1dfdb; border-top-color: #e0301a; animation: tbgspin .8s linear infinite; }
.tbg-search-list { list-style: none; margin: 0 !important; padding: 4px 8px 8px !important; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tbg-search-list li { margin: 0 !important; }
.tbg-search-list a {
	display: flex; gap: 12px; align-items: flex-start; padding: 12px 10px; border-radius: 12px; color: #1d1d1f !important; text-decoration: none !important;
	animation: tbgsr .25s ease both; animation-delay: var(--d, 0ms);
}
@keyframes tbgsr { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tbg-search-list a:hover, .tbg-search-list a.is-active { background: #fff3f1; }
.tbg-search-list img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; }
.tbg-search-dot { width: 52px; height: 52px; border-radius: 10px; flex: none; background: linear-gradient(135deg, var(--tbg-primary, #e0301a), var(--tbg-dark, #a3160b)); opacity: .9; }
.tbg-search-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tbg-search-type { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--tbg-primary, #e0301a); }
.tbg-search-title { font-weight: 750; font-size: 16px; line-height: 1.3; }
.tbg-search-snip { font-size: 14px; color: #5b5b62; line-height: 1.45; }
.tbg-search mark { background: #ffe1db; color: inherit; padding: 0 2px; border-radius: 3px; }
.tbg-search-note { margin: 0; padding: 8px 18px 14px; font-size: 12px; color: #999; border-top: 1px solid #f3e6e3; }

.tbg-ss-searchsec { padding: 24px 0; }
.tbg-ss-searchbox {
	width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 18px; min-height: 56px; border-radius: 999px; cursor: text;
	border: 2px solid #f1dfdb; background: #fff; color: #888; font: inherit; font-size: 17px; text-align: left; box-shadow: 0 8px 24px rgba(163, 22, 11, .08);
	transition: border-color .15s ease, box-shadow .15s ease;
}
.tbg-ss-searchbox:hover { border-color: var(--tbg-primary, #e0301a); }
.tbg-ss-searchbox span:nth-child(2) { flex: 1; }
.tbg-ss-searchbox-icon { color: var(--tbg-primary, #e0301a); display: flex; }
.tbg-ss-searchbox kbd { font-size: 12px; padding: 2px 8px; border-radius: 6px; border: 1px solid #ddd; color: #999; background: #fafafa; }
@media (max-width: 640px) { .tbg-ss-searchbox kbd { display: none; } }

.tbg-ss-empty-note { padding: 18px; border: 2px dashed #e6c9c4; border-radius: 12px; color: #a3160b; text-align: center; }

/* v1.6 – klickbare Abteilungen + Details */
.tbg-ss-dept.is-clickable .tbg-ss-dept-body { cursor: pointer; }
.tbg-ss-dept.is-clickable .tbg-ss-dept-media { cursor: zoom-in; }
.tbg-ss-dept-more {
	position: absolute; z-index: 3; right: 14px; bottom: 14px; width: 46px; height: 46px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700;
	background: #fff; color: var(--tbg-primary); box-shadow: 0 6px 18px rgba(0, 0, 0, .2); transition: transform .25s ease, background .2s ease, color .2s ease;
}
.tbg-ss-dept.is-clickable:hover .tbg-ss-dept-more { transform: rotate(90deg) scale(1.08); background: var(--tbg-primary); color: #fff; }
.tbg-ss-dept-cta.tbg-ss-open { border: 0; cursor: pointer; font-family: inherit; }
.tbg-ss-tz-ext { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #fff3d6; color: #8a5a00; font-size: 12px; font-weight: 700; }
.tbg-dlg-hero { position: relative; margin: -18px -20px 16px; aspect-ratio: 16 / 9; overflow: hidden; background: #f6e9e6; isolation: isolate; }
.tbg-dlg-hero::before { content: ""; position: absolute; inset: -30px; background: var(--img) center / cover no-repeat; filter: blur(24px) saturate(1.3); opacity: .85; z-index: 0; }
.tbg-dlg-hero img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; border-radius: 0 !important; }
.tbg-dlg-hero .tbg-ss-dept-tag { position: absolute; left: 16px; bottom: 14px; z-index: 2; }
.tbg-dlg-body .tbg-ss-dept-lines { margin: 0 0 16px !important; }
.tbg-dlg-foot[hidden] { display: none; }

/* Abstände je Baustein */
.tbg-ss-block.has-pt .tbg-ss > :is(section, nav) { padding-top: var(--tbg-pt) !important; }
.tbg-ss-block.has-pb .tbg-ss > :is(section, nav) { padding-bottom: var(--tbg-pb) !important; }
.tbg-dlg-panel:focus { outline: none; }
.tbg-dlg .tbg-ss-btn { text-decoration: none !important; color: #fff !important; }
