/**
 * Tattoo Gallery - estilos front-end
 *
 * Variables personalizables: redefine estas custom properties
 * en el CSS de tu tema para adaptar la galería a tu marca.
 */
.tg-gallery,
.tg-archive,
.tg-single {
	--tg-ink: #14110f;        /* tinta */
	--tg-paper: #ffffff;      /* fondo de tarjeta */
	--tg-accent: #b3402a;     /* rojo óxido, acento */
	--tg-muted: #756e66;
	--tg-gutter: 16px;
	--tg-radius: 2px;
}

/* ------------------------------------------------------------------ *
 *  FILTROS
 * ------------------------------------------------------------------ */

.tg-filters {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 28px;
}

.tg-filters__group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.tg-filters__label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--tg-muted);
	margin-right: 4px;
	min-width: 72px;
}

.tg-filters__btn {
	appearance: none;
	background: transparent;
	border: 1px solid var(--tg-ink);
	border-radius: var(--tg-radius);
	color: var(--tg-ink);
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1;
	padding: 8px 14px;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.tg-filters__btn:hover,
.tg-filters__btn:focus-visible {
	background: var(--tg-accent);
	border-color: var(--tg-accent);
	color: #fff;
	outline: none;
}

.tg-filters__btn:focus-visible {
	outline: 2px solid var(--tg-accent);
	outline-offset: 2px;
}

.tg-filters__btn.is-active {
	background: var(--tg-ink);
	border-color: var(--tg-ink);
	color: #fff;
}

.tg-filters__count {
	opacity: 0.55;
	font-weight: 400;
	margin-left: 4px;
}

.tg-filters__search {
	width: min(320px, 100%);
	padding: 9px 14px;
	border: 1px solid var(--tg-ink);
	border-radius: var(--tg-radius);
	font-size: 14px;
}

/* ------------------------------------------------------------------ *
 *  GRID MASONRY
 *  El ancho de columna lo define .tg-grid__sizer (porcentual)
 *  y Masonry posiciona los items.
 * ------------------------------------------------------------------ */

.tg-grid {
	position: relative;
	margin: 0 0 24px;
}

.tg-grid__sizer,
.tg-grid__item {
	width: calc((100% - 2 * var(--tg-gutter)) / 3); /* 3 columnas */
}

.tg-grid__gutter {
	width: var(--tg-gutter);
}

@media (max-width: 900px) {
	.tg-grid__sizer,
	.tg-grid__item {
		width: calc((100% - var(--tg-gutter)) / 2); /* 2 columnas */
	}
}

@media (max-width: 560px) {
	.tg-grid__sizer,
	.tg-grid__item {
		width: 100%; /* 1 columna */
	}
}

.tg-grid__item {
	margin-bottom: var(--tg-gutter);
}

.tg-gallery.is-loading .tg-grid {
	opacity: 0.45;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

/* --- Tarjeta --- */

.tg-card {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--tg-radius);
	background: var(--tg-ink);
	text-decoration: none;
}

.tg-card__img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.4s ease, opacity 0.4s ease;
}

.tg-card:hover .tg-card__img,
.tg-card:focus-visible .tg-card__img {
	transform: scale(1.03);
	opacity: 0.85;
}

.tg-card:focus-visible {
	outline: 2px solid var(--tg-accent);
	outline-offset: 2px;
}

.tg-card__placeholder {
	display: block;
	padding-top: 120%;
	background: repeating-linear-gradient(45deg, #1d1a17, #1d1a17 8px, #14110f 8px, #14110f 16px);
}

.tg-card__overlay {
	position: absolute;
	inset: auto 0 0 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 28px 14px 12px;
	background: linear-gradient(to top, rgba(20, 17, 15, 0.92), rgba(20, 17, 15, 0));
	color: #fff;
	transform: translateY(8px);
	opacity: 0;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.tg-card:hover .tg-card__overlay,
.tg-card:focus-visible .tg-card__overlay {
	transform: translateY(0);
	opacity: 1;
}

@media (hover: none) {
	/* En táctil el overlay queda siempre visible */
	.tg-card__overlay {
		transform: none;
		opacity: 1;
	}
}

.tg-card__title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
}

.tg-card__meta {
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #d8d2ca;
}

.tg-card__artist {
	font-size: 12px;
	font-style: italic;
	color: var(--tg-accent);
	filter: brightness(1.6);
}

/* --- Vacío y cargar más --- */

.tg-empty {
	text-align: center;
	color: var(--tg-muted);
	padding: 32px 0;
}

.tg-loadmore-wrap {
	text-align: center;
}

.tg-loadmore {
	appearance: none;
	background: var(--tg-ink);
	border: 1px solid var(--tg-ink);
	border-radius: var(--tg-radius);
	color: #fff;
	cursor: pointer;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding: 12px 32px;
	transition: background-color 0.15s ease;
}

.tg-loadmore:hover,
.tg-loadmore:focus-visible {
	background: var(--tg-accent);
	border-color: var(--tg-accent);
}

/* ------------------------------------------------------------------ *
 *  ARCHIVE
 * ------------------------------------------------------------------ */

.tg-archive {
	max-width: 1200px;
	margin: 0 auto;
	padding: 32px 20px 64px;
}

.tg-archive__header {
	margin-bottom: 28px;
}

.tg-archive__title {
	margin: 0 0 8px;
}

.tg-archive__desc {
	color: var(--tg-muted);
	max-width: 64ch;
}

.tg-archive__back a,
.tg-single__breadcrumb a {
	font-size: 13px;
	text-decoration: none;
	color: var(--tg-muted);
}

.tg-archive__back a:hover,
.tg-single__breadcrumb a:hover {
	color: var(--tg-accent);
}

.tg-archive__pagination {
	margin-top: 16px;
}

/* ------------------------------------------------------------------ *
 *  SINGLE
 * ------------------------------------------------------------------ */

.tg-single {
	max-width: 1100px;
	margin: 0 auto;
	padding: 32px 20px 64px;
}

.tg-single__header {
	margin-bottom: 24px;
}

.tg-single__title {
	margin: 4px 0 10px;
}

.tg-single__layout {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
	gap: 36px;
	align-items: start;
}

@media (max-width: 820px) {
	.tg-single__layout {
		grid-template-columns: 1fr;
	}
}

.tg-single__main-img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--tg-radius);
}

.tg-single__gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
	gap: 10px;
	margin-top: 12px;
}

.tg-single__gallery img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	aspect-ratio: 1 / 1;
	border-radius: var(--tg-radius);
	transition: opacity 0.2s ease;
}

.tg-single__gallery a:hover img {
	opacity: 0.8;
}

.tg-single__details {
	margin: 0 0 24px;
	border-top: 1px solid var(--tg-ink);
}

.tg-single__detail {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 10px 0;
	border-bottom: 1px solid rgba(20, 17, 15, 0.15);
}

.tg-single__detail dt {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--tg-muted);
}

.tg-single__detail dd {
	margin: 0;
	font-weight: 600;
	text-align: right;
}

.tg-single__terms a {
	display: inline-block;
	margin: 0 6px 6px 0;
	padding: 5px 11px;
	border: 1px solid var(--tg-ink);
	border-radius: var(--tg-radius);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--tg-ink);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.tg-single__terms a:hover {
	background: var(--tg-ink);
	color: #fff;
}

.tg-related {
	margin-top: 56px;
}

.tg-related__title {
	font-size: 20px;
	margin-bottom: 18px;
}

.tg-related__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: var(--tg-gutter);
}

.tg-related__grid .tg-grid__item {
	width: auto;
	margin-bottom: 0;
}

/* ------------------------------------------------------------------ *
 *  LIGHTBOX
 * ------------------------------------------------------------------ */

.tg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(10, 8, 7, 0.94);
	padding: 24px;
}

.tg-lightbox.is-open {
	display: flex;
}

.tg-lightbox__img {
	max-width: min(92vw, 1200px);
	max-height: 88vh;
	object-fit: contain;
	border-radius: 2px;
}

.tg-lightbox__close,
.tg-lightbox__nav {
	position: absolute;
	appearance: none;
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	font-size: 30px;
	line-height: 1;
	padding: 12px;
	opacity: 0.8;
	transition: opacity 0.15s ease;
}

.tg-lightbox__close:hover,
.tg-lightbox__nav:hover,
.tg-lightbox__close:focus-visible,
.tg-lightbox__nav:focus-visible {
	opacity: 1;
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.tg-lightbox__close {
	top: 16px;
	right: 20px;
	font-size: 40px;
}

.tg-lightbox__nav--prev { left: 12px; }
.tg-lightbox__nav--next { right: 12px; }

@media (prefers-reduced-motion: reduce) {
	.tg-card__img,
	.tg-card__overlay,
	.tg-grid {
		transition: none !important;
	}
}
