/*
 * v2 の動画一覧・分類のページ・動画詳細（v2/page-videos.php。本体は template-parts/v2/videos-*.php）。
 * 縦の動画 1 本の枠（.short-grid の再生ボタン・長さ・題名）は components.css。ここは一覧の並び・送りボタン・詳細・SP の縦スワイプ。
 * クラス名と状態（is-open・is-static・aria-disabled・body.is-video-feed）は scripts.js が使うので今のまま。
 */
@layer components {
	.v2-videos-page {
		padding-block: var(--sp-8) var(--sp-9);
	}

	/* 固定ページの説明文 */
	.v2-videos-page > .entry-content {
		max-width: var(--w-text);
		margin-bottom: var(--sp-6);
		line-height: 2;
	}

	/* ===== 分類の目次 ===== */
	.videos-index {
		display: flex;
		flex-direction: column;
		gap: var(--sp-4);
		padding: var(--sp-5) var(--sp-6);
		border-radius: var(--radius-md);
		background: var(--c-soft);
	}

	.videos-index__head {
		margin: 0;
		font-weight: 700;
	}

	.videos-index__list {
		display: flex;
		flex-wrap: wrap;
		gap: var(--sp-2);
		margin: var(--sp-2) 0 0;
		padding: 0;
		list-style: none;
	}

	.videos-index__list a {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-height: 40px;
		padding: 0 14px;
		border: 1px solid var(--c-line-strong);
		border-radius: var(--radius-pill);
		background: var(--c-bg);
		color: var(--c-ink);
		font-size: var(--fs-sm);
		text-decoration: none;
	}

	.videos-index__list a:hover {
		border-color: var(--c-brand);
	}

	.videos-index__n {
		font-size: var(--fs-xs);
		color: var(--c-ink-mute);
	}

	.videos-index__list a[aria-current="page"] {
		border-color: var(--c-brand);
		background: var(--c-brand);
		color: var(--c-on-brand);
	}

	.videos-index__list a[aria-current="page"] .videos-index__n {
		color: var(--c-on-brand-sub);
	}

	/* ===== 節（ドラマ・記事の解説動画） ===== */
	.videos-section {
		margin-top: var(--sp-8);
		scroll-margin-top: 24px;
	}

	.videos-section .heading--sub01 {
		margin: 0;
	}

	.videos-section .heading-text--en {
		display: block;
		font-family: var(--f-en);
		font-weight: 300;
		font-size: var(--fs-en);
		line-height: 1;
		letter-spacing: 0.06em;
	}

	.videos-section .heading-text--sub {
		display: block;
		margin-top: var(--sp-3);
		font-size: var(--fs-md);
		font-weight: 700;
		color: var(--c-accent-text);
	}

	.videos-section__lead {
		max-width: var(--w-text);
		margin: var(--sp-4) 0 0;
		line-height: 1.9;
	}

	.videos-section__note {
		margin: var(--sp-2) 0 0;
		font-size: var(--fs-xs);
		color: var(--c-ink-mute);
	}

	.videos-back {
		margin: 0 0 var(--sp-3);
		font-size: var(--fs-sm);
	}

	.videos-back a {
		color: var(--c-accent-text);
	}

	/* ===== 分類の見出し（行・分類のページ共通） ===== */
	.short-grid--row,
	.short-grid--list {
		margin-top: var(--sp-7);
		scroll-margin-top: 24px;
	}

	.short-grid__heading {
		position: relative;
		margin: 0;
		padding: 0 0 var(--sp-2) 22px;
		font-size: var(--fs-lg);
		line-height: 1.5;
	}

	.short-grid__heading::before {
		content: "";
		position: absolute;
		left: 0;
		top: 0.3em;
		width: 10px;
		height: 1.1em;
		background: var(--c-brand);
		clip-path: var(--clip-tag);
	}

	.short-grid__heading a {
		color: inherit;
		text-decoration: none;
	}

	.short-grid__heading a:hover {
		text-decoration: underline;
	}

	.short-grid__heading-n {
		font-size: var(--fs-sm);
		font-weight: 400;
		color: var(--c-ink-mute);
	}

	.short-grid--list .short-grid__heading {
		border-bottom: 1px solid var(--c-line);
	}

	.short-grid__row-head {
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
		gap: var(--sp-4);
		border-bottom: 1px solid var(--c-line);
	}

	.short-grid__all-link {
		flex: none;
		margin-bottom: var(--sp-2);
		font-family: var(--f-ja);
		font-size: var(--fs-sm);
		font-weight: 700;
		color: var(--c-accent-text);
	}

	.short-grid__all-link::after {
		content: " \203A";
	}

	.short-grid__scroller {
		position: relative;
		margin-top: var(--sp-4);
	}

	/* 一覧の行: 横に送る（PC は 3 本ずつ見え、左右のボタンでも送る） */
	.short-grid--row .short-grid__list {
		display: flex;
		gap: 20px;
		margin: 0;
		padding: 0 0 8px;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scroll-behavior: smooth;
		overscroll-behavior-x: contain;
		scrollbar-width: thin;
		scrollbar-color: var(--c-input-line) transparent;
	}

	.short-grid--row .short-grid__item {
		flex: 0 0 calc((100% - 40px) / 3);
		scroll-snap-align: start;
	}

	/* 分類のページ: PC はグリッド、SP は横に送る */
	.short-grid--list .short-grid__list {
		gap: 28px 20px;
		margin-top: 0;
	}

	.short-grid--list .short-grid__scroll {
		display: none;
	}

	.short-grid__name a {
		color: inherit;
		text-decoration: none;
	}

	.short-grid__name a:hover {
		text-decoration: underline;
	}

	.short-grid__link {
		display: inline-block;
		margin-top: 6px;
		font-size: var(--fs-xs);
		color: var(--c-accent-text);
	}

	/* 左右の送りボタン（マウスの画面だけ。JS が行の幅で is-static と aria-disabled を付ける） */
	.short-grid__scroll {
		display: none;
	}

	@media (hover: hover) and (pointer: fine) {
		.short-grid--row .short-grid__scroll {
			position: absolute;
			top: 40%;
			z-index: 2;
			display: block;
			width: 44px;
			height: 44px;
			margin-top: -22px;
			padding: 0;
			border: 1px solid var(--c-line-strong);
			border-radius: 50%;
			background: var(--c-bg);
			box-shadow: var(--shadow-lift);
			cursor: pointer;
		}

		.short-grid--row .short-grid__scroll::after {
			content: "";
			position: absolute;
			top: 50%;
			left: 50%;
			width: 10px;
			height: 10px;
			border-top: 2px solid var(--c-ink);
			border-right: 2px solid var(--c-ink);
		}

		.short-grid--row .short-grid__scroll[aria-disabled="true"] {
			opacity: 0.3;
			cursor: default;
		}

		.short-grid--row .short-grid__scroll--prev {
			left: -22px;
		}

		.short-grid--row .short-grid__scroll--prev::after {
			transform: translate(-30%, -50%) rotate(-135deg);
		}

		.short-grid--row .short-grid__scroll--next {
			right: -22px;
		}

		.short-grid--row .short-grid__scroll--next::after {
			transform: translate(-70%, -50%) rotate(45deg);
		}

		.short-grid--row .short-grid__scroller.is-static .short-grid__scroll {
			display: none;
		}
	}

	@media (max-width: 600px) {
		.short-grid--row .short-grid__list,
		.short-grid--list .short-grid__list {
			display: flex;
			gap: 12px;
			padding-bottom: 8px;
			overflow-x: auto;
			scroll-snap-type: x mandatory;
			overscroll-behavior-x: contain;
		}

		.short-grid--row .short-grid__item,
		.short-grid--list .short-grid__item {
			flex: 0 0 72%;
			scroll-snap-align: start;
		}
	}

	/* ===== 問い合わせ ===== */
	.videos-cta {
		margin-top: var(--sp-8);
		text-align: center;
	}

	.videos-cta__btn,
	.video-detail__btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 56px;
		padding: 0 var(--sp-7);
		border: 2px solid var(--c-brand);
		border-radius: var(--radius-pill);
		background: var(--c-brand);
		color: var(--c-on-brand);
		font-weight: 700;
		text-decoration: none;
		transition: transform var(--dur-fast), box-shadow var(--dur-fast);
	}

	.videos-cta__btn {
		min-width: 280px;
	}

	.video-detail__btn--line {
		background: var(--c-bg);
		color: var(--c-ink);
	}

	.videos-cta__btn:hover,
	.video-detail__btn:hover {
		transform: translateY(-2px);
		box-shadow: var(--shadow-lift);
	}

	/* ===== 動画詳細 ===== */
	.video-detail {
		display: grid;
		grid-template-columns: minmax(0, calc((100% - 40px) / 3)) minmax(0, 1fr);
		gap: var(--sp-7);
		align-items: start;
	}

	.video-detail .video-detail__media .short-grid__list {
		display: block;
		margin: 0;
	}

	@media (max-width: 900px) {
		.video-detail {
			grid-template-columns: minmax(0, 1fr);
			gap: var(--sp-5);
		}

		.video-detail .video-detail__media {
			width: min(383px, 100%);
			margin: 0 auto;
		}
	}

	.video-detail__eyebrow {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: var(--sp-2);
		margin: 0;
		font-family: var(--f-en);
		font-size: var(--fs-sm);
		font-weight: 600;
		letter-spacing: var(--ls-en);
		color: var(--c-accent-text);
	}

	.video-detail__chip {
		display: inline-flex;
		align-items: center;
		min-height: 32px;
		padding: 0 12px;
		border: 1px solid var(--c-line-strong);
		border-radius: var(--radius-pill);
		color: var(--c-ink);
		font-family: var(--f-ja);
		font-size: var(--fs-xs);
		font-weight: 500;
		letter-spacing: 0;
		text-decoration: none;
	}

	.video-detail__title {
		margin-top: var(--sp-3);
		font-size: var(--fs-xl);
		line-height: 1.5;
	}

	.video-detail__meta {
		margin: var(--sp-2) 0 0;
		font-size: var(--fs-sm);
		color: var(--c-ink-mute);
	}

	.video-detail__summary {
		position: relative;
		margin-top: var(--sp-5);
		padding: var(--sp-4) var(--sp-5) var(--sp-4) 34px;
		border-radius: var(--radius-md);
		background: var(--c-soft);
	}

	.video-detail__summary::before {
		content: "";
		position: absolute;
		left: 14px;
		top: calc(var(--sp-4) + 0.2em);
		width: 8px;
		height: 1.1em;
		background: var(--c-brand);
		clip-path: var(--clip-tag);
	}

	.video-detail__summary-ttl {
		margin: 0;
		font-size: var(--fs-sm);
		font-weight: 700;
	}

	.video-detail__punch {
		margin: 6px 0 0;
		font-size: var(--fs-lg);
		font-weight: 700;
		line-height: 1.6;
	}

	.video-detail__chapters {
		margin: var(--sp-3) 0 0;
		padding-left: 1.4em;
		font-size: var(--fs-sm);
		line-height: 1.9;
	}

	.video-detail__actions {
		display: flex;
		flex-wrap: wrap;
		gap: var(--sp-3);
		margin-top: var(--sp-6);
	}

	@media (max-width: 600px) {
		.video-detail__actions {
			flex-direction: column;
		}
	}

	.video-detail__sub {
		margin: var(--sp-4) 0 0;
		font-size: var(--fs-sm);
	}

	.video-detail__sub a {
		color: var(--c-accent-text);
	}

	.video-detail__note {
		margin: var(--sp-3) 0 0;
		font-size: var(--fs-xs);
		line-height: 1.7;
		color: var(--c-ink-mute);
	}

	/* 課題・業種から探す（ドラマの案内先のサービスに合うもの） */
	.video-detail .related-service-guides {
		margin-top: var(--sp-5);
		padding: var(--sp-4) var(--sp-5);
		border-radius: var(--radius-md);
		background: var(--c-soft);
	}

	.video-detail .related-service-guides__label {
		margin: 0;
		font-size: var(--fs-sm);
		font-weight: 700;
	}

	.video-detail .guide-pills {
		display: flex;
		flex-wrap: wrap;
		gap: var(--sp-2);
		margin: var(--sp-3) 0 0;
		padding: 0;
		list-style: none;
	}

	.video-detail .guide-pills a {
		display: inline-block;
		padding: 4px 14px;
		border: 1px solid var(--c-line-strong);
		border-radius: var(--radius-pill);
		background: var(--c-bg);
		font-size: var(--fs-sm);
		text-decoration: none;
	}

	/* 台本（開閉） */
	.video-script {
		margin-top: var(--sp-8);
		border: 1px solid var(--c-line);
		border-radius: var(--radius-md);
		background: var(--c-bg);
	}

	.video-script summary {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 56px;
		padding: 0 var(--sp-5);
		font-weight: 700;
		cursor: pointer;
		list-style: none;
	}

	.video-script summary::-webkit-details-marker {
		display: none;
	}

	.video-script summary::after {
		content: "＋";
		font-weight: 400;
	}

	.video-script[open] summary::after {
		content: "－";
	}

	.video-script .video-script__body {
		padding: 0 var(--sp-5) var(--sp-5);
	}

	.video-script__h {
		margin: var(--sp-4) 0 6px;
		font-size: var(--fs-md);
	}

	.video-script__line {
		margin: 0 0 var(--sp-2);
		font-size: var(--fs-sm);
		line-height: 1.9;
	}

	.video-script__who {
		display: inline-block;
		min-width: 4.5em;
		margin-right: var(--sp-2);
		font-weight: 700;
		color: var(--c-accent-text);
	}

	.video-related {
		margin-top: var(--sp-7);
	}

	/* ===== SP（600px 以下）の縦スワイプ。scripts.js が body に is-video-feed を付けたときだけ全画面に出す ===== */
	.video-feed {
		display: none;
	}

	@media (max-width: 600px) {
		body.is-video-feed {
			overflow: hidden;
		}

		body.is-video-feed main,
		body.is-video-feed .v2-loop {
			display: none;
		}

		body.is-video-feed .video-feed {
			position: fixed;
			inset: 0;
			z-index: 10000;
			display: block;
			background: #000;
			color: #fff;
		}

		.video-feed__bar {
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			z-index: 3;
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 52px;
			padding: 0 14px;
			background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
		}

		.video-feed__back {
			display: inline-flex;
			align-items: center;
			min-height: 44px;
			color: #fff;
			font-size: var(--fs-md);
			font-weight: 700;
			text-decoration: none;
		}

		.video-feed__count {
			font-size: var(--fs-xs);
			opacity: 0.85;
		}

		.video-feed__track {
			height: 100%;
			overflow-y: auto;
			scroll-snap-type: y mandatory;
			overscroll-behavior: contain;
		}

		.video-feed__slide {
			position: relative;
			height: 100dvh;
			overflow: hidden;
			scroll-snap-align: start;
			scroll-snap-stop: always;
		}

		.video-feed__slide iframe {
			position: absolute;
			inset: 0;
			width: 100%;
			height: 100%;
			border: 0;
		}

		.video-feed__poster {
			position: absolute;
			inset: 0;
			width: 100%;
			height: 100%;
			margin: 0;
			padding: 0;
			border: 0;
			background: #000;
			cursor: pointer;
		}

		.video-feed__poster img {
			display: block;
			width: 100%;
			height: 100%;
			object-fit: contain;
			object-position: 50% 52px;
		}

		.video-feed__poster:focus-visible {
			outline: 3px solid #fff;
			outline-offset: -3px;
		}

		.video-feed__sound {
			position: absolute;
			top: 60px;
			right: 12px;
			z-index: 3;
			display: inline-flex;
			align-items: center;
			gap: 6px;
			min-height: 44px;
			padding: 0 16px;
			border: 1px solid rgba(255, 255, 255, 0.85);
			border-radius: var(--radius-pill);
			background: rgba(0, 0, 0, 0.6);
			color: #fff;
			font-size: var(--fs-sm);
			font-weight: 700;
		}

		.video-feed__sound[hidden] {
			display: none;
		}

		.video-feed__playicon {
			position: absolute;
			left: 50%;
			top: 50%;
			width: 72px;
			height: 72px;
			margin: -36px 0 0 -36px;
			border-radius: 50%;
			background: rgba(0, 0, 0, 0.55);
			pointer-events: none;
		}

		.video-feed__playicon::after {
			content: "";
			position: absolute;
			left: 29px;
			top: 22px;
			border-style: solid;
			border-width: 14px 0 14px 22px;
			border-color: transparent transparent transparent #fff;
		}

		.video-feed__info {
			position: absolute;
			left: 0;
			right: 76px;
			bottom: 0;
			z-index: 2;
			padding: 80px 16px calc(20px + env(safe-area-inset-bottom));
			background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
			pointer-events: none;
		}

		.video-feed__info a,
		.video-feed__info button {
			pointer-events: auto;
		}

		.video-feed__eyebrow {
			margin: 0;
			font-size: var(--fs-xs);
			opacity: 0.9;
		}

		.video-feed__title {
			margin: 6px 0 0;
			color: #fff;
			font-size: var(--fs-lg);
			line-height: 1.5;
		}

		.video-feed__btns {
			display: flex;
			gap: 8px;
			margin-top: 12px;
		}

		.video-feed__btn {
			display: inline-flex;
			align-items: center;
			justify-content: center;
			min-height: 44px;
			padding: 0 16px;
			border: 1px solid rgba(255, 255, 255, 0.8);
			border-radius: var(--radius-pill);
			background: rgba(0, 0, 0, 0.35);
			color: #fff;
			font-size: var(--fs-sm);
			font-weight: 700;
			text-decoration: none;
		}

		.video-feed__btn--fill {
			border-color: #fff;
			background: #fff;
			color: var(--c-ink);
		}

		.video-feed__side {
			position: absolute;
			right: 10px;
			bottom: calc(120px + env(safe-area-inset-bottom));
			z-index: 2;
			display: flex;
			flex-direction: column;
			gap: 18px;
		}

		.video-feed__side-btn {
			display: flex;
			flex-direction: column;
			align-items: center;
			gap: 4px;
			width: 56px;
			color: #fff;
			font-size: var(--fs-xs);
			text-decoration: none;
			text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
		}

		.video-feed__side-btn span {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 44px;
			height: 44px;
			border-radius: 50%;
			background: rgba(0, 0, 0, 0.45);
			font-size: var(--fs-md);
		}

		.video-feed__hint {
			position: absolute;
			left: 0;
			right: 0;
			bottom: calc(170px + env(safe-area-inset-bottom));
			z-index: 1;
			margin: 0;
			text-align: center;
			font-size: var(--fs-xs);
			opacity: 0.8;
			pointer-events: none;
		}

		.video-feed__sheet {
			position: absolute;
			inset: 0;
			z-index: 5;
			display: flex;
			align-items: flex-end;
			background: rgba(0, 0, 0, 0.45);
		}

		.video-feed__sheet[hidden] {
			display: none;
		}

		.video-feed__sheet .video-detail__btn {
			width: 100%;
			margin-top: 12px;
		}

		.video-feed__sheet-in {
			position: relative;
			width: 100%;
			max-height: 78dvh;
			overflow-y: auto;
			padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
			border-radius: 16px 16px 0 0;
			background: var(--c-bg);
			color: var(--c-ink);
		}

		.video-feed__sheet-title {
			margin: 0 44px 8px 0;
			font-size: var(--fs-lg);
			font-weight: 700;
			line-height: 1.5;
		}

		.video-feed__close {
			position: absolute;
			top: 12px;
			right: 12px;
			width: 44px;
			height: 44px;
			border: 0;
			border-radius: 50%;
			background: var(--c-soft);
			color: var(--c-ink);
			font-size: var(--fs-lg);
		}
	}
}
