/* mod_my_hero - หน้าปกสไลด์ */

.my-hero {
	position: relative;
	overflow: hidden;
	--hero-h: 460px;
	--hero-hm: 260px;
	--hero-ov: .45;
}

.my-hero.is-rounded { border-radius: var(--my-radius, 14px); }

.my-hero__track { position: relative; height: var(--hero-h); }

.my-hero__slide {
	position: absolute; inset: 0;
	background-size: cover; background-position: center;
	display: flex; align-items: center;
	opacity: 0; visibility: hidden;
	transition: opacity .6s ease;
}
.my-hero__slide.is-active { opacity: 1; visibility: visible; z-index: 2; }

/*
 * การขยายภาพ - how a picture meets a frame of another shape. Cover is the
 * rule above. The modes that can leave part of the frame bare show the
 * track's dark ground there, the same navy as the veil.
 */
.my-hero__track { background: #0b1f3a; }

.my-hero.fit-original .my-hero__slide { background-size: auto; background-repeat: no-repeat; }
.my-hero.fit-contain  .my-hero__slide { background-size: contain; background-repeat: no-repeat; }
.my-hero.fit-fill     .my-hero__slide { background-size: 100% auto; background-repeat: no-repeat; }
.my-hero.fit-stretch  .my-hero__slide { background-size: 100% 100%; }

/*
 * Fit and Zoom draw the picture on pseudo layers: the slide keeps its inline
 * background-image so the layers can inherit it, but sizes its own copy to
 * nothing. Negative z-index inside an isolated slide keeps them under the
 * veil and the words.
 */
.my-hero.fit-fit .my-hero__slide,
.my-hero.fit-zoom .my-hero__slide { background-size: 0 0; background-repeat: no-repeat; isolation: isolate; overflow: hidden; }

.my-hero.fit-fit .my-hero__slide::before,
.my-hero.fit-fit .my-hero__slide::after,
.my-hero.fit-zoom .my-hero__slide::before {
	content: ""; position: absolute; inset: 0;
	background-image: inherit; background-position: center; background-repeat: no-repeat;
}

/* Fit: the whole picture, over a blurred copy of itself. */
.my-hero.fit-fit .my-hero__slide::before {
	background-size: cover; z-index: -2;
	filter: blur(24px) brightness(.75); transform: scale(1.15);
}
.my-hero.fit-fit .my-hero__slide::after { background-size: contain; z-index: -1; }

/*
 * Zoom: fills the frame and closes in while the slide shows. Leaving, it
 * holds the zoom until the fade is over and only then resets, unseen.
 */
.my-hero.fit-zoom .my-hero__slide::before {
	background-size: cover; z-index: -1;
	transform: scale(1); transition: transform 0s linear .6s;
}
.my-hero.fit-zoom .my-hero__slide.is-active::before {
	transform: scale(1.15); transition: transform calc(var(--hero-iv, 6000ms) + 600ms) linear;
}

/*
 * Where the text block sits vertically. Top and bottom keep a margin off the
 * edge so the words never touch the frame, and clear the dots at the bottom.
 */
.my-hero__slide.vpos-top    { align-items: flex-start; padding-block-start: clamp(24px, 7%, 64px); }
.my-hero__slide.vpos-middle { align-items: center; }
.my-hero__slide.vpos-bottom { align-items: flex-end; padding-block-end: clamp(34px, 9%, 76px); }

/*
 * The veil is darkest where the words are, so it follows the chosen position
 * instead of always weighting the left edge.
 */
.my-hero__veil {
	position: absolute; inset: 0;
	background: linear-gradient(90deg, rgba(9, 32, 62, calc(var(--hero-ov) + .2)), rgba(9, 32, 62, var(--hero-ov)) 55%, rgba(9, 32, 62, .12));
}

.my-hero__slide.align-end .my-hero__veil {
	background: linear-gradient(270deg, rgba(9, 32, 62, calc(var(--hero-ov) + .2)), rgba(9, 32, 62, var(--hero-ov)) 55%, rgba(9, 32, 62, .12));
}

.my-hero__slide.align-center .my-hero__veil {
	background: rgba(9, 32, 62, var(--hero-ov));
}

/* Text pushed to an edge also gets a little extra shade on that edge. */
.my-hero__slide.vpos-top.align-center .my-hero__veil {
	background: linear-gradient(180deg, rgba(9, 32, 62, calc(var(--hero-ov) + .15)), rgba(9, 32, 62, var(--hero-ov)) 60%);
}
.my-hero__slide.vpos-bottom.align-center .my-hero__veil {
	background: linear-gradient(0deg, rgba(9, 32, 62, calc(var(--hero-ov) + .15)), rgba(9, 32, 62, var(--hero-ov)) 60%);
}

.my-hero__inner {
	position: relative; z-index: 2; color: #fff;
	display: flex; flex-direction: column; gap: 6px;
}
.my-hero__inner.is-center { align-items: center; text-align: center; }
.my-hero__inner.is-end { align-items: flex-end; text-align: end; }

/*
 * Text sizes come from the module options as the UPPER bound of a clamp, so
 * a large setting still shrinks gracefully on a narrow screen instead of
 * overflowing the slide.
 */
.my-hero__caption {
	display: inline-block; align-self: flex-start;
	background: rgba(255, 255, 255, .2); backdrop-filter: blur(4px);
	border-radius: 999px; padding: 4px 14px; font-weight: 600;
	font-size: clamp(11px, 1.1vw, var(--hero-caption, 14px));
}
.my-hero__inner.is-center .my-hero__caption { align-self: center; }
.my-hero__inner.is-end .my-hero__caption { align-self: flex-end; }

.my-hero__title {
	color: #fff; margin: 0;
	font-size: clamp(26px, 3.6vw, var(--hero-title, 48px));
	text-shadow: 0 3px 16px rgba(0, 0, 0, .35); line-height: 1.25;
}
.my-hero__sub {
	color: rgba(255, 255, 255, .95); margin: 0;
	font-size: clamp(15px, 1.5vw, var(--hero-sub, 20px));
	text-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}
.my-hero__btn { margin-top: 12px; }

.my-hero__nav {
	position: absolute; top: 50%; transform: translateY(-50%); z-index: 6;
	width: 42px; height: 42px; border: 0; border-radius: 50%;
	background: rgba(255, 255, 255, .82); color: #13203a; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	transition: background .15s ease;
}
.my-hero__nav:hover { background: #fff; }
.my-hero__nav--prev { inset-inline-start: 16px; }
.my-hero__nav--next { inset-inline-end: 16px; }

.my-hero__dots {
	position: absolute; bottom: 16px; inset-inline: 0; z-index: 6;
	display: flex; gap: 8px; justify-content: center;
}
.my-hero__dot {
	width: 10px; height: 10px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
	background: rgba(255, 255, 255, .55);
}
.my-hero__dot.is-active { background: #fff; width: 26px; border-radius: 999px; }

/* ภาพขยาย (ป๊อปอัพ) ------------------------------------------------------ */
.my-hero[data-hero-popup="1"] .my-hero__slide { cursor: zoom-in; }
.my-hero[data-hero-popup="1"] .my-hero__inner a,
.my-hero[data-hero-popup="1"] .my-hero__inner button { cursor: pointer; }

.my-hero__zoom {
	position: absolute; top: 12px; inset-inline-end: 12px; z-index: 5;
	width: 38px; height: 38px; border: 0; border-radius: 50%;
	display: grid; place-items: center;
	background: rgba(0, 0, 0, .45); color: #fff; font-size: 16px; cursor: zoom-in;
	opacity: .75; transition: opacity .2s, background .2s;
}
.my-hero__zoom:hover, .my-hero__zoom:focus-visible { opacity: 1; background: rgba(0, 0, 0, .7); }

html.my-hero-lb-open { overflow: hidden; }

.my-hero-lb {
	position: fixed; inset: 0; z-index: 10000;
	display: flex; align-items: center; justify-content: center;
	padding: 56px 64px 48px;
	background: rgba(8, 12, 20, .92);
	animation: my-hero-lb-in .2s ease-out;
}
.my-hero-lb[hidden] { display: none; }

.my-hero-lb__fig { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.my-hero-lb__img {
	display: block; max-width: 100%; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px);
	width: auto; height: auto; object-fit: contain;
	border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); cursor: default;
}
.my-hero-lb__cap { color: #fff; font-size: 16px; text-align: center; max-width: 70ch; line-height: 1.5; }
.my-hero-lb__cap[hidden] { display: none; }

.my-hero-lb__close, .my-hero-lb__nav {
	position: absolute; border: 0; border-radius: 50%; cursor: pointer;
	display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, .14);
	transition: background .2s;
}
.my-hero-lb__close:hover, .my-hero-lb__nav:hover,
.my-hero-lb__close:focus-visible, .my-hero-lb__nav:focus-visible { background: rgba(255, 255, 255, .3); }
.my-hero-lb__close { top: 12px; inset-inline-end: 12px; width: 44px; height: 44px; font-size: 30px; line-height: 1; }
.my-hero-lb__nav { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 18px; }
.my-hero-lb__nav--prev { inset-inline-start: 12px; }
.my-hero-lb__nav--next { inset-inline-end: 12px; }
.my-hero-lb.is-single .my-hero-lb__nav { display: none; }
.my-hero-lb__count { position: absolute; top: 22px; inset-inline-start: 20px; color: rgba(255, 255, 255, .8); font-size: 14px; }

@keyframes my-hero-lb-in { from { opacity: 0; } }

@media (max-width: 767px) {
	.my-hero__zoom { top: 8px; inset-inline-end: 8px; width: 32px; height: 32px; font-size: 14px; }
	.my-hero-lb { padding: 56px 8px 64px; }
	.my-hero-lb__img { max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); }
	/* Thumbs reach the bottom of a phone more easily than its sides. */
	.my-hero-lb__nav { top: auto; bottom: 10px; transform: none; width: 42px; height: 42px; }
	.my-hero-lb__nav--prev { inset-inline-start: calc(50% - 54px); }
	.my-hero-lb__nav--next { inset-inline-end: calc(50% - 54px); }
}

@media (max-width: 767px) {
	.my-hero__track { height: var(--hero-hm); }
	.my-hero__nav { width: 34px; height: 34px; }
	.my-hero__inner { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
	.my-hero__slide { transition: none; }
	.my-hero.fit-zoom .my-hero__slide::before,
	.my-hero.fit-zoom .my-hero__slide.is-active::before { transform: none; transition: none; }
}
