/**
 * Custom Tariff Cards for Bricks – v1.2.0
 *
 * Alle Werte hier sind nur Standardwerte (Optik der Referenz).
 * Sie werden über CSS-Variablen bzw. Bricks-Controls überschrieben.
 * Spezifität bewusst niedrig (eine Klasse), damit Bricks-Styles immer gewinnen.
 */

/* ==========================================================================
   Grid
   ========================================================================== */
.custom-tariff-grid {
	--ctf-columns-default: 3;
	--ctf-mode-default: grid;
	/* Reihenfolge: "Untereinander" (--ctf-stack: 1) → "Karten pro Reihe" → Fallback */
	--ctf-cols: var(--ctf-stack, var(--ctf-columns, var(--ctf-columns-default)));
	/* Wird vom JavaScript gelesen: grid | slider (pro Breakpoint über Bricks einstellbar) */
	--ctf-mode-resolved: var(--ctf-mode, var(--ctf-mode-default));
	position: relative;
	container: ctf-grid / inline-size;
	width: 100%;
	min-width: 0;
}

.custom-tariff-grid__track {
	display: grid;
	grid-template-columns: repeat(var(--ctf-cols), minmax(0, 1fr));
	column-gap: var(--ctf-col-gap, 24px);
	row-gap: var(--ctf-row-gap, 24px);
	align-items: start;
	min-width: 0;
}

/* Die Fallback-Werte für kleinere Geräte (2 Spalten Tablet, Slider Mobile) werden per PHP
   aus den Bricks-Breakpoints erzeugt (custom_tariff_fallback_columns_css). */

.custom-tariff-grid--equal > .custom-tariff-grid__track {
	align-items: stretch;
}

/* ==========================================================================
   Karte
   ========================================================================== */
.custom-tariff-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	width: 100%;
	box-sizing: border-box;
	overflow: hidden;
	color: var(--ctf-feat-color, #1a1a1a);
	background-color: var(--ctf-card-bg, #fff);
	border: var(--ctf-card-border-width, 1px) solid var(--ctf-card-border-color, #d4d4d4);
	border-radius: var(--ctf-card-radius, 10px);
	transition:
		transform calc(var(--ctf-transition, 250) * 1ms) ease,
		box-shadow calc(var(--ctf-transition, 250) * 1ms) ease,
		border-color calc(var(--ctf-transition, 250) * 1ms) ease;
}

.custom-tariff-card *,
.custom-tariff-card *::before,
.custom-tariff-card *::after {
	box-sizing: border-box;
}

.custom-tariff-grid--equal > .custom-tariff-grid__track > .custom-tariff-card .custom-tariff-card__details {
	flex-grow: 1;
}

/* Subgrid: Header / Preis / Buttons / Details kartenübergreifend auf einer Linie */
@supports (grid-template-rows: subgrid) {
	.custom-tariff-grid--subgrid > .custom-tariff-grid__track {
		row-gap: 0;
	}

	.custom-tariff-grid--subgrid > .custom-tariff-grid__track > .custom-tariff-card {
		display: grid;
		grid-row: span 4;
		grid-template-rows: subgrid;
		row-gap: 0;
		margin-bottom: var(--ctf-row-gap, 24px);
	}
}

/* ==========================================================================
   Slider / Carousel (z. B. Mobile) – aktiviert per JavaScript über die Klasse
   .custom-tariff-grid--slider, wenn "Layout-Modus" = Slider ist.
   Native Scroll-Snap → touchfähig, ohne externe Library.
   ========================================================================== */
.custom-tariff-grid--slider {
	--ctf-cols: 1;
}

.custom-tariff-grid--peek {
	--ctf-peek-default: 12%;
}

.custom-tariff-grid--slider > .custom-tariff-grid__track {
	position: relative;
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: var(--ctf-slide-gap, 16px);
	row-gap: 0;
	overflow-x: auto;
	overflow-y: hidden;
	padding-block: 8px;
	scroll-snap-type: x mandatory;
	scroll-behavior: auto;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	touch-action: pan-x pan-y;
}

.custom-tariff-grid--slider > .custom-tariff-grid__track::-webkit-scrollbar {
	display: none;
}

.custom-tariff-grid--slider > .custom-tariff-grid__track:focus-visible {
	outline: 2px solid var(--ctf-dot-active, #0050ff);
	outline-offset: 2px;
}

.custom-tariff-grid--slider.custom-tariff-grid--no-swipe > .custom-tariff-grid__track {
	overflow-x: hidden;
	touch-action: pan-y;
}

.custom-tariff-grid--slider.custom-tariff-grid--animating > .custom-tariff-grid__track {
	scroll-snap-type: none;
}

.custom-tariff-grid--slider > .custom-tariff-grid__track > .custom-tariff-card,
.custom-tariff-grid--slider.custom-tariff-grid--subgrid > .custom-tariff-grid__track > .custom-tariff-card {
	/* Breite = (Trackbreite − Abstände − angeschnittene Vorschau) / sichtbare Karten */
	flex: 0 0 var(
		--ctf-slide-w,
		calc(
			(100% - (var(--ctf-slides-visible, 1) - 1) * var(--ctf-slide-gap, 16px) - var(--ctf-peek, var(--ctf-peek-default, 0px)))
			/ var(--ctf-slides-visible, 1)
		)
	);
	display: flex;
	grid-row: auto;
	max-width: 100%;
	margin-bottom: 0;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.custom-tariff-grid--slider > .custom-tariff-grid__track > .custom-tariff-card .custom-tariff-card__details {
	flex-grow: 1;
}

/* Pagination-Punkte (werden per JavaScript erzeugt) */
.custom-tariff-dots {
	display: none;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: var(--ctf-dot-gap, 14px);
	margin-top: var(--ctf-dots-offset, 16px);
}

.custom-tariff-grid--slider > .custom-tariff-dots {
	display: flex;
}

.custom-tariff-dots__dot {
	position: relative;
	display: block;
	flex: 0 0 auto;
	width: var(--ctf-dot-size, 14px);
	height: var(--ctf-dot-size, 14px);
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	line-height: 0;
	font-size: 0;
	cursor: pointer;
	background: var(--ctf-dot-color, transparent);
	border: var(--ctf-dot-border-width, 2px) solid var(--ctf-dot-border, #0050ff);
	border-radius: 50%;
	box-shadow: none;
	appearance: none;
	transition:
		background-color calc(var(--ctf-transition, 250) * 1ms) ease,
		border-color calc(var(--ctf-transition, 250) * 1ms) ease;
}

/* Größere Touch-Fläche ohne sichtbare Vergrößerung */
.custom-tariff-dots__dot::before {
	content: "";
	position: absolute;
	inset: -10px;
}

.custom-tariff-dots__dot[aria-current="true"] {
	background: var(--ctf-dot-active, #0050ff);
	border-color: var(--ctf-dot-active-border, var(--ctf-dot-active, #0050ff));
}

.custom-tariff-dots__dot:focus-visible {
	outline: 2px solid var(--ctf-dot-active, #0050ff);
	outline-offset: 3px;
}

/* Hervorhebung */
.custom-tariff-card--highlight {
	border-color: var(--ctf-highlight-border, #ff9a4d);
	border-width: var(--ctf-highlight-border-width, 2px);
}

/* Hover (nur wenn im Grid aktiviert) */
.custom-tariff-grid--hover > .custom-tariff-grid__track > .custom-tariff-card:hover {
	transform: translateY(var(--ctf-hover-y, -4px)) scale(var(--ctf-hover-scale, 1));
	box-shadow: 0 12px 32px rgba(0, 0, 60, 0.14);
	border-color: var(--ctf-hover-border, #b9b9c9);
}

@media (prefers-reduced-motion: reduce) {
	.custom-tariff-card,
	.custom-tariff-card__button,
	.custom-tariff-card__sheet {
		transition: none;
	}

	.custom-tariff-grid--hover > .custom-tariff-grid__track > .custom-tariff-card:hover {
		transform: none;
	}
}

/* Screenreader-Text */
.custom-tariff-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Bereiche */
.custom-tariff-card__section {
	/* Ungefähre Kartenbreite aus Grid-Breite, Spalten und Abstand (100cqi = Grid-Breite) */
	--ctf-card-w: calc((100cqi - (var(--ctf-cols, 1) - 1) * var(--ctf-col-gap, 24px)) / var(--ctf-cols, 1));
	--ctf-pad-x: clamp(12px, calc(var(--ctf-card-w) * 0.085), 32px);
	container: ctf-section / inline-size;
	min-width: 0;
	margin: 0;
	padding: 24px var(--ctf-pad-x);
}

/* Ausgeblendete Bereiche: 0 Höhe, bleiben aber für die Subgrid-Zeilen erhalten */
.custom-tariff-card__section:empty {
	padding: 0;
	border: 0;
}

.custom-tariff-card__actions,
.custom-tariff-card__details {
	border-top: var(--ctf-divider-width, 1px) solid var(--ctf-divider-color, #cfcfcf);
}

.custom-tariff-card__speed,
.custom-tariff-deal__title,
.custom-tariff-deal__text,
.custom-tariff-reco__title,
.custom-tariff-reco__desc {
	margin: 0;
}

/* ==========================================================================
   Header
   ========================================================================== */
.custom-tariff-card__header {
	--ctf-header-image-default: linear-gradient(
		calc(var(--ctf-header-angle, 180) * 1deg),
		var(--ctf-header-g1, #000091) 0%,
		var(--ctf-header-g2, #1447ff) 100%
	);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.2em;
	padding: 44px var(--ctf-pad-x) 48px;
	text-align: center;
	color: var(--ctf-header-color, #fff);
	background-color: var(--ctf-header-bg, #0019f5);
	background-image: var(--ctf-header-image, var(--ctf-header-image-default));
}

.custom-tariff-grid--header-solid {
	--ctf-header-image: none;
}

.custom-tariff-card--header-solid {
	--ctf-header-image: none;
}

.custom-tariff-card--header-gradient {
	--ctf-header-image: linear-gradient(
		calc(var(--ctf-header-angle, 180) * 1deg),
		var(--ctf-header-g1, #000091) 0%,
		var(--ctf-header-g2, #1447ff) 100%
	);
}

.custom-tariff-card__title {
	margin: 0;
	padding: 0;
	font-size: 1.375rem;
	font-size: clamp(1rem, 6cqi, 1.375rem);
	font-weight: 400;
	line-height: 1.2;
	overflow-wrap: anywhere;
	hyphens: auto;
	color: var(--ctf-title-color, var(--ctf-header-color, #fff));
}

.custom-tariff-card__speed {
	font-size: clamp(2rem, 1.5rem + 1.6vw, 2.75rem);
	font-size: clamp(1.25rem, 14cqi, 2.75rem);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.01em;
	color: var(--ctf-speed-color, var(--ctf-header-color, #fff));
	overflow-wrap: anywhere;
}

/* ==========================================================================
   Preisbereich
   ========================================================================== */
.custom-tariff-card__pricing {
	padding: 24px var(--ctf-pad-x) 44px;
	color: var(--ctf-price-text, #000);
	font-size: 0.875rem;
	line-height: 1.35;
	text-align: left;
}

.custom-tariff-pricing__label {
	margin: 0 0 0.1em;
}

.custom-tariff-pricing__after {
	margin: 0.3em 0 0;
	font-weight: 700;
}

.custom-tariff-pricing__note {
	margin: 2em 0 0;
}

.custom-tariff-pricing__term {
	margin: 0.2em 0 0;
}

/* Preisgruppe: [Hauptzahl][Nachkommastellen / ,€]
   Alles in em relativ zur Schriftgröße der Gruppe → funktioniert für 7,99 wie 129,99 */
.custom-tariff-price {
	display: inline-flex;
	align-items: stretch;
	column-gap: 0.12em;
	margin: 0;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	text-decoration: none;
	vertical-align: top;
}

.custom-tariff-price--new {
	font-size: 2.5rem;
	font-size: clamp(1.75rem, 13cqi, 2.5rem);
	color: var(--ctf-price-new-color, #000);
}

.custom-tariff-price__main {
	font-size: 1em;
	line-height: 0.9;
	letter-spacing: -0.02em;
}

.custom-tariff-price__side {
	display: inline-flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: flex-start;
	column-gap: 0.15em;
	padding-top: 0.04em;
	line-height: 1;
}

.custom-tariff-price__decimals,
.custom-tariff-price__currency {
	font-size: 0.38em;
	line-height: 1;
}

/* Nur Währung ohne Nachkommastellen: trotzdem unten an der Grundlinie */
.custom-tariff-price__currency:only-child {
	margin-top: auto;
}

.custom-tariff-price__sep {
	margin-right: 0.1em;
}

/* ==========================================================================
   Rabatt / Aktionspreis
   ========================================================================== */
.custom-tariff-pricing--discount {
	display: flex;
	flex-flow: row wrap;
	align-items: stretch;
	gap: 0.5rem 20px;
	min-width: 0;
}

.custom-tariff-pricing__col {
	min-width: 0;
}

.custom-tariff-pricing__col--old {
	flex: 0 0 auto;
}

.custom-tariff-pricing__col--new {
	/* Basis 0 + Mindestbreite: bleibt neben dem alten Preis, bricht erst bei echtem Platzmangel um */
	flex: 1 1 0%;
	min-width: min(9em, 100%);
}

.custom-tariff-pricing__col--old .custom-tariff-pricing__label {
	display: block;
	margin-inline-end: 0.35em;
	vertical-align: top;
}

.custom-tariff-price--old {
	position: relative;
	font-size: 1.75rem;
	font-size: clamp(1.25rem, 9cqi, 1.75rem);
	color: var(--ctf-price-old-color, #000);
}

/* Diagonale Streichlinie – relativ zur Breite des alten Preises,
   passt sich jedem Preis automatisch an. */
.custom-tariff-price--old::after {
	content: "";
	position: absolute;
	left: calc(var(--ctf-strike-overhang, 0.08em) * -1);
	right: calc(var(--ctf-strike-overhang, 0.08em) * -1);
	top: calc(var(--ctf-strike-top, 52) * 1%);
	height: var(--ctf-strike-width, 2px);
	background-color: var(--ctf-strike-color, #e30613);
	opacity: var(--ctf-strike-opacity, 1);
	border-radius: 1px;
	transform: translateY(-50%) rotate(calc(var(--ctf-strike-angle, -18) * 1deg));
	transform-origin: center;
	pointer-events: none;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.custom-tariff-card__actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 22px;
	padding: 24px var(--ctf-pad-x) 28px;
	text-align: center;
}

.custom-tariff-card__button {
	display: flex;
	align-self: stretch;
	align-items: center;
	justify-content: center;
	min-width: 0;
	max-width: 100%;
	min-height: 3rem;
	padding: 0.7em 1.25em;
	font-size: 1.125rem;
	overflow-wrap: anywhere;
	hyphens: auto;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	color: var(--ctf-btn-color, #000091);
	background-color: var(--ctf-btn-bg, #ffa45b);
	border: var(--ctf-btn-border-width, 1px) solid var(--ctf-btn-border-color, #e57e33);
	border-radius: var(--ctf-btn-radius, 4px);
	transition:
		background-color calc(var(--ctf-transition, 250) * 1ms) ease,
		color calc(var(--ctf-transition, 250) * 1ms) ease,
		border-color calc(var(--ctf-transition, 250) * 1ms) ease;
}

.custom-tariff-card__button:hover,
.custom-tariff-card__button:focus-visible {
	color: var(--ctf-btn-color-hover, var(--ctf-btn-color, #000091));
	background-color: var(--ctf-btn-bg-hover, #ff9340);
	border-color: var(--ctf-btn-border-color-hover, var(--ctf-btn-border-color, #e57e33));
	text-decoration: none;
}

.custom-tariff-card__sheet {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.3em;
	max-width: 100%;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
	text-decoration: none;
	color: var(--ctf-sheet-color, #0050ff);
	transition: color calc(var(--ctf-transition, 250) * 1ms) ease;
}

.custom-tariff-card__sheet:hover,
.custom-tariff-card__sheet:focus-visible {
	color: var(--ctf-sheet-color-hover, var(--ctf-sheet-color, #0050ff));
	text-decoration: underline;
}

.custom-tariff-card__button:focus-visible,
.custom-tariff-card__sheet:focus-visible,
.custom-tariff-deal__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.custom-tariff-card__sheet-icon {
	display: inline-flex;
	font-size: 0.8em;
}

/* ==========================================================================
   Details: Deal, Empfehlung, Features
   ========================================================================== */
.custom-tariff-card__details {
	display: flex;
	flex-direction: column;
	gap: 28px;
	padding: 32px var(--ctf-pad-x) 36px;
}

/* Icon links, Text rechts – ohne zusätzliche Wrapper */
.custom-tariff-deal,
.custom-tariff-reco,
.custom-tariff-feature {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: 0.6em;
	align-items: start;
}

.custom-tariff-deal > :not(.custom-tariff-deal__icon),
.custom-tariff-reco > :not(.custom-tariff-reco__icon),
.custom-tariff-feature > :not(.custom-tariff-feature__icon) {
	grid-column: 2;
}

.custom-tariff-deal__icon,
.custom-tariff-reco__icon,
.custom-tariff-feature__icon {
	grid-column: 1;
	grid-row: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	margin-top: 0.2em;
}

.custom-tariff-deal--no-icon,
.custom-tariff-reco--no-icon,
.custom-tariff-feature--no-icon {
	grid-template-columns: minmax(0, 1fr);
}

.custom-tariff-deal--no-icon > *,
.custom-tariff-reco--no-icon > *,
.custom-tariff-feature--no-icon > * {
	grid-column: 1;
}

.custom-tariff-card svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* Deal */
.custom-tariff-deal {
	color: var(--ctf-deal-color, #1b7cc2);
	font-size: 1.0625rem;
	line-height: 1.4;
}

.custom-tariff-deal__icon {
	font-size: 1.1em;
	color: var(--ctf-deal-icon-color, var(--ctf-deal-color, #1b7cc2));
}

.custom-tariff-deal__title {
	font-weight: 700;
}

.custom-tariff-deal__line {
	display: block;
}

.custom-tariff-deal__link {
	justify-self: start;
	margin-top: 0.35em;
	font-weight: 700;
	font-size: 0.95em;
	text-decoration: none;
	color: var(--ctf-deal-link-color, #0050ff);
}

.custom-tariff-deal__link:hover,
.custom-tariff-deal__link:focus-visible {
	color: var(--ctf-deal-link-color-hover, var(--ctf-deal-link-color, #0050ff));
	text-decoration: underline;
}

/* Empfehlung */
.custom-tariff-reco {
	color: var(--ctf-reco-color, #1b7cc2);
	font-size: 1.0625rem;
	line-height: 1.4;
}

.custom-tariff-reco__icon {
	font-size: 1em;
	color: var(--ctf-reco-icon-color, var(--ctf-reco-color, #1b7cc2));
}

.custom-tariff-reco__title {
	font-weight: 700;
}

/* Features */
.custom-tariff-features {
	display: flex;
	flex-direction: column;
	gap: 26px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.custom-tariff-feature {
	margin: 0;
	padding: 0;
	font-size: 1.0625rem;
	line-height: 1.45;
	color: var(--ctf-feat-color, #1a1a1a);
}

.custom-tariff-feature::before {
	content: none;
}

.custom-tariff-feature__icon {
	font-size: 1em;
	color: var(--ctf-feat-icon-color, var(--ctf-feat-color, #1a1a1a));
}

.custom-tariff-feature__title {
	font-weight: 700;
}

.custom-tariff-feature__title,
.custom-tariff-feature__desc {
	display: block;
	overflow-wrap: anywhere;
}

/* ==========================================================================
   Badge
   ========================================================================== */
.custom-tariff-card__badge {
	position: absolute;
	z-index: 2;
	top: var(--ctf-badge-offset, 12px);
	display: inline-block;
	max-width: calc(100% - 2 * var(--ctf-badge-offset, 12px));
	padding: 0.35em 0.85em;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--ctf-badge-color, #000091);
	background-color: var(--ctf-badge-bg, #ffa45b);
	border-radius: var(--ctf-badge-radius, 999px);
	pointer-events: none;
}

.custom-tariff-card__badge--top-left {
	left: var(--ctf-badge-offset, 12px);
}

.custom-tariff-card__badge--top-right {
	right: var(--ctf-badge-offset, 12px);
}

.custom-tariff-card__badge--top-center {
	left: 50%;
	transform: translateX(-50%);
}

/* ==========================================================================
   Schmale Karten (z. B. 2 Karten nebeneinander auf Mobile)
   Greift über die tatsächliche Kartenbreite (Container Query je Bereich),
   nicht über feste Geräte-Breakpoints. Eigene Builder-Werte haben Vorrang.
   ========================================================================== */
@container ctf-section (max-width: 240px) {
	.custom-tariff-card__speed {
		letter-spacing: 0;
	}

	.custom-tariff-pricing--discount {
		flex-direction: column;
		gap: 0.5rem;
	}

	.custom-tariff-pricing__label,
	.custom-tariff-pricing__after,
	.custom-tariff-pricing__note,
	.custom-tariff-pricing__term {
		font-size: 0.8125rem;
	}

	.custom-tariff-pricing__note {
		margin-top: 1.25em;
	}

	.custom-tariff-card__button {
		font-size: 0.9375rem;
		padding-left: 0.6em;
		padding-right: 0.6em;
	}

	.custom-tariff-card__sheet {
		font-size: 0.9375rem;
	}

	.custom-tariff-card__details {
		gap: 20px;
	}

	.custom-tariff-deal,
	.custom-tariff-reco,
	.custom-tariff-feature {
		font-size: 0.9375rem;
	}

	.custom-tariff-features {
		gap: 18px;
	}
}
