/* EX REDESiGN — Hero Carousel block styles (keen-slider 版)
 *
 * Layout (frontend):
 *
 *   .exr-hero-carousel              ← alignfull, --color-surface-raised bg, sidemask container
 *     .exr-hero-carousel__slider.keen-slider
 *       .keen-slider__slide.exr-hero-slide ...   (各スライド)
 *     .exr-hero-carousel__arrow--prev / --next   (矢印ボタン、手書き HTML)
 *     .exr-hero-carousel__dots > .exr-hero-carousel__dot ...  (ドットボタン)
 *
 * スタンダードフェード方式: テキスト/CTAは .exr-hero-slide__content の opacity を view.js が制御。
 */

/* ============================================================
   ラッパー + サイドマスク
   ============================================================ */
.exr-hero-carousel {
	position: relative;
	width: 100%;
	background: var(--color-surface-raised, #f9fafb);
	overflow: hidden;
	--exr-hero-content-half: calc((var(--exr-container, 1200px) - 2 * var(--exr-section-x, 2rem)) / 2);
}

/* 両端の静的サイドマスク (コンテンツ境界より外側) */
.exr-hero-carousel::before,
.exr-hero-carousel::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	background: var(--color-surface-raised, #f9fafb);
	opacity: var(--exr-hero-side-overlay-opacity, 0.85);
	z-index: 5;
	pointer-events: none;
}
.exr-hero-carousel::before {
	left: 0;
	right: calc(50% + var(--exr-hero-content-half));
}
.exr-hero-carousel::after {
	left: calc(50% + var(--exr-hero-content-half));
	right: 0;
}

/* ============================================================
   keen-slider root ・スライドサイズ
   ============================================================ */
.exr-hero-carousel__slider {
	width: 100%;
	position: relative;
	min-height: var(--exr-hero-min-height, 490px);
}

/* keen-slider は .keen-slider クラスを使う (keen-slider.min.css で display:flex 等が適用される) */
/* keen-slider デフォルト (.keen-slider:not([data-keen-slider-disabled]) .keen-slider__slide{width:100%}) 
   を上書きするため specificity を (0,3,1) に上げる。
   スライド幅 = コンテンツ幅 (サイドスライドが両端に peek される)。 */
.exr-hero-carousel .exr-hero-carousel__slider:not([data-keen-slider-disabled]) .keen-slider__slide {
	position: relative;
	min-width: 0;
	max-width: none;
	min-height: var(--exr-hero-min-height, 490px);
	flex-shrink: 0;
	overflow: hidden;
	box-sizing: border-box;
	width: min(
		calc(100vw - 2 * var(--exr-section-x, 2rem)),
		calc(var(--exr-container, 1200px) - 2 * var(--exr-section-x, 2rem))
	);
}

/* ============================================================
   中央スライドの dim overlay (hero-slide の dimRatio) を上書き
   スライド単位の dimRatio は inline style で出ているため !important が必要。
   ============================================================ */
.exr-hero-carousel .keen-slider__slide .exr-hero-slide__overlay {
	transition: none !important;
}
.exr-hero-carousel .keen-slider__slide.exr-hero-active .exr-hero-slide__overlay {
	opacity: var(--exr-hero-center-overlay-opacity, 0) !important;
}

/* ============================================================
   テキスト/CTA の表示制御
   ============================================================ */
.exr-hero-carousel .exr-hero-slide__content {
	opacity: 0; /* デフォルト隠し (view.js がアクティブスライドだけ opacity を1にする) */
	pointer-events: none;
}
.exr-hero-carousel .keen-slider__slide.exr-hero-active .exr-hero-slide__content {
	pointer-events: auto;
}

/* ============================================================
   矢印ナビレール (= スライド幅に一致した透明コンテナ)
   矢印はこのレール内側 16px で位置決めされるため、
   カルーセル外コンテナ幅 (alignfull / page-bounded / wrapped) に関わらず
   常にスライドの両端から 16px 内側の位置に表示される。
   ============================================================ */
.exr-hero-carousel__nav {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	max-width: min(
		calc(100vw - 2 * var(--exr-section-x, 2rem)),
		calc(var(--exr-container, 1200px) - 2 * var(--exr-section-x, 2rem))
	);
	pointer-events: none;
	z-index: 6;
}

/* ============================================================
   矢印ボタン (rail 内位置決め)
   ============================================================ */
.exr-hero-carousel__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(17, 24, 39, 0.6);
	color: #ffffff;
	cursor: pointer;
	pointer-events: auto;
	transition: background 0.18s ease, transform 0.18s ease;
}
.exr-hero-carousel__arrow:hover {
	background: rgba(17, 24, 39, 0.85);
	transform: translateY(-50%) scale(1.08);
}
.exr-hero-carousel__arrow:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}
.exr-hero-carousel__arrow svg {
	width: 14px;
	height: 14px;
	display: block;
}
.exr-hero-carousel__arrow--prev {
	left: 16px;
}
.exr-hero-carousel__arrow--next {
	right: 16px;
}

/* ============================================================
   ドットボタン
   ============================================================ */
.exr-hero-carousel__dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 16px;
	display: flex;
	justify-content: center;
	gap: 8px;
	z-index: 6;
	pointer-events: none;
}
.exr-hero-carousel__dot {
	appearance: none;
	display: inline-block;
	width: 9px;
	height: 9px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.45);
	cursor: pointer;
	pointer-events: auto;
	transition: background 0.15s ease, transform 0.15s ease;
}
.exr-hero-carousel__dot:hover {
	background: rgba(255, 255, 255, 0.75);
}
.exr-hero-carousel__dot.is-active {
	background: #ffffff;
	transform: scale(1.25);
}

/* ============================================================
   レスポンシブ (Tablet / Mobile)
   ============================================================ */

/* Tablet + Mobile (<1200px): 中央シングル表示、サイドスライドとサイドマスクは非表示。
   矢印位置は rail (スライド幅一致) に追随するため 上記デフォルトルールで古品にす。 */
@media (max-width: 1199px) {
	.exr-hero-carousel .exr-hero-carousel__slider:not([data-keen-slider-disabled]) .keen-slider__slide {
		width: 100vw;
	}
	.exr-hero-carousel::before,
	.exr-hero-carousel::after {
		display: none;
	}
}

/* Mobile (<768px):
   ・ 矢印をさらに縮小サイズ (28px) + もっと外側に寄せる (left/right 4px)
   ・ コンテンツ (.exr-hero-slide__content) の左右 padding を矢印分だけ拡張して
     タイトル / 説明文 / ボタンが矢印と被らないようにする。
     padding-inline: 48px = 矢印 28px + コイレスポ 20px (矢印与テキストとの隔たり)。 */
@media (max-width: 767px) {
	.exr-hero-carousel__arrow {
		width: 28px;
		height: 28px;
	}
	.exr-hero-carousel__arrow--prev { left: 4px; }
	.exr-hero-carousel__arrow--next { right: 4px; }
	.exr-hero-carousel__arrow svg {
		width: 12px;
		height: 12px;
	}
	/* hero-carousel 内のコンテンツグループに、矢印との重なりを防ぐための左右 padding を上乗せ。
	   hero-slider (単独) には矢印がないため適用しない (親セレクタで限定)。 */
	.exr-hero-carousel .exr-hero-slide__content {
		padding-inline: 48px;
	}
	.exr-hero-carousel__slider,
	.exr-hero-carousel .exr-hero-carousel__slider:not([data-keen-slider-disabled]) .keen-slider__slide,
	.exr-hero-carousel .exr-hero-slide {
		min-height: max(360px, 75vw);
	}
	.exr-hero-carousel__dots {
		bottom: 12px;
	}
}

/* ============================================================
   Editor-only styles (エディタではスライドを縦スタック)
   ============================================================ */
.exr-hero-carousel--editor .exr-hero-carousel__editor-hint {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	background: rgba(17, 24, 39, 0.04);
	color: rgba(17, 24, 39, 0.7);
	font-size: 12px;
	border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}
.exr-hero-carousel--editor .exr-hero-carousel__editor-hint .dashicons {
	width: 16px;
	height: 16px;
	font-size: 16px;
}
.exr-hero-carousel--editor .exr-hero-carousel__editor-list > * + * {
	margin-top: 1px;
}


/* ============================================================
   Editor: "スライドを追加" Appender ボタンの視認性改善
   暗い背景画像の上でも読みやすく白背景 + 枠線 + 影を強制。
   ============================================================ */
.exr-hero-carousel--editor .block-list-appender .components-button,
.exr-hero-carousel--editor .block-list-appender .block-editor-inserter__toggle {
	background: rgba(0, 0, 0, 0.85) !important;
	color: #ffffff !important;
	border: 1px dashed rgba(255, 255, 255, 0.45) !important;
	border-radius: 6px !important;
	padding: 10px 18px !important;
	font-weight: 500 !important;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
	transition: background 0.15s ease, transform 0.15s ease !important;
}
.exr-hero-carousel--editor .block-list-appender .components-button:hover,
.exr-hero-carousel--editor .block-list-appender .block-editor-inserter__toggle:hover {
	background: #000000 !important;
	border-color: #ffffff !important;
	transform: scale(1.02);
}


/* ============================================================
   Editor: スライドのコンパクト表示 + プレースホルダースタイル
   - min-height を 280px に縮める (frontend は 490px のまま)
   - 画像未設定時は明るいプレースホルダー背景 + dashed border
   - スライド番号ラベルを CSS counter で描画
   ============================================================ */

/* List 全体の counter 初期化 */
.exr-hero-carousel--editor .exr-hero-carousel__editor-list {
	counter-reset: exr-slide;
	padding-top: 24px; /* 最初のスライドのタブ分 */
}

/* スライド番号ラベル */
.exr-hero-carousel--editor .exr-hero-slide--editor {
	position: relative;
	min-height: 280px !important;
	overflow: visible !important; /* タブがスライド上部に出るよう */
}
.exr-hero-carousel--editor .exr-hero-slide--editor::before {
	content: "スライド " counter(exr-slide);
	counter-increment: exr-slide;
	position: absolute;
	top: -24px; /* タブ高と同じ — 余白ゼロ */
	left: -2px;     /* dashed border 2px を考慮して左端と揃える */
	background: rgba(17, 24, 39, 0.85);
	color: #ffffff;
	padding: 4px 12px;
	border-radius: 0; /* 角丸なし */
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.04em;
	z-index: 10;
	pointer-events: none;
}

/* 画像未設定 (inline style に background-image が無い) 時は明るいプレースホルダー */
.exr-hero-carousel--editor .exr-hero-slide--editor:not([style*="background-image"]) {
	background-color: rgba(243, 244, 246, 0.7) !important;
	background-image:
		linear-gradient(45deg, rgba(0, 0, 0, 0.025) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.025) 50%, rgba(0, 0, 0, 0.025) 75%, transparent 75%, transparent) !important;
	background-size: 18px 18px !important;
	border: none;
	outline: none;
}

/* MediaPlaceholder は透明背景にしてスライドチェッカー背景とよく馴染ませる */
.exr-hero-carousel--editor .exr-hero-slide--editor .components-placeholder {
	background: transparent !important;
	border: none !important;
	color: rgba(17, 24, 39, 0.8) !important;
	min-height: auto !important;
}
.exr-hero-carousel--editor .exr-hero-slide--editor .components-placeholder__label,
.exr-hero-carousel--editor .exr-hero-slide--editor .components-placeholder__instructions {
	color: rgba(17, 24, 39, 0.85) !important;
}

/* 画像未設定時は content area のテキスト色もダークに */
.exr-hero-carousel--editor .exr-hero-slide--editor:not([style*="background-image"]) .exr-hero-slide__content {
	color: var(--color-text-primary, #111827);
}
.exr-hero-carousel--editor .exr-hero-slide--editor:not([style*="background-image"]) .exr-hero-slide__content .ex-hero-title,
.exr-hero-carousel--editor .exr-hero-slide--editor:not([style*="background-image"]) .exr-hero-slide__content .ex-hero-lead,
.exr-hero-carousel--editor .exr-hero-slide--editor:not([style*="background-image"]) .exr-hero-slide__content p,
.exr-hero-carousel--editor .exr-hero-slide--editor:not([style*="background-image"]) .exr-hero-slide__content :is(h1, h2, h3, h4, h5, h6) {
	color: var(--color-text-primary, #111827);
	text-shadow: none;
}

/* スライド間の gap を見やすく */
.exr-hero-carousel--editor .exr-hero-carousel__editor-list > * + * {
	margin-top: 24px; /* タブ分のみ */
}

/* ============================================================
   Editor: サイドマスク ・ 画像未設定時のスクリーンスペース修正
   - フロントの ::before / ::after サイドオーバーレイをエディタでは隠す
     (エディタではスライドを縦スタックして見せるため、両サイドマスクは不要)
   - 画像未設定スライドは min-height を解除して MediaPlaceholder に auto-fit させる
   ============================================================ */
.exr-hero-carousel--editor::before,
.exr-hero-carousel--editor::after {
	display: none !important;
}

/* 画像未設定 (style 属性に background-image が含まれない) のときは auto-fit */
.exr-hero-carousel--editor .exr-hero-slide--editor:not([style*="background-image"]) {
	min-height: auto !important;
	padding: 20px 16px;
}

/* ============================================================
   Editor: hero-slide の content は常に表示
   (frontend では view.js がアクティブスライドの opacity を 1 にしているが、
    エディタでは view.js が走らないため、opacity:0 のままでテキストが見えなくなる)
   ============================================================ */
.exr-hero-carousel--editor .exr-hero-slide__content {
	opacity: 1 !important;
	pointer-events: auto !important;
}