/**
 * ASD Costa Rica — Hero slider styles.
 * Overrides on top of Swiper's default styles to match ASD brand palette.
 */

/* Offset the fixed .site-header (160px brand + 64px nav = 224px) for any
   Elementor page wrapped by front-page.php / page.php. Defined here so this
   file alone carries the layout fix, independent of theme.css. */
.elementor-full-width {
	margin-top: 224px;
	transition: margin-top 0.35s cubic-bezier(.4,0,.2,1);
}

.header-scrolled .elementor-full-width {
	margin-top: 64px;
}

.asd-hero-slider {
	width: 100%;
	overflow: hidden;
	position: relative;
	z-index: 0;
}

/* ── Inner Elementor pages — constrain content width ──────────────────────────
   When an Elementor page is NOT the home, every top-level container that ISN'T
   the page banner gets a max-width so paragraphs don't span the full viewport.
   The banner keeps its full-width gradient because we exclude #asdcr-page-banner. */
body.elementor-page:not(.home) main#main > .elementor-full-width > .elementor > [data-element_type="container"]:not(#asdcr-page-banner) {
	max-width: 1140px;
	margin-left: auto !important;
	margin-right: auto !important;
}

/* ── Elementor V4 YouTube element — fill its container ────────────────────────
   Elementor's base-desktop.css gives .e-youtube-base an aspect-ratio but no
   width. As a flex item in an e-flexbox-base container it then shrinks to the
   iframe's intrinsic default (300px) at every viewport — which is why the video
   rendered 300px wide on both desktop and mobile.

   width:100% makes it fill the container. The max-width caps the height at 70vh
   while keeping 16:9: height = width * 9/16, so height <= 70vh means
   width <= 70vh * 16/9. Capping max-HEIGHT instead would stretch the box off
   16:9 and letterbox the video. On phones the cap exceeds the viewport width,
   so it self-neutralises and the video simply goes edge to edge.

   Specificity 0,2,0 matches Elementor's own base rule and this file loads before
   local-<id>-frontend-*.css, so an explicit width set in the editor still wins. */
.elementor .e-youtube-base {
	width: 100%;
	max-width: calc(70vh * 16 / 9);
	margin-inline: auto;
	/* Match the gap above the video to the gap below it. Below, the "¿Por qué
	   elegir ASD?" container contributes padding-top:90px on top of this
	   container's own 10px padding, so the visible gap there is 100px. Adding
	   90px here makes both sides 100px. Fixed, not a clamp: that 90px padding
	   is itself fixed across breakpoints, so a fluid value would only match at
	   one viewport width. */
	margin-block-start: 90px;
}

/* ── Page title bar (the lime block + dark green plate over a photo) ──────────
   The lime block is the container's left border. Elementor paints the
   container background under the border by default (background-clip:
   border-box), so a semi-transparent lime would blend with the dark green
   plate instead of the photo behind it — it reads as murky olive, not as
   transparency. Clipping the background to the padding box keeps the dark
   plate off the border, so the border alpha composites against the photo.

   background-clip is the one property this needs that Elementor's UI does not
   expose. Everything else — border width, colour, padding, the plate colour —
   stays editable per breakpoint in the editor. Add the class under
   Advanced → CSS Classes (key `css_classes` for containers) on any new bar. */
.asd-title-bar {
	background-clip: padding-box;
}

/* ── QR download bar ──────────────────────────────────────────────────────────
   Same lime-block-plus-dark-plate language as .asd-title-bar, but the lime
   block holds a QR image instead of being a border, so it is a real container.

   The heading has to absorb the leftover width for its text to sit centred in
   the dark plate; left to itself it would shrink to its content and hug the
   lime block. Elementor's per-widget flex controls could do this, but naming
   them correctly from a script is guesswork, so the rule lives here where it
   is explicit and versioned. */
.asd-qr-bar {
	align-items: stretch;
	position: relative;
}

/* Centre the bar on the page, not just inside its own column.
   Two things fight this. Elementor sets `margin` on `.e-con` from a custom
   property and its stylesheet loads after the theme's, so an unqualified
   `.asd-qr-bar` rule ties on specificity and loses — hence `.e-con` in the
   selector here. And the wrapping container is itself narrower than, and
   left-aligned within, the page column, so centring the bar inside it still
   leaves it off-centre; the wrapper only ever holds this bar, so it is safe to
   stretch and centre it too. :has() is matched by every browser this theme
   targets; where it is not, the bar simply stays left-aligned as before. */
.asd-qr-bar.e-con {
	margin-inline: auto;
}

.e-con:has(> .asd-qr-bar) {
	width: 100%;
	max-width: none;
	padding-inline: 0;
	margin-inline: auto;
}

.asd-qr-bar > .elementor-widget-heading {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	/* Elementor sets position:relative on every widget wrapper, which would
	   otherwise become the containing block for the stretched link below and
	   limit the hit area to the dark plate, leaving the QR unclickable. */
	position: static;
}

/* Whole bar clickable from the one real link. Elementor's container-level link
   control exists in this version but emits no anchor, so the link lives on the
   heading and its hit area is stretched over the bar — one <a>, no nesting,
   and the QR image underneath is covered by it too. */
.asd-qr-bar .elementor-widget-heading a::after {
	content: "";
	position: absolute;
	inset: 0;
}

/* Make all slides equal-height (height of the tallest one) so transitions
   don't jump. flex-direction:row on the wrapper does this automatically;
   we just ensure each slide stretches its inner Elementor container full height. */
.asd-hero-slider .swiper-slide {
	height: auto;
	display: flex;
}

.asd-hero-slider .swiper-slide > [data-element_type="container"] {
	width: 100%;
	flex: 1 1 auto;
}

/* Navigation arrows — nav-green disc that darkens on hover.
   The resting colour intentionally tracks the nav bar via --color-nav: the
   brief was "same green as the menu", so if that green is retuned the arrows
   should follow it. The hover value is a literal on purpose — it matches
   --color-footer today but carries no relationship to the footer. */
.asd-hero-slider .swiper-button-prev,
.asd-hero-slider .swiper-button-next {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--color-nav);
	border: 1px solid rgba(255, 255, 255, 0.35);
	transition: background 0.2s ease, transform 0.2s ease;
	top: 50%;
	margin-top: -24px;
}

.asd-hero-slider .swiper-button-prev:hover,
.asd-hero-slider .swiper-button-next:hover {
	background: #0a3026;
	transform: scale(1.05);
}

/* White chevron works on both discs: 7.3:1 on the nav green, 14.4:1 on the
   hovered dark green — both clear of the 3:1 WCAG minimum for icons. */
.asd-hero-slider .swiper-button-prev::after,
.asd-hero-slider .swiper-button-next::after {
	font-size: 18px;
	color: #fff;
	font-weight: 800;
}

.asd-hero-slider .swiper-button-prev {
	left: 24px;
}

.asd-hero-slider .swiper-button-next {
	right: 24px;
}

@media (max-width: 767px) {
	.asd-hero-slider .swiper-button-prev,
	.asd-hero-slider .swiper-button-next {
		width: 36px;
		height: 36px;
		margin-top: -18px;
	}
	.asd-hero-slider .swiper-button-prev { left: 10px; }
	.asd-hero-slider .swiper-button-next { right: 10px; }
	.asd-hero-slider .swiper-button-prev::after,
	.asd-hero-slider .swiper-button-next::after {
		font-size: 14px;
	}
}

/* Pagination dots */
.asd-hero-slider .swiper-pagination {
	bottom: 28px;
}

.asd-hero-slider .swiper-pagination-bullet {
	width: 12px;
	height: 12px;
	background: rgba(255, 255, 255, 0.5);
	opacity: 1;
	transition: background 0.2s ease, transform 0.2s ease;
}

.asd-hero-slider .swiper-pagination-bullet-active {
	background: #e8a020;
	transform: scale(1.2);
}

/* ── Home: ocultar el divider decorativo sobre "Una plantación productiva…" ──
   Widget Divider de Elementor (id 9eb08ff) en la página 60. Se oculta por CSS
   en vez de borrarlo de _elementor_data para no pisar ediciones de David; el
   widget sigue existiendo en el editor y puede eliminarse ahí cuando convenga. */
.elementor-page-60 .elementor-element-9eb08ff {
	display: none;
}
