/* MA Index — estilos */

@font-face {
	font-family: "Apercu Mono";
	src: url("../fonts/ApercuPro-Mono.woff2") format("woff2");
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

/* ---------- Modos de color ---------- */
:root,
[data-mode="light"] {
	--bg: #ffffff;
	--fg: #111111;
	--muted: #6a6a66;
	--line: #e4e4e1;
	--accent: #1e9e3a;
	--new: #1e7a33;
}
[data-mode="dark"] {
	--bg: #0d0d0d;
	--fg: #ededea;
	--muted: #8f8f8a;
	--line: #2a2a2a;
	--accent: #7cff6b;
	--new: #7cff6b;
}
[data-mode="infrared"] {
	--bg: #140404;
	--fg: #ffd9cf;
	--muted: #c98371;
	--line: #3d1611;
	--accent: #ff4a2b;
	--new: #7cff6b;
}
[data-mode="chrome"] {
	--bg: #c9cbce;
	--fg: #0f1012;
	--muted: #3e4145;
	--line: #a7aaaf;
	--accent: #0f1012;
	--new: #1c6b2e;
}

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

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: "Apercu Mono", ui-monospace, Menlo, monospace;
	font-size: 13px;
	line-height: 1.4;
	text-transform: uppercase;
	transition: background-color .5s ease, color .5s ease;
}

a { color: inherit; text-decoration: none; }
a:hover, button:hover { opacity: .6; }
img { display: block; max-width: 100%; height: auto; }
p { margin: 0; }
h1 { font: inherit; margin: 0; }

button {
	font: inherit;
	color: inherit;
	text-transform: inherit;
	letter-spacing: inherit;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	text-align: left;
}

:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }

.lc { text-transform: none; }
.uc { text-transform: uppercase; }
.muted { color: var(--muted); }

.ma-page {
	min-height: 100vh;
	padding: 0 16px;
	display: flex;
	flex-direction: column;
}

/* Retícula de 10 columnas */
.g10 {
	display: grid;
	grid-template-columns: repeat(10, minmax(0, 1fr));
	column-gap: 12px;
}
.ix { grid-column: 3 / -1; }

/* ---------- Cabecera índice ---------- */
.ma-head {
	position: sticky;
	top: 0;
	z-index: 5;
	background: var(--bg);
	transition: background-color .5s ease;
	padding-bottom: 28px;
	align-items: start;
}
.ma-name { grid-column: 1 / 3; padding-top: 18px; }
.ma-mtime { display: none; }
.ma-nav { display: flex; flex-direction: column; gap: 6px; }
.ma-nav--1 { grid-column: 3 / 5; }
.ma-nav--2 { grid-column: 5 / 7; }
.ma-nav--3 { grid-column: 7 / 9; }
.ma-nav--4 { grid-column: 9 / 11; }
.ma-on { display: inline-block; width: 7px; height: 7px; background: var(--accent); }
/* Idioma: textos que existen en los dos idiomas */
html[data-ui="es"] .only-en, html:not([data-ui="es"]) .only-es { display: none !important; }
.ma-lang { display: inline-flex; align-items: center; gap: 6px; margin-left: 14px; padding-top: 6px; color: var(--muted); }
.ma-lang button { min-height: 24px; color: var(--muted); }
.ma-lang button[aria-pressed="true"] { color: var(--fg); }
/* Lab: cabecera + Digital Life a pantalla completa */
.ma-lab { min-height: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.ma-lab .ma-head { position: relative; padding-bottom: 18px; flex: none; }
.admin-bar .ma-lab { height: calc(100vh - 32px); height: calc(100dvh - 32px); }
@media (max-width: 782px) { .admin-bar .ma-lab { height: calc(100vh - 46px); height: calc(100dvh - 46px); } }
.ma-lab-frame { flex: 1; min-height: 0; width: calc(100% + 32px); margin: 0 -16px; border: 0; display: block; background: var(--bg); }
.tick { width: 1px; height: 10px; background: var(--fg); }
.ma-nav > a, .ma-nav > button { display: inline-flex; align-items: center; column-gap: 1ch; min-height: 24px; line-height: 1.4; }
.ma-drop { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.ma-drop[hidden], .ma-list[hidden] { display: none; }
.ma-drop p { line-height: 1.5; max-width: 38ch; }
.ma-available { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ---------- Herramientas ---------- */
.ma-main { flex: 1; padding-bottom: 64px; }
.ma-tools { margin-bottom: 24px; }
.ma-tools .ix { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 28px; }
.ma-expand { display: flex; align-items: center; gap: 10px; min-height: 24px; }
.ma-expand svg { transition: transform .3s ease; }
.ma-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
.ma-filters { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.ma-filters button { color: var(--muted); min-height: 24px; }
.ma-filters button[aria-pressed="true"] { color: var(--fg); }

/* ---------- Índice ---------- */
.ma-list { list-style: none; margin: 0; padding: 0; }
.row[hidden] { display: none; }
.row-btn { display: flex; gap: 22px; align-items: center; padding: 2px 0; min-height: 22px; }
.row-btn:hover { opacity: 1; }
.row-btn:hover .rn { opacity: .6; }
.rc { width: 44px; flex: none; color: var(--muted); }
.row-btn[aria-expanded="true"] .rc { color: var(--fg); }
.rnew { color: var(--new); font-size: 11px; }

/* Tira de 5 imágenes */
.strip {
	grid-column: 1 / -1;
	margin: 18px 0 30px;
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 24px 12px;
	animation: ma-rise .45s ease both;
}
@keyframes ma-rise {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

/* Tarjetas (tira y cuadrícula) */
.card { display: flex; flex-direction: column; gap: 8px; }
.card:hover { opacity: 1; }
.th { display: block; overflow: hidden; background: var(--line); aspect-ratio: 16 / 9; }
.th img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.card:hover .th img { transform: scale(1.04); }
.cap { display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }

/* Vista "Expand all" */
.ma-works {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 44px 12px;
	margin-bottom: 32px;
	animation: ma-rise .45s ease both;
}
.ma-works[hidden] { display: none; }
.ma-works .card[hidden] { display: none; }

/* ---------- HUD inferior ---------- */
.ma-hud {
	position: sticky;
	bottom: 0;
	background: var(--bg);
	transition: background-color .5s ease;
	padding: 12px 0 14px;
	align-items: center;
	color: var(--muted);
}
.ma-modes { grid-column: 1 / 3; display: flex; gap: 8px; align-items: center; }
.mode { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 6px; }
.mode:hover { opacity: 1; }
.mode .sq { width: 12px; height: 12px; box-shadow: 0 0 0 1px var(--line); transition: transform .2s ease; }
.mode:hover .sq { transform: scale(1.15); }
.mode .ln { width: 12px; height: 2px; background: transparent; transition: background-color .3s ease; }
.mode[aria-pressed="true"] .ln { background: var(--accent); }
.mode--light .sq { background: #ffffff; }
.mode--dark .sq { background: #0d0d0d; }
.mode--infrared .sq { background: #ff4a2b; }
.mode--chrome .sq { background: linear-gradient(135deg, #f4f5f6, #8d9196); }
.hud-time { grid-column: 3 / 6; }
.hud-xy { grid-column: 6 / 9; }
.hud-copy { grid-column: 9 / 11; }

/* ---------- Proyecto: sala oscura ---------- */
.ma-project {
	--bg: #000;
	--fg: #ededea;
	--muted: #8f8f8a;
	--line: #222;
	background: var(--bg);
	color: var(--fg);
	padding-bottom: 40px;
}
.ma-pbar {
	position: sticky;
	top: 0;
	z-index: 5;
	background: var(--bg);
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 14px 0;
}
.ma-phead { padding: 36px 0 44px; row-gap: 20px; }
.ma-phead .meta { grid-column: 1 / 4; display: flex; flex-direction: column; gap: 2px; line-height: 1.4; }
.ma-phead .desc { grid-column: 4 / 8; line-height: 1.55; max-width: 58ch; }
.ma-phead .desc p + p { margin-top: .8em; }
.ma-phead .credits { grid-column: 8 / 11; display: flex; flex-direction: column; gap: 2px; line-height: 1.4; }
.ma-phead a { text-decoration: underline; text-underline-offset: 2px; }

.stage { grid-column: 2 / 10; display: flex; flex-direction: column; gap: 56px; animation: ma-rise .6s ease both; }
.stage figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.shot { display: block; width: 100%; cursor: zoom-in; }
.shot:hover { opacity: 1; }
.shot img { width: 100%; transition: opacity .4s ease; }
.shot:hover img { opacity: .85; }
.video { position: relative; width: 100%; background: #111; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.ma-pfoot { margin-top: 96px; padding-top: 16px; border-top: 1px solid var(--line); row-gap: 16px; align-items: end; }
.pf-prev, .pf-next { display: flex; flex-direction: column; gap: 2px; line-height: 1.4; }
.pf-prev { grid-column: 1 / 4; }
.pf-index { grid-column: 5 / 7; justify-self: center; }
.pf-next { grid-column: 8 / 11; text-align: right; }

/* Visor a pantalla completa */
.ma-lb {
	position: fixed;
	inset: 0;
	z-index: 50;
	background: #000;
	display: flex;
	flex-direction: column;
	padding: 0 16px;
}
.ma-lb[hidden] { display: none; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; }
.lb-code { padding: 20px 0; }
.lb-img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding-bottom: 32px; }
.lb-img img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Panel móvil (versión A) */
.mpanel { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; margin: 10px 0 22px; animation: ma-rise .4s ease both; }
.mpanel .th { aspect-ratio: 16 / 9; }
.mpanel .mrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mpanel .mrow > span { display: flex; flex-direction: column; gap: 2px; }
.mpanel .mgo { flex: none; min-height: 32px; }

/* ---------- Móvil ---------- */
@media (max-width: 900px) {
	/* Cabecera: nombre + hora, y M1 / M2 / M3 en tres columnas */
	.ma-head {
		grid-template-columns: repeat(4, auto);
		justify-content: space-between;
		column-gap: 6px;
		row-gap: 10px;
		padding: 12px 0 14px;
	}
	.ma-nav { font-size: 11px; white-space: nowrap; gap: 4px; }
	.ma-nav > a, .ma-nav > button { column-gap: .6ch; }
	.ma-name { grid-column: 1 / 4; padding-top: 0; }
	.ma-mtime { display: block; grid-column: 4; justify-self: end; font-size: 11px; }
	.ma-nav--1 { grid-column: 1; }
	.ma-nav--2 { grid-column: 2; }
	.ma-nav--3 { grid-column: 3; }
	.ma-nav--4 { grid-column: 4; }
	.ma-lab .ma-head { padding-bottom: 12px; }
	.ma-lang { margin-left: 10px; padding-top: 0; }
	.ma-lang button { min-height: 32px; }
	.ma-drop {
		position: absolute;
		left: 0;
		right: 0;
		top: 100%;
		margin: 0;
		padding: 0 0 20px;
		background: var(--bg);
		animation: ma-rise .3s ease both;
	}

	/* Herramientas: solo filtros */
	.ma-tools { margin-bottom: 20px; }
	.ma-tools .ix { grid-column: 1 / -1; }
	.ma-expand { display: none; }
	.ma-filters { gap: 4px 16px; }
	.ma-filters button { min-height: 28px; }
	.ma-works[hidden] { display: none; }

	/* Lista */
	.ix { grid-column: 1 / -1; }
	.row-btn { width: 100%; min-height: 32px; gap: 18px; }
	.rc { width: 40px; }

	/* Pie: modos + © */
	.ma-hud { display: flex; justify-content: space-between; padding: 10px 0 14px; font-size: 11px; }
	.hud-time, .hud-xy { display: none; }
	.mode .sq, .mode .ln { width: 14px; }
	.mode .sq { height: 14px; }
	.mode { min-height: 32px; padding: 6px 2px 0; }

	/* Proyecto */
	.ma-phead .meta, .ma-phead .desc, .ma-phead .credits,
	.stage,
	.pf-prev, .pf-index, .pf-next { grid-column: 1 / -1; }
	.ma-phead { padding: 24px 0 32px; }
	.stage { gap: 36px; }
	.pair { grid-template-columns: minmax(0, 1fr); gap: 36px; }
	.ma-works { grid-template-columns: minmax(0, 1fr); }
	.pf-index { justify-self: start; }
	.pf-next { text-align: left; }
	.ma-pfoot { margin-top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}
