/* ==========================================================================
   Industrial Symbiosis Toolkit, estilo de liaise-action.eu.
   Sistema de formas (el mismo de la web): filtros y tarjetas rectos · campos con radio 3px · botones y estados en píldora.
   Marca: rojo #e94354 · amarillo #ecc004 · texto #3c3c3b · Domine (títulos, cifras) · Open Sans (texto).
   Jerarquía por tarjeta: título → explicación (con el enlace a la hoja) → campos → resultado → feedback.
   Escala tipográfica (base 16px): título 24 · resultado 40 · texto corrido 16 · campos 16 · etiquetas y ayudas 14.
   Todo va bajo .istk con especificidad suficiente para ganar al kit de Elementor y al tema.
   ========================================================================== */

.istk {
	--istk-red: #e94354;
	--istk-yellow: #ecc004;
	--istk-text: #3c3c3b;
	--istk-muted: #5f5f5e;           /* 6.3:1 sobre blanco */
	--istk-card: #fff;
	--istk-field: #f2f2f2;           /* relleno de los campos (el gris pasa a los inputs, no a cajas) */
	--istk-field-hover: #ebebeb;
	--istk-line: #e4e4e3;
	--istk-title: var(--istk-red);   /* Para títulos amarillos, como en Digital tools: var(--istk-yellow). */
	--istk-better: #1f7a45;          /* 5.35:1 sobre blanco · 4.62:1 sobre su fondo */
	--istk-better-bg: #e3f2e8;
	--istk-worse: #b4232f;           /* 6.52:1 sobre blanco · 5.48:1 sobre su fondo */
	--istk-worse-bg: #fde6e8;
	--istk-same: #3c3c3b;
	--istk-same-bg: #ececec;
	--istk-serif: "Domine", Georgia, "Times New Roman", serif;
	--istk-sans: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	container: istk / inline-size;   /* La tarjeta se adapta al ancho de la columna de Elementor, no al de la ventana. */
	color: var(--istk-text);
	font-family: var(--istk-sans);
	font-size: 16px;
	line-height: 1.5;
}
.istk *, .istk *::before, .istk *::after { box-sizing: border-box; }
.istk :is(p, h3, ul, dl, dd, fieldset) { margin: 0; padding: 0; }
.istk [hidden] { display: none !important; }
.istk .istk-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Filtro: botones rectangulares amarillos, activo rojo (Networking tools) ---------- */
.istk .istk-filter { margin: 0 0 20px; }
.istk .istk-filter fieldset { border: 0; min-width: 0; }
.istk .istk-filter__legend { padding: 0; margin: 0 0 12px; font: 600 14px/1.3 var(--istk-sans); color: var(--istk-text); }
.istk .istk-chips { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.istk .istk-chip { position: relative; display: inline-flex; }
.istk .istk-chip input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; } /* Oculto pero enfocable: el clic va a la etiqueta. */
.istk .istk-chip label,
.istk a.istk-chip--all {
	display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin: 0; padding: 8px 20px;
	border: 0; border-radius: 0; background: var(--istk-yellow); color: #fff;
	font: 400 16px/1.2 var(--istk-serif); text-decoration: none; text-transform: none; letter-spacing: 0; cursor: pointer;
	transition: background-color .2s ease;
}
.istk .istk-chip:hover label, .istk a.istk-chip--all:hover { background: color-mix(in srgb, var(--istk-yellow) 88%, #000); color: #fff; }
.istk .istk-chip input:checked + label,
.istk a.istk-chip--all.is-active,
.istk .istk-chip input:checked + label:hover,
.istk a.istk-chip--all.is-active:hover { background: var(--istk-red); color: #fff; }
.istk .istk-chip__n { font-family: var(--istk-sans); font-size: 13px; font-weight: 700; opacity: .85; }
.istk .istk-chip input:focus-visible + label,
.istk a.istk-chip--all:focus-visible { outline: 3px solid var(--istk-text); outline-offset: 2px; }
.istk button.istk-apply { margin-top: 16px; }
.istk.is-js button.istk-apply { display: none; } /* Con JS el filtro es inmediato. */

.istk .istk-count { margin: 0 0 16px; font-size: 14px; color: var(--istk-muted); }
.istk .istk-empty, .istk .istk-nojs { padding: 32px; background: var(--istk-card); text-align: center; }
.istk .istk-privacy { margin-top: 20px; font-size: 14px; color: var(--istk-muted); }

/* ---------- Lista: dos KPIs por fila. align-items:start → cada tarjeta mide lo suyo; nunca estira a la de al lado. ---------- */
.istk ul.istk-list { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 24px; margin: 0; padding: 0; list-style: none; }
@container istk (min-width: 820px) {
	.istk ul.istk-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.istk .istk-item { margin: 0; padding: 0; }
.istk .istk-item::before, .istk .istk-item::marker { content: none; }

.istk .istk-kpi { display: flex; flex-direction: column; gap: 24px; padding: 28px 24px; border: 0; border-radius: 0; background: var(--istk-card); }
@container istk (min-width: 480px) {
	.istk .istk-kpi { padding: 36px 40px; }
}

/* Información */
.istk .istk-kpi__info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.istk .istk-kpi__cat { font: 700 14px/1.3 var(--istk-sans); color: var(--istk-text); }
.istk h3.istk-kpi__title {
	margin: 0; padding: 0; font-family: var(--istk-serif); font-size: 24px; font-weight: 700; line-height: 1.3;
	letter-spacing: 0; text-transform: none; color: var(--istk-title);
	display: flex; flex-direction: column; align-items: flex-start; gap: 14px; /* Numeral arriba, título debajo. */
}
.istk .istk-kpi__name { min-width: 0; text-wrap: balance; }
/* Numeral en círculo relleno sobre el título. 20px negrita = texto grande: blanco sobre #e94354 (3.89:1) cumple AA (≥3:1). */
.istk .istk-kpi__num {
	flex: none; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px;
	border: 0; border-radius: 50%; background: var(--istk-red); color: #fff;
	font: 700 20px/1 var(--istk-serif); font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.istk .istk-kpi__desc { font-size: 16px; line-height: 1.6; color: var(--istk-muted); }
.istk a.istk-kpi__sheet {
	display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap;
	color: var(--istk-text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--istk-red);
	text-decoration-thickness: 2px; text-underline-offset: 3px; transition: color .15s ease;
}
.istk a.istk-kpi__sheet:hover { color: var(--istk-red); }
.istk a.istk-kpi__sheet:focus-visible { outline: 2px solid var(--istk-text); outline-offset: 2px; border-radius: 2px; }
.istk a.istk-kpi__sheet svg { flex: none; align-self: center; }

.istk dl.istk-kpi__meta { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 4px 0 0; }
.istk .istk-meta { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; line-height: 1.4; }
.istk .istk-meta dt { margin: 0; font-weight: 400; color: var(--istk-muted); }
.istk .istk-meta dd { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 700; color: var(--istk-text); }
.istk .istk-meta .istk-obj svg { color: var(--istk-red); }

/* Botón "+Info": píldora con borde rojo (texto oscuro 11:1); se rellena al pasar. Sin JS no se muestra (el popup lo necesita). */
.istk button.istk-more {
	align-self: flex-start; display: inline-flex; align-items: center; min-width: 0; min-height: 40px; margin: 4px 0 0; padding: 6px 20px;
	border: 2px solid var(--istk-red); border-radius: 999px; background: transparent; box-shadow: none; color: var(--istk-text);
	font: 400 16px/1.2 var(--istk-serif); letter-spacing: 0; text-transform: none; text-decoration: none; cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
.istk button.istk-more:hover, .istk button.istk-more:focus { background: var(--istk-red); border-color: var(--istk-red); color: #fff; }
.istk button.istk-more:focus-visible { outline: 2px solid var(--istk-text); outline-offset: 2px; }
.istk:not(.is-js) button.istk-more { display: none; }

/* Calculadora: sin caja propia, el gris está en los campos */
.istk .istk-calc { display: flex; flex-direction: column; min-width: 0; }
.istk .istk-calc__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
/* Campo con etiqueta flotante: la etiqueta hace de placeholder y sube al enfocar o al tener valor. */
.istk .istk-field { position: relative; min-width: 0; }
.istk .istk-calc .istk-field input[type="number"] {
	display: block; width: 100%; min-width: 0; max-width: 100%; height: 56px; min-height: 56px; margin: 0; padding: 22px 14px 6px;
	border: 1px solid transparent; border-radius: 3px; background: var(--istk-field); box-shadow: none; color: var(--istk-text);
	font: 400 16px/28px var(--istk-sans); font-variant-numeric: tabular-nums; /* = texto corrido; 16px evita el zoom automático en iOS */
	-moz-appearance: textfield; appearance: textfield; transition: background-color .15s ease, border-color .15s ease;
}
.istk .istk-calc .istk-field.has-suffix input[type="number"] { padding-right: 34px; }
.istk .istk-calc .istk-field input[type="number"]::placeholder { color: transparent; }
.istk .istk-calc .istk-field input[type="number"]::-webkit-outer-spin-button,
.istk .istk-calc .istk-field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.istk .istk-calc .istk-field input[type="number"]:hover { background: var(--istk-field-hover); }
.istk .istk-calc .istk-field input[type="number"]:focus { background: #fff; border-color: var(--istk-text); outline: 0; box-shadow: 0 0 0 3px rgba(236, 192, 4, .55); }
.istk .istk-field label {
	position: absolute; top: 0; left: 15px; right: 15px; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
	color: var(--istk-muted); font: 400 16px/56px var(--istk-sans); pointer-events: none;
	transform-origin: 0 0; transition: transform .15s ease, color .15s ease;
}
.istk .istk-field input:focus + label,
.istk .istk-field input:not(:placeholder-shown) + label { transform: translateY(-8px) scale(.75); color: var(--istk-text); font-weight: 600; }
.istk .istk-input__suffix { position: absolute; top: 22px; right: 14px; font: 600 16px/28px var(--istk-sans); color: var(--istk-muted); pointer-events: none; }
.istk .istk-field input:not(:focus):placeholder-shown ~ .istk-input__suffix { opacity: 0; } /* El % aparece con el valor, no compite con la etiqueta. */

/* Resultado */
.istk .istk-result { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.istk .istk-result__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 24px; }
.istk .istk-result__k { font: 600 14px/1.3 var(--istk-sans); color: var(--istk-muted); }
.istk .istk-result__v { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.istk .istk-result output { font: 700 40px/1.1 var(--istk-serif); color: var(--istk-text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.istk .istk-badge { padding: 5px 12px; border-radius: 999px; font: 600 14px/1.2 var(--istk-sans); white-space: nowrap; }
.istk .istk-result__hint { font-size: 14px; line-height: 1.5; color: var(--istk-muted); }
.istk .istk-result[data-state="better"] output { color: var(--istk-better); }
.istk .istk-result[data-state="worse"] output { color: var(--istk-worse); }
.istk .istk-result[data-state="better"] .istk-badge { background: var(--istk-better-bg); color: var(--istk-better); }
.istk .istk-result[data-state="worse"] .istk-badge { background: var(--istk-worse-bg); color: var(--istk-worse); }
.istk .istk-result[data-state="same"] .istk-badge { background: var(--istk-same-bg); color: var(--istk-same); }
.istk .istk-result[data-state="zero"] .istk-result__hint { color: var(--istk-worse); }

/* Feedback: texto corrido, sin línea ni sangría */
.istk .istk-feedback { margin: 4px 0 0; padding: 0; border: 0; font-size: 16px; line-height: 1.6; color: var(--istk-text); }

/* Botones: se anulan los estilos globales del tema/kit. "Clear" es secundario: texto, no píldora. */
.istk .istk-calc button.istk-reset {
	min-width: 0; min-height: 0; margin: 0; padding: 2px 0; border: 0; border-radius: 0; background: none; box-shadow: none;
	color: var(--istk-muted); font: 600 14px/1.3 var(--istk-sans); letter-spacing: 0; text-transform: none;
	text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.istk .istk-calc button.istk-reset:hover, .istk .istk-calc button.istk-reset:focus { background: none; color: var(--istk-red); }
.istk .istk-filter button.istk-apply {
	align-self: flex-start; min-width: 120px; min-height: 40px; margin: 16px 0 0; padding: 8px 26px; border: 0; border-radius: 999px;
	background: var(--istk-red); box-shadow: none; color: #fff; font: 400 16px/1.2 var(--istk-serif);
	letter-spacing: 0; text-transform: none; text-decoration: none; cursor: pointer;
}
.istk .istk-filter button.istk-apply:hover, .istk .istk-filter button.istk-apply:focus { background: color-mix(in srgb, var(--istk-red) 85%, #000); color: #fff; }
.istk :is(button.istk-reset, button.istk-apply):focus-visible { outline: 2px solid var(--istk-text); outline-offset: 2px; }

/* ---------- Popup "+Info" ---------- */
:root:has(.istk-modal[open]) { overflow: hidden; } /* sin scroll de fondo mientras está abierto */
.istk dialog.istk-modal {
	width: min(720px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 48px); margin: auto; padding: 0;
	border: 0; border-radius: 0; background: var(--istk-card); color: var(--istk-text); box-shadow: 0 24px 64px rgba(60, 60, 59, .25);
	overflow: auto; overscroll-behavior: contain;
}
.istk dialog.istk-modal::backdrop { background: rgba(60, 60, 59, .6); }
.istk dialog.istk-modal[open] { animation: istk-in .2s ease-out; }
@keyframes istk-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.istk .istk-modal__panel { padding: 28px 24px 32px; }
@media (min-width: 640px) { .istk .istk-modal__panel { padding: 40px 48px 44px; } }
.istk .istk-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.istk .istk-modal button.istk-modal__close {
	display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 0; margin: 0; padding: 0;
	border: 0; border-radius: 50%; background: var(--istk-field); box-shadow: none; color: var(--istk-text); cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
.istk .istk-modal button.istk-modal__close:focus { background: var(--istk-field); color: var(--istk-text); } /* recibe el foco al abrir: no debe parecer pulsado */
.istk .istk-modal button.istk-modal__close:hover, .istk .istk-modal button.istk-modal__close:focus-visible { background: var(--istk-red); color: #fff; }
.istk .istk-modal button.istk-modal__close:focus-visible { outline: 2px solid var(--istk-text); outline-offset: 2px; }
.istk h2.istk-modal__title {
	margin: 16px 0 20px; padding: 0; font-family: var(--istk-serif); font-size: 28px; font-weight: 700; line-height: 1.25;
	letter-spacing: 0; text-transform: none; color: var(--istk-title); text-wrap: balance;
}
.istk dl.istk-modal__facts { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: -8px 0 24px; }
.istk .istk-modal__facts div { display: inline-flex; align-items: baseline; gap: 8px; font-size: 14px; line-height: 1.4; }
.istk .istk-modal__facts dt { margin: 0; color: var(--istk-muted); }
.istk .istk-modal__facts dd { margin: 0; font-weight: 700; color: var(--istk-text); }

/* Ficha en desplegables (<details>): una línea entre grupos, sin cajas */
.istk .istk-acc { border-top: 1px solid var(--istk-line); }
.istk .istk-acc__item { border-bottom: 1px solid var(--istk-line); }
.istk .istk-acc__sum {
	display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; padding: 16px 0;
	list-style: none; cursor: pointer; font: 700 18px/1.3 var(--istk-serif); color: var(--istk-text); transition: color .15s ease;
}
.istk .istk-acc__sum::-webkit-details-marker { display: none; }
.istk .istk-acc__sum:hover { color: var(--istk-red); }
.istk .istk-acc__sum:focus-visible { outline: 2px solid var(--istk-text); outline-offset: 2px; }
.istk .istk-acc__icon { flex: none; color: var(--istk-red); }
.istk .istk-acc__v { transform-box: fill-box; transform-origin: center; transition: transform .2s ease; }
.istk .istk-acc__item[open] .istk-acc__v { transform: scaleY(0); } /* + → − */
.istk .istk-acc__body { display: flex; flex-direction: column; gap: 18px; padding: 0 0 24px; }
.istk h4.istk-acc__label { margin: 0 0 6px; padding: 0; font: 600 14px/1.4 var(--istk-sans); letter-spacing: 0; text-transform: none; color: var(--istk-muted); }
.istk .istk-acc__text { font-size: 16px; line-height: 1.65; color: var(--istk-text); }
.istk .istk-acc__text :is(p, ul) { margin: 0 0 .75em; }
.istk .istk-acc__text > :last-child { margin-bottom: 0; }
.istk .istk-acc__text ul { padding-left: 1.2em; }
.istk .istk-acc__text li { margin: 0 0 .35em; }
.istk .istk-acc__text a { color: var(--istk-text); text-decoration: underline; text-decoration-color: var(--istk-red); text-underline-offset: 3px; }
.istk .istk-acc__text sub, .istk .istk-acc__text sup { font-size: .72em; line-height: 0; }
/* Fórmulas: bloque gris (mismo relleno y radio que los campos), sin borde */
.istk .is-formula .istk-acc__text { padding: 14px 16px; border-radius: 3px; background: var(--istk-field); font-weight: 600; }
.istk .istk-modal__foot { margin: 24px 0 0; }

@container istk (max-width: 300px) {
	.istk .istk-calc__fields { grid-template-columns: minmax(0, 1fr); }
	.istk h3.istk-kpi__title { font-size: 22px; }
	.istk .istk-result output { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) {
	.istk * { transition: none !important; }
	.istk dialog.istk-modal[open] { animation: none; }
	.istk .istk-acc__v { transition: none; }
}
