/*
Theme Name: YT Matome
Theme URI: https://github.com/example/wp-theme-yt
Author: Theme Author
Description: 動画まとめサイト向けの YouTube 風タイルレイアウトテーマ。アイキャッチ上にチャンネル名をオーバーレイ表示します。
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: yt-matome
*/

:root {
	--yt-bg: #0f0f0f;
	--yt-surface: #212121;
	--yt-surface-hover: #3f3f3f;
	--yt-text: #f1f1f1;
	--yt-text-muted: #aaaaaa;
	--yt-accent: #ff0000;
	--yt-header-h: 56px;
	--yt-gap: 12px;
	--yt-radius: 12px;
	--yt-overlay-bg: rgba(0, 0, 0, 0.72);
	--yt-font: "Roboto", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	font-family: var(--yt-font);
	font-size: 14px;
	line-height: 1.4;
	color: var(--yt-text);
	background: var(--yt-bg);
}

a {
	color: inherit;
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	gap: 16px;
	height: var(--yt-header-h);
	padding: 0 16px;
	background: var(--yt-bg);
	border-bottom: 1px solid #303030;
}

.site-header__brand {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	font-size: 18px;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.site-header__brand:hover {
	text-decoration: none;
}

.site-header__logo-icon {
	display: inline-flex;
	width: 28px;
	height: 20px;
	background: var(--yt-accent);
	border-radius: 4px 8px 8px 4px;
	position: relative;
}

.site-header__logo-icon::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-35%, -50%);
	border-style: solid;
	border-width: 5px 0 5px 8px;
	border-color: transparent transparent transparent #fff;
}

.site-header__search {
	flex: 1;
	max-width: 640px;
	margin: 0 auto;
	display: flex;
}

.site-header__search input[type="search"] {
	flex: 1;
	min-width: 0;
	height: 40px;
	padding: 0 16px;
	border: 1px solid #303030;
	border-right: none;
	border-radius: 40px 0 0 40px;
	background: #121212;
	color: var(--yt-text);
	font-size: 16px;
}

.site-header__search input[type="search"]:focus {
	outline: 2px solid #1c62b9;
	outline-offset: 0;
	border-color: #1c62b9;
}

.site-header__search button {
	width: 64px;
	height: 40px;
	border: 1px solid #303030;
	border-radius: 0 40px 40px 0;
	background: var(--yt-surface);
	color: var(--yt-text);
	cursor: pointer;
}

.site-header__search button:hover {
	background: var(--yt-surface-hover);
}

.site-header__menu-toggle {
	display: none;
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--yt-text);
	cursor: pointer;
}

.site-main {
	width: 100%;
	max-width: none;
	padding: var(--yt-gap);
}

.video-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
	gap: var(--yt-gap);
	width: 100%;
}

@media (min-width: 600px) {
	.video-grid {
		grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	}
}

@media (min-width: 1280px) {
	.video-grid {
		grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
		gap: 16px;
		padding: 0 4px;
	}
}

.video-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.video-card__link {
	display: block;
	color: inherit;
}

.video-card__link:hover {
	text-decoration: none;
}

.video-card__thumb-wrap {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: var(--yt-radius);
	overflow: hidden;
	background: var(--yt-surface);
}

.video-card__thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.2s ease;
}

.video-card__link:hover .video-card__thumb {
	transform: scale(1.03);
}

.video-card__channel {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	max-width: calc(100% - 16px);
	padding: 4px 8px;
	border-radius: 4px;
	background: var(--yt-overlay-bg);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	backdrop-filter: blur(4px);
}

.video-card__duration {
	position: absolute;
	bottom: 8px;
	right: 8px;
	z-index: 2;
	padding: 2px 6px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
}

.video-card__placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
	color: var(--yt-text-muted);
	font-size: 13px;
}

.video-card__body {
	padding: 10px 4px 4px;
}

.video-card__title {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var(--yt-text);
}

.video-card__meta {
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--yt-text-muted);
}

.pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 32px 0 16px;
	padding: 0;
	list-style: none;
}

.pagination a,
.pagination span {
	display: inline-block;
	padding: 8px 14px;
	border-radius: 8px;
	background: var(--yt-surface);
	color: var(--yt-text);
}

.pagination .current {
	background: var(--yt-text);
	color: var(--yt-bg);
}

.page-header {
	margin: 0 0 20px;
	padding: 0 4px;
}

.page-header h1 {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
}

.page-header p {
	margin: 8px 0 0;
	color: var(--yt-text-muted);
}

/* Single post */
.single-layout {
	max-width: 960px;
	margin: 0 auto;
	padding: var(--yt-gap);
}

.single-video__player {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: var(--yt-radius);
	overflow: hidden;
	background: #000;
	margin-bottom: 16px;
}

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

.single-video__title {
	margin: 0 0 12px;
	font-size: clamp(18px, 4vw, 22px);
	font-weight: 600;
	line-height: 1.3;
}

.single-video__channel-badge {
	display: inline-block;
	margin-bottom: 12px;
	padding: 6px 12px;
	border-radius: 6px;
	background: var(--yt-surface);
	font-weight: 600;
}

.single-video__content {
	color: #e0e0e0;
	font-size: 15px;
	line-height: 1.7;
}

.single-video__content p {
	margin: 0 0 1em;
}

.no-results {
	padding: 48px 16px;
	text-align: center;
	color: var(--yt-text-muted);
}

.site-footer {
	margin-top: 24px;
	padding: 24px 16px;
	border-top: 1px solid #303030;
	text-align: center;
	font-size: 12px;
	color: var(--yt-text-muted);
}

@media (max-width: 640px) {
	.site-header__search {
		display: none;
	}

	.site-header__menu-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	.site-main {
		padding: 8px;
	}

	.video-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
		gap: 8px;
	}

	.video-card__title {
		font-size: 13px;
	}

	.video-card__channel {
		font-size: 11px;
		top: 6px;
		left: 6px;
	}
}

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	position: absolute !important;
	height: 1px;
	width: 1px;
	overflow: hidden;
}
