/*
 * Tu Frecuencia Radio – theme styles.
 *
 * The audio player (bottom mini player, popup, player card) belongs to the
 * Radio Directory WP plugin and keeps its own styles. This file only styles the
 * theme layout and the theme's Play buttons, which the plugin's player.js drives.
 */

:root {
	--tf-bg: #ffffff;
	--tf-text: #111827;
	--tf-muted: #4b5563;
	--tf-border: #e5e7eb;
	--tf-dark: #0b0b0f;
	--tf-dark-text: #f9fafb;
	--tf-accent: #4338ca;
	--tf-accent-hover: #3730a3;
	--tf-focus: #2563eb;
	--tf-radius: 10px;
	--tf-container: 1320px;
	--tf-gutter: clamp(16px, 3vw, 32px);
}

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

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

body {
	margin: 0;
	color: var(--tf-text);
	background: var(--tf-bg);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 1rem;
	line-height: 1.6;
	overflow-x: hidden;
}

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

a {
	color: var(--tf-accent);
}

:focus-visible {
	outline: 3px solid var(--tf-focus);
	outline-offset: 2px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.tf-skip-link:focus {
	position: fixed !important;
	top: 8px;
	left: 8px;
	z-index: 10000;
	width: auto;
	height: auto;
	padding: 8px 14px;
	margin: 0;
	clip: auto;
	color: #ffffff;
	background: var(--tf-accent);
	border-radius: 6px;
}

.tf-site {
	position: relative;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.tf-main {
	flex: 1 0 auto;
}

.tf-container {
	width: 100%;
	max-width: var(--tf-container);
	margin: 0 auto;
	padding: 0 var(--tf-gutter);
}

.tf-icon {
	display: block;
	width: 24px;
	height: 24px;
	fill: currentColor;
}

/* ---------------------------------------------------------------- */
/* Header                                                            */
/* ---------------------------------------------------------------- */

.tf-header {
	position: relative;
	z-index: 50;
	color: var(--tf-dark-text);
	background: var(--tf-dark);
}

/* Over the hero of single stations, with a fade for legibility. */
.single-rdw_station .tf-header {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 100%);
}

.tf-header__inner {
	display: flex;
	align-items: center;
	gap: 24px;
	max-width: var(--tf-container);
	min-height: 72px;
	margin: 0 auto;
	padding: 12px var(--tf-gutter);
}

.tf-brand {
	flex: 0 0 auto;
}

.tf-brand__name {
	color: inherit;
	font-size: 1.25rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	text-decoration: none;
}

.tf-brand .custom-logo {
	display: block;
	width: auto;
	max-height: 48px;
}

.tf-nav {
	flex: 1 1 auto;
}

.tf-menu,
.tf-menu .sub-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tf-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 22px;
}

.tf-menu > li {
	position: relative;
}

.tf-menu a {
	display: block;
	padding: 6px 0;
	color: inherit;
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-decoration: none;
	text-transform: uppercase;
}

.tf-menu a:hover,
.tf-menu .current-menu-item > a {
	color: #a5b4fc;
}

.tf-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: -12px;
	z-index: 60;
	display: none;
	min-width: 200px;
	padding: 8px 12px;
	background: var(--tf-dark);
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.tf-menu li:hover > .sub-menu,
.tf-menu li:focus-within > .sub-menu {
	display: block;
}

.tf-header__actions {
	flex: 0 0 auto;
	margin-left: auto;
}

.tf-header .search-form {
	display: flex;
	align-items: center;
	gap: 6px;
}

.tf-header .search-field {
	width: 180px;
	padding: 7px 12px;
	color: var(--tf-dark-text);
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 999px;
	font: inherit;
	font-size: 0.875rem;
}

.tf-header .search-field::placeholder {
	color: #9ca3af;
}

.tf-header .search-submit {
	padding: 7px 14px;
	color: #ffffff;
	background: var(--tf-accent);
	border: 0;
	border-radius: 999px;
	font: inherit;
	font-size: 0.8rem;
	font-weight: 700;
	cursor: pointer;
}

.tf-menu-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: inherit;
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 8px;
	cursor: pointer;
}

@media (max-width: 900px) {
	.tf-header__inner {
		flex-wrap: wrap;
		gap: 12px;
	}

	.tf-menu-toggle {
		display: inline-flex;
		order: 2;
		margin-left: auto;
	}

	.tf-header__actions {
		order: 3;
		flex: 1 1 100%;
		margin-left: 0;
	}

	.tf-header .search-field {
		flex: 1 1 auto;
		width: auto;
	}

	.tf-nav {
		display: none;
		order: 4;
		flex: 1 1 100%;
	}

	.tf-nav.is-open {
		display: block;
	}

	.tf-menu {
		flex-direction: column;
		gap: 0;
		padding: 8px 0;
	}

	.tf-menu a {
		padding: 10px 0;
	}

	.tf-menu .sub-menu {
		position: static;
		display: block;
		padding: 0 0 0 16px;
		background: transparent;
		box-shadow: none;
	}

	.single-rdw_station .tf-nav.is-open {
		padding: 0 12px;
		background: rgba(11, 11, 15, 0.92);
		border-radius: 10px;
	}
}

/* ---------------------------------------------------------------- */
/* Archive + grid                                                    */
/* ---------------------------------------------------------------- */

.tf-archive {
	padding: clamp(32px, 6vw, 72px) 0 64px;
}

.tf-archive__header {
	margin-bottom: clamp(24px, 4vw, 48px);
	text-align: center;
}

.tf-archive__kicker {
	margin: 0 0 6px;
	color: var(--tf-muted);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.tf-archive__title {
	margin: 0;
	font-size: clamp(2rem, 5vw, 3.5rem);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.tf-archive__description {
	max-width: 70ch;
	margin: 14px auto 0;
	color: var(--tf-muted);
}

.tf-archive__empty {
	text-align: center;
	color: var(--tf-muted);
}

.tf-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 28px 18px;
}

@media (min-width: 560px) {
	.tf-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 768px) {
	.tf-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 32px 22px;
	}
}

@media (min-width: 1024px) {
	.tf-grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
}

@media (min-width: 1280px) {
	.tf-grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

/* ---------------------------------------------------------------- */
/* Station card                                                      */
/* ---------------------------------------------------------------- */

.tf-station {
	min-width: 0;
}

.tf-station__media {
	position: relative;
}

.tf-station__image {
	display: block;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	background: #f3f4f6;
	border-radius: var(--tf-radius);
}

.tf-station__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.25s ease;
}

.tf-station:hover .tf-station__image img {
	transform: scale(1.03);
}

.tf-station__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: #9ca3af;
}

.tf-station__placeholder .tf-icon {
	width: 40%;
	height: 40%;
}

.tf-station__body {
	min-width: 0;
}

.tf-station__title {
	margin: 10px 0 0;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.tf-station__title a {
	color: var(--tf-text);
	text-decoration: none;
}

.tf-station__title a:hover {
	text-decoration: underline;
}

.tf-station__meta {
	margin: 2px 0 0;
	color: var(--tf-muted);
	font-size: 0.8rem;
}

/* Theme wrapper that follows the plugin player contract: neutralise the
   plugin's card box styles (.rdw-player) so only the theme layout applies. */
.tf-player.rdw-player {
	margin: 0;
	padding: 0;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	container-type: normal;
	font-size: inherit;
	line-height: inherit;
}

.tf-player [hidden] {
	display: none !important;
}

.tf-station__media .tf-player {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.tf-play {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	margin: 0;
	padding: 0;
	color: #ffffff;
	background: rgba(17, 24, 39, 0.72);
	border: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	pointer-events: auto;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.tf-play:hover,
.tf-player[data-rdw-state="playing"] .tf-play,
.tf-player[data-rdw-state="connecting"] .tf-play {
	background: var(--tf-accent);
}

.tf-play:active {
	transform: scale(0.95);
}

/* Icon swap: player.js adds .is-active while playing or connecting. */
.tf-play .tf-icon--pause,
.tf-play.is-active .tf-icon--play {
	display: none;
}

.tf-play.is-active .tf-icon--pause {
	display: block;
}

.tf-player[data-rdw-state="connecting"] .tf-play {
	animation: tf-pulse 1.2s ease-in-out infinite;
}

/* Compact variant (sidebar list). */
.tf-station--compact {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr);
	gap: 12px;
	align-items: center;
}

.tf-station--compact .tf-station__image {
	border-radius: 8px;
}

.tf-station--compact .tf-play {
	width: 34px;
	height: 34px;
	border-width: 1.5px;
}

.tf-station--compact .tf-play .tf-icon {
	width: 18px;
	height: 18px;
}

.tf-station--compact .tf-station__title {
	margin: 0;
	font-size: 0.9rem;
}

/* ---------------------------------------------------------------- */
/* Single station                                                    */
/* ---------------------------------------------------------------- */

.tf-hero {
	position: relative;
	display: flex;
	align-items: flex-end;
	min-height: clamp(380px, 62vh, 640px);
	padding: 120px 0 clamp(28px, 5vw, 56px);
	color: #ffffff;
	background-color: #111827;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}

.tf-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.35) 45%, rgba(0, 0, 0, 0.85) 100%);
	pointer-events: none;
}

.tf-hero__inner {
	position: relative;
	z-index: 1;
}

.tf-hero__title {
	max-width: 22ch;
	margin: 0 0 18px;
	font-size: clamp(2rem, 6vw, 4.25rem);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.02em;
	overflow-wrap: anywhere;
	text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

.tf-player--hero {
	margin-bottom: 18px;
}

.tf-hero__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
}

.tf-play--hero {
	width: 68px;
	height: 68px;
	background: var(--tf-accent);
	border: 0;
}

.tf-play--hero:hover {
	background: var(--tf-accent-hover);
}

.tf-play--hero .tf-icon {
	width: 30px;
	height: 30px;
}

.tf-hero__popup {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 10px 16px;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: 999px;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	cursor: pointer;
	backdrop-filter: blur(4px);
}

.tf-hero__popup:hover {
	background: rgba(255, 255, 255, 0.25);
}

.tf-hero__popup .tf-icon {
	width: 18px;
	height: 18px;
}

.tf-hero__status {
	flex: 1 1 100%;
	margin: 0;
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.9rem;
}

.tf-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tf-chip {
	display: inline-block;
	padding: 5px 12px;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 999px;
	font-size: 0.8rem;
	font-weight: 600;
	text-decoration: none;
	backdrop-filter: blur(4px);
}

.tf-chip:hover {
	background: rgba(255, 255, 255, 0.28);
}

.tf-single__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 48px;
	padding-top: clamp(28px, 5vw, 56px);
	padding-bottom: 64px;
}

.tf-single__main {
	min-width: 0;
}

.tf-content {
	max-width: 72ch;
	font-size: 1.05rem;
	line-height: 1.75;
}

.tf-content > :first-child {
	margin-top: 0;
}

/*
 * Singular pages/posts: text keeps the 72ch reading column, but a Radio
 * Directory block placed directly in the content, and any block aligned wide,
 * uses the full width of the page container (so its columns setting has
 * room); a block aligned full uses the whole window width. Blocks inside a
 * Group or another container keep the width set there.
 */
:is(.single, .page) .tf-page .tf-entry {
	container-type: inline-size;
}

:is(.single, .page) .tf-page .tf-content > .wp-block-radio-directory-wp-directory-loop:not(.alignfull),
:is(.single, .page) .tf-page .tf-content > .alignwide {
	width: 100cqi;
	max-width: none;
}

/* Separator block in page content: discreet line with room around it (its color stays editable). */
.tf-content .wp-block-separator {
	height: 0;
	margin: 48px 0 40px;
	color: var(--tf-border);
	border: 0;
	border-top: 1px solid currentColor;
	opacity: 1;
}

/* Empty home page (no stations / no posts): a clear message instead of an empty screen. */
.tf-empty-state {
	max-width: 72ch;
	margin: 0 0 32px;
	padding: 28px 24px;
	border: 1px dashed var(--tf-border);
	border-radius: var(--tf-radius);
}

.tf-empty-state__message {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
}

.tf-empty-state__links {
	margin: 12px 0 0;
	padding-left: 1.2em;
}

:is(.single, .page) .tf-page .tf-content > .alignfull {
	width: 100vw;
	max-width: none;
	margin-inline-start: calc(50cqi - 50vw);
	margin-inline-end: 0;
}

.tf-section-title {
	margin: 0 0 18px;
	font-size: 1.35rem;
	font-weight: 800;
	letter-spacing: -0.01em;
}

.tf-related {
	margin-top: 48px;
}

.tf-grid--related {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tf-sidebar .tf-list {
	display: grid;
	gap: 14px;
}

@media (max-width: 1024px) {
	.tf-single__layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 40px;
	}

	.tf-sidebar .tf-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px 24px;
	}
}

@media (max-width: 560px) {
	.tf-grid--related {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.tf-sidebar .tf-list {
		grid-template-columns: minmax(0, 1fr);
	}

	.tf-hero {
		min-height: 360px;
		padding-top: 150px;
	}
}

/* ---------------------------------------------------------------- */
/* Generic pages + footer                                            */
/* ---------------------------------------------------------------- */

.tf-page {
	padding-top: 48px;
	padding-bottom: 64px;
}

.tf-page__title {
	margin: 0 0 24px;
	font-size: clamp(1.75rem, 4vw, 2.75rem);
	line-height: 1.15;
}

.tf-entry + .tf-entry {
	margin-top: 32px;
	padding-top: 32px;
	border-top: 1px solid var(--tf-border);
}

.tf-entry__title {
	margin: 0 0 8px;
	font-size: 1.4rem;
}

.tf-entry__title a {
	color: var(--tf-text);
	text-decoration: none;
}

.nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 48px;
}

.nav-links .page-numbers {
	min-width: 40px;
	padding: 8px 12px;
	color: var(--tf-text);
	border: 1px solid var(--tf-border);
	border-radius: 8px;
	text-align: center;
	text-decoration: none;
}

.nav-links .page-numbers.current {
	color: #ffffff;
	background: var(--tf-dark);
	border-color: var(--tf-dark);
}

.tf-footer {
	padding: 28px 0;
	color: #9ca3af;
	background: var(--tf-dark);
	font-size: 0.875rem;
}

.tf-footer__text {
	margin: 0;
}

@keyframes tf-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(67, 56, 202, 0.5); }
	50% { box-shadow: 0 0 0 10px rgba(67, 56, 202, 0); }
}

/* Theme elements only; the plugin handles reduced motion for its own player. */
@media (prefers-reduced-motion: reduce) {
	.tf-site *,
	.tf-site *::before,
	.tf-site *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
