/**
 * 「世界の撮影ポスト」[luq_world_voices]（inc/shortcodes-world-voices.php）
 *
 * - PC（1024px以上）：全件同じ幅の3列（最大960px、列間18px）。見出しと導入文は本文の列に揃える。
 * - iPad など（768〜1023px）：全件同じ幅の2列（最大658px・1件320pxまで、列間18px）、中央。
 *   カードは上揃え（短いカードを引き伸ばさない）。X の埋め込みはカードの幅で表示する。
 * - スマホ（767px以下）：カードは画面の約85％。横スワイプ＋スナップで、次のカードが少し見える。
 *   カードの上に「01 / 06」と前後ボタン（assets/js/world-voices.js）。カードの高さは内容に合わせる。
 * - X の埋め込みが読み込めないときは埋め込み欄だけを隠す（日本語の本文と原文リンクは残る）。
 */

/* The section: in the article body (the list of posts may be wider, see below) */
.luq-prose > .luq-voices {
	max-width: none;
	margin: 56px 0;
	scroll-margin-top: 28px;
}

.admin-bar .luq-prose > .luq-voices {
	scroll-margin-top: 64px;
}

.luq-prose > .luq-voices + * {
	margin-top: 0;
}

.luq-voices .luq-voices__inner {
	padding-top: 30px;
	border-top: 1px solid var(--luq-gold, #b59b64);
}

.luq-voices--single .luq-voices__inner {
	padding-top: 0;
	border-top: 0;
}

/* Heading and introduction: in the text column (the heading number hangs like the others) */
.luq-voices .luq-voices__head {
	max-width: var(--luq-col, 720px);
}

.luq-voices .luq-voices__title {
	margin-top: 0;
	margin-bottom: 0;
}

.luq-voices .luq-voices__intro {
	margin: 14px 0 0;
	color: #3a3834;
	font-size: 15px;
	line-height: 1.95;
	letter-spacing: 0.04em;
}

/* Articles written as one centred column (.luq-review-content): follow that column
   and its heading style, so the section reads as part of the article. */
.luq-review-content ~ .luq-voices .luq-voices__head {
	max-width: 700px;
	margin-inline: auto;
}

.luq-review-content ~ .luq-voices .luq-voices__title {
	font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
	font-size: 24px;
	font-weight: 500;
	line-height: 1.6;
}

/* The list of posts (the layout for each screen width is set in the media queries below) */
.luq-voices .luq-voices__list {
	margin: 26px 0 0;
	padding: 0;
	list-style: none;
}

.luq-voices .luq-voice {
	min-width: 0;
	margin: 0;
	border-top: 1px solid rgba(181, 155, 100, 0.45);
}

.luq-voices .luq-voice__card {
	min-width: 0;
}

/* Text: the Japanese words lead */
.luq-voices .luq-voice__text {
	min-width: 0;
}

.luq-voices .luq-voice__label {
	display: inline-block;
	margin: 0 0 12px;
	padding: 0 7px;
	border: 1px solid rgba(181, 155, 100, 0.7);
	color: var(--luq-gold-text, #8b6b2d);
	font-size: 11px;
	line-height: 1.8;
	letter-spacing: 0.14em;
}

.luq-voices .luq-voice__body p {
	margin: 0;
	color: var(--luq-ink, #242424);
	font-size: 16px;
	line-height: 1.95;
	letter-spacing: 0.04em;
}

.luq-voices .luq-voice__body p + p {
	margin-top: 0.7em;
}

.luq-voices .luq-voice__note {
	margin: 14px 0 0;
	color: var(--luq-sub, #68635b);
	font-size: 13px;
	line-height: 1.85;
	letter-spacing: 0.03em;
}

.luq-voices .luq-voice__note-label {
	margin-right: 10px;
	color: var(--luq-gold-text, #8b6b2d);
	font-size: 11px;
	letter-spacing: 0.14em;
}

.luq-voices .luq-voice__source {
	margin: 16px 0 0;
	font-size: 12.5px;
	line-height: 1.6;
	letter-spacing: 0.06em;
}

.luq-voices .luq-voice__source a {
	color: var(--luq-sub, #68635b);
	text-decoration: none;
	border-bottom: 1px solid var(--luq-rule, #e2ded6);
}

.luq-voices .luq-voice__source a::after {
	content: " ↗";
	color: var(--luq-gold, #b59b64);
}

.luq-voices .luq-voice__source a:hover {
	color: var(--luq-gold-text, #8b6b2d);
}

/* The official X embed (photos / video), drawn by X at the card's width. Not a scroll
   anchor: it is replaced and grows when X renders it, so the browser keeps the reader's
   place by other elements. */
.luq-voices .luq-voice__embed {
	min-width: 0;
	margin-top: 22px;
	overflow-anchor: none;
}

.luq-voices .luq-voice__embed blockquote.twitter-tweet {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	margin: 0;
	padding: 16px;
	border: 1px solid var(--luq-rule, #e2ded6);
	background: #faf9f6;
	color: var(--luq-sub, #68635b);
	font-size: 12.5px;
	text-align: center;
}

.luq-voices .luq-voice__embed blockquote.twitter-tweet a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid var(--luq-rule, #e2ded6);
}

.luq-voices .luq-voice__embed .twitter-tweet-rendered {
	margin: 0 auto !important;
}

.luq-voices .luq-voice__embed iframe {
	max-width: 100%;
}

/* X is not available (blocked, offline, removed post): keep the text and the link only */
.no-js .luq-voices .luq-voice__embed,
.luq-voices.is-embed-unavailable .luq-voice__embed,
.luq-voices .luq-voice.is-embed-failed .luq-voice__embed {
	display: none;
}

.luq-voices .luq-voices__controls {
	display: none;
}

.luq-voices .luq-voices__footnote {
	margin: 0;
	padding-top: 16px;
	border-top: 1px solid rgba(181, 155, 100, 0.45);
	color: var(--luq-sub, #68635b);
	font-size: 12px;
	line-height: 1.85;
	letter-spacing: 0.03em;
}

/* Shown to editors only, when a post address is not accepted */
.luq-voices .luq-voice--invalid {
	grid-column: 1 / -1;
}

.luq-voices .luq-voice__warning {
	margin: 0;
	padding: 10px 12px;
	background: #fcf6e8;
	color: #7a5a3a;
	font-size: 12.5px;
}

/* ---------------------------------------------------------------------------
   PC and iPad (768px and wider): every post the same width, cards aligned at the top
   ------------------------------------------------------------------------ */

@media (min-width: 768px) {
	/* 768–1023px: two columns, up to 658px (320px a post), centred on the text column */
	.luq-voices {
		--luq-voices-w: min(658px, 100%);
		--luq-voices-x: calc((100% - var(--luq-voices-w)) / 2);
	}

	.luq-voices .luq-voices__viewport {
		width: var(--luq-voices-w);
		margin-left: var(--luq-voices-x);
	}

	.luq-voices .luq-voices__list {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 24px 18px;
		align-items: start;
		margin-top: 22px;
	}

	.luq-voices .luq-voice {
		padding: 16px 0 0;
	}

	.luq-voices .luq-h2__num {
		font-size: 24px;
	}

	.luq-voices .luq-voice__label {
		margin-bottom: 8px;
	}

	.luq-voices .luq-voice__body p {
		font-size: 15px;
		line-height: 1.7;
	}

	.luq-voices .luq-voice__note {
		margin-top: 8px;
		font-size: 12.5px;
		line-height: 1.7;
	}

	.luq-voices .luq-voice__source {
		margin-top: 8px;
		font-size: 12px;
	}

	.luq-voices .luq-voice__embed {
		margin-top: 12px;
	}

	.luq-voices .luq-voices__footnote {
		margin-top: 24px;
		padding-top: 14px;
	}

	/* a single post on its own */
	.luq-voices--single .luq-voices__viewport {
		width: auto;
		margin-left: 0;
	}

	.luq-voices--single .luq-voices__list {
		grid-template-columns: minmax(0, 1fr);
		max-width: 550px;
	}
}

@media (min-width: 1024px) {
	/* three columns, up to 960px: wider than the body column, so the list, its top rule
	   and the note extend into the heading-number gutter (never past the page's edge) */
	.luq-voices {
		--luq-voices-w: min(960px, 100% + var(--luq-num, 0px));
		--luq-voices-x: min((100% - var(--luq-voices-w)) / 2, 100% - var(--luq-voices-w));
	}

	.luq-voices .luq-voices__list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.luq-voices:not(.luq-voices--single) .luq-voices__inner {
		position: relative;
		border-top: 0;
	}

	.luq-voices:not(.luq-voices--single) .luq-voices__inner::before {
		content: "";
		position: absolute;
		top: 0;
		left: var(--luq-voices-x);
		width: var(--luq-voices-w);
		border-top: 1px solid var(--luq-gold, #b59b64);
	}

	.luq-voices .luq-voices__footnote {
		width: var(--luq-voices-w);
		margin-left: var(--luq-voices-x);
	}
}

/* ---------------------------------------------------------------------------
   Phone (767px and narrower): one card at a time, swipe with snap, the next card peeks in
   ------------------------------------------------------------------------ */

@media (max-width: 767px) {
	.luq-prose > .luq-voices {
		margin-block: 44px;
	}

	.luq-voices .luq-voices__inner {
		padding-top: 24px;
	}

	.luq-review-content ~ .luq-voices .luq-voices__title {
		font-size: 22px;
	}

	.luq-voices .luq-voices__intro {
		font-size: 14.5px;
	}

	.luq-voices .luq-voices__viewport {
		margin-inline: calc(var(--luq-gutter, 16px) * -1);
	}

	.luq-voices .luq-voices__list {
		display: flex;
		align-items: flex-start;
		gap: 12px;
		margin-top: 20px;
		padding: 2px var(--luq-gutter, 16px) 6px;
		overflow-x: auto;
		overflow-y: hidden; /* the height follows the card in view (world-voices.js) */
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scroll-padding-inline: var(--luq-gutter, 16px);
		scroll-behavior: smooth;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
		transition: height 0.3s ease;
	}

	.luq-voices .luq-voices__list::-webkit-scrollbar {
		display: none;
	}

	.luq-voices .luq-voices__list:focus-visible {
		outline: 1px solid var(--luq-gold, #b59b64);
		outline-offset: -1px;
	}

	.luq-voices .luq-voice {
		flex: 0 0 min(85vw, 420px);
		padding: 18px 16px 20px;
		border: 1px solid var(--luq-rule, #e2ded6);
		border-top-color: var(--luq-gold, #b59b64);
		background: #fff;
		scroll-snap-align: start;
		scroll-snap-stop: always;
	}

	/* is-wide (the featured post, and a last post left alone in a row of two):
	   on phones only a slightly smaller space above the embed, as before */
	.luq-voices .luq-voice.is-wide .luq-voice__embed {
		margin-top: 18px;
	}

	.luq-voices .luq-voice--featured .luq-voice__body p {
		font-size: 18px;
		line-height: 1.85;
		letter-spacing: 0.06em;
	}

	/* position and previous / next: one row above the cards */
	.luq-voices .luq-voices__controls:not([hidden]) {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 16px;
	}

	.luq-voices .luq-voices__controls:not([hidden]) + .luq-voices__viewport .luq-voices__list {
		margin-top: 12px;
	}

	.luq-voices .luq-voices__buttons {
		display: flex;
		gap: 8px;
	}

	.luq-voices .luq-voices__controls button {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 1px solid var(--luq-rule, #e2ded6);
		border-radius: 0;
		background: #fff;
		color: var(--luq-ink, #242424);
		cursor: pointer;
	}

	.luq-voices .luq-voices__controls button:disabled {
		color: #c9c4bb;
		cursor: default;
	}

	.luq-voices .luq-voices__count {
		margin: 0;
		color: var(--luq-gold-text, #8b6b2d);
		font-family: var(--luq-latin, serif);
		font-size: 18px;
		letter-spacing: 0.12em;
	}

	.luq-voices .luq-voices__footnote {
		margin-top: 16px;
		padding-top: 0;
		border-top: 0;
	}

	/* a single post on its own: no carousel */
	.luq-voices--single .luq-voices__viewport {
		margin-inline: 0;
	}

	.luq-voices--single .luq-voices__list {
		padding-inline: 0;
	}

	.luq-voices--single .luq-voice {
		flex-basis: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.luq-voices .luq-voices__list {
		scroll-behavior: auto;
		transition: none;
	}
}
