/* LABG — hoja de estilos del portal
   Paleta: la del logo — oro y negro sobre blanco —, con el oro oscuro para enlaces y texto de acento.
   Tipografía servida desde el propio sitio (assets/css/fonts.css): serif para títulos,
   sans para el texto y monoespaciada para datos (DOI, versiones). */

:root {
  --paper: #ffffff;
  --ground: #f7f5f0;
  --ink: #111111;
  --ink-2: #3d3a35;
  --muted: #5b5750;
  --line: #e6e1d6;
  --line-2: #efebe3;
  --blue: #7d5b14;            /* (nombre histórico) enlaces y bordes activos: oro oscuro, 6:1 sobre blanco */
  --blue-deep: #111111;       /* texto fuerte y botón principal: negro */
  --blue-soft: #fbf6ea;
  --gold: #b8862e;
  --gold-soft: #fbf1dc;
  --ok: #1d7a4d;
  --ok-soft: #e1f3ea;
  --soon: #8a5a00;
  --soon-soft: #fbefd6;
  --accent-strong: #111111;   /* relleno de lo activo: filtro elegido, enlace de salto, marca */
  --on-accent: #ffffff;
  --focus: #7d5b14;           /* anillo de enfoque: ≥ 3:1 sobre el papel y el fondo */
  --field-line: #8a8478;      /* borde de campos: ≥ 3:1 */
  --shadow: 0 1px 2px rgba(17, 17, 17, .06), 0 8px 24px rgba(17, 17, 17, .07);
  --radius: 10px;
  --maxw: 1180px;
  --f-display: "LABG Serif", ui-serif, serif;
  --f-body: "LABG Sans", system-ui, sans-serif;
  --f-mono: "LABG Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #171512; --ground: #0e0d0b; --ink: #f2efe8; --ink-2: #d2ccc0; --muted: #a39d91;
    --line: #2e2b25; --line-2: #22201b; --blue: #e6c470; --blue-deep: #f1dda8; --blue-soft: #2a2416;
    --gold: #e8b64a; --gold-soft: #2e2512; --ok: #6fd3a0; --ok-soft: #12301f; --soon: #f0c36a; --soon-soft: #33280f;
    --accent-strong: #d4a848; --on-accent: #111111; --focus: #e8b64a; --field-line: #7a7468;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #171512; --ground: #0e0d0b; --ink: #f2efe8; --ink-2: #d2ccc0; --muted: #a39d91;
  --line: #2e2b25; --line-2: #22201b; --blue: #e6c470; --blue-deep: #f1dda8; --blue-soft: #2a2416;
  --gold: #e8b64a; --gold-soft: #2e2512; --ok: #6fd3a0; --ok-soft: #12301f; --soon: #f0c36a; --soon-soft: #33280f;
    --accent-strong: #d4a848; --on-accent: #111111; --focus: #e8b64a; --field-line: #7a7468;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--blue-deep); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.15; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.55rem, 2.8vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0; }
.mono { font-family: var(--f-mono); font-size: .86em; }
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }
.eyebrow { font-family: var(--f-mono); font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); font-weight: 500; }
.lead { font-size: 1.14rem; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--muted); }

/* ---------- Cabecera ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-mark { height: 40px; width: auto; display: block; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-family: var(--f-display); font-size: 1.12rem; }
.brand-text span { font-size: .74rem; color: var(--muted); }
.nav { display: flex; gap: 2px; margin-left: auto; align-items: center; }
.nav a {
  text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .94rem;
  padding: 8px 12px; border-radius: 8px; white-space: nowrap;
}
.nav a:hover { background: var(--blue-soft); color: var(--blue-deep); }
.nav a[aria-current="page"] { color: var(--blue-deep); background: var(--blue-soft); }
/* herramientas: separadas del menú por una línea fina, siempre visibles */
.top-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding-left: 16px; border-left: 1px solid var(--line); }
.icon-btn {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  width: 40px; height: 40px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; padding: 0;
  text-decoration: none;
}
.icon-btn:hover { border-color: var(--blue); color: var(--blue); }
.icon-btn[aria-pressed="true"] { border-color: var(--accent-strong); background: var(--blue-soft); color: var(--blue-deep); }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}
.theme-btn[aria-pressed]:not(:hover) { border-color: var(--line); background: var(--paper); color: var(--ink-2); }
/* botón de búsqueda: en pantallas anchas muestra la palabra y el atajo */
.search-btn { gap: 8px; }
.search-label, .search-kbd { display: none; }
.search-kbd { font: 500 .68rem var(--f-mono); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--ground); }
/* el atajo se dibuja con CSS: así no cuenta como texto del nombre del botón */
.search-kbd::before { content: "Ctrl K"; }
@media (min-width: 1180px) {
  .search-btn { width: auto; padding: 0 8px 0 12px; display: inline-flex; align-items: center; }
  .search-label { display: inline; font: 500 .9rem var(--f-body); color: var(--muted); margin-right: 18px; }
  .search-kbd { display: inline; }
}
@media (max-width: 1100px) { .nav a { padding: 8px 9px; } .top .wrap { gap: 12px; } .top-tools { padding-left: 12px; } }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .menu-btn { display: inline-grid; }
  .top-tools { margin-left: auto; border-left: 0; padding-left: 0; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px 16px 16px; margin: 0;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .nav a::after { display: none; }
  .nav a[aria-current="page"] { background: var(--blue-soft) !important; }
}
@media (max-width: 420px) { .brand-text span { display: none; } .top-tools { gap: 6px; } }
@media (pointer: coarse) { .icon-btn { width: 44px; height: 44px; } }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html.no-scroll { overflow: hidden; }

/* ---------- Botones y chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: 600 .95rem/1 var(--f-body); padding: 12px 18px; border-radius: 8px; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--blue-deep); color: #fff; }
.btn-primary:hover { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #2a2620; }
:root[data-theme="dark"] .btn-primary { background: #d4a848; color: #111; }
:root[data-theme="dark"] .btn-primary:hover { background: #e6c470; color: #111; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { background: #d4a848; color: #111; } :root:not([data-theme="light"]) .btn-primary:hover { background: #e6c470; color: #111; } }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue-deep); }
.btn-sm { padding: 8px 12px; font-size: .86rem; }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font: 500 .74rem/1 var(--f-mono);
  padding: 5px 8px; border-radius: 999px; white-space: nowrap;
}
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-soon { background: var(--soon-soft); color: var(--soon); }
.chip-cat { background: var(--blue-soft); color: var(--blue-deep); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Secciones ---------- */
main { display: block; }
.section { padding-block: 64px; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.section-head > div { display: grid; gap: 8px; }
.band { background: var(--paper); border-block: 1px solid var(--line); }

/* ---------- Portada ---------- */
.hero { padding-block: 56px 64px; background:
  radial-gradient(900px 400px at 85% 0%, var(--blue-soft), transparent 70%), var(--paper); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.hero-copy { display: grid; gap: 20px; }
.hero h1 em { font-style: italic; color: var(--blue); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 22px; padding-top: 6px; color: var(--ink-2); font-size: .92rem; }
.facts span { display: inline-flex; align-items: center; gap: 8px; }
.facts svg { color: var(--ok); flex: none; }
.stack { position: relative; aspect-ratio: 16 / 11; max-width: 100%; }
.shot {
  position: absolute; width: 78%; border-radius: 10px; overflow: hidden; background: var(--paper);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.shot .bar { height: 22px; background: var(--line-2); display: flex; align-items: center; gap: 5px; padding-inline: 9px; }
.shot .bar i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); display: block; }
.shot .bar b { font: 500 .66rem var(--f-mono); color: var(--muted); margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot img { aspect-ratio: 16/10; object-fit: cover; object-position: top; width: 100%; }
.shot:nth-child(1) { left: 0; top: 0; transform: rotate(-2.2deg); }
.shot:nth-child(2) { right: 0; top: 14%; transform: rotate(1.6deg); }
.shot:nth-child(3) { left: 11%; bottom: 0; transform: rotate(-.4deg); z-index: 2; }

.numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.numbers div { padding: 20px 22px; border-left: 1px solid var(--line); display: grid; gap: 4px; }
.numbers div:first-child { border-left: 0; }
.numbers b { font: 600 2rem/1 var(--f-display); color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.numbers span { color: var(--muted); font-size: .9rem; }

.areas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.area {
  display: grid; gap: 6px; padding: 18px 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
}
.area:hover { border-color: var(--blue); }
.area h3 { font-size: 1.08rem; }
.area p { color: var(--muted); font-size: .9rem; }

/* ---------- Tarjetas de apps ---------- */
.grid-apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: color-mix(in srgb, var(--blue) 50%, var(--line)); box-shadow: var(--shadow); transform: translateY(-2px); }
.card-img { display: block; aspect-ratio: 16/10; overflow: hidden; background: var(--line-2); border-bottom: 1px solid var(--line); position: relative; }
.card-img img { width: 100%; height: 100% !important; object-fit: cover; object-position: top left; }
.card-img .chip { position: absolute; top: 10px; left: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.card-body h3 a { color: var(--ink); text-decoration: none; }
.card-body h3 a:hover { color: var(--blue); }
.card-lema { color: var(--ink-2); font-size: .94rem; }
.label {
  margin-top: auto; display: flex; flex-wrap: wrap; gap: 4px 14px; padding-top: 12px; border-top: 1px dashed var(--line);
  font: .74rem/1.4 var(--f-mono); color: var(--muted);
}
.label b { color: var(--ink-2); font-weight: 500; }
.card-actions { display: flex; gap: 8px; padding: 0 18px 18px; }
.card-actions .btn { flex: 1; }

/* ---------- Filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 24px; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--field-line);
  border-radius: 8px; padding: 0 12px; min-height: 44px;
}
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.search input { border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; width: 100%; min-height: 42px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); border-radius: 999px;
  padding: 8px 14px; font: 500 .86rem var(--f-body); cursor: pointer;
}
.pill:hover { border-color: var(--blue); }
.pill[aria-pressed="true"] { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
select.field {
  border: 1px solid var(--field-line); background: var(--paper); color: var(--ink); border-radius: 8px; padding: 0 12px; min-height: 44px; font: inherit;
}
.count { font: .85rem var(--f-mono); color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- Ficha de app ---------- */
.detail-hero { background: var(--paper); border-bottom: 1px solid var(--line); padding-block: 36px 48px; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 18px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs li { display: inline-flex; align-items: center; gap: 4px; }
.crumbs li + li::before { content: "/"; color: var(--line); margin-right: 2px; }
.crumbs [aria-current] { color: var(--ink-2); font-weight: 500; }
.crumbs a { color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 44px; align-items: start; }
.detail-copy { display: grid; gap: 16px; }
.detail-copy .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-shot { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.ficha { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.ficha div { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: grid; gap: 2px; }
.ficha div:nth-child(odd) { border-right: 1px solid var(--line-2); }
.ficha dt { font: .7rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ficha dd { margin: 0; font: 500 .92rem var(--f-mono); color: var(--ink); overflow-wrap: anywhere; }
.puntos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; list-style: none; padding: 0; margin: 0; }
.puntos li { display: flex; gap: 10px; align-items: start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.puntos svg { color: var(--blue); flex: none; margin-top: 3px; }
.cite-box {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 12px;
}
.cite-box p { font-size: .95rem; color: var(--ink-2); overflow-wrap: anywhere; }
.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: start; }

/* ---------- Publicaciones ---------- */
.pub-year { display: grid; grid-template-columns: 88px 1fr; gap: 20px; padding-block: 18px; border-top: 1px solid var(--line); }
.pub-year > h2 { font: 600 1.5rem/1.2 var(--f-display); color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.pub-list { display: grid; gap: 14px; }
.pub { overflow-wrap: anywhere; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 6px; }
.pub-title { font: 600 1.02rem/1.4 var(--f-body); color: var(--ink); }
.pub-authors { font-size: .9rem; color: var(--ink-2); }
.pub-authors mark { background: none; color: var(--ink); font-weight: 600; }
.pub-venue { font-size: .9rem; color: var(--muted); font-style: italic; }
.pub-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.pub-meta a.doi { font: .8rem var(--f-mono); }
.link-btn { background: none; border: 0; padding: 6px 0; font: 500 .82rem var(--f-body); color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Descargas ---------- */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
table.dl { width: 100%; border-collapse: collapse; min-width: 720px; }
table.dl th, table.dl td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.dl th { font: 500 .72rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--ground); }
table.dl tr:last-child td { border-bottom: 0; }
table.dl td .name { font-weight: 600; }
table.dl td .sub { font-size: .82rem; color: var(--muted); }
.dl-links { display: flex; flex-wrap: wrap; gap: 6px; }
.size { font: .78rem var(--f-mono); color: var(--muted); }

/* ---------- Blog ---------- */
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.post-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); }
.post-card:hover { border-color: var(--blue); }
.post-card time, .post-head time { font: .78rem var(--f-mono); color: var(--muted); }
.post-card h3 { font-size: 1.2rem; }
.post-card p { color: var(--ink-2); font-size: .94rem; }
.post-card .more { margin-top: auto; color: var(--blue); font-weight: 600; font-size: .9rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.article { max-width: 720px; margin-inline: auto; }
.post-head { display: grid; gap: 12px; margin-bottom: 28px; }
.prose { font-size: 1.06rem; line-height: 1.75; color: var(--ink); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: 1.5rem; margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose blockquote { margin: 1.2em 0; padding: 12px 18px; border-left: 3px solid var(--gold); background: var(--gold-soft); border-radius: 0 8px 8px 0; color: var(--ink-2); }
.prose pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--f-mono); font-size: .9rem; }
.prose code { font-family: var(--f-mono); font-size: .88em; background: var(--blue-soft); padding: 2px 5px; border-radius: 4px; }
.prose img { border-radius: 8px; border: 1px solid var(--line); }
.related { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); display: grid; gap: 12px; }

/* ---------- Acerca ---------- */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
.contact-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 14px; }
.contact-card dl { margin: 0; display: grid; gap: 12px; }
.contact-card dt { font: .7rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.contact-card dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: .92rem; }
.form input, .form textarea { font: inherit; color: var(--ink); background: var(--ground); border: 1px solid var(--field-line); border-radius: 8px; padding: 10px 12px; }
.form textarea { min-height: 120px; resize: vertical; }
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.principle { display: grid; gap: 8px; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.principle h3 { font-size: 1.05rem; }
.principle p { color: var(--ink-2); font-size: .94rem; }

/* ---------- Pie ---------- */
.foot { background: #111; color: #e9e4d8; padding-block: 44px 28px; margin-top: 0; }
:root[data-theme="dark"] .foot { background: #0a0908; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .foot { background: #0a0908; } }
.foot a { color: #fff; }
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 32px; }
.foot-h { margin: 0 0 10px; font: 500 .72rem var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: #d4a848; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.foot ul a { text-decoration: none; color: #e9e4d8; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.foot ul a:hover { color: #fff; text-decoration: underline; }
.foot-bottom { margin-top: 32px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.15); font-size: .84rem; color: #d4a848; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .grid-apps, .posts { grid-template-columns: repeat(2, 1fr); }
  .areas, .principles { grid-template-columns: repeat(2, 1fr); }
  .hero-grid, .detail-grid, .two-col, .about-grid { grid-template-columns: 1fr; }
  .stack { max-width: 620px; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding-inline: 16px; }
  .section { padding-block: 44px; }
  .grid-apps, .posts, .areas, .principles, .puntos { grid-template-columns: 1fr; }
  .numbers { grid-template-columns: 1fr 1fr; }
  .numbers div:nth-child(3) { border-left: 0; }
  .numbers div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .ficha { grid-template-columns: 1fr; }
  .ficha div:nth-child(odd) { border-right: 0; }
  .pub-year { grid-template-columns: 1fr; gap: 8px; }
  .foot-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   CAPA PREMIUM — dirección de arte, microinteracciones y animaciones.
   Solo se animan transform y opacity. Sin CLS: nada cambia de tamaño.
   ===================================================================== */
:root {
  --ground: #faf8f3;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t: 200ms;
  --glow: 0 0 0 1px rgba(125,91,20,.10), 0 18px 40px -12px rgba(17,17,17,.22);
  --mesh-a: rgba(125,91,20,.14); --mesh-b: rgba(212,168,72,.10); --mesh-c: rgba(230,196,112,.16);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glow: 0 0 0 1px rgba(230,196,112,.12), 0 18px 40px -12px rgba(0,0,0,.6); --mesh-a: rgba(212,168,72,.22); --mesh-b: rgba(232,182,74,.10); --mesh-c: rgba(125,91,20,.28); } }
:root[data-theme="dark"] { --glow: 0 0 0 1px rgba(230,196,112,.12), 0 18px 40px -12px rgba(0,0,0,.6); --mesh-a: rgba(212,168,72,.22); --mesh-b: rgba(232,182,74,.10); --mesh-c: rgba(125,91,20,.28); }

/* --- Fondo mesh que respira (fijo, detrás de todo) --- */
body { position: relative; isolation: isolate; }
body::before {
  content: ""; position: fixed; inset: -20% -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42% 38% at 18% 12%, var(--mesh-a), transparent 70%),
    radial-gradient(36% 34% at 84% 8%,  var(--mesh-c), transparent 70%),
    radial-gradient(30% 30% at 70% 90%, var(--mesh-b), transparent 70%);
  /* fondo fijo: sin animación continua, que no distraiga ni gaste batería */

}
.hero { background: transparent; }
.band, .detail-hero, .top { background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); }
.top { box-shadow: 0 1px 0 var(--line), 0 10px 30px -18px rgba(17,17,17,.25); }

/* --- Navegación: subrayado que crece desde el centro --- */
.nav a { position: relative; background: none !important; transition: color var(--t) var(--ease); }
.nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px; border-radius: 2px;
  background: var(--blue); transform: scaleX(0); transform-origin: center; transition: transform var(--t) var(--ease);
}
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--blue-deep); }
.icon-btn { transition: transform var(--t) var(--ease), border-color var(--t), color var(--t); }
.icon-btn:hover { transform: translateY(-1px); }

/* --- Botones --- */
.btn { transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t), border-color var(--t), color var(--t); }
.btn svg { transition: transform var(--t) var(--ease); }
.btn:hover { transform: translateY(-1px); }
.btn:hover svg { transform: translate(2px, -2px); }
.btn:active { transform: translateY(0) scale(.99); transition-duration: 120ms; }
.btn-primary { background: linear-gradient(135deg, var(--blue-deep), var(--blue)); box-shadow: 0 6px 18px -8px rgba(17,17,17,.5); }
.btn-primary:hover { box-shadow: 0 14px 28px -10px rgba(17,17,17,.55), inset 0 -2px 0 var(--gold); }
.btn-ghost:hover { box-shadow: var(--glow); }

/* --- Tarjetas de apps: borde luminoso + zoom lento en la captura --- */
.card { position: relative; transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t); overflow: hidden; }
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  background: linear-gradient(120deg, rgba(125,91,20,.0) 30%, rgba(125,91,20,.28) 50%, rgba(212,168,72,.18) 70%, transparent 90%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 1px;
  opacity: 0; transition: opacity var(--t) var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--glow); border-color: transparent; }
.card:hover::before { opacity: 1; }
.card-img img { transition: transform 600ms var(--ease); }
.card:hover .card-img img { transform: scale(1.03); }
.card-img .chip { transition: transform var(--t) var(--ease); }
.card:hover .card-img .chip { transform: translateY(-2px); }
.area, .post-card, .principle, .pub { transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t); }
.area:hover, .post-card:hover, .principle:hover, .pub:hover { transform: translateY(-3px); box-shadow: var(--glow); }
.post-card .more { display: inline-flex; gap: 6px; transition: gap var(--t) var(--ease); }
.post-card:hover .more { gap: 12px; }

/* --- Hero: título con subrayado dorado y capturas con profundidad --- */
.hero h1 em { position: relative; white-space: nowrap; isolation: isolate; }
.hero h1 em::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .06em; height: .14em; border-radius: 4px; z-index: -1;
  background: linear-gradient(90deg, var(--gold-soft), color-mix(in srgb, var(--gold) 55%, transparent));
  transform: scaleX(0); transform-origin: left; animation: underline 900ms var(--ease) 500ms forwards;
}
@keyframes underline { to { transform: scaleX(1); } }
.stack { perspective: 1200px; }
.shot { box-shadow: 0 30px 60px -24px rgba(17,17,17,.35), 0 0 0 1px var(--line); transition: transform 600ms var(--ease), box-shadow 600ms var(--ease); }
.stack:hover .shot { box-shadow: 0 40px 70px -24px rgba(17,17,17,.45), 0 0 0 1px var(--line); }
.stack[style*="--pp"] .shot { transform: translateY(calc(var(--py, 0px) * -1)) rotate(var(--rot)); }
.shot:nth-child(1) { --rot: -2.2deg; }
.shot:nth-child(2) { --rot: 1.6deg; }
.shot:nth-child(3) { --rot: -.4deg; }
.shot:nth-child(1) { animation: shot-in 900ms var(--ease) 150ms both; }
.shot:nth-child(2) { animation: shot-in 900ms var(--ease) 320ms both; }
.shot:nth-child(3) { animation: shot-in 900ms var(--ease) 490ms both; }
@keyframes shot-in { from { opacity: 0; transform: translateY(28px) scale(.97) rotate(0deg); } }
.hero-copy > * { animation: rise 700ms var(--ease) both; }
.hero-copy > :nth-child(1) { animation-delay: 60ms; } .hero-copy > :nth-child(2) { animation-delay: 140ms; }
.hero-copy > :nth-child(3) { animation-delay: 220ms; } .hero-copy > :nth-child(4) { animation-delay: 300ms; } .hero-copy > :nth-child(5) { animation-delay: 380ms; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* --- Cifras: vidrio --- */
.numbers { background: color-mix(in srgb, var(--paper) 70%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--glow); border-color: transparent; }
.numbers b { font-variant-numeric: tabular-nums; }

/* --- Entradas al hacer scroll (el JS añade .in cuando el elemento aparece) --- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }
html:not(.js) .reveal { opacity: 1; transform: none; }
.fade-swap > * { animation: rise 450ms var(--ease) both; }

/* --- Ficha de app --- */
.detail-shot { transition: transform 600ms var(--ease), box-shadow 600ms var(--ease); }
.detail-shot:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: var(--glow); }
.puntos li { transition: transform var(--t) var(--ease), border-color var(--t); }
.puntos li:hover { transform: translateX(4px); border-color: var(--blue); }

/* --- Pie con degradado profundo --- */
.foot { background: linear-gradient(160deg, #1d1a14, #12100c 60%, #0a0908); }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .shot, .hero-copy > *, .hero h1 em::after, .fade-swap > * { animation: none; }
  .hero h1 em::after { transform: scaleX(1); }
}

/* --- Accesibilidad: saltar al contenido --- */
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--accent-strong); color: var(--on-accent); padding: 10px 14px; border-radius: 8px; text-decoration: none; font-weight: 600; transition: top var(--t) var(--ease); }
.skip:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }

/* --- Buscador global --- */
dialog.sdlg { width: min(680px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 16vh); margin: calc(8vh + env(safe-area-inset-top, 0px)) auto auto; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible; }
dialog.sdlg::backdrop { background: rgba(10,9,8,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog.sdlg[open] .sbox { animation: rise 200ms var(--ease) both; }
.sinput .sclose { margin-left: 4px; width: 32px; height: 32px; border-color: transparent; }
.sempty { padding: 24px; text-align: center; color: var(--muted); }
.sbox { max-width: 680px; margin-inline: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); overflow: hidden; }
.sinput { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 60px; padding-inline: 18px; }
.sinput svg { color: var(--muted); flex: none; }
.sinput input { font-size: 1.05rem; }
.sinput kbd, .shint kbd { font: 500 .7rem var(--f-mono); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; background: var(--ground); }
.sres { max-height: min(56vh, 520px); overflow-y: auto; padding: 8px; display: grid; gap: 2px; }
.sitem { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; text-decoration: none; color: var(--ink); }
.sitem:hover, .sitem[aria-selected="true"] { background: var(--blue-soft); }
.skind { flex: none; font: 500 .68rem var(--f-mono); letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); min-width: 92px; text-align: center; }
.skind-app { background: var(--blue-soft); color: var(--blue-deep); } .skind-post { background: var(--gold-soft); color: var(--soon); } .skind-pub { background: var(--ok-soft); color: var(--ok); }
.stext { display: grid; gap: 1px; min-width: 0; flex: 1; }
.stext b { font-weight: 600; font-size: .96rem; } .stext small { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shint { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.shint span { display: inline-flex; gap: 4px; align-items: center; }
@media (max-width: 640px) { .skind { min-width: 0; } .shint { display: none; } }

/* --- Catálogo: controles, contadores, vista de lista --- */
.select-wrap { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); }
.select-label { white-space: nowrap; }
.view-seg { display: inline-flex; gap: 4px; }
.pill-n { font: 500 .72rem var(--f-mono); margin-left: 2px; }
.card-actions { align-items: center; }
.card-extra { display: inline-flex; gap: 6px; margin-left: auto; }
.card-extra .icon-btn { width: 36px; height: 36px; }
@media (pointer: coarse) { .card-extra .icon-btn { width: 44px; height: 44px; } }
.card-actions .btn { flex: 1 1 auto; }
.empty p + p { margin-top: 6px; }

.grid-apps.as-list { grid-template-columns: 1fr; gap: 12px; }
.grid-apps.as-list .card { display: grid; grid-template-columns: 200px 1fr auto; align-items: stretch; }
.grid-apps.as-list .card:hover { transform: translateY(-1px); }
.grid-apps.as-list .card-img { aspect-ratio: auto; height: 100%; min-height: 120px; border-bottom: 0; border-right: 1px solid var(--line); }
.grid-apps.as-list .card-body { padding: 14px 18px; gap: 4px; }
.grid-apps.as-list .label { border-top: 0; padding-top: 4px; }
.grid-apps.as-list .card-actions { padding: 14px 18px; flex-direction: column; align-items: stretch; justify-content: center; min-width: 190px; border-left: 1px dashed var(--line); }
.grid-apps.as-list .card-extra { margin-left: 0; justify-content: center; }
@media (max-width: 760px) {
  .grid-apps.as-list .card { grid-template-columns: 96px 1fr; }
  .grid-apps.as-list .card-img { min-height: 0; }
  .grid-apps.as-list .card-img .chip { display: none; }
  .grid-apps.as-list .card-actions { grid-column: 1 / -1; flex-direction: row; min-width: 0; border-left: 0; border-top: 1px dashed var(--line); padding: 12px 14px; }
  .grid-apps.as-list .card-extra { margin-left: auto; }
}
@media (max-width: 640px) {
  .toolbar .select-wrap { flex: 1 1 140px; }
  .toolbar .select-wrap select { flex: 1; min-width: 0; }
}

/* --- Página 404 --- */
.nf-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.nf-copy { display: grid; gap: 18px; }
.nf-copy code { overflow-wrap: anywhere; background: var(--blue-soft); padding: 2px 6px; border-radius: 4px; }
.nf-art { width: 100%; max-width: 340px; justify-self: center; color: var(--blue); }
.nf-art .nf-q { color: var(--gold); stroke: var(--gold); }
@media (max-width: 760px) { .nf-grid { grid-template-columns: 1fr; } .nf-art { max-width: 220px; order: -1; } }

/* --- Ficha de app: índice lateral, secciones y cita --- */
.detail-lema { font-family: var(--f-display); font-style: italic; }
.detail-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; align-items: start; }
.detail-main { display: grid; gap: 44px; min-width: 0; }
.detail-sec { display: grid; gap: 16px; scroll-margin-top: 84px; }
#relacionadas { scroll-margin-top: 64px; }
.toc { position: sticky; top: 88px; display: grid; gap: 8px; font-size: .9rem; }
.toc-title { font: 500 .72rem var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); display: grid; }
.toc a { display: block; padding: 6px 12px; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; transition: color var(--t), border-color var(--t); }
.toc a:hover { color: var(--blue-deep); }
.toc a[aria-current] { color: var(--blue-deep); border-left-color: var(--accent-strong); font-weight: 600; }
.cite-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--ground); border: 1px solid var(--line); justify-self: start; }
.cite-tabs [role="tab"] { border: 0; background: transparent; color: var(--muted); font: 600 .82rem var(--f-body); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.cite-tabs [role="tab"][aria-selected="true"] { background: var(--paper); color: var(--blue-deep); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.cite-text { font-size: .98rem; color: var(--ink); line-height: 1.65; }
.cite-bib { margin: 0; padding: 12px 14px; background: var(--ground); border: 1px solid var(--line-2); border-radius: 8px; font: .82rem/1.55 var(--f-mono); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.small { font-size: .88rem; }
@media (max-width: 1000px) {
  .detail-layout { grid-template-columns: 1fr; gap: 20px; }
  .toc { position: static; }
  .toc ol { border-left: 0; display: flex; flex-wrap: wrap; gap: 6px; }
  .toc a { margin: 0; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--paper); }
  .toc a[aria-current] { border-color: var(--accent-strong); }
}

/* --- Pie --- */
.foot-about { display: grid; gap: 10px; align-content: start; }
.foot-name { font: 600 1.3rem/1.2 var(--f-display); color: #fff; }
.foot-desc { max-width: 44ch; }
.foot-count { font: .8rem var(--f-mono); color: #d4a848; }
.foot .ext { opacity: .7; }
.foot-top { margin-left: auto; color: #e9e4d8; text-decoration: none; font-weight: 500; }
.foot-top:hover { text-decoration: underline; color: #fff; }
@media (max-width: 1000px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-about { grid-column: 1 / -1; } }
@media (max-width: 640px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-top { margin-left: 0; } }

/* --- Áreas táctiles: los enlaces sueltos (fuera de un párrafo) miden al menos 24 px --- */
.foot-top, .pub-meta a, .pub-meta .link-btn, .contact-card dd a, .contact-card dd .link-btn, .post-head > a, .crumbs a, .ficha dd a {
  display: inline-flex; align-items: center; min-height: 24px; padding-block: 2px;
}
.pub-meta a, .pub-meta .link-btn { min-width: 24px; justify-content: center; }
/* listas que dibuja JavaScript: reservan espacio mientras llegan, así el pie no salta */
#pubs:empty, #grid:empty, #posts:empty, #featured:empty, #others:empty, .table-wrap:has(#dlBody:empty) { min-height: 100vh; }
