/**
 * テンプレート一覧ページ専用CSS
 * AI開発実践ラボ — Creative Content Lab Tokyo
 */

/* ========================================================
   ヒーロー
   ======================================================== */
.tpl-hero {
	position: relative;
	min-height: clamp(300px, 35vw, 400px);
	background: #0D1117;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	overflow: hidden;
}

.tpl-hero-overlay {
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse at 50% 120%, rgba(43, 108, 176, 0.18) 0%, transparent 70%);
	z-index: 1;
}

/* スラッシュ装飾（front-pageと同パターン） */
.tpl-hero-slash {
	position: absolute;
	inset: 0;
	z-index: 1;
	overflow: hidden;
}

.tpl-hero-slash::before,
.tpl-hero-slash::after {
	content: "";
	position: absolute;
	width: 200%;
	height: 100%;
	top: 0;
	left: -50%;
}

.tpl-hero-slash::before {
	background: repeating-linear-gradient(
		-60deg,
		transparent,
		transparent 80px,
		rgba(255, 255, 255, 0.015) 80px,
		rgba(255, 255, 255, 0.015) 81px
	);
}

.tpl-hero-slash::after {
	background: repeating-linear-gradient(
		60deg,
		transparent,
		transparent 120px,
		rgba(255, 255, 255, 0.01) 120px,
		rgba(255, 255, 255, 0.01) 121px
	);
}

.tpl-hero-inner {
	position: relative;
	z-index: 2;
	padding: 64px 20px;
}

.tpl-hero-badges {
	margin-bottom: 20px;
}

.tpl-hero-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: "Space Grotesk", sans-serif;
	font-size: 13px;
	color: rgba(255, 255, 255, 0.7);
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 40px;
	padding: 6px 16px;
	letter-spacing: 0.02em;
}

.tpl-hero-badge-num {
	font-weight: 700;
	font-size: 16px;
	color: #fff;
}

.tpl-hero-title {
	font-size: 36px;
	font-weight: 700;
	color: #fff;
	line-height: 1.3;
	margin: 0 0 12px;
}

.tpl-hero-sub {
	font-size: 15px;
	color: rgba(255, 255, 255, 0.85);
	line-height: 1.7;
	margin: 0;
}

/* ========================================================
   フィルタ
   ======================================================== */
.tpl-filter {
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 20px 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.tpl-filter-btn {
	display: inline-flex;
	align-items: center;
	padding: 8px 20px;
	border-radius: 40px;
	border: 1px solid #E2E8F0;
	background: transparent;
	color: var(--color-sub, #718096);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
	white-space: nowrap;
}

.tpl-filter-btn:hover {
	border-color: var(--color-primary, #2B6CB0);
	color: var(--color-primary, #2B6CB0);
}

.tpl-filter-btn.is-active {
	background: var(--color-primary, #2B6CB0);
	border-color: var(--color-primary, #2B6CB0);
	color: #fff;
}

/* ========================================================
   カードグリッド
   ======================================================== */
.tpl-grid {
	max-width: 1200px;
	margin: 32px auto 0;
	padding: 0 20px 64px;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}

.tpl-empty {
	grid-column: 1 / -1;
	text-align: center;
	color: var(--color-sub, #718096);
	padding: 48px 0;
}

/* ========================================================
   カード
   ======================================================== */
.tpl-card {
	background: #fff;
	border: 1px solid #E2E8F0;
	border-radius: 12px;
	padding: 24px;
	text-decoration: none;
	color: inherit;
	display: flex;
	gap: 16px;
	align-items: flex-start;
	transition: box-shadow 0.2s, transform 0.2s;
}

.tpl-card:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
	transform: translateY(-2px);
}

.tpl-card:focus-visible {
	outline: 2px solid var(--color-primary, #2B6CB0);
	outline-offset: 2px;
}

/* 非表示カード */
.tpl-card[hidden] {
	display: none;
}

/* ========================================================
   カードアイコン
   ======================================================== */
.tpl-card-icon {
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	background: var(--color-primary-tint, #DBEAFE);
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-primary, #2B6CB0);
}

.tpl-card-icon svg {
	width: 20px;
	height: 20px;
}

/* ========================================================
   カード本体
   ======================================================== */
.tpl-card-body {
	flex: 1;
	min-width: 0;
}

.tpl-card-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--color-heading, #2D3748);
	line-height: 1.4;
	margin: 0;
}

.tpl-card-excerpt {
	font-size: 13px;
	color: var(--color-sub, #718096);
	line-height: 1.6;
	margin: 6px 0 0;
}

.tpl-card-tags {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 10px;
}

.tpl-card-tag {
	font-size: 11px;
	color: var(--color-sub, #718096);
	background: #F0F4F8;
	padding: 3px 8px;
	border-radius: 4px;
	white-space: nowrap;
}

/* ========================================================
   CTA
   ======================================================== */
.tpl-cta {
	background: linear-gradient(160deg, #EBF4FF, #F0F4F8, #E8F0FB);
	border-top: 4px solid var(--color-primary, #2B6CB0);
	text-align: center;
	padding: 64px 20px;
}

.tpl-cta-inner {
	max-width: 640px;
	margin: 0 auto;
}

.tpl-cta-title {
	font-size: 24px;
	font-weight: 700;
	color: var(--color-heading, #2D3748);
	line-height: 1.4;
	margin: 0 0 16px;
}

.tpl-cta-sub {
	font-size: 15px;
	color: var(--color-body, #4A5568);
	line-height: 1.8;
	margin: 0 0 32px;
}

.tpl-cta-btns {
	margin-bottom: 20px;
}

.tpl-cta-secondary {
	margin-top: 12px;
}

.tpl-cta-link {
	font-size: 14px;
	color: var(--color-primary, #2B6CB0);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s;
}

.tpl-cta-link:hover {
	border-bottom-color: var(--color-primary, #2B6CB0);
}

/* ========================================================
   レスポンシブ（旧デザイン用）
   ======================================================== */
@media (max-width: 768px) {
	.tpl-hero-title {
		font-size: 28px;
	}

	.tpl-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;
	}

	.tpl-cta-title {
		font-size: 20px;
	}
}

@media (max-width: 480px) {
	.tpl-hero-title {
		font-size: 24px;
	}

	.tpl-hero-sub {
		font-size: 14px;
	}

	.tpl-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.tpl-card {
		padding: 20px;
	}

	.tpl-filter {
		padding: 32px 16px 0;
	}

	.tpl-filter-btn {
		padding: 6px 16px;
		font-size: 13px;
	}
}

/* ========================================================
   テンプレート一覧 v2（blog-archive流用レイアウト）
   ======================================================== */

/* 検索バー */
.tpl-search {
	max-width: 600px;
	margin: 24px auto 32px;
}
.tpl-search-input {
	width: 100%;
	padding: 12px 20px;
	font-size: 15px;
	border: 2px solid var(--color-border, #E2E8F0);
	border-radius: 10px;
	outline: none;
	transition: border-color 0.2s;
	box-sizing: border-box;
	background: var(--color-bg-white, #FFFFFF);
	color: var(--color-body, #4A5568);
}
.tpl-search-input::placeholder {
	color: var(--color-sub, #718096);
}
.tpl-search-input:focus {
	border-color: var(--color-primary, #2B6CB0);
}

/* 表示切替+並び替えコントロール */
.tpl-controls {
	display: flex;
	align-items: center;
	gap: 16px;
}
.tpl-view-toggle {
	display: flex;
	gap: 2px;
	background: var(--color-bg-gray, #F0F0F0);
	border-radius: 8px;
	padding: 2px;
}
.tpl-view-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border: none;
	border-radius: 6px;
	background: transparent;
	cursor: pointer;
	color: var(--color-sub, #718096);
	font-size: 13px;
	font-weight: 500;
	transition: all 0.2s;
	white-space: nowrap;
}
.tpl-view-btn:hover {
	color: var(--color-heading, #2D3748);
}
.tpl-view-btn.is-active {
	background: #FFFFFF;
	color: var(--color-heading, #2D3748);
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.tpl-view-btn svg {
	flex-shrink: 0;
}

/* リスト表示（デフォルト非表示） */
.tpl-list {
	display: none;
}
.tpl-list-table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid var(--color-border, #E2E8F0);
}
.tpl-list-table th {
	font-size: 12px;
	color: var(--color-sub, #718096);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	padding: 8px 12px;
	border-bottom: 2px solid var(--color-border, #E2E8F0);
	border-right: 1px solid var(--color-bg-gray, #F0F0F0);
	text-align: left;
	font-weight: 600;
	cursor: pointer;
	user-select: none;
	position: relative;
	white-space: nowrap;
}
.tpl-list-table th:last-child {
	border-right: none;
}
.tpl-list-table th:hover {
	background: var(--color-bg-light, #F8FAFC);
}
.tpl-sort-icon {
	display: inline-block;
	margin-left: 4px;
	font-size: 10px;
	color: var(--color-sub, #718096);
	vertical-align: middle;
}
.tpl-list-table th.sort-asc .tpl-sort-icon::after { content: '▲'; }
.tpl-list-table th.sort-desc .tpl-sort-icon::after { content: '▼'; }
.tpl-list-table th:not(.sort-asc):not(.sort-desc) .tpl-sort-icon::after { content: '⇅'; opacity: 0.4; }
.tpl-resize-handle {
	position: absolute;
	top: 0;
	right: 0;
	width: 5px;
	height: 100%;
	cursor: col-resize;
	background: transparent;
}
.tpl-resize-handle:hover,
.tpl-resize-handle.is-dragging {
	background: var(--color-primary, #2B6CB0);
	opacity: 0.3;
}
.tpl-list-table td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--color-bg-gray, #F0F0F0);
	font-size: 14px;
	color: var(--color-body, #4A5568);
}
.tpl-list-table tr:last-child td {
	border-bottom: none;
}
.tpl-list-table tr:hover td {
	background: var(--color-bg-light, #F8FAFC);
}
.tpl-list-table a {
	color: var(--color-heading, #2D3748);
	text-decoration: none;
	font-weight: 600;
}
.tpl-list-table a:hover {
	color: var(--color-primary, #2B6CB0);
}

/* ファイル形式バッジ */
.tpl-format-icon {
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 4px;
	display: inline-block;
}
.tpl-format-excel { background: #E6F4EA; color: #1E7E34; }
.tpl-format-ppt   { background: #FFF3E0; color: #E65100; }
.tpl-format-word  { background: #E3F2FD; color: #1565C0; }

.blog-card-format {
	position: absolute;
	top: 12px;
	right: 12px;
}

/* 工程バッジ */
.tpl-phase-badge {
	font-size: 11px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 4px;
	white-space: nowrap;
	display: inline-block;
}
.tpl-phase-pm     { background: #EBF5FB !important; color: #1A5276 !important; }
.tpl-phase-rd     { background: #F5EEF8 !important; color: #6C3483 !important; }
.tpl-phase-design { background: #FEF9E7 !important; color: #7D6608 !important; }
.tpl-phase-dev    { background: #E8F8F5 !important; color: #0E6655 !important; }
.tpl-phase-test   { background: #FDEDEC !important; color: #922B21 !important; }
.tpl-phase-deploy { background: #EBF5FB !important; color: #1F618D !important; }
.tpl-phase-ops    { background: #F0F4F8 !important; color: #2D3748 !important; }
.tpl-phase-other  { background: #F0F0F0 !important; color: #718096 !important; }

/* CTA上書き */
.tpl-cta {
	margin-top: 48px;
}
.tpl-cta .training-cta {
	border-radius: 12px;
}

#tpl-no-results {
	display: none;
}

/* レスポンシブ（v2） */
@media (max-width: 768px) {
	.tpl-controls {
		width: 100%;
		justify-content: space-between;
	}
	.blog-filters {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}
	.tpl-list-table th:nth-child(3),
	.tpl-list-table td:nth-child(3),
	.tpl-list-table th:nth-child(4),
	.tpl-list-table td:nth-child(4) {
		display: none;
	}
}
