/*
 * Theme T&B — Homepage Styles
 *
 * Styles for all homepage sections.
 * Implements 04D-Homepage-UI.md specification.
 *
 * @package ThemeTB
 * @version 2.0.0
 */

/* =========================================================
   Homepage Styles
   =========================================================
   Full-page atmospheric backgrounds live in page-backgrounds.css
   (body.tb-bg-home). Do not set body.home backgrounds here —
   WordPress often assigns both "home" and "blog" body classes,
   which previously caused green blog styles to override home blue.
   ========================================================= */

/* =========================================================
   Hero Section
   ========================================================= */

.tb-hero {
	position: relative;
	padding-block: var(--tb-space-32);
	overflow: hidden;
	background: linear-gradient(135deg, var(--tb-color-primary-50) 0%, var(--tb-bg) 60%);
}

.tb-hero__bg {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse at 20% 50%, rgb(37 99 235 / 0.08) 0%, transparent 60%),
		radial-gradient(ellipse at 80% 20%, rgb(124 58 237 / 0.06) 0%, transparent 50%);
	pointer-events: none;
}

.tb-hero__content {
	position: relative;
	text-align: center;
	max-width: 800px;
	margin-inline: auto;
}

.tb-hero__title {
	font-size: var(--tb-text-6xl);
	font-weight: var(--tb-font-extrabold);
	line-height: var(--tb-leading-tight);
	margin-bottom: var(--tb-space-6);
	background: linear-gradient(135deg, var(--tb-color-primary) 0%, var(--tb-color-accent) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.tb-hero__subtitle {
	font-size: var(--tb-text-xl);
	color: var(--tb-text-secondary);
	margin-bottom: var(--tb-space-10);
	line-height: var(--tb-leading-relaxed);
}

.tb-hero__actions {
	display: flex;
	gap: var(--tb-space-4);
	justify-content: center;
	flex-wrap: wrap;
}

@media (max-width: 768px) {
	.tb-hero {
		padding-block: var(--tb-space-20);
	}
	.tb-hero__title {
		font-size: var(--tb-text-4xl);
	}
	.tb-hero__subtitle {
		font-size: var(--tb-text-lg);
	}
}

/* =========================================================
   Search Hero
   ========================================================= */

.tb-section--search {
	padding-block: var(--tb-space-12);
	background: var(--tb-bg-secondary);
}

.tb-search-hero__form {
	display: flex;
	gap: var(--tb-space-2);
	max-width: 640px;
	margin-inline: auto;
}

.tb-search-hero__input {
	flex: 1;
	padding: var(--tb-space-4) var(--tb-space-5);
	border: 2px solid var(--tb-border);
	border-radius: var(--tb-radius-xl);
	background: var(--tb-surface);
	color: var(--tb-text-primary);
	font-size: var(--tb-text-base);
	transition: border-color var(--tb-duration-fast), box-shadow var(--tb-duration-fast);
}

.tb-search-hero__input:focus {
	outline: none;
	border-color: var(--tb-color-primary);
	box-shadow: 0 0 0 4px rgb(37 99 235 / 0.1);
}

.tb-search-hero__btn {
	padding: var(--tb-space-4) var(--tb-space-8);
	background: var(--tb-color-primary);
	color: var(--tb-text-inverse);
	border-radius: var(--tb-radius-xl);
	font-weight: var(--tb-font-semibold);
	transition: background var(--tb-duration-fast);
}

.tb-search-hero__btn:hover {
	background: var(--tb-color-primary-dark);
}

.tb-search-hero__results {
	max-width: 640px;
	margin-inline: auto;
	margin-top: var(--tb-space-2);
}

/* =========================================================
   Category Grid — Snake Glow Borders
   ========================================================= */

.tb-categories-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: var(--tb-space-4);
}

/* Base card — transparent bg for snake glow */
.tb-category-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--tb-space-2);
	padding: var(--tb-space-6);
	background: transparent;
	border: none;
	border-radius: var(--tb-radius-xl);
	text-align: center;
	transition: all var(--tb-duration-normal);
	text-decoration: none;
	position: relative;
	overflow: hidden;
}

/* Inner content — sits above snake border */
.tb-category-card__name,
.tb-category-card__count {
	position: relative;
	z-index: 1;
	background: var(--tb-card-bg, #fff);
	margin: 2px;
	padding: var(--tb-space-1) var(--tb-space-3);
	border-radius: calc(var(--tb-radius-xl) - 4px);
}

/* Snake glow rotating element */
.tb-category-card::before {
	content: '';
	position: absolute;
	top: -50%;
	left: -50%;
	width: 200%;
	height: 200%;
	border-radius: inherit;
	animation: tb-snake-spin 3s linear infinite;
}

/* Color 1 — Cyan */
.tb-categories-grid .tb-category-card:nth-child(1)::before {
	background: conic-gradient(from 0deg, transparent 0%, rgba(6,182,212,0.1) 5%, #06B6D4 12%, #22D3EE 20%, #67E8F9 28%, #A5F3FC 35%, rgba(6,182,212,0.1) 42%, transparent 50%, transparent 100%);
}
/* Color 2 — Purple */
.tb-categories-grid .tb-category-card:nth-child(2)::before {
	background: conic-gradient(from 0deg, transparent 0%, rgba(124,58,237,0.1) 5%, #7C3AED 12%, #A78BFA 20%, #C4B5FD 28%, #DDD6FE 35%, rgba(124,58,237,0.1) 42%, transparent 50%, transparent 100%);
}
/* Color 3 — Green */
.tb-categories-grid .tb-category-card:nth-child(3)::before {
	background: conic-gradient(from 0deg, transparent 0%, rgba(16,185,129,0.1) 5%, #10B981 12%, #34D399 20%, #6EE7B7 28%, #A7F3D0 35%, rgba(16,185,129,0.1) 42%, transparent 50%, transparent 100%);
}
/* Color 4 — Amber */
.tb-categories-grid .tb-category-card:nth-child(4)::before {
	background: conic-gradient(from 0deg, transparent 0%, rgba(245,158,11,0.1) 5%, #F59E0B 12%, #FBBF24 20%, #FDE68A 28%, #FEF3C7 35%, rgba(245,158,11,0.1) 42%, transparent 50%, transparent 100%);
}
/* Color 5 — Rose */
.tb-categories-grid .tb-category-card:nth-child(5)::before {
	background: conic-gradient(from 0deg, transparent 0%, rgba(244,63,94,0.1) 5%, #F43F5E 12%, #FB7185 20%, #FDA4AF 28%, #FECDD3 35%, rgba(244,63,94,0.1) 42%, transparent 50%, transparent 100%);
}
/* Color 6 — Blue */
.tb-categories-grid .tb-category-card:nth-child(6)::before {
	background: conic-gradient(from 0deg, transparent 0%, rgba(59,130,246,0.1) 5%, #3B82F6 12%, #60A5FA 20%, #93C5FD 28%, #BFDBFE 35%, rgba(59,130,246,0.1) 42%, transparent 50%, transparent 100%);
}
/* Color 7 — Indigo */
.tb-categories-grid .tb-category-card:nth-child(7)::before {
	background: conic-gradient(from 0deg, transparent 0%, rgba(99,102,241,0.1) 5%, #6366F1 12%, #818CF8 20%, #A5B4FC 28%, #C7D2FE 35%, rgba(99,102,241,0.1) 42%, transparent 50%, transparent 100%);
}
/* Color 8 — Teal */
.tb-categories-grid .tb-category-card:nth-child(8)::before {
	background: conic-gradient(from 0deg, transparent 0%, rgba(20,184,166,0.1) 5%, #14B8A6 12%, #2DD4BF 20%, #5EEAD4 28%, #99F6E4 35%, rgba(20,184,166,0.1) 42%, transparent 50%, transparent 100%);
}

/* Hover glow effect */
.tb-category-card:nth-child(1):hover { box-shadow: 0 8px 32px rgba(6,182,212,0.3); }
.tb-category-card:nth-child(2):hover { box-shadow: 0 8px 32px rgba(124,58,237,0.3); }
.tb-category-card:nth-child(3):hover { box-shadow: 0 8px 32px rgba(16,185,129,0.3); }
.tb-category-card:nth-child(4):hover { box-shadow: 0 8px 32px rgba(245,158,11,0.3); }
.tb-category-card:nth-child(5):hover { box-shadow: 0 8px 32px rgba(244,63,94,0.3); }
.tb-category-card:nth-child(6):hover { box-shadow: 0 8px 32px rgba(59,130,246,0.3); }
.tb-category-card:nth-child(7):hover { box-shadow: 0 8px 32px rgba(99,102,241,0.3); }
.tb-category-card:nth-child(8):hover { box-shadow: 0 8px 32px rgba(20,184,166,0.3); }

.tb-category-card:hover {
	transform: translateY(-4px);
}

/* Name and count text */
.tb-category-card__name {
	font-weight: var(--tb-font-semibold);
	color: var(--tb-text-primary);
	font-size: var(--tb-text-sm);
}

.tb-category-card__count {
	color: var(--tb-text-muted);
	font-size: var(--tb-text-xs);
}

/* =========================================================
   Newsletter Section
   ========================================================= */

.tb-section--newsletter {
	background: linear-gradient(135deg, var(--tb-color-primary) 0%, var(--tb-color-accent) 100%);
	color: var(--tb-text-inverse);
}

.tb-newsletter {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--tb-space-10);
	flex-wrap: wrap;
}

.tb-newsletter__content {
	flex: 1;
	min-width: 280px;
}

.tb-newsletter__title {
	color: var(--tb-text-inverse);
	font-size: var(--tb-text-3xl);
	margin-bottom: var(--tb-space-3);
}

.tb-newsletter__subtitle {
	color: rgb(255 255 255 / 0.85);
	margin: 0;
}

.tb-newsletter__form {
	flex: 1;
	min-width: 280px;
}

.tb-newsletter__default-form {
	display: flex;
	gap: var(--tb-space-2);
}

.tb-newsletter__default-form input {
	flex: 1;
	padding: var(--tb-space-3) var(--tb-space-4);
	border: 2px solid rgb(255 255 255 / 0.3);
	border-radius: var(--tb-radius-lg);
	background: rgb(255 255 255 / 0.15);
	color: var(--tb-text-inverse);
	font-size: var(--tb-text-base);
}

.tb-newsletter__default-form input::placeholder {
	color: rgb(255 255 255 / 0.7);
}

.tb-newsletter__default-form input:focus {
	outline: none;
	border-color: rgb(255 255 255 / 0.8);
	background: rgb(255 255 255 / 0.2);
}

.tb-newsletter__default-form .tb-btn--primary {
	background: var(--tb-text-inverse);
	color: var(--tb-color-primary);
	border-color: var(--tb-text-inverse);
}

.tb-newsletter__default-form .tb-btn--primary:hover {
	background: var(--tb-color-primary-50);
}

.tb-newsletter__message {
	margin-top: var(--tb-space-3);
	padding: var(--tb-space-3) var(--tb-space-4);
	border-radius: var(--tb-radius-lg);
	font-size: var(--tb-text-sm);
	font-weight: var(--tb-font-medium);
}

.tb-newsletter__message--success {
	background: rgb(255 255 255 / 0.2);
	color: #fff;
	border: 1px solid rgb(255 255 255 / 0.3);
}

.tb-newsletter__message--error {
	background: rgb(0 0 0 / 0.2);
	color: #fff;
	border: 1px solid rgb(255 255 255 / 0.3);
}

.tb-newsletter__message--duplicate {
	background: rgb(255 165 0 / 0.2);
	color: #fff;
	border: 1px solid rgb(255 255 255 / 0.3);
}

@media (max-width: 768px) {
	.tb-newsletter {
		flex-direction: column;
		text-align: center;
	}
	.tb-newsletter__default-form {
		flex-direction: column;
	}
}

/* =========================================================
   Snake Glow — Homepage Card Colors
   ========================================================= */

/* Tools = Cyan */
.tb-tool-card::before {
	background: conic-gradient(
		from 0deg,
		transparent 0%,
		rgba(6, 182, 212, 0.1) 5%,
		#06B6D4 12%,
		#22D3EE 20%,
		#67E8F9 28%,
		#A5F3FC 35%,
		rgba(6, 182, 212, 0.1) 42%,
		transparent 50%,
		transparent 100%
	);
}

/* Books = Purple */
.tb-ebook-card::before {
	background: conic-gradient(
		from 0deg,
		transparent 0%,
		rgba(124, 58, 237, 0.1) 5%,
		#7C3AED 12%,
		#A78BFA 20%,
		#C4B5FD 28%,
		#DDD6FE 35%,
		rgba(124, 58, 237, 0.1) 42%,
		transparent 50%,
		transparent 100%
	);
}

/* Blog = Green */
.tb-blog-card::before {
	background: conic-gradient(
		from 0deg,
		transparent 0%,
		rgba(16, 185, 129, 0.1) 5%,
		#10B981 12%,
		#34D399 20%,
		#6EE7B7 28%,
		#A7F3D0 35%,
		rgba(16, 185, 129, 0.1) 42%,
		transparent 50%,
		transparent 100%
	);
}
