/* Buscador de ayudas para discapacidad y dependencia — v1.1
 * Tipografía: Atkinson Hyperlegible Next (Braille Institute), diseñada para baja visión. Licencia OFL en fonts/OFL.txt
 */
@font-face { font-family: "Atkinson Next BAD"; src: url("fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Next BAD"; src: url("fonts/atkinson-hyperlegible-next-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Next BAD"; src: url("fonts/atkinson-hyperlegible-next-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }

.bad-buscador {
	--tinta: #12323f;
	--verde: var(--bad-acento, #0e6b73);
	--ambar: #ffc629;
	--ambar-2: #f2b400;
	--papel: #ffffff;
	--niebla: #eef4f5;
	--linea: #c5d3d6;
	--borde-campo: #5f747c;
	--apagado: #46595f;
	--radio: 14px;
	--foco: 0 0 0 3px var(--tinta), 0 0 0 7px var(--ambar);

	font-family: "Atkinson Next BAD", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 1.0625rem;
	line-height: 1.55;
	color: var(--tinta);
	max-width: 1040px;
	margin: 0 auto 3rem;
	text-align: left;
	-webkit-font-smoothing: antialiased;
}
.bad-buscador *, .bad-buscador *::before, .bad-buscador *::after { box-sizing: border-box; }
.bad-buscador :where(h2, h3, h4, p, ol, ul, dl, dd, fieldset, legend) { margin: 0; padding: 0; }
.bad-buscador :where(button, input, select) { font: inherit; color: inherit; letter-spacing: normal; }
.bad-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; }
.bad-ico { width: 24px; height: 24px; flex: none; }
.bad-buscador [hidden] { display: none !important; }

/* Foco común: anillo de tinta y ámbar, visible sobre cualquier fondo */
.bad-buscador :where(a, button, select, input, summary, [tabindex]):focus { outline: none; }
.bad-buscador :where(a, button, select, input, summary, h3, h4):focus-visible { box-shadow: var(--foco); outline: none; border-radius: 6px; }
.bad-res-titulo:focus { box-shadow: none; }

/* ------------------------------ Cabecera ------------------------------ */
.bad-cabezal {
	background: var(--tinta);
	color: #fff;
	border-radius: var(--radio) var(--radio) 0 0;
	padding: clamp(24px, 5vw, 44px) clamp(20px, 5vw, 48px) clamp(22px, 4vw, 34px);
}
.bad-buscador .bad-titulo {
	font-size: clamp(1.75rem, 4.2vw, 2.6rem);
	line-height: 1.12;
	font-weight: 800;
	letter-spacing: -0.015em;
	color: #fff;
	max-width: 22ch;
	text-wrap: balance;
}
.bad-entradilla { margin-top: 12px; font-size: clamp(1.05rem, 2vw, 1.2rem); color: #d3e6ea; max-width: 60ch; }
.bad-cargando { padding: 28px clamp(20px, 5vw, 48px); border: 2px solid var(--tinta); border-top: 0; border-radius: 0 0 var(--radio) var(--radio); }

/* ------------------------------ Formulario ------------------------------ */
.bad-form {
	background: var(--papel);
	border: 2px solid var(--tinta);
	border-top: 0;
	border-radius: 0 0 var(--radio) var(--radio);
}
.bad-paso { border: 0; padding: clamp(22px, 4vw, 34px) clamp(20px, 5vw, 48px); min-width: 0; }
.bad-paso + .bad-paso { border-top: 1px solid var(--linea); }
.bad-paso legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; float: left; width: 100%; margin-bottom: 18px; }
.bad-paso legend + * { clear: both; }
.bad-num {
	display: inline-grid; place-items: center;
	width: 40px; height: 40px; border-radius: 50%;
	background: var(--ambar); color: var(--tinta);
	font-weight: 800; font-size: 1.2rem; line-height: 1;
}
.bad-paso-titulo { font-size: clamp(1.3rem, 2.6vw, 1.55rem); font-weight: 800; line-height: 1.2; }
.bad-opcional { font-size: .95rem; color: var(--apagado); font-weight: 400; width: 100%; padding-left: 54px; margin-top: -4px; }

.bad-fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 20px; }
.bad-campo label, .bad-palabra label { display: block; font-weight: 600; margin-bottom: 6px; }
.bad-buscador select, .bad-buscador input[type="search"] {
	display: block; width: 100%; min-height: 54px;
	padding: 12px 44px 12px 14px;
	border: 2px solid var(--borde-campo);
	border-radius: 10px;
	background-color: var(--papel);
	color: var(--tinta);
	font-size: 1.0625rem;
	line-height: 1.3;
	margin: 0;
	box-shadow: none;
}
.bad-buscador select {
	-webkit-appearance: none; appearance: none; cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none' stroke='%2312323f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1.5 1.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 16px center;
}
.bad-buscador input[type="search"] { padding-right: 14px; }
.bad-buscador select:hover, .bad-buscador input[type="search"]:hover { border-color: var(--tinta); }
.bad-buscador select:focus-visible, .bad-buscador input[type="search"]:focus-visible { border-color: var(--tinta); border-radius: 10px; }
.bad-buscador select:disabled { background-color: #e7eeef; border-color: #a9b8bc; color: #5b6d73; cursor: not-allowed; }
.bad-nota { margin-top: 10px; font-size: .95rem; color: var(--apagado); max-width: 70ch; }

/* Baldosas de temas */
.bad-baldosas { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.bad-baldosas + .bad-baldosas { margin-top: 10px; }
.bad-baldosa { position: relative; display: block; cursor: pointer; }
.bad-baldosa input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.bad-baldosa-cuerpo {
	position: relative; height: 100%;
	display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
	min-height: 96px; padding: 14px 14px 14px;
	border: 2px solid var(--linea); border-radius: 12px; background: var(--papel);
	font-weight: 600; line-height: 1.25;
	transition: border-color .12s, background-color .12s, color .12s;
}
.bad-baldosa .bad-ico { width: 28px; height: 28px; color: var(--verde); }
.bad-baldosa-check { position: absolute; top: 10px; right: 10px; width: 22px !important; height: 22px !important; padding: 3px; border-radius: 50%; background: var(--ambar); color: var(--tinta) !important; stroke-width: 3; opacity: 0; }
.bad-baldosa:hover .bad-baldosa-cuerpo { border-color: var(--tinta); }
.bad-baldosa input:checked + .bad-baldosa-cuerpo { background: var(--verde); border-color: var(--verde); color: #fff; }
.bad-baldosa input:checked + .bad-baldosa-cuerpo .bad-ico { color: #fff; }
.bad-baldosa input:checked + .bad-baldosa-cuerpo .bad-baldosa-check { opacity: 1; }
.bad-baldosa input:focus-visible + .bad-baldosa-cuerpo { box-shadow: var(--foco); }

.bad-textual {
	display: inline-flex; align-items: center; gap: 6px;
	min-height: 44px; padding: 8px 2px; border: 0; background: none; cursor: pointer;
	color: var(--verde); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px;
}
.bad-textual:hover { color: var(--tinta); text-decoration-thickness: 3px; }
.bad-ver-temas { margin-top: 6px; }
.bad-palabra { margin-top: 22px; max-width: 640px; }

/* Afinar */
.bad-afinar { border-top: 1px solid var(--linea); }
.bad-afinar summary {
	display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none;
	padding: 20px clamp(20px, 5vw, 48px); font-weight: 800; font-size: 1.12rem;
}
.bad-afinar summary::-webkit-details-marker { display: none; }
.bad-afinar summary::before {
	content: ""; width: 12px; height: 12px; flex: none; margin-right: 4px;
	border-right: 3px solid var(--tinta); border-bottom: 3px solid var(--tinta);
	transform: rotate(-45deg); transition: transform .15s;
}
.bad-afinar[open] summary::before { transform: rotate(45deg) translate(-2px, -2px); }
.bad-afinar summary:hover span:first-child { text-decoration: underline; text-underline-offset: 4px; }
.bad-afinar-n { font-weight: 600; color: var(--verde); }
.bad-afinar-cuerpo { padding: 0 clamp(20px, 5vw, 48px) 26px; display: grid; gap: 22px; }
.bad-grupo { border: 0; min-width: 0; }
.bad-grupo legend { font-weight: 700; margin-bottom: 10px; }
.bad-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bad-chip { position: relative; cursor: pointer; }
.bad-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.bad-chip span {
	display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
	padding: 8px 16px; border: 2px solid var(--linea); border-radius: 999px; background: var(--papel); font-weight: 600; font-size: .98rem;
}
.bad-chip:hover span { border-color: var(--tinta); }
.bad-chip input:checked + span { background: var(--verde); border-color: var(--verde); color: #fff; }
.bad-chip input:checked + span::before { content: ""; width: 12px; height: 7px; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(-45deg) translateY(-2px); }
.bad-chip input:focus-visible + span { box-shadow: var(--foco); }

/* Botón de búsqueda: el elemento protagonista */
.bad-enviar {
	display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px;
	padding: 24px clamp(20px, 5vw, 48px) 30px;
	background: var(--niebla);
	border-top: 1px solid var(--linea);
	border-radius: 0 0 calc(var(--radio) - 2px) calc(var(--radio) - 2px);
}
.bad-boton-buscar {
	display: inline-flex; align-items: center; justify-content: center; gap: 12px;
	min-height: 64px; min-width: min(100%, 320px); padding: 14px 34px;
	border: 0; border-radius: 12px; cursor: pointer;
	background: var(--ambar); color: var(--tinta);
	font-weight: 800; font-size: 1.3rem; letter-spacing: .005em;
	box-shadow: inset 0 -4px 0 rgba(18, 50, 63, .22);
}
.bad-boton-buscar .bad-ico { width: 26px; height: 26px; stroke-width: 2.6; }
.bad-boton-buscar:hover { background: var(--ambar-2); }
.bad-boton-buscar:active { box-shadow: inset 0 2px 0 rgba(18, 50, 63, .25); transform: translateY(1px); }
.bad-boton-buscar:focus-visible { box-shadow: 0 0 0 3px var(--papel), 0 0 0 6px var(--tinta); border-radius: 12px; }
.bad-borrar { color: var(--tinta); }
.bad-pendiente { width: 100%; font-weight: 600; padding: 10px 14px; border-left: 5px solid var(--ambar); background: var(--papel); border-radius: 0 8px 8px 0; }

/* ------------------------------ Resultados ------------------------------ */
.bad-resultados { margin-top: clamp(32px, 6vw, 56px); scroll-margin-top: 24px; }
.bad-res-cabecera { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 28px; padding-bottom: 18px; border-bottom: 4px solid var(--tinta); }
.bad-res-titulo { font-size: clamp(1.6rem, 3.4vw, 2.15rem); font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; color: var(--tinta); scroll-margin-top: 24px; }
.bad-res-resumen { margin-top: 8px; color: var(--apagado); max-width: 68ch; }
.bad-res-acciones { display: flex; flex-direction: column; gap: 6px; min-width: 250px; }
.bad-res-acciones label { font-weight: 600; font-size: .95rem; }

.bad-lista { list-style: none; }
.bad-item {
	position: relative; list-style: none; margin: 0;
	padding: 28px 0 30px 26px;
	border-bottom: 1px solid var(--linea);
}
.bad-item::before { content: ""; position: absolute; left: 0; top: 30px; bottom: 30px; width: 6px; border-radius: 3px; background: var(--nivel); }
.bad-n-estatal    { --nivel: #9b2c3a; }
.bad-n-autonomico { --nivel: #1f5c99; }
.bad-n-provincial { --nivel: #6b4c9a; }
.bad-n-municipal  { --nivel: #0e6b73; }
.bad-item-sup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 8px; }
.bad-nivel { font-weight: 800; color: var(--nivel); font-size: .98rem; }
.bad-estado { font-size: .88rem; font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.bad-estado-abierta { background: #e1f1ea; color: #145238; }
.bad-estado-cerrada { background: #f7e2e2; color: #86202a; }
.bad-buscador .bad-item-titulo { font-size: clamp(1.25rem, 2.4vw, 1.45rem); font-weight: 800; line-height: 1.25; color: var(--tinta); max-width: 52ch; scroll-margin-top: 24px; }
.bad-item-org { margin-top: 4px; color: var(--apagado); font-size: .97rem; }
.bad-item-desc { margin-top: 12px; max-width: 72ch; }
.bad-datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 28px; margin-top: 18px; }
.bad-datos > div { border-top: 2px solid var(--niebla); padding-top: 10px; }
.bad-datos dt { font-weight: 800; font-size: .95rem; }
.bad-datos dd { margin: 2px 0 0; font-size: 1rem; }
.bad-para { margin-top: 14px; font-size: .97rem; color: var(--apagado); }
.bad-para span { font-weight: 800; color: var(--tinta); }
.bad-item-pie { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px; margin-top: 20px; }
.bad-buscador a.bad-boton-fuente {
	display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 22px;
	background: var(--tinta); color: #fff; border-radius: 10px; font-weight: 800; text-decoration: none;
}
.bad-buscador a.bad-boton-fuente:hover { background: var(--verde); color: #fff; }
.bad-buscador a.bad-boton-fuente .bad-ico { width: 20px; height: 20px; stroke-width: 2.4; }
.bad-buscador a.bad-boton-fuente:focus-visible { border-radius: 10px; }
.bad-verif { font-size: .9rem; color: var(--apagado); margin-left: auto; }
.bad-vacio { list-style: none; padding: 26px; margin-top: 22px; background: var(--niebla); border-radius: 12px; max-width: 70ch; }

.bad-res-pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; }
.bad-boton-mas {
	min-height: 56px; padding: 12px 28px; border-radius: 12px; cursor: pointer;
	border: 2px solid var(--tinta); background: var(--papel); color: var(--tinta); font-weight: 800; font-size: 1.08rem;
}
.bad-boton-mas:hover { background: var(--tinta); color: #fff; }
.bad-volver .bad-ico { width: 20px; height: 20px; }
.bad-aviso { margin-top: 26px; padding: 16px 20px; background: var(--niebla); border-radius: 10px; font-size: .95rem; color: var(--apagado); max-width: 78ch; }

/* ------------------------------ Ficha individual ------------------------------ */
.bad-ficha { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 1.5rem 0; padding: 20px; background: #eef4f5; border-left: 6px solid #12323f; border-radius: 0 12px 12px 0; }
.bad-ficha dt { font-weight: 700; }
.bad-ficha dd { margin: 0; }
.bad-verificado { font-size: .9rem; color: #46595f; }
a.bad-boton { display: inline-flex; align-items: center; min-height: 52px; padding: 12px 22px; background: #12323f; color: #fff !important; border-radius: 10px; font-weight: 700; text-decoration: none !important; }
a.bad-boton:hover { background: #0e6b73; }
a.bad-boton:focus-visible { outline: none; box-shadow: 0 0 0 3px #12323f, 0 0 0 7px #ffc629; }

/* ------------------------------ Móvil ------------------------------ */
@media (max-width: 640px) {
	.bad-cabezal { border-radius: 10px 10px 0 0; }
	.bad-form { border-radius: 0 0 10px 10px; }
	.bad-baldosas { grid-template-columns: 1fr 1fr; }
	.bad-baldosa-cuerpo { min-height: 88px; font-size: .98rem; }
	.bad-opcional { padding-left: 0; }
	.bad-boton-buscar { width: 100%; }
	.bad-enviar { justify-content: center; }
	.bad-res-acciones { width: 100%; }
	.bad-item { padding-left: 20px; }
	.bad-buscador a.bad-boton-fuente { width: 100%; justify-content: center; }
	.bad-verif { margin-left: 0; width: 100%; }
	.bad-ficha { grid-template-columns: 1fr; }
	.bad-ficha dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
	.bad-baldosa-cuerpo, .bad-afinar summary::before { transition: none; }
	.bad-boton-buscar:active { transform: none; }
}
@media (forced-colors: active) {
	.bad-baldosa input:checked + .bad-baldosa-cuerpo, .bad-chip input:checked + span { outline: 3px solid Highlight; }
	.bad-item::before { background: CanvasText; }
}

@media (min-width: 760px) {
	.bad-baldosas { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
