/**
 * Custom styles for Pensando en Voz Alta
 * Refined animations, textures, and micro-interactions
 */

/* ========================================
   SUBTLE GRAIN TEXTURE (page-wide)
   ======================================== */

body::after {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0.018;
	background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
	pointer-events: none;
	z-index: 9999;
}

/* ========================================
   CUSTOM SCROLLBAR
   ======================================== */

::-webkit-scrollbar {
	width: 8px;
}

::-webkit-scrollbar-track {
	background: var(--color-cream-deep);
}

::-webkit-scrollbar-thumb {
	background: var(--color-text-muted);
	border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--color-primary);
}

/* Firefox scrollbar */
* {
	scrollbar-width: thin;
	scrollbar-color: var(--color-text-muted) var(--color-cream-deep);
}

/* ========================================
   NAV LINK UNDERLINE ANIMATION
   ======================================== */

.nav-link {
	position: relative;
}

.nav-link::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	width: 0;
	height: 1px;
	background: var(--color-dark);
	transition: width 0.4s var(--ease-out);
}

.nav-link:hover::after {
	width: 100%;
}

/* ========================================
   CARD HOVER — SUBTLE BORDER GLOW
   ======================================== */

.episode-item,
.blog-post,
.episode-card {
	position: relative;
}

/* Image overflow containers */
.episode-item > div:first-child,
.blog-post > div:first-child {
	overflow: hidden;
}

/* ========================================
   FILTER BUTTON — REFINED INTERACTION
   ======================================== */

.filter-btn {
	position: relative;
	overflow: hidden;
}

.filter-btn::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 0;
	background: var(--color-dark);
	transition: height 0.3s var(--ease-out);
	z-index: -1;
}

.filter-btn:hover::after {
	height: 100%;
}

.filter-btn:hover {
	color: var(--color-cream);
	border-color: var(--color-dark);
}

.filter-btn.active::after {
	height: 100%;
}

/* ========================================
   NAVBAR SCROLL EFFECT
   ======================================== */

.navbar {
	transition: all 0.5s var(--ease-out);
}

.navbar.scrolled {
	padding-top: 0.75rem;
	padding-bottom: 0.75rem;
}

/* ========================================
   STAGGERED FADE-IN FOR GRIDS
   ======================================== */

.episodes-grid .episode-item:nth-child(1) { animation-delay: 0s; }
.episodes-grid .episode-item:nth-child(2) { animation-delay: 0.1s; }
.episodes-grid .episode-item:nth-child(3) { animation-delay: 0.2s; }
.episodes-grid .episode-item:nth-child(4) { animation-delay: 0.3s; }
.episodes-grid .episode-item:nth-child(5) { animation-delay: 0.4s; }
.episodes-grid .episode-item:nth-child(6) { animation-delay: 0.5s; }
.episodes-grid .episode-item:nth-child(7) { animation-delay: 0.1s; }
.episodes-grid .episode-item:nth-child(8) { animation-delay: 0.2s; }
.episodes-grid .episode-item:nth-child(9) { animation-delay: 0.3s; }

/* ========================================
   HERO ENTRANCE ANIMATIONS — Cinematic
   ======================================== */

/* Top elements: fade in from above */
.hero-description {
	opacity: 0;
	animation: heroSlideDown 0.9s var(--ease-out) 0.2s forwards;
}

.hero-nav {
	opacity: 0;
	animation: heroSlideDown 0.9s var(--ease-out) 0.4s forwards;
}

@keyframes heroSlideDown {
	from {
		opacity: 0;
		transform: translateY(-15px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Center mic: scale in with glow */
.hero-mic-icon {
	opacity: 0;
	animation: heroMicReveal 1.2s var(--ease-out) 0.3s forwards;
}

.hero-mic-glow {
	opacity: 0;
	animation: heroGlowPulse 1.8s var(--ease-out) 0.6s forwards;
}

@keyframes heroMicReveal {
	from {
		opacity: 0;
		transform: scale(0.85) translateY(20px);
	}
	to {
		opacity: 0.85;
		transform: scale(1) translateY(0);
	}
}

@keyframes heroGlowPulse {
	from {
		opacity: 0;
		transform: scale(0.6);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* Bottom headline: each word slides up staggered */
.hero-word {
	opacity: 0;
	transform: translateY(40px);
	animation: heroWordReveal 0.8s var(--ease-out) forwards;
}

.hero-word:nth-child(1) { animation-delay: 0.5s; }
.hero-word:nth-child(2) { animation-delay: 0.65s; }
.hero-word:nth-child(3) { animation-delay: 0.8s; }

@keyframes heroWordReveal {
	from {
		opacity: 0;
		transform: translateY(40px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* CTAs: fade in last */
.hero-ctas {
	opacity: 0;
	animation: heroCTAFade 0.7s var(--ease-out) 1.1s forwards;
}

@keyframes heroCTAFade {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* ========================================
   ACCENT LINE DECORATIONS
   ======================================== */

.section-title::after {
	content: '';
	display: block;
	width: 40px;
	height: 1px;
	background: var(--color-accent);
	margin: 1rem auto 0;
}

/* ========================================
   BLOCKQUOTE STYLING
   ======================================== */

.post-content blockquote {
	position: relative;
	padding: 1.5rem 2rem;
	margin: 2.5rem 0;
	border-left: 3px solid var(--color-accent);
	background: var(--color-cream);
	font-style: italic;
	font-size: 1.1rem;
	line-height: 1.8;
}

.post-content blockquote p:last-child {
	margin-bottom: 0;
}

/* ========================================
   YOUTUBE EMBED STYLING
   ======================================== */

.post-audio iframe {
	border-radius: 4px;
	border: 1px solid var(--color-border);
}

/* ========================================
   SELECTION COLOR
   ======================================== */

::selection {
	background: rgba(123, 63, 66, 0.15);
	color: var(--color-dark);
}

::-moz-selection {
	background: rgba(123, 63, 66, 0.15);
	color: var(--color-dark);
}

/* ========================================
   FOCUS STYLES (accessibility)
   ======================================== */

*:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

.btn-play:focus-visible,
.btn-primary:focus-visible,
.btn-subscribe:focus-visible,
.filter-btn:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 3px;
}

/* ========================================
   LOADING STATE
   ======================================== */

.loading {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.3s var(--ease-out);
}

/* ========================================
   RESPONSIVE REFINEMENTS
   ======================================== */

@media (max-width: 576px) {
	.episodes-grid {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}

	.blog-grid {
		grid-template-columns: 1fr;
	}

	.about-content {
		grid-template-columns: 1fr;
	}

	.blog-sidebar {
		width: 100%;
	}
}

/* ========================================
   PRINT
   ======================================== */

@media print {
	.navbar,
	.footer,
	.filter-buttons {
		display: none;
	}

	body::after {
		display: none;
	}
}
