/*
 * Hotel Phones: desplegable de teléfonos del header.
 *
 * Todas las clases llevan el prefijo `hphones-` y no dependen del CSS del
 * tema (ni de Tailwind). Colores y medidas van en variables: un tema las
 * sobrescribe en `.hphones { --hphones-…: … }` sin tocar este fichero. La
 * tipografía se hereda del header.
 */

.hphones {
	--hphones-bg: #fff;
	--hphones-text: #1a1a1a;
	--hphones-muted: #6b6b6b;
	--hphones-accent: #1d3a6b;
	--hphones-border: #e3e3e3;
	--hphones-separator: #d9d9d9;
	--hphones-scroll-thumb: #9a9a9a;
	--hphones-scroll-track: transparent;
	--hphones-focus: #1d3a6b;
	--hphones-radius: 12px;
	--hphones-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
	--hphones-width: 245px;
	--hphones-padding: 20px;
	--hphones-gap: 14px;
	--hphones-font-size: 15px;
	--hphones-title-size: 16px;
	--hphones-flag-size: 20px;
	--hphones-list-max-height: 260px;
	--hphones-trigger-color: currentColor;
	/* Móvil: hoja a pantalla completa con una píldora por número. */
	--hphones-sheet-z: 100000;
	--hphones-sheet-padding-top: 72px;
	--hphones-sheet-duration: 0.5s;
	--hphones-pill-border: #d7d7d7;
	--hphones-pill-radius: 30px;
	--hphones-pill-height: 52px;
	--hphones-pill-width: 85%;
	--hphones-pill-gap: 12px;
	--hphones-pill-icon-size: 22px;

	position: relative;
	display: inline-block;
	line-height: 1.4;
}

/* --- Disparador ---------------------------------------------------------- */

.hphones-trigger {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin: 0;
	padding: 4px;
	border: 0;
	background: transparent;
	color: var(--hphones-trigger-color);
	font: inherit;
	line-height: 1;
	cursor: pointer;
}

.hphones-trigger .hphones-svg-phone {
	width: 20px;
	height: 20px;
}

.hphones-trigger .hphones-svg-caret {
	width: 16px;
	height: 16px;
}

.hphones-trigger:focus-visible,
.hphones-close:focus-visible,
.hphones-all-toggle:focus-visible,
.hphones-number:focus-visible {
	outline: 2px solid var(--hphones-focus);
	outline-offset: 2px;
	border-radius: 4px;
}

.hphones-trigger:focus-visible {
	outline-color: currentColor;
}

/* --- Panel --------------------------------------------------------------- */

.hphones-panel {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 1000;
	box-sizing: border-box;
	width: var(--hphones-width);
	max-width: calc(100vw - 16px);
	padding: var(--hphones-padding);
	border: 1px solid var(--hphones-border);
	border-radius: var(--hphones-radius);
	background: var(--hphones-bg);
	box-shadow: var(--hphones-shadow);
	color: var(--hphones-text);
	font-size: var(--hphones-font-size);
	font-weight: 400;
	text-align: left;
	letter-spacing: normal;
	text-transform: none;
	white-space: normal;
}

.hphones--align-left .hphones-panel {
	right: auto;
	left: 0;
}

/* Cerrado mientras el JS no lo abra. */
.hphones:not(.is-open) .hphones-panel {
	display: none;
}

.hphones-panel *,
.hphones-panel *::before,
.hphones-panel *::after {
	box-sizing: border-box;
}

.hphones-title {
	margin: 0 0 var(--hphones-gap);
	color: var(--hphones-text);
	font-size: var(--hphones-title-size);
	font-weight: 600;
	line-height: 1.3;
}

.hphones-section {
	margin: 0 0 var(--hphones-gap);
}

.hphones-section[hidden] {
	display: none;
}

/* Fila: bandera o icono + etiqueta; debajo, el número alineado con el texto. */
.hphones-row {
	display: block;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hphones-row-head {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--hphones-muted);
	line-height: 1.35;
}

.hphones-name {
	min-width: 0;
	overflow-wrap: anywhere;
}

.hphones-flag {
	flex: none;
	display: block;
	width: var(--hphones-flag-size);
	height: var(--hphones-flag-size);
	border-radius: 50%;
	object-fit: cover;
	background: var(--hphones-border);
	/* Banderas con mucho blanco (Japón, Polonia): que se vea el círculo. */
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.hphones-icon {
	flex: none;
	display: inline-flex;
	color: var(--hphones-accent);
}

.hphones-icon .hphones-svg {
	width: var(--hphones-flag-size);
	height: var(--hphones-flag-size);
}

.hphones-number {
	display: inline-block;
	margin-top: 4px;
	margin-left: calc(var(--hphones-flag-size) + 10px);
	color: var(--hphones-text);
	font-weight: 400;
	line-height: 1.35;
	text-decoration: none;
	white-space: nowrap;
}

.hphones-number:hover {
	color: var(--hphones-accent);
	text-decoration: underline;
}

/* Teléfonos del hotel: varios números bajo el nombre, cada uno con su etiqueta. */
.hphones-hotel-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.hphones-hotel-item {
	margin: 6px 0 0;
	padding: 0 0 0 calc(var(--hphones-flag-size) + 10px);
}

.hphones-hotel-item .hphones-label {
	display: block;
	color: var(--hphones-muted);
	font-size: 0.875em;
}

.hphones-hotel-item .hphones-number {
	margin-left: 0;
	margin-top: 2px;
}

/* Piezas que solo se ven en la hoja de móvil (abajo). */
.hphones-close,
.hphones-code,
.hphones-hotel-item > .hphones-icon {
	display: none;
}

/* --- Ver todos ----------------------------------------------------------- */

.hphones-separator {
	height: 0;
	margin: 0 0 var(--hphones-gap);
	border: 0;
	border-top: 1px solid var(--hphones-separator);
}

.hphones-all-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--hphones-muted);
	font: inherit;
	font-size: var(--hphones-font-size);
	line-height: 1.35;
	text-align: left;
	cursor: pointer;
}

.hphones-all-toggle .hphones-svg {
	flex: none;
	width: 18px;
	height: 18px;
	color: var(--hphones-accent);
	transform: rotate(180deg);
	transition: transform 0.2s ease;
}

.hphones-all-toggle[aria-expanded="true"] .hphones-svg {
	transform: none;
}

.hphones-list {
	display: flex;
	flex-direction: column;
	gap: var(--hphones-gap);
	margin: var(--hphones-gap) 0 0;
	padding: 0 6px 0 0;
	max-height: var(--hphones-list-max-height);
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
	scrollbar-width: thin;
	scrollbar-color: var(--hphones-scroll-thumb) var(--hphones-scroll-track);
}

/* Sin JS el acordeón no se puede abrir: la lista se ve siempre. */
.hphones.is-ready .hphones-all-toggle[aria-expanded="false"] + .hphones-list {
	display: none;
}

.hphones-list::-webkit-scrollbar {
	width: 6px;
}

.hphones-list::-webkit-scrollbar-track {
	background: var(--hphones-scroll-track);
}

.hphones-list::-webkit-scrollbar-thumb {
	border-radius: 3px;
	background: var(--hphones-scroll-thumb);
}

.hphones-list > .hphones-row[hidden] {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.hphones-all-toggle .hphones-svg {
		transition: none;
	}
}

/* --- Móvil: hoja a pantalla completa, una píldora por número ------------
 *
 * El punto de corte vive solo aquí: el JS no lo repite, decide si el panel
 * es la hoja mirando si el botón de cerrar se ve (hphones.js, isSheet()).
 * Mismo DOM que en escritorio: cambia la presentación, no el contenido.
 */

@media (max-width: 639px) {
	/* Cerrada sigue en el DOM (fuera de pantalla e invisible) para que se
	   vea deslizarse al abrir. */
	.hphones .hphones-panel,
	.hphones:not(.is-open) .hphones-panel,
	.hphones--align-left .hphones-panel {
		position: fixed;
		inset: 0;
		z-index: var(--hphones-sheet-z);
		display: block;
		width: 100%;
		max-width: none;
		height: 100%;
		margin: 0;
		padding: var(--hphones-sheet-padding-top) 0 24px;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		transform: translateX(-100%);
		visibility: hidden;
		transition: transform var(--hphones-sheet-duration) ease, visibility 0s linear var(--hphones-sheet-duration);
	}

	.hphones.is-open .hphones-panel {
		transform: none;
		visibility: visible;
		transition: transform var(--hphones-sheet-duration) ease;
	}

	html.hphones-lock,
	html.hphones-lock body {
		overflow: hidden;
	}

	.hphones-close {
		position: absolute;
		top: 12px;
		right: 12px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 48px;
		height: 48px;
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: transparent;
		color: var(--hphones-text);
		cursor: pointer;
	}

	.hphones-close .hphones-svg {
		width: 24px;
		height: 24px;
	}

	/* Sin título, sin separador y sin acordeón: todos los países a la vista. */
	.hphones-title,
	.hphones-separator,
	.hphones-all-toggle,
	.hphones-hotel > .hphones-row-head,
	.hphones-panel .hphones-name {
		display: none;
	}

	.hphones-section {
		margin: 0;
	}

	.hphones-list,
	.hphones.is-ready .hphones-all-toggle[aria-expanded="false"] + .hphones-list {
		display: block;
		max-height: none;
		margin: 0;
		padding: 0;
		overflow: visible;
	}

	/* Píldora: [bandera | icono] [código ISO | etiqueta] número. Toda la
	   píldora es el enlace (el ::after del <a> la cubre). */
	.hphones-panel .hphones-row,
	.hphones-hotel-item {
		position: relative;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		width: var(--hphones-pill-width);
		height: var(--hphones-pill-height);
		margin: 0 auto var(--hphones-pill-gap);
		padding: 10px;
		border: 1px solid var(--hphones-pill-border);
		border-radius: var(--hphones-pill-radius);
		background: var(--hphones-bg);
		color: var(--hphones-text);
		font-size: 15px;
		line-height: 1.2;
		text-align: left;
	}

	.hphones-list > .hphones-row[hidden] {
		display: none;
	}

	.hphones-panel .hphones-row-head {
		flex: none;
		gap: 0;
		color: var(--hphones-text);
	}

	.hphones-panel .hphones-flag,
	.hphones-panel .hphones-icon {
		margin-left: 5px;
	}

	.hphones-panel .hphones-flag {
		width: var(--hphones-pill-icon-size);
		height: var(--hphones-pill-icon-size);
		box-shadow: 0 0 1px #000;
	}

	.hphones-panel .hphones-icon .hphones-svg {
		width: var(--hphones-pill-icon-size);
		height: var(--hphones-pill-icon-size);
	}

	.hphones-hotel-item > .hphones-icon {
		display: inline-flex;
	}

	.hphones-code {
		display: inline-block;
		width: 20px;
		margin: 0 22px 0 7px;
		font-size: 15px;
	}

	.hphones-hotel-item .hphones-label {
		flex: 0 1 auto;
		min-width: 20px;
		margin: 0 16px 0 7px;
		overflow: hidden;
		color: var(--hphones-text);
		font-size: 15px;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.hphones-panel .hphones-number,
	.hphones-hotel-item .hphones-number {
		flex: none;
		margin: 0;
		color: var(--hphones-text);
		font-size: 15px;
		text-decoration: none;
	}

	.hphones-panel .hphones-number::after {
		content: "";
		position: absolute;
		inset: 0;
		border-radius: var(--hphones-pill-radius);
	}

	.hphones-panel .hphones-number:hover {
		color: var(--hphones-text);
		text-decoration: none;
	}

	.hphones-panel .hphones-number:focus-visible {
		outline: none;
	}

	.hphones-panel .hphones-number:focus-visible::after {
		outline: 2px solid var(--hphones-focus);
		outline-offset: 2px;
	}
}

@media (max-width: 639px) and (prefers-reduced-motion: reduce) {
	.hphones .hphones-panel,
	.hphones.is-open .hphones-panel {
		transition: none;
	}
}
