/**
 * Premium Sections CSS
 * Curated subset for Premium Sections template (page-premium.php)
 * Includes: Narrative, Features (left/right), Slider
 *
 * @package MG
 */

/* ========================================
   PREMIUM TEMPLATE RESETS (SCOPED)
   Fix global conflicts for premium template only
   ======================================== */

/* Reset page-content-container padding (prevent double padding) */
body.page-template-page-premium .page-content-container {
	padding: 0 !important;
}

/* Premium title typography ownership (prevent .entry-content h2 conflicts) */
body.page-template-page-premium .entry-content .model-narrative__title,
body.page-template-page-premium .entry-content .model-intro-params__title {
	font-size: 28px;
	font-weight: 400;
	color: rgb(46, 46, 56);
	line-height: 1.2;
	margin-top: 0; /* Override .entry-content h2 (2em) */
	margin-bottom: 20px;
}

@media (min-width: 768px) {
	body.page-template-page-premium .entry-content .model-narrative__title,
	body.page-template-page-premium .entry-content .model-intro-params__title {
		font-size: 48px;
	}
}

/* Vertical spacing: first element in entry-content */
body.page-template-page-premium .entry-content > .wp-block-group:first-child,
body.page-template-page-premium .entry-content > .wp-block-heading:first-child,
body.page-template-page-premium .entry-content > p:first-child {
	margin-top: 60px; /* Mobile: space after hero */
}

@media (min-width: 768px) {
	body.page-template-page-premium .entry-content > .wp-block-group:first-child,
	body.page-template-page-premium .entry-content > .wp-block-heading:first-child,
	body.page-template-page-premium .entry-content > p:first-child {
		margin-top: 80px; /* Desktop: more breathing room */
	}
}

/* Vertical spacing: last premium section */
body.page-template-page-premium .entry-content > .wp-block-group:last-child {
	margin-bottom: 60px; /* Mobile: space before footer */
}

@media (min-width: 768px) {
	body.page-template-page-premium .entry-content > .wp-block-group:last-child {
		margin-bottom: 80px; /* Desktop: more breathing room */
	}
}

/* ========================================
   BASE CONTAINER PATTERN (REUSABLE)
   Max-width 1440px, padding 30/40, spacing 60/80
   ======================================== */

/* Premium sections base container */
.model-narrative-section,
.model-features-section,
.model-media-slider-section {
	max-width: 1440px;
	margin: 0 auto 60px; /* Mobile: 60px vertical spacing */
	padding: 0 30px; /* Mobile: 30px horizontal padding */
}

@media (min-width: 768px) {
	.model-narrative-section,
	.model-features-section,
	.model-media-slider-section {
		margin-bottom: 80px; /* Tablet+: 80px vertical spacing */
		padding: 0 40px; /* Tablet+: 40px horizontal padding */
	}
}

/* Remove bottom margin from last section */
.model-narrative-section:last-child,
.model-features-section:last-child,
.model-media-slider-section:last-child {
	margin-bottom: 0;
}

/* Reduce features section bottom margin (desktop only) */
@media (min-width: 768px) {
	.model-features-section,
	.model-features-section.wp-block-group {
		margin-bottom: 40px; /* Override global 80px */
	}
}

/* ========================================
   GUTENBERG RESET PATTERN (SCOPED)
   Reset margins/padding only in premium sections
   ======================================== */

/* Reset Gutenberg block group wrappers */
.model-narrative-section.wp-block-group,
.model-features-section.wp-block-group,
.model-media-slider-section.wp-block-group {
	margin: 0 auto 60px; /* Override WP margin, preserve vertical spacing */
	padding: 0 30px; /* Override WP padding, preserve horizontal padding */
}

@media (min-width: 768px) {
	.model-narrative-section.wp-block-group,
	.model-features-section.wp-block-group,
	.model-media-slider-section.wp-block-group {
		margin-bottom: 80px;
		padding: 0 40px;
	}
}

/* Reset nested Gutenberg blocks inside premium sections */
.model-narrative-section .wp-block-image,
.model-features-section .wp-block-image,
.model-media-slider-section .wp-block-image,
.model-narrative-section .wp-block-gallery,
.model-features-section .wp-block-gallery,
.model-media-slider-section .wp-block-gallery,
.model-narrative-section .wp-block-video,
.model-features-section .wp-block-video,
.model-media-slider-section .wp-block-video {
	margin: 0; /* Remove default WP vertical margins */
}

/* Reset group margins inside premium sections */
.model-narrative-section .wp-block-group,
.model-features-section .wp-block-group,
.model-media-slider-section .wp-block-group {
	margin: 0; /* Remove default WP group margins */
}

/* ========================================
   ROUNDED MEDIA PATTERN (REUSABLE)
   Border-radius 10px, overflow hidden, object-fit cover
   ======================================== */

/* Media wrapper with rounded corners */
.model-media__frame {
	position: relative;
	border-radius: 10px;
	overflow: hidden;
	background-color: #000; /* Fallback background */
}

/* Simple rounded image (no absolute positioning) */
.model-media__frame img,
.model-media__frame video {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px;
}

/* Aspect ratio variants (optional, controlled by BEM modifiers) */
.model-media__frame--4-3 {
	aspect-ratio: 4 / 3;
}

.model-media__frame--16-9 {
	aspect-ratio: 16 / 9;
}

/* Force cover when aspect ratio is set */
.model-media__frame--4-3 img,
.model-media__frame--4-3 video,
.model-media__frame--16-9 img,
.model-media__frame--16-9 video {
	object-fit: cover;
	height: 100%;
}

/* ========================================
   NARRATIVE SECTION
   Stacked layout: content + full-width media
   ======================================== */

.model-narrative__content {
	width: 100%;
	max-width: none; /* Full-width content (not centered 800px) */
	margin: 0 auto 32px;
	text-align: left;
}

@media (min-width: 768px) {
	.model-narrative__content {
		margin-bottom: 40px;
	}
}

.model-narrative__eyebrow {
	font-size: 14px;
	font-weight: 500;
	color: rgb(115, 115, 140);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin: 0 0 30px; /* ~30px eyebrow→title spacing */
}

.model-narrative__title {
	font-size: 28px;
	font-weight: 400;
	color: rgb(46, 46, 56);
	line-height: 1.2;
	margin: 0 0 20px;
}

@media (min-width: 768px) {
	.model-narrative__title {
		font-size: 48px;
	}
}

.model-narrative__text {
	font-size: 16px;
	font-weight: 350;
	color: #505062;
	line-height: 1.6;
	margin: 0;
}

/* Full-width media below content */
.model-narrative__media {
	width: 100%;
	margin: 0;
}

/* Remove black fallback background (scoped to narrative only) */
.model-narrative__media .model-media__frame {
	background-color: transparent;
}

/* Remove forced 16:9 aspect-ratio in narrative (allow natural img ratio) */
.model-narrative__media .model-media__frame--16-9 {
	aspect-ratio: auto;
}

.model-narrative__media .model-media__frame--16-9 img {
	height: auto;
	width: 100%;
	object-fit: cover;
	display: block;
}

/* ========================================
   FEATURES ACCORDION (LEFT / RIGHT)
   50/50 layout with media + CSS-only accordion
   ======================================== */

/* INNER CONTAINER FIX: Gutenberg wraps children in .wp-block-group__inner-container */
.model-features__layout > .wp-block-group__inner-container {
	display: flex;
	flex-direction: column;
	gap: 32px;
	align-items: flex-start;
}

@media (min-width: 768px) {
	.model-features__layout > .wp-block-group__inner-container {
		flex-direction: row;
		gap: 40px;
		align-items: flex-start; /* Media height independent of accordion */
	}
}

/* Image on left (default) */
.model-features--image-left .model-features__media {
	order: 1;
}

.model-features--image-left .model-features__accordion {
	order: 2;
}

/* Image on right */
.model-features--image-right .model-features__media {
	order: 2;
}

.model-features--image-right .model-features__accordion {
	order: 1;
}

.model-features__media {
	flex: 1;
	width: 100%;
}

@media (min-width: 768px) {
	.model-features__media {
		width: 50%;
	}
}

/* Features image fills container without black bg */
.model-features__media .model-media__frame {
	min-height: 300px; /* Minimum height on mobile */
	background-color: transparent; /* Transparent background (image fills) */
}

@media (min-width: 768px) {
	.model-features__media .model-media__frame {
		min-height: 400px; /* Taller on desktop */
	}
}

/* Remove forced 4:3 aspect-ratio in features (allow natural img ratio) */
.model-features__media .model-media__frame--4-3 {
	aspect-ratio: auto;
}

.model-features__media .model-media__frame img {
	height: auto; /* Allow natural ratio */
	width: 100%;
	object-fit: cover;
	display: block;
}

.model-features__accordion {
	flex: 1;
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 0;
}

@media (min-width: 768px) {
	.model-features__accordion {
		width: 50%;
	}
}

/* Accordion item (using <details> element for CSS-only) */
.model-features__item {
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	margin: 0;
}

.model-features__item:last-child {
	border-bottom: none;
}

/* Summary (clickable header) */
.model-features__item-title {
	font-size: 18px;
	font-weight: 500;
	color: #000;
	line-height: 1.4;
	padding: 20px 0;
	cursor: pointer;
	list-style: none;
	user-select: none;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 0;
}

/* Remove default marker */
.model-features__item-title::-webkit-details-marker {
	display: none;
}

/* Plus/minus icon */
.model-features__item-title::after {
	content: '+';
	font-size: 24px;
	font-weight: 300;
	color: #000;
	transition: transform 0.4s ease-out;
}

.model-features__item[open] .model-features__item-title::after {
	content: '−';
}

/* Content (expandable) */
.model-features__item-content {
	font-size: 16px;
	font-weight: 350;
	color: #505062;
	line-height: 1.6;
	padding: 0 0 20px 0;
	margin: 0;
	overflow: hidden;
}

/* ========================================
   MEDIA SLIDER
   Slider for model media galleries
   ======================================== */

/* Hide unused section title in slider (backward compat for old instances) */
.model-media-slider-section > .wp-block-heading.t-section-title,
.model-media-slider-section > .wp-block-group__inner-container > .wp-block-heading.t-section-title {
	display: none;
}

/* Slider container with edge gutters (like hero) */
.mg-model-slider {
	position: relative; /* Required for absolute button positioning */
	width: 100%;
	max-width: none;
	flex: 1 1 auto;
	min-width: 0;
}

/* Keyboard focus indicator for slider root */
.mg-model-slider:focus-visible {
	outline: 2px solid #000;
	outline-offset: 8px;
	border-radius: 10px;
}

.mg-model-slider:focus:not(:focus-visible) {
	outline: none;
}

.mg-model-slider .swiper-container {
	overflow: hidden;
	width: 100%;
	max-width: none;
	display: block;
}

/* INNER CONTAINER FIX: Gutenberg wraps children in .wp-block-group__inner-container */
.mg-model-slider .swiper-wrapper > .wp-block-group__inner-container {
	display: flex;
	width: 100%;
	max-width: none;
}

.mg-model-slider .swiper-slide {
	flex-shrink: 0;
}

/* Edge-only gutters: controlled by JS classes */
.mg-model-slider.is-first .swiper-container {
	padding-left: 0; /* Slider starts from edge */
	padding-right: 0;
}

.mg-model-slider.is-last .swiper-container {
	padding-left: 0;
	padding-right: 30px;
}

.mg-model-slider.is-single .swiper-container {
	padding-left: 30px;
	padding-right: 30px;
}

/* Slide opacity states (non-active slides dimmed) */
.mg-model-slider .swiper-slide {
	opacity: 0.6;
	transition: opacity 0.25s ease;
}

.mg-model-slider .swiper-slide-active {
	opacity: 1;
}

/* Media frame inside slide */
.mg-model-slider .model-media__frame {
	width: 100%;
	height: 100%;
}

.mg-model-slider .model-media__frame img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px;
}

/* ========================================
   MODEL SLIDER NAVIGATION BUTTONS
   Visible prev/next controls
   ======================================== */

.mg-model-slider__nav-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 46px;
	height: 46px;
	border-radius: 999px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
	line-height: 1;
	color: #000;
	cursor: pointer;
	transition: all 0.3s ease;
	z-index: 10;
	pointer-events: auto;
	padding: 0;
	font-family: inherit;
}

.mg-model-slider__nav-btn:hover {
	background: #f7f7f7;
	border-color: rgba(0, 0, 0, 0.25);
}

.mg-model-slider__nav-btn:focus-visible {
	outline: 2px solid #000;
	outline-offset: 4px;
}

.mg-model-slider__nav-btn:active {
	transform: translateY(-50%) scale(0.95);
}

.mg-model-slider__nav-btn--prev {
	left: 12px;
}

.mg-model-slider__nav-btn--next {
	right: 12px;
}

/* Hide buttons on single slide */
.mg-model-slider.is-single .mg-model-slider__nav-btn {
	display: none;
}

/* Disable prev on first slide, next on last slide */
.mg-model-slider.is-first .mg-model-slider__nav-btn--prev,
.mg-model-slider.is-last .mg-model-slider__nav-btn--next {
	opacity: 0.3;
	pointer-events: none;
}

/* Responsive: adjust sizing on mobile */
@media (max-width: 767px) {
	.mg-model-slider__nav-btn {
		width: 40px;
		height: 40px;
		font-size: 28px;
	}

	.mg-model-slider__nav-btn--prev {
		left: 8px;
	}

	.mg-model-slider__nav-btn--next {
		right: 8px;
	}
}