/* Legit PhotoBook - front (タイル一覧＋拡大表示) */

.lpb-tiles,
.lpb-lb {
	--lpb-accent: #c8a24a;
}

.lpb-tiles *,
.lpb-lb * { box-sizing: border-box; }

/* ---------- タイル一覧 ---------- */
.lpb-tiles {
	--lpb-tile: 150px;
	--lpb-tile-gap: 6px;
	--lpb-tile-ratio: 1 / 1;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--lpb-tile), 1fr));
	gap: var(--lpb-tile-gap);
	margin: 2em 0;
	padding: 0;
	list-style: none;
}

.lpb-tiles .lpb-cell {
	position: relative;
	margin: 0;
	aspect-ratio: var(--lpb-tile-ratio);
	overflow: hidden;
	background: #eceae6;
	border-radius: 2px;
	cursor: zoom-in;
	contain: layout paint;
}
.lpb-tiles[data-fit="contain"] .lpb-cell { background: transparent; }

.lpb-tiles .lpb-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: opacity .2s ease;
}
.lpb-tiles[data-fit="contain"] .lpb-img { object-fit: contain; }

/* 縦写真は上側を優先して見せる（顔が見切れにくいように） */
.lpb-tiles[data-fit="cover"] .lpb-cell--p .lpb-img { object-position: top center; }

.lpb-tiles .lpb-cell:hover .lpb-img { opacity: .85; }
.lpb-tiles .lpb-cell:focus-visible { outline: 2px solid var(--lpb-accent); outline-offset: 2px; }

/* ---------- いいね ---------- */
.lpb-like {
	position: absolute;
	right: 6px;
	bottom: 6px;
	width: 26px;
	height: 26px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(10, 10, 12, .46);
	color: #fff;
	cursor: pointer;
	backdrop-filter: blur(2px);
	transition: background .15s ease, transform .12s ease;
	z-index: 3;
}
.lpb-like:hover { background: rgba(10, 10, 12, .64); }
.lpb-like:active { transform: scale(.9); }
.lpb-like-heart { width: 14px; height: 14px; display: block; color: #fff; transition: color .15s ease, transform .2s ease; pointer-events: none; }
.lpb-like.is-liked .lpb-like-heart {
	color: #ff5470;
	fill: #ff5470;
	transform: scale(1.1);
}
.lpb-like-count {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 14px;
	height: 14px;
	padding: 0 3px;
	border-radius: 999px;
	background: #ff5470;
	color: #fff;
	font-size: 9px;
	line-height: 14px;
	text-align: center;
	font-variant-numeric: tabular-nums;
	pointer-events: none;
}
.lpb-like-count:empty { display: none; }

/* モーダル内のいいねは、写真の右下に重ねる */
.lpb-lb-imgwrap { position: relative; display: inline-block; max-width: 100%; }
.lpb-lb-like {
	position: absolute;
	right: 10px;
	bottom: 10px;
	width: 34px;
	height: 34px;
}
.lpb-lb-like .lpb-like-heart { width: 18px; height: 18px; }
.lpb-lb-like[hidden] { display: none; }

.lpb-empty {
	padding: 1em;
	border: 1px dashed rgba(0,0,0,.2);
	color: #666;
}

/* ---------- 拡大表示 ---------- */
.lpb-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(8, 9, 12, .94);
	opacity: 0;
	transition: opacity .2s ease, background-color .2s ease;
}
.lpb-lb[hidden] { display: none; }
.lpb-lb.is-open { opacity: 1; }

/* 背景色のバリエーション。文字やボタンの色も、見やすいように合わせて変える。 */
.lpb-lb.lpb-lb--white { background: rgba(255,255,255,.97); }
.lpb-lb.lpb-lb--transparent { background: transparent; }

.lpb-lb.lpb-lb--white .lpb-lb-cap,
.lpb-lb.lpb-lb--white .lpb-lb-track-label { color: rgba(30,30,30,.6); }
.lpb-lb.lpb-lb--white .lpb-lb-counter { color: #222; }
.lpb-lb.lpb-lb--white .lpb-lb-close,
.lpb-lb.lpb-lb--white .lpb-lb-nav,
.lpb-lb.lpb-lb--white .lpb-lb-like {
	background: rgba(0,0,0,.08);
	color: #222;
}
.lpb-lb.lpb-lb--white .lpb-lb-close:hover,
.lpb-lb.lpb-lb--white .lpb-lb-nav:hover,
.lpb-lb.lpb-lb--white .lpb-lb-like:hover { background: rgba(0,0,0,.16); }
.lpb-lb.lpb-lb--white .lpb-lb-track-bar::before { background: rgba(0,0,0,.14); }
.lpb-lb.lpb-lb--white .lpb-lb-thumb { background: #222; }

.lpb-lb-scroll {
	position: absolute;
	inset: 0;
	display: flex;
	overflow-y: auto;
	overflow-x: hidden;
	padding: clamp(16px, 4vw, 56px);
	padding-bottom: 168px;
	touch-action: pan-y;
	-webkit-overflow-scrolling: touch;
	cursor: grab;
}
.lpb-lb-scroll:active { cursor: grabbing; }

.lpb-lb-figure {
	margin: auto;
	max-width: 100%;
	transform: scale(.99);
	transition: transform .2s ease;
}
.lpb-lb.is-open .lpb-lb-figure { transform: none; }

.lpb-lb-img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 260px);
	max-height: calc(100dvh - 260px);
	width: auto;
	height: auto;
	margin: 0 auto;
	border-radius: 2px;
	transition: opacity .15s ease;
}
.lpb-lb.is-loading .lpb-lb-img { opacity: .35; }

.lpb-lb-cap {
	margin: 14px auto 0;
	max-width: 68ch;
	color: #d8d4cc;
	font-size: 13px;
	line-height: 1.7;
	text-align: center;
}
.lpb-lb-cap:empty { display: none; }

.lpb-lb-close {
	position: fixed;
	top: 16px;
	right: 16px;
	z-index: 2;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(255,255,255,.12);
	color: #fff;
	line-height: 1;
	font-size: 24px;
	cursor: pointer;
}
.lpb-lb-close:hover { background: rgba(255,255,255,.24); }
.lpb-lb-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lpb-lb-close[hidden] { display: none; }

/* 前後の写真ボタンと位置バーは、ひとつの「ドック」として画面下部に固定する。
   画像の縦横比が変わっても位置がずれない。 */
.lpb-lb-dock {
	position: fixed;
	left: 50%;
	bottom: 0;
	transform: translateX(-50%);
	z-index: 3;
	width: min(92vw, 720px);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 14px 0 18px;
	user-select: none;
	-webkit-user-select: none;
}

.lpb-lb-navrow {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
}

.lpb-lb-nav {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(255,255,255,.12);
	color: #fff;
	line-height: 1;
	font-size: 20px;
	cursor: pointer;
}
.lpb-lb-nav:hover { background: rgba(255,255,255,.24); }
.lpb-lb-nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lpb-lb-nav[hidden] { display: none; }

.lpb-lb-counter {
	margin: 0;
	min-width: 4.5em;
	text-align: center;
	color: #f1efe9;
	font-size: var(--lpb-counter-size, 15px);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: .04em;
}
.lpb-lb-counter[hidden] { display: none; }

/* 下部の位置バー：太めにして、スライドできることが伝わる文言を添える */
.lpb-lb-track {
	width: 100%;
	padding: 4px 0 0;
	cursor: grab;
	touch-action: none;
}
.lpb-lb-track.is-dragging { cursor: grabbing; }
.lpb-lb-track-label {
	display: block;
	margin: 0 0 8px;
	color: rgba(255,255,255,.55);
	font-size: 11px;
	letter-spacing: .04em;
	text-align: center;
}
.lpb-lb-track-label:empty { display: none; }
.lpb-lb-track-bar {
	position: relative;
	height: 20px;
	display: flex;
	align-items: center;
}
.lpb-lb-track-bar::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	height: 8px;
	background: rgba(255,255,255,.18);
	border-radius: 999px;
}
.lpb-lb-thumb {
	position: absolute;
	top: 50%;
	height: 8px;
	min-width: 20px;
	transform: translateY(-50%);
	background: #fff;
	border-radius: 999px;
	pointer-events: none;
	transition: left .18s ease, width .18s ease;
}
.lpb-lb-track.is-dragging .lpb-lb-thumb { transition: none; }
.lpb-lb-track[hidden] { display: none; }
.lpb-lb-dock[hidden] { display: none; }

body.lpb-locked {
	position: fixed;
	width: 100%;
	overflow: hidden;
}

/* ---------- スマートフォン ---------- */
@media (max-width: 782px) {
	.lpb-tiles { --lpb-tile: 100px; }
	.lpb-like { right: 4px; bottom: 4px; width: 24px; height: 24px; }
	.lpb-like-heart { width: 13px; height: 13px; }
	.lpb-lb-like { right: 18px; width: 32px; height: 32px; }
	.lpb-lb-scroll { padding: 12px 12px 96px; }
	.lpb-lb-close { top: 10px; right: 10px; width: 40px; height: 40px; }
	.lpb-lb-nav { width: 40px; height: 40px; }
	.lpb-lb-navrow { gap: 14px; margin-top: 10px; }
	.lpb-lb-img { max-height: calc(100svh - 210px); }
	.lpb-lb-track { width: 88vw; }
}

@media (hover: none) {
	.lpb-tiles .lpb-cell:hover .lpb-img { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.lpb-lb,
	.lpb-lb-figure { transition-duration: 1ms !important; }
}


/* ---------- タイルのページ送り ---------- */
.lpb-cell.lpb-hide { display: none; }

.lpb-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin: 16px 0 0;
}
.lpb-pager-prev,
.lpb-pager-next {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid rgba(0,0,0,.18);
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: border-color .2s, color .2s;
}
.lpb-pager-prev:hover,
.lpb-pager-next:hover { border-color: var(--lpb-accent, #c8a24a); color: var(--lpb-accent, #c8a24a); }
.lpb-pager-prev:disabled,
.lpb-pager-next:disabled { opacity: .32; cursor: default; }
.lpb-pager-prev:disabled:hover,
.lpb-pager-next:disabled:hover { border-color: rgba(0,0,0,.18); color: inherit; }
.lpb-pager-prev svg,
.lpb-pager-next svg { width: 16px; height: 16px; display: block; }

.lpb-pager-label {
	min-width: 4.5em;
	text-align: center;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	letter-spacing: .06em;
}
