/*
Theme Name: UltraGuarras
Theme URI: https://ultraguarras.com/
Author: Ultramedia
Description: Tema de galerías de miniaturas (TGP) para afiliación con patrocinadores. Rejilla de miniaturas, categorías, etiquetas, buscador, aviso +18, banner de cookies, huecos de anuncios y páginas legales automáticas.
Version: 1.2.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: galeria-tgp
*/

:root {
	--bg: #0f0f12;
	--bg-2: #17171c;
	--bg-3: #22222a;
	--text: #e9e9ee;
	--muted: #9a9aa6;
	--accent: #ff3d6e;
	--accent-2: #ff7a59;
	--radius: 8px;
	--gap: 10px;
	--max: 1500px;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Cabecera */
.site-header {
	background: var(--bg-2);
	border-bottom: 1px solid var(--bg-3);
	position: sticky;
	top: 0;
	z-index: 50;
}
.site-header .wrap {
	display: flex;
	align-items: center;
	gap: 16px;
	height: 60px;
}
.site-logo { font-weight: 800; font-size: 22px; letter-spacing: -0.5px; white-space: nowrap; }
.site-logo span { color: var(--accent); }
.site-logo img { max-height: 40px; width: auto; }

.search-form { flex: 1; display: flex; max-width: 560px; }
.search-form input[type="search"] {
	flex: 1;
	min-width: 0;
	background: var(--bg);
	border: 1px solid var(--bg-3);
	border-right: 0;
	color: var(--text);
	padding: 9px 12px;
	border-radius: var(--radius) 0 0 var(--radius);
	font-size: 14px;
}
.search-form button {
	background: var(--accent);
	color: #fff;
	border: 0;
	padding: 0 16px;
	border-radius: 0 var(--radius) var(--radius) 0;
	font-weight: 600;
	cursor: pointer;
}

/* Barra de categorías */
.cat-bar { background: var(--bg); border-bottom: 1px solid var(--bg-3); }
.cat-bar ul {
	list-style: none;
	margin: 0 auto;
	padding: 10px 16px;
	max-width: var(--max);
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scrollbar-width: none;
}
.cat-bar ul::-webkit-scrollbar { display: none; }
.cat-bar a {
	display: block;
	background: var(--bg-2);
	border: 1px solid var(--bg-3);
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 13px;
	white-space: nowrap;
}
.cat-bar .current-cat a, .cat-bar a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Cabecera de listado */
.listing-head { padding: 20px 0 10px; }
.listing-head h1 { margin: 0 0 6px; font-size: 22px; }
.listing-head .desc { color: var(--muted); max-width: 900px; font-size: 14px; }
.listing-head .desc p { margin: 0 0 8px; }

/* Rejilla */
.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: var(--gap);
	padding: 10px 0 20px;
}
.card { position: relative; background: var(--bg-2); border-radius: var(--radius); overflow: hidden; }
.card .thumb { aspect-ratio: 3 / 4; background: var(--bg-3); overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.04); }
.card .count {
	position: absolute;
	top: 6px;
	right: 6px;
	background: rgba(0,0,0,.75);
	font-size: 11px;
	padding: 2px 7px;
	border-radius: 4px;
}
.card .meta { padding: 7px 9px 9px; }
.card .title {
	font-size: 13px;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.6em;
}
.card .sponsor { font-size: 11px; color: var(--muted); margin-top: 3px; }

.grid .ad-cell {
	grid-column: 1 / -1;
	display: flex;
	justify-content: center;
	padding: 6px 0;
}

/* Página de categorías */
.cat-bar .all-cats a { background: var(--bg-3); font-weight: 700; }
.cat-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.cat-jump a { background: var(--bg-2); border: 1px solid var(--bg-3); padding: 6px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 600; }
.cat-group { padding-top: 18px; scroll-margin-top: 80px; }
.cat-group h2 { font-size: 18px; margin: 0 0 10px; padding-left: 10px; border-left: 3px solid var(--accent); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--gap); }
.cat-tile { position: relative; display: block; border-radius: var(--radius); overflow: hidden; background: var(--bg-2); }
.cat-tile .thumb { aspect-ratio: 3 / 4; background: linear-gradient(160deg, #3a2430, #17171c); }
.cat-tile .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.cat-tile:hover .thumb img { transform: scale(1.05); }
.cat-tile .cat-name, .cat-tile .cat-count {
	position: absolute; left: 0; right: 0; padding: 0 10px; text-shadow: 0 1px 3px rgba(0,0,0,.9);
}
.cat-tile::after {
	content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(0,0,0,.85)); pointer-events: none;
}
.cat-tile .cat-name { bottom: 26px; font-weight: 800; font-size: 16px; z-index: 1; }
.cat-tile .cat-count { bottom: 9px; font-size: 12px; color: #d0d0d8; z-index: 1; }
.cat-tile:hover .cat-name { color: var(--accent); }

/* Modo demo */
.demo-note { background: #2a1d22; border: 1px dashed var(--accent); color: #ffb3c6; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; }
.demo-ad { width: 728px; max-width: 100%; height: 90px; border: 1px dashed #444; display: flex; align-items: center; justify-content: center; color: #777; font-size: 12px; }

/* Anuncios */
.ad-slot { display: flex; justify-content: center; margin: 12px auto; max-width: 100%; overflow: hidden; }

/* Paginación */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 10px 0 30px; flex-wrap: wrap; }
.pagination .page-numbers {
	min-width: 38px;
	text-align: center;
	padding: 8px 12px;
	background: var(--bg-2);
	border: 1px solid var(--bg-3);
	border-radius: var(--radius);
}
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Ficha de galería */
.gallery-single { padding: 20px 0; display: grid; grid-template-columns: minmax(0, 380px) 1fr; gap: 24px; align-items: start; }
.gallery-single .cover { border-radius: var(--radius); overflow: hidden; background: var(--bg-3); }
.gallery-single h1 { margin: 0 0 10px; font-size: 24px; line-height: 1.25; }
.gallery-single .info { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.gallery-single .entry { color: #cfcfd6; }
.btn {
	display: inline-block;
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
	color: #fff !important;
	font-weight: 700;
	padding: 13px 26px;
	border-radius: var(--radius);
	font-size: 16px;
	margin: 6px 0 16px;
}
.btn:hover { filter: brightness(1.08); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tags a { background: var(--bg-2); border: 1px solid var(--bg-3); padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.related-title { font-size: 18px; margin: 10px 0 0; }

/* Páginas normales */
.page-content { max-width: 820px; padding: 24px 0 40px; }
.page-content h1 { font-size: 26px; }
.page-content a { color: var(--accent); }

/* Pie */
.site-footer {
	background: var(--bg-2);
	border-top: 1px solid var(--bg-3);
	color: var(--muted);
	font-size: 13px;
	padding: 24px 0;
	margin-top: 20px;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; }
.site-footer nav a { margin-right: 16px; }
.site-footer .disclaimer { flex-basis: 100%; font-size: 12px; }

/* Aviso +18 */
.age-gate {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(8,8,10,.97);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.age-gate.is-open { display: flex; }
.age-gate .box {
	background: var(--bg-2);
	border: 1px solid var(--bg-3);
	border-radius: 12px;
	max-width: 460px;
	width: 100%;
	padding: 28px;
	text-align: center;
}
.age-gate h2 { margin: 0 0 10px; font-size: 22px; }
.age-gate p { color: var(--muted); font-size: 14px; }
.age-gate .actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.age-gate button, .age-gate a.leave {
	border: 0;
	border-radius: var(--radius);
	padding: 11px 20px;
	font-weight: 700;
	font-size: 15px;
	cursor: pointer;
}
.age-gate button { background: var(--accent); color: #fff; }
.age-gate a.leave { background: var(--bg-3); color: var(--text); }
body.age-locked { overflow: hidden; }

/* Banner de cookies */
.cookie-bar {
	position: fixed;
	left: 16px;
	right: 16px;
	bottom: 16px;
	z-index: 900;
	max-width: 720px;
	margin: 0 auto;
	background: var(--bg-2);
	border: 1px solid var(--bg-3);
	border-radius: 10px;
	padding: 14px 16px;
	display: none;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
	font-size: 13px;
	color: var(--muted);
	box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.cookie-bar.is-open { display: flex; }
.cookie-bar p { margin: 0; flex: 1 1 280px; }
.cookie-bar a { color: var(--accent); }
.cookie-bar button {
	border: 0;
	border-radius: 6px;
	padding: 8px 14px;
	font-weight: 600;
	cursor: pointer;
}
.cookie-bar .accept { background: var(--accent); color: #fff; }
.cookie-bar .reject { background: var(--bg-3); color: var(--text); }

@media (max-width: 760px) {
	.site-header .wrap { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
	.search-form { flex-basis: 100%; max-width: none; }
	.grid { grid-template-columns: repeat(2, 1fr); }
	.gallery-single { grid-template-columns: 1fr; }
}
