/* hero-slider.css — the slides at the top of each work.
   nest-design.net V5 · theme nest-design-v5

   仕事実績の個票の上のスライド。 */
/**
 * 仕事実績ページの一番上のスライダー専用の CSS。
 *
 * works.css（本文のギャラリー）やライトボックスの CSS とは切り離してある。
 * クラス名は ws-hero-slider__* にそろえ、.wp-block-gallery や .wp-lightbox-container とぶつからないようにする。
 *
 * 【比率と見せ方】
 * 箱の縦横比を 3:2 に固定し、object-fit: cover で見せる。cover は歪ませず、はみ出した分だけを切る。
 * （V4 は「幅100%・高さ自動」＋ fill で、写真ごとに高さが変わり、比率の合わない写真はゆがんでいた。）
 * 建築写真は天井際・床際に大事なものが入ることがあるので、不自然に切れる作品は個別に考える（下の正方形の箱など）。
 *
 * 【拡張】
 * 写真ごとに位置（object-position）を変えるときは、PHP で style="--ws-hero-position: 50% 30%;" を出すだけでよい。
 * CSS 変数 --ws-hero-position（既定 50% 50%）を通してある。
 */

.ws-hero-slider {
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	margin: 0 0 1.6em;
	background: #e7e5e2;
}

.ws-hero-slider--single img {
	display: block;
	width: 100%;
	object-fit: cover;
	object-position: var(--ws-hero-position, 50% 50%);
}

.ws-hero-slider__track {
	position: relative;
	width: 100%;
	height: 100%;
}

.ws-hero-slider__slide {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	z-index: 0;
	/* 切替のフェードをもう少しゆっくりに（0.3s→0.5s） */
	transition: opacity 0.3s ease;
}

.ws-hero-slider__slide.is-active {
	opacity: 1;
	z-index: 1;
}

.ws-hero-slider__slide img {
	display: block;
	width: 100%;
	object-fit: cover;
	object-position: var(--ws-hero-position, 50% 50%);
}

.ws-hero-slider__arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	transform: translateY(-50%);
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.15);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease;
	/*
	 * 矢印（‹ ›）は、丸の中で文字の縦位置だけを上へ寄せる（丸の位置は動かさない）。
	 * この字形は見た目が行の箱の中心より下に描かれるので、align-items: center だけでは丸の中心に合わない。
	 * padding-top / bottom をわざと非対称にして、文字の入る領域ごと上へずらす。
	 * ずれの量は文字の大きさに比例するので、px ではなく em で書く（px だと小さいスマホの 19px で上へ寄りすぎる）。
	 */
	padding: 0 0 0.25em;
}
.ws-hero-slider__arrow:hover {
	background: rgba(0, 0, 0, 0.3);
}
.ws-hero-slider__arrow--prev {
	left: 12px;
}
.ws-hero-slider__arrow--next {
	right: 12px;
}

.ws-hero-slider__dots {
	position: absolute;
	right: 0;
	bottom: 12px;
	left: 0;
	z-index: 2;
	display: flex;
	justify-content: center;
	gap: 8px;
}

.ws-hero-slider__dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.4);
	cursor: pointer;
}
.ws-hero-slider__dot.is-active {
	background: #fff;
}

@media (max-width: 640px) {
	.ws-hero-slider {
		aspect-ratio: 4 / 3;
	}
	/*
	 * スマホでは .works-single の縦罫線を消しているので、端末の丸めでスライダーの左右に 1px ほどの白い線が見えることがある。
	 * はみ出させて隠すのは、中の写真だけにする。スライダーは overflow: hidden なので、ページ側には 1px もはみ出さない。
	 * スライダーごとはみ出させると、それがページの横スクロール（幅376px）になり、iPhone で横に引っ張ると枠の外が見えて揺れる。
	 */
	.ws-hero-slider__slide img,
	.ws-hero-slider--single img {
		width: calc(100% + 2px);
		max-width: none;
		margin-left: -1px;
	}
	.ws-hero-slider__arrow {
		width: 34px;
		height: 34px;
		font-size: 19px;
	}
}

/* 1 枚目の写真が正方形の作品は、箱も 1:1 にする（functions.php の
   nest_design_v5_hero_shape_class が添付の寸法を見て付ける）。
   Before/After の合成を正方形で作ってあるリノベーションで時々ある（例：028）。
   3:2 で切ると合成の Before と余白が中途半端に残るため。幅は 721 のまま。 */
.ws-hero-slider--square {
	aspect-ratio: 1 / 1;
}

/* 下端の髪の毛線。箱の高さが 720.998px のような端数になると（幅 100% の親が端数のため）、
   Retina では写真の下の半ピクセルに箱の地色（#e7e5e2）が透けて、明るい線に見える。
   写真を上下 0.5px ずつはみ出させて地色を隠す（箱は overflow:hidden なので外には出ない。
   cover の切り抜きが 0.5px ずれるだけで、見た目は変わらない）。 */
.ws-hero-slider__slide img,
.ws-hero-slider--single img {
	height: calc(100% + 1px);
	margin-top: -0.5px;
}

/* 切り替わる瞬間に明るくならないように。
   入ってくる絵（is-active、上に重なる）だけが 0.3秒で濃くなり、出ていく絵は 0.3秒待ってから消す。いつもどちらかが不透明なので、下の地は透けない。
   両方を同時に 0.3秒で薄く・濃くすると、途中で両方とも半透明になり、地（#e7e5e2 の明るいグレー）が約25%透けて一瞬明るく見える。 */
.ws-hero-slider__slide { transition: opacity 0s linear 0.3s; }
.ws-hero-slider__slide.is-active { transition: opacity 0.3s; }

/* ダークモードで個票を開いた瞬間、絵が出るまでの約0.3秒、地の #e7e5e2 が白っぽく光る件。
   ダークモードでは地をページの地（--kinari のダーク値 #191919）と同じにして、光らないようにする。 */
@media (prefers-color-scheme: dark) {
	.ws-hero-slider { background: #191919; }
}

/* 図面のヒーロー（ws-hero-slider--wide、functions.php が付ける）はスマホでも 3:2。4:3 にすると左右が切れる（017） */
@media (max-width: 640px) {
  .ws-hero-slider--wide { aspect-ratio: 3 / 2; }
}
