/* =====================================================
   WP Itinerarios – Frontend Styles
   ===================================================== */

/* Container */
.wpi-itinerario *,
.wpi-itinerario *::before,
.wpi-itinerario *::after { box-sizing: border-box; }

.wpi-itinerario {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
	color: #333;
	max-width: 1100px;
	margin: 0 auto;
	line-height: 1.6;
}

/* ---- Top bar (download button) ---- */
.wpi-top-bar {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	padding: 10px 0 14px;
	gap: 10px;
}

.wpi-btn-pdf {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	padding: 8px 18px;
	cursor: pointer;
	font-size: 13px;
	color: #444;
	transition: background .2s, border-color .2s;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.wpi-btn-pdf:hover {
	background: #f4f4f4;
	border-color: #aaa;
}

/* ---- Main layout: CSS Grid para sticky confiable ---- */
.wpi-layout {
	display: grid;
	grid-template-columns: 260px 1fr;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	/* SIN overflow:hidden — destruye position:sticky en todos los navegadores */
	align-items: start;
}

/* =====================================================
   SIDEBAR  — sticky puro CSS (el JS arregla ancestors)
   ===================================================== */
.wpi-sidebar {
	width: 260px;
	background: #fff;
	border-right: 1px solid #e8e8e8;
	border-radius: 8px 0 0 8px;

	position: -webkit-sticky;
	position: sticky;
	top: 30px;           /* JS ajusta este valor si hay barra de admin WP */
	align-self: start;   /* imprescindible para sticky en Grid */
	max-height: calc(100vh - 50px);
	overflow-y: auto;
}

.wpi-sidebar-header {
	padding: 14px 16px;
	border-bottom: 1px solid #e8e8e8;
}

.wpi-sidebar-logo {
	max-width: 120px;
	max-height: 40px;
	object-fit: contain;
	display: block;
	margin-bottom: 8px;
}

.wpi-sidebar-itinerario-title {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: #888;
	line-height: 1.4;
}

.wpi-nav { padding: 6px 0; }

.wpi-nav-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 13px 16px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #555;
	text-decoration: none;
	border-bottom: 1px solid #f0f0f0;
	transition: background .15s, color .15s;
}
.wpi-nav-item:hover {
	background: #f5faf8;
	color: #2d7a5f;
	text-decoration: none;
}
.wpi-nav-item.wpi-active {
	background: #edf6f2;
	color: #2d7a5f;
}

.wpi-nav-icon {
	width: 22px;
	height: 22px;
	background: #e8e8e8;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	color: #666;
	flex-shrink: 0;
	transition: background .15s, color .15s;
}
.wpi-nav-item:hover .wpi-nav-icon,
.wpi-nav-item.wpi-active .wpi-nav-icon {
	background: #2d7a5f;
	color: #fff;
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.wpi-content {
	flex: 1;
	min-width: 0;
	background: #fff;
	border-radius: 0 8px 8px 0;
	overflow: hidden; /* solo en el contenido, no en el layout */
}

/* Expert card */
.wpi-expert-card {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 18px 28px;
	border-bottom: 1px solid #e8e8e8;
	flex-wrap: wrap;
}

.wpi-expert-photo {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.wpi-expert-info { flex: 1; min-width: 180px; }

.wpi-expert-name {
	display: block;
	font-size: 16px;
	font-weight: 700;
	color: #1a1a1a;
}

.wpi-expert-subtitle {
	display: block;
	font-size: 12px;
	color: #888;
	margin-top: 2px;
}

.wpi-expert-contact {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-top: 8px;
}
.wpi-expert-contact a {
	font-size: 13px;
	color: #444;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.wpi-expert-contact a:hover { color: #2d7a5f; }

.wpi-logo-img {
	max-height: 48px;
	max-width: 130px;
	object-fit: contain;
	flex-shrink: 0;
	margin-left: auto;
}

/* Header image */
.wpi-header-image {
	position: relative;
	overflow: hidden;
	max-height: 280px;
}
.wpi-header-image img {
	width: 100%;
	height: 280px;
	object-fit: cover;
	display: block;
}
.wpi-header-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(transparent, rgba(0,0,0,.55));
	padding: 50px 28px 22px;
}
.wpi-header-title {
	color: #fff;
	font-size: 26px;
	font-weight: 700;
	margin: 0;
	text-shadow: 0 1px 4px rgba(0,0,0,.3);
	line-height: 1.25;
}

/* No header fallback */
.wpi-titulo-fallback {
	font-size: 24px;
	font-weight: 700;
	padding: 22px 28px 0;
	margin: 0;
	color: #1a1a1a;
}

/* =====================================================
   DESTINO SECTIONS
   ===================================================== */
.wpi-destino-section {
	padding: 36px 28px;
	border-bottom: 1px solid #efefef;
}
.wpi-destino-section:last-child { border-bottom: none; }

.wpi-destino-heading {
	font-size: 15px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: #1a1a1a;
	margin: 0 0 22px;
	padding-bottom: 10px;
	border-bottom: 2px solid #2d7a5f;
}

/* Content typography */
.wpi-destino-contenido {
	font-size: 14px;
	line-height: 1.75;
	color: #444;
}
.wpi-destino-contenido p       { margin: 0 0 14px; }
.wpi-destino-contenido h1,
.wpi-destino-contenido h2,
.wpi-destino-contenido h3,
.wpi-destino-contenido h4      { color: #1a1a1a; margin: 20px 0 10px; }
.wpi-destino-contenido strong  { color: #222; }
.wpi-destino-contenido ul,
.wpi-destino-contenido ol      { padding-left: 22px; margin-bottom: 14px; }
.wpi-destino-contenido ul li,
.wpi-destino-contenido ol li   { margin-bottom: 4px; }
.wpi-destino-contenido a       { color: #2d7a5f; text-decoration: underline; }

/* =====================================================
   GALLERY
   ===================================================== */
.wpi-gallery { margin-top: 24px; }

.wpi-gallery-grid {
	display: flex;
	gap: 6px;
	height: 280px;
	border-radius: 8px;
	overflow: hidden;
}

.wpi-gallery-main {
	flex: 2 1 0;
	overflow: hidden;
	cursor: pointer;
}
.wpi-gallery-main img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .3s;
}
.wpi-gallery-main:hover img { transform: scale(1.03); }

.wpi-gallery-thumbs {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.wpi-gallery-thumb {
	flex: 1 1 0;
	overflow: hidden;
	position: relative;
	cursor: pointer;
}
.wpi-gallery-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .3s;
}
.wpi-gallery-thumb:hover img { transform: scale(1.05); }

.wpi-gallery-more-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,.5);
	color: #fff;
	font-size: 20px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

/* =====================================================
   LIGHTBOX
   ===================================================== */
.wpi-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
}
.wpi-lb-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,.88);
	cursor: pointer;
}
.wpi-lb-inner {
	position: relative;
	z-index: 1;
	text-align: center;
}
.wpi-lb-img {
	max-width: 90vw;
	max-height: 85vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 4px 40px rgba(0,0,0,.6);
}
.wpi-lb-close {
	position: absolute;
	top: -40px;
	right: 0;
	background: none;
	border: none;
	color: #fff;
	font-size: 28px;
	cursor: pointer;
	line-height: 1;
	padding: 4px 8px;
}
.wpi-lb-close:hover { color: #ddd; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
	.wpi-layout {
		grid-template-columns: 1fr;  /* una sola columna en móvil */
	}

	.wpi-sidebar {
		width: 100%;
		position: static;
		max-height: none;
		border-right: none;
		border-bottom: 1px solid #e8e8e8;
		border-radius: 8px 8px 0 0;
	}

	.wpi-nav { display: flex; flex-wrap: wrap; }
	.wpi-nav-item { flex: 1 1 140px; border-right: 1px solid #f0f0f0; }

	.wpi-gallery-grid { height: auto; flex-direction: column; }
	.wpi-gallery-main { height: 220px; }
	.wpi-gallery-thumbs { flex-direction: row; height: 80px; }

	.wpi-destino-section { padding: 24px 16px; }
	.wpi-expert-card     { padding: 14px 16px; }
	.wpi-header-title    { font-size: 20px; }
}

/* =====================================================
   PRINT / PDF
   ===================================================== */
@media print {
	.wpi-top-bar,
	.wpi-sidebar,
	.wpi-lb-overlay,
	.wpi-lightbox { display: none !important; }

	.wpi-layout { border: none; display: block; }
	.wpi-content { width: 100%; }
	.wpi-destino-section { page-break-inside: avoid; }
	.wpi-gallery { page-break-inside: avoid; }

	.wpi-header-image img { height: 200px; }
}
