/* =========================================================
   Maquetación C · Zine editorial
   - Índices (Diary, Works, archivos): filas tipo índice con fecha grande
     en Dela, título en Zen 900 y miniatura a la derecha.
   - Entrada: columna lateral fija con la fecha grande y los datos.
   - Galerías G2: mosaico justificado (cada foto con su proporción).
   Las filas salen de patterns/row-diary.php y patterns/row-works.php.
   ========================================================= */

:root {
	--hv-line: #2c2c2c;
	--hv-muted: #8a8a8a;
	--hv-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Título de página ---------- */

.hv-c-index .hv-c-title {
	margin-top: 0;
	margin-bottom: var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--xx-large);
}

/* ---------- Índice ---------- */

.hv-index.wp-block-post-template {
	margin-top: 0;
	border-top: 1px solid var(--hv-line);
}

.hv-index > li {
	margin: 0 !important;
}

/* Año grande al empezar cada año (lo mete functions.php) */
.hv-index > li.hv-year {
	padding: 0.35em 0 0.1em;
	border-bottom: 1px solid var(--hv-line);
	color: #2a2a2a;
	font-family: var(--wp--preset--font-family--dela-gothic-one);
	font-size: clamp(3rem, 7vw, 5rem);
	line-height: 1;
	letter-spacing: 0;
	user-select: none;
}
.hv-index > li.hv-year:first-child {
	padding-top: 0.15em;
}

.hv-index .hv-row {
	position: relative;
	display: grid;
	grid-template-columns: 130px minmax(0, 1fr) 210px;
	gap: 30px;
	align-items: center;
	margin: 0 !important;
	padding: 18px 0;
	border-bottom: 1px solid var(--hv-line);
}
.hv-index .hv-row > * {
	margin: 0 !important;
}

/* Fecha MM.DD (Diary) o año (Works) */
.hv-index .hv-row__date {
	color: var(--hv-section);
	font-family: var(--wp--preset--font-family--dela-gothic-one) !important;
	font-size: 30px !important;
	font-weight: 400 !important;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	font-variant-numeric: tabular-nums;
}

/* Título */
.hv-index .hv-row__title {
	margin: 0 0 8px !important;
	font-family: var(--wp--preset--font-family--zen-kaku-gothic-new);
	font-size: 30px !important; /* igual que la fecha */
	font-weight: 900 !important;
	line-height: 1.2;
	letter-spacing: -0.01em;
	transition: transform 0.4s var(--hv-ease);
}
/* Al pasar el ratón por la fila, el título se rellena del color de la sección
   (como en los listados de antes): rojo en Diary, turquesa en Works. */
.hv-index .hv-row__title a {
	padding-inline: 0.08em;
	margin-inline: -0.08em;
	color: #f3f3f3;
	text-decoration: none !important;
	background: linear-gradient(var(--hv-section), var(--hv-section)) no-repeat 0 100% / 0% 100% !important;
	border-radius: 2px;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
	transition: background-size 0.4s var(--hv-ease), color 0.3s;
}
.hv-index .hv-row:is(:hover, :focus-within) .hv-row__title a {
	background-size: 100% 100% !important;
	color: var(--hv-section-ink) !important;
}
/* Si el ratón está sobre la píldora de categoría, el título no se rellena */
.hv-index .hv-row:has(.hv-row__tags a:hover) .hv-row__title a,
.hv-index .hv-row:has(.hv-row__meta a:hover) .hv-row__title a {
	background-size: 0% 100% !important;
	color: #f3f3f3 !important;
}
/* Toda la fila es clicable: el enlace del título la cubre */
.hv-index .hv-row__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

/* Categorías en píldora (Diary) */
.hv-index .hv-row__tags {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 !important;
}
.hv-index .hv-row__tags .wp-block-post-terms__separator {
	display: none;
}
.hv-index .hv-row__tags a {
	display: inline-block;
	padding: 5px 9px 4px;
	border: 1px solid #444;
	border-radius: 99px;
	color: var(--wp--preset--color--accent-4) !important;
	font-size: 10.5px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none !important;
	transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}
/* Al pasar el ratón la píldora se rellena del color de la sección */
.hv-index .hv-row__tags a:is(:hover, :focus-visible) {
	background: var(--hv-section) !important;
	border-color: var(--hv-section);
	color: var(--hv-section-ink) !important;
}

/* Miniatura en color; al pasar el ratón se acerca un poco */
.hv-index .hv-row__thumb {
	overflow: hidden;
	aspect-ratio: 3 / 2;
	border-radius: 2px;
	background: #222;
}
.hv-index .hv-row__thumb :is(a, img) {
	display: block;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	border-radius: 0 !important;
	transition: transform 0.6s var(--hv-ease);
}

.hv-index .hv-row:hover .hv-row__thumb img,
.hv-index .hv-row:focus-within .hv-row__thumb img {
	transform: scale(1.04);
}
.hv-index .hv-row:hover .hv-row__title,
.hv-index .hv-row:focus-within .hv-row__title {
	transform: translateX(8px);
}

/* Fila sin foto destacada: la columna se queda vacía y la fila no salta */
.hv-index .hv-row:not(:has(.hv-row__thumb)) {
	min-height: 0;
}

/* Diary (escritorio): fecha y título en la misma fila de la rejilla y alineados
   por la línea de base; las categorías van debajo. Las filas 1fr de arriba y
   abajo mantienen el texto centrado en vertical respecto a la miniatura. */
@media (min-width: 782px) {
	.hv-index .hv-row:has(> .hv-row__text) {
		grid-template-rows: 1fr auto auto 1fr;
		grid-template-areas:
			".  .  th"
			"md t  th"
			".  tg th"
			".  .  th";
		row-gap: 0;
	}
	.hv-index .hv-row > .hv-row__text {
		display: contents;
	}
	.hv-index .hv-row:has(> .hv-row__text) .hv-row__date {
		grid-area: md;
		align-self: baseline;
	}
	.hv-index .hv-row:has(> .hv-row__text) .hv-row__title {
		grid-area: t;
		align-self: baseline;
	}
	.hv-index .hv-row:has(> .hv-row__text) .hv-row__tags {
		grid-area: tg;
	}
	.hv-index .hv-row:has(> .hv-row__text) .hv-row__thumb {
		grid-area: th;
	}
}

/* Works: año | título | tipo | miniatura */
.hv-index .hv-row--works {
	grid-template-columns: 90px minmax(0, 1fr) 240px 210px;
}
.hv-index .hv-row--works .hv-row__date {
	color: var(--hv-muted);
	font-size: 22px !important;
}
.hv-index .hv-row--works .hv-row__title {
	margin: 0 !important;
	font-size: 24px !important;
}
.hv-index .hv-row--works .hv-row__meta {
	position: relative;
	z-index: 2;
	margin: 0 !important;
	color: var(--hv-muted);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	letter-spacing: 0.12em;
	line-height: 1.5;
	text-transform: uppercase;
}
.hv-index .hv-row--works .hv-row__meta a {
	color: inherit !important;
	text-decoration: none !important;
	transition: color 0.25s;
}
.hv-index .hv-row--works .hv-row__meta a:is(:hover, :focus-visible) {
	color: var(--hv-section) !important;
}

/* Paginación y explorar */
.hv-c-index .wp-block-query-pagination {
	margin-top: var(--wp--preset--spacing--40);
}

.hv-browse {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: var(--wp--preset--spacing--50);
	margin-top: var(--wp--preset--spacing--60) !important;
	padding-top: var(--wp--preset--spacing--40);
	border-top: 1px solid var(--hv-line);
}
.hv-browse > * {
	margin: 0 !important;
}
.hv-browse h3 {
	margin: 0 0 0.6em;
	font-family: var(--wp--preset--font-family--dela-gothic-one);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 400;
}

/* ---------- Entrada ---------- */

.hv-c-post {
	display: grid;
	grid-template-columns: 240px minmax(0, 1fr);
	gap: 60px;
	align-items: start;
}
.hv-c-post > * {
	max-width: none !important;
	margin: 0 !important;
}

.hv-c-aside {
	position: sticky;
	top: 90px;
}
.admin-bar .hv-c-aside {
	top: calc(90px + 32px);
}

.hv-bigdate {
	margin: 0 !important;
}
.hv-bigdate__md {
	color: var(--hv-section);
	font-family: var(--wp--preset--font-family--dela-gothic-one) !important;
	font-size: 64px !important;
	font-weight: 400 !important;
	line-height: 0.95;
	letter-spacing: 0;
}
.hv-bigdate__y {
	margin-top: 10px !important;
	color: var(--hv-muted);
	font-size: 12px !important;
	font-weight: 700 !important;
	line-height: 1;
	letter-spacing: 0.14em;
}

.hv-c-meta {
	margin-top: 26px !important;
}
.hv-c-meta > p {
	margin: 0 0 4px !important;
	color: var(--hv-muted) !important;
	font-size: var(--wp--preset--font-size--x-small) !important;
	font-weight: 500;
	letter-spacing: 0.12em;
	line-height: 1.3;
	text-transform: uppercase;
}
.hv-c-meta > .wp-block-post-terms {
	margin: 0 !important;
	font-size: var(--wp--preset--font-size--medium) !important;
	font-weight: 400 !important;
	line-height: 1.4;
}
/* Sin etiquetas: fuera el rótulo también */
.hv-c-meta:not(:has(.wp-block-post-terms)) {
	display: none;
}

.hv-c-body > .wp-block-post-title {
	margin-top: 0;
	margin-bottom: var(--wp--preset--spacing--40);
}
.hv-c-body .hv-c-feat {
	margin-bottom: var(--wp--preset--spacing--40);
}
.hv-c-body .hv-c-feat img {
	border-radius: 2px;
}

/* "There is more" */
.hv-c-more {
	margin-top: var(--wp--preset--spacing--60) !important;
}
.hv-c-more > h2 {
	margin-bottom: var(--wp--preset--spacing--30);
}
.hv-c-more .hv-index .hv-row {
	padding: 14px 0;
}
.hv-c-more .hv-index .hv-row__date {
	font-size: 24px !important;
}
.hv-c-more .hv-index .hv-row__title {
	font-size: 20px !important;
}

/* ---------- Galería G2 · mosaico justificado ---------- */

.hv-gal {
	margin-block: var(--wp--preset--spacing--50);
}
.hv-gal-h {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: 14px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--hv-line);
}
.hv-gal-h__t {
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--dela-gothic-one);
	font-size: 18px;
	line-height: 1;
}
.hv-gal-h__n {
	color: var(--hv-muted);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.wp-block-gallery.hv-g2.has-nested-images {
	display: flex;
	flex-wrap: wrap;
	gap: 8px !important;
	margin: 0;
}
.wp-block-gallery.hv-g2.has-nested-images figure.wp-block-image:not(#individual-image) {
	position: relative;
	flex-grow: var(--r);
	flex-shrink: 1;
	flex-basis: calc(var(--r) * 210px);
	width: auto !important;
	min-width: 0;
	margin: 0 !important;
}
.wp-block-gallery.hv-g2.has-nested-images figure.wp-block-image img {
	display: block;
	width: 100% !important;
	height: auto !important;
	aspect-ratio: var(--r);
	object-fit: cover;
	border-radius: 2px;
}
/* La última fila no se estira */
.wp-block-gallery.hv-g2::after {
	content: "";
	flex-grow: 999;
}


/* Pie de foto dentro del mosaico: discreto, sobre la foto */
.wp-block-gallery.hv-g2 figure.wp-block-image figcaption {
	font-size: var(--wp--preset--font-size--x-small);
}

/* ---------- Anchos medianos: en Works el tipo pasa bajo el título ---------- */

@media (min-width: 782px) and (max-width: 1180px) {
	.hv-index .hv-row--works {
		grid-template-columns: 90px minmax(0, 1fr) 210px;
		grid-template-areas:
			"md t  th"
			"md mt th";
		row-gap: 6px;
	}
	.hv-index .hv-row--works .hv-row__date { grid-area: md; }
	.hv-index .hv-row--works .hv-row__title { grid-area: t; align-self: end; }
	.hv-index .hv-row--works .hv-row__meta { grid-area: mt; align-self: start; }
	.hv-index .hv-row--works .hv-row__thumb { grid-area: th; }
}

/* ---------- Móvil ---------- */

@media (max-width: 781px) {
	.hv-index > li.hv-year {
		font-size: 48px;
	}

	.hv-index .hv-row,
	.hv-index .hv-row--works {
		grid-template-columns: minmax(0, 1fr) 104px;
		grid-template-areas:
			"md th"
			"tx th";
		column-gap: 16px;
		row-gap: 4px;
		align-items: start;
		padding: 14px 0;
	}
	.hv-index .hv-row--works {
		grid-template-areas:
			"md th"
			"tx th"
			"mt th";
	}
	.hv-index .hv-row__date {
		grid-area: md;
		font-size: 18px !important;
	}
	.hv-index .hv-row--works .hv-row__date {
		font-size: 14px !important;
	}
	.hv-index .hv-row__text,
	.hv-index .hv-row--works .hv-row__title {
		grid-area: tx;
	}
	.hv-index .hv-row--works .hv-row__meta {
		grid-area: mt;
	}
	.hv-index .hv-row__thumb {
		grid-area: th;
		align-self: center;
		aspect-ratio: 4 / 3;
	}
	.hv-index .hv-row__title {
		font-size: 17px !important;
		line-height: 1.25;
	}
	.hv-index .hv-row:hover .hv-row__title {
		transform: none;
	}

	.hv-browse {
		grid-template-columns: 1fr;
	}

	/* Entrada: los datos arriba en una franja */
	.hv-c-post {
		grid-template-columns: 1fr;
		gap: 0;
	}
	.hv-c-aside {
		position: static;
		display: flex;
		flex-wrap: wrap;
		align-items: flex-end;
		gap: 6px 22px;
		margin-bottom: 18px !important;
		padding-bottom: 14px;
		border-bottom: 1px solid var(--hv-line);
	}
	.hv-bigdate {
		display: flex;
		align-items: baseline;
		gap: 8px;
	}
	.hv-bigdate__md {
		font-size: 34px !important;
	}
	.hv-bigdate__y {
		margin: 0 !important;
	}
	.hv-c-meta {
		margin: 0 !important;
	}
	.hv-c-meta > .wp-block-post-terms {
		font-size: 14px !important;
	}

	/* Foto destacada a sangre */
	.hv-c-body .hv-c-feat {
		margin-inline: calc(-1 * var(--wp--preset--spacing--50, 1.5rem)) !important;
	}
	.hv-c-body .hv-c-feat img {
		border-radius: 0;
	}

	.wp-block-gallery.hv-g2.has-nested-images {
		gap: 5px !important;
	}
	.wp-block-gallery.hv-g2.has-nested-images figure.wp-block-image:not(#individual-image) {
		flex-basis: calc(var(--r) * 110px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hv-index .hv-row__title,
	.hv-index .hv-row__title a,
	.hv-index .hv-row__thumb img {
		transition: none;
	}
	.hv-index .hv-row:hover .hv-row__thumb img {
		transform: none;
	}
	.hv-index .hv-row:hover .hv-row__title {
		transform: none;
	}
}

/* ---------- Fondo con grano ----------
   Ruido fino muy leve sobre el mismo color de fondo para que no sea tan plano:
   motas claras y motas oscuras repartidas (se compensan y el color no cambia).
   Va como imagen de fondo del body, así no toca fotos ni texto. */
body {
	background-image:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 4 0 0 0 -2.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23a)' opacity='0.1'/%3E%3C/svg%3E"),
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='b'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -4 0 0 0 1.7'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23b)' opacity='0.14'/%3E%3C/svg%3E") !important;
	background-repeat: repeat !important;
}

/* ---------- Texto japonés en vertical (portada, Contact, Contribute) ----------
   Mismo tipo en las tres: Dela en rojo, arriba a la derecha.
   - Con foto (.hv-kana--photo): encima de la foto, montado sobre su borde derecho.
   - Sin foto (Contribute): el contenedor (.hv-has-kana) le reserva una columna. */

.hv-has-kana {
	position: relative;
	padding-right: clamp(80px, 9vw, 130px);
}
.hv-kana {
	position: absolute;
	top: 0;
	right: 0;
	margin: 0 !important;
	color: var(--wp--preset--color--accent-3, #D12735);
	font-family: var(--wp--preset--font-family--dela-gothic-one);
	font-size: clamp(56px, 7vw, 104px);
	line-height: 1;
	letter-spacing: -0.04em;
	white-space: nowrap;
	writing-mode: vertical-rl;
	pointer-events: none;
	user-select: none;
}

/* Sobre la foto: la columna de la foto es la referencia */
.hv-hero__r,
.hv-contact__r {
	position: relative;
}
.hv-kana--photo {
	top: -0.12em;
	right: -0.38em;
	z-index: 2;
	text-shadow: 0 0 24px rgb(0 0 0 / 0.35);
}

@media (max-width: 781px) {
	.hv-has-kana {
		padding-right: 56px;
	}
	.hv-kana {
		font-size: 46px;
	}
	.hv-kana--photo {
		top: 0.15em;
		right: 0.1em;
	}
}
