:root {
	--tcdm-sw-x: 24px;
	--tcdm-sw-y: 24px;
	--tcdm-img: .9;
	--tcdm-pumpkin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2365a30d' d='M11 2.5h2.2l.5 3h-3.2z'/%3E%3Cellipse cx='7.5' cy='14' rx='5.5' ry='7.5' fill='%23ea580c'/%3E%3Cellipse cx='16.5' cy='14' rx='5.5' ry='7.5' fill='%23ea580c'/%3E%3Cellipse cx='12' cy='14' rx='4' ry='8' fill='%23f97316'/%3E%3Cpath fill='%23431407' d='M8 11.5l2 2.5H6zM16 11.5l2 2.5h-4zM7.5 17c1.5 3 7.5 3 9 0-2 1-7 1-9 0z'/%3E%3C/svg%3E");
}

html[data-tcdm="dark"] {
	color-scheme: dark;
	background: var(--tcdm-bg);
}

/* Transición solo durante el cambio manual */
html.tcdm-anim,
html.tcdm-anim *,
html.tcdm-anim *::before,
html.tcdm-anim *::after {
	transition:
		background-color .3s ease,
		color .3s ease,
		border-color .3s ease,
		fill .3s ease !important;
}

/* ====
   BASE
   ==== */
html[data-tcdm="dark"] body,
html[data-tcdm="dark"] #td-outer-wrap,
html[data-tcdm="dark"] .td-theme-wrap,
html[data-tcdm="dark"] .td-main-content-wrap,
html[data-tcdm="dark"] .td-main-page-wrap {
	background-color: var(--tcdm-bg) !important;
	color: var(--tcdm-text);
}

/* ====
   MODO AUTOMÁTICO
   ==== */

html[data-tcdm="dark"] [data-tcdm-b] {
	background-color: var(--tcdm-a-bg) !important;
}

html[data-tcdm="dark"] [data-tcdm-t] {
	color: var(--tcdm-a-t) !important;
}

html[data-tcdm="dark"] [data-tcdm-d] {
	border-color: var(--tcdm-a-d) !important;
}

html[data-tcdm="dark"] [data-tcdm-before-b]::before {
	background-color: var(--tcdm-a-before-bg) !important;
}

html[data-tcdm="dark"] [data-tcdm-after-b]::after {
	background-color: var(--tcdm-a-after-bg) !important;
}

html[data-tcdm="dark"] [data-tcdm-before-d]::before,
html[data-tcdm="dark"] [data-tcdm-after-d]::after {
	border-color: var(--tcdm-border) !important;
}

/* ====
   TITULOS DE BLOQUE
   ==== */
html[data-tcdm="dark"] h3.tdm-title,
html[data-tcdm="dark"] .tdm-title .td-element-style,
html[data-tcdm="dark"] .tdm-title [class*="_rand_style"],
html[data-tcdm="dark"] .tdm-title [data-tcdm-b],
html[data-tcdm="dark"] .td-block-title-wrap,
html[data-tcdm="dark"] .td-block-title-wrap [data-tcdm-b],
html[data-tcdm="dark"] .td-block-title,
html[data-tcdm="dark"] .td-block-title span {
	background-color: transparent !important;
}

/* ====
   TEXTO
   ==== */
html[data-tcdm="dark"] :is(
	h1,
	h2,
	h3,
	h4,
	h5,
	h6,
	p,
	li,
	dt,
	dd,
	label,
	.entry-title,
	.td-module-title a,
	.td-post-content
) {
	color: var(--tcdm-text);
}

html[data-tcdm="dark"] :is(
	.td-post-date,
	.td-post-author-name,
	.td-module-meta-info,
	.td-module-comments a,
	.td-excerpt,
	.td-post-sub-title,
	.comment-meta,
	small,
	time,
	figcaption
) {
	color: var(--tcdm-muted) !important;
}

/* ====
   ENLACES
   ==== */
html[data-tcdm="dark"] :is(
	.td-post-content,
	.entry-content,
	.comment-content,
	.widget
) a:not(.wp-block-button__link):not(.button) {
	color: var(--tcdm-link);
}

html[data-tcdm="dark"] :is(
	.td-post-content,
	.entry-content,
	.comment-content,
	.widget
) a:not(.wp-block-button__link):not(.button):hover {
	color: var(--tcdm-link-hover);
}

/* ====
   CABECERA, MENU Y FOOTER
   ==== */
html[data-tcdm="dark"] :is(
	.td-header-wrap,
	.td-header-menu-wrap-full,
	.td-header-menu-wrap,
	.td-header-main-menu,
	.td-header-top-menu-full
) {
	background-color: var(--tcdm-header-bg) !important;
}

html[data-tcdm="dark"] :is(
	.sf-menu > li > a,
	.td-header-top-menu-full a
) {
	color: var(--tcdm-text) !important;
}

html[data-tcdm="dark"] :is(
	.sf-menu ul.sub-menu,
	.td-drop-down-search,
	.td-mega-menu .td-mega-grid,
	#td-mobile-nav,
	.td-menu-background
) {
	background-color: var(--tcdm-surface) !important;
}

html[data-tcdm="dark"] :is(
	.td-footer-wrapper,
	.td-sub-footer-container
) {
	background-color: var(--tcdm-footer-bg) !important;
	color: var(--tcdm-muted);
}

html[data-tcdm="dark"] :is(
	.td-footer-wrapper,
	.td-sub-footer-container
) :is(
	a,
	p,
	li,
	h4,
	.td-block-title span
) {
	color: var(--tcdm-muted);
}

/* ====
   SUPERFICIES Y BORDES
   ==== */
html[data-tcdm="dark"] :is(
	hr,
	table,
	th,
	td,
	blockquote,
	.comment-list li
) {
	border-color: var(--tcdm-border) !important;
}

/* Citas dentro de bloques de texto del editor: sin fondo */
html[data-tcdm="dark"] .td_block_wrap.vc_column_text blockquote,
html[data-tcdm="dark"] .td_block_wrap.td_block_text_with_title blockquote {
	background-color: transparent;
}

/* ====
   FORMULARIOS
   ==== */
html[data-tcdm="dark"] :is(
	input[type="text"],
	input[type="email"],
	input[type="search"],
	input[type="password"],
	input[type="url"],
	input[type="tel"],
	input[type="number"],
	textarea,
	select
) {
	background-color: var(--tcdm-input-bg) !important;
	color: var(--tcdm-input-text) !important;
	border-color: var(--tcdm-border) !important;
}

html[data-tcdm="dark"] ::placeholder {
	color: var(--tcdm-input-ph);
	opacity: 1;
}

/* ====
   BOTONES
   ==== */
html[data-tcdm="dark"] :is(
	.wp-block-button__link,
	input[type="submit"],
	.wpcf7-submit,
	a.button,
	.button
) {
	background-color: var(--tcdm-btn-bg) !important;
	color: var(--tcdm-btn-text) !important;
	border-color: var(--tcdm-btn-bg) !important;
}

html[data-tcdm="dark"] :is(
	.wp-block-button__link,
	input[type="submit"],
	.wpcf7-submit,
	a.button,
	.button
):hover {
	background-color: var(--tcdm-btn-hover) !important;
}

/* ====
   IMAGENES (usa class="tcdm-ignore" para excluir una)
   ==== */
html[data-tcdm="dark"] :is(img, .entry-thumb):not(.tcdm-ignore) {
	filter: brightness(var(--tcdm-img));
}

/* ====
   INTERRUPTOR
   ==== */
.tcdm-switch {
	z-index: 9999;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	min-width: 44px;
	padding: 0 16px;
	margin: 0;
	border: 1px solid rgba(128, 128, 128, .4);
	border-radius: 999px;
	background: var(--tcdm-sw-bg) !important;
	color: var(--tcdm-sw-text) !important;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
	cursor: pointer;
	font: 600 14px/1.2 system-ui, -apple-system, sans-serif;
	text-transform: none;
	letter-spacing: 0;
	transition:
		transform .2s ease,
		box-shadow .2s ease;
}

.tcdm-switch:not(.tcdm-switch--inline) {
	position: fixed;
}

.tcdm-switch--bottom-right {
	right: var(--tcdm-sw-x);
	bottom: var(--tcdm-sw-y);
}

.tcdm-switch--bottom-left {
	left: var(--tcdm-sw-x);
	bottom: var(--tcdm-sw-y);
}

.tcdm-switch--top-right {
	right: var(--tcdm-sw-x);
	top: var(--tcdm-sw-y);
}

.tcdm-switch--top-left {
	left: var(--tcdm-sw-x);
	top: var(--tcdm-sw-y);
}

.tcdm-switch--circle,
.tcdm-switch--pumpkin {
	border-radius: 50%;
	padding: 0;
	width: 60px;
	height: 60px;
}

.tcdm-switch--circle .tcdm-switch__icon {
	font-size: 28px;
}

.tcdm-switch--pumpkin .tcdm-switch__icon {
	font-size: 0;
}

.tcdm-switch--pumpkin .tcdm-switch__icon::before {
	content: '';
	display: block;
	width: 36px;
	height: 36px;
	background: var(--tcdm-pumpkin) center / contain no-repeat;
}

.tcdm-switch--square {
	border-radius: 10px;
}

.tcdm-switch--circle .tcdm-switch__label,
.tcdm-switch--pumpkin .tcdm-switch__label,
.tcdm-switch--nolabel .tcdm-switch__label {
	display: none;
}

.tcdm-switch--nolabel:not(.tcdm-switch--circle) {
	padding: 0;
	width: 44px;
}

.tcdm-switch:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(0, 0, 0, .3);
}

.tcdm-switch:focus-visible {
	outline: 3px solid #60a5fa;
	outline-offset: 3px;
}

.tcdm-switch__icon {
	font-size: 18px;
	line-height: 1;
}

@media (max-width: 600px) {
	.tcdm-switch:not(.tcdm-switch--inline) .tcdm-switch__label {
		display: none;
	}

	.tcdm-switch:not(.tcdm-switch--inline):not(.tcdm-switch--circle):not(.tcdm-switch--pumpkin) {
		padding: 0;
		width: 44px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tcdm-switch,
	html.tcdm-anim * {
		transition: none !important;
	}
}

/* ====
   ANIMACION AL CAMBIAR MODO
   ==== */
html.tcdm-anim-lock {
	overflow-x: hidden;
}

html.tcdm-anim-lock,
html.tcdm-anim-lock *,
html.tcdm-anim-lock *::before,
html.tcdm-anim-lock *::after {
	transition: none !important;
}

body.tcdm-anim-page {
	animation-duration: .7s;
	animation-timing-function: ease-in-out;
}

body.tcdm-anim-fade {
	animation-name: tcdm-k-fade;
}

body.tcdm-anim-pulse {
	animation-name: tcdm-k-pulse;
}

body.tcdm-anim-flip {
	animation-name: tcdm-k-flip;
}

body.tcdm-anim-roll {
	animation-name: tcdm-k-roll;
}

body.tcdm-anim-slide-left {
	animation-name: tcdm-k-sl;
}

body.tcdm-anim-slide-up {
	animation-name: tcdm-k-su;
}

body.tcdm-anim-slide-right {
	animation-name: tcdm-k-sr;
}

body.tcdm-anim-slide-down {
	animation-name: tcdm-k-sd;
}

@keyframes tcdm-k-fade {
	0% {
		opacity: 1;
	}

	30% {
		opacity: .15;
	}

	100% {
		opacity: 1;
	}
}

@keyframes tcdm-k-pulse {
	0%,
	100% {
		transform: scale(1);
		opacity: 1;
	}

	50% {
		transform: scale(.97);
		opacity: .6;
	}
}

@keyframes tcdm-k-flip {
	from {
		transform: perspective(1200px) rotateY(90deg);
		opacity: 0;
	}

	to {
		transform: perspective(1200px) rotateY(0);
		opacity: 1;
	}
}

@keyframes tcdm-k-roll {
	from {
		transform: translateX(-100%) rotate(-120deg);
		opacity: 0;
	}

	to {
		transform: none;
		opacity: 1;
	}
}

@keyframes tcdm-k-sl {
	from {
		transform: translateX(-100%);
	}

	to {
		transform: none;
	}
}

@keyframes tcdm-k-su {
	from {
		transform: translateY(100%);
	}

	to {
		transform: none;
	}
}

@keyframes tcdm-k-sr {
	from {
		transform: translateX(100%);
	}

	to {
		transform: none;
	}
}

@keyframes tcdm-k-sd {
	from {
		transform: translateY(-100%);
	}

	to {
		transform: none;
	}
}