/* =========================================================================
   Web personal · Carlos González — modo gráfico (tema claro)
   Papel cálido, tipografía editorial (Fraunces + Inter), acentos índigo y
   verde azulado, fondo 3D sutil (assets/js/site.js).
   ========================================================================= */
:root {
  --bg: #f6f5f1;
  --bg2: #efede6;
  --panel: rgba(255, 255, 255, .78);
  --panel-solid: #ffffff;
  --ink: #12141a;
  --text: #2a2e37;
  --muted: #646b78;
  --dim: #9aa0aa;
  --line: rgba(18, 20, 26, .08);
  --line-strong: rgba(18, 20, 26, .16);
  --accent: #4338ca;
  --accent-soft: rgba(67, 56, 202, .08);
  --accent2: #0f766e;
  --accent2-soft: rgba(15, 118, 110, .09);
  --accent3: #b45309;
  --accent3-soft: rgba(180, 83, 9, .09);
  --warn: #b45309;
  --danger: #be123c;
  --grad: linear-gradient(120deg, #4338ca 0%, #6d28d9 45%, #0f766e 100%);
  --radius: 16px;
  --sidebar: 292px;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow-sm: 0 1px 2px rgba(18, 20, 26, .05), 0 1px 1px rgba(18, 20, 26, .03);
  --shadow: 0 1px 2px rgba(18, 20, 26, .04), 0 12px 32px -12px rgba(30, 27, 75, .18);
  --shadow-lg: 0 2px 4px rgba(18, 20, 26, .04), 0 24px 60px -18px rgba(30, 27, 75, .28);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16.5px/1.7 var(--font); overflow-x: hidden;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(900px 520px at 92% -8%, rgba(109, 40, 217, .07), transparent 62%),
    radial-gradient(800px 520px at 8% 108%, rgba(15, 118, 110, .07), transparent 60%);
  background-attachment: fixed;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: #312e81; }
::selection { background: rgba(67, 56, 202, .18); color: var(--ink); }
kbd {
  font: 600 .7em var(--mono); padding: .12em .45em; border-radius: 5px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--muted); box-shadow: 0 1px 0 var(--line-strong);
}
.accent { color: var(--accent); }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--accent); color: #fff; padding: 8px 12px; }
.skip:focus { left: 8px; top: 8px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Texto justificado (con guionado en castellano) */
.prose p, .prose li, .card p, .intro, .intro p {
  text-align: justify; text-justify: inter-word; -webkit-hyphens: auto; hyphens: auto;
}

/* ---------- Fondo ---------- */
#bg3d { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -2; opacity: 0; transition: opacity 1.6s; pointer-events: none; }
#bg3d.ready { opacity: 1; }
.bg-grid { display: none; }
.crt, #tape { display: none; }

/* ---------- Barra lateral ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar); z-index: 30;
  display: flex; flex-direction: column; gap: 16px; padding: 30px 20px 20px;
  background: rgba(255, 255, 255, .72); border-right: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  overflow-y: auto; scrollbar-width: thin;
}
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.avatar {
  position: relative; width: 108px; height: 108px; border-radius: 50%; padding: 3px; display: block;
  background: conic-gradient(from var(--ang, 0deg), #4338ca, #6d28d9, #0f766e, #4338ca);
  animation: spin 9s linear infinite; box-shadow: 0 12px 30px -10px rgba(67, 56, 202, .45);
}
@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --ang: 360deg; } }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--bg2); border: 3px solid #fff; display: block; }
.who .name { font: 600 1.45rem/1.15 var(--serif); letter-spacing: -.01em; color: var(--ink); }
.who .role { font: 500 .78rem/1.45 var(--font); color: var(--muted); margin-top: 6px; }

.menu ul { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.menu a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 6px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: .92rem; line-height: 1.45; transition: color .2s, background .25s, transform .25s;
}
.menu a .num { font: 500 .66rem var(--mono); color: var(--dim); width: 18px; }
.menu a .bi { font-size: 1.05rem; transition: transform .3s, color .2s; }
.menu a::before {
  content: ''; position: absolute; left: -20px; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--grad); transform: scaleY(0); transition: transform .25s;
}
.menu a:hover { color: var(--ink); background: rgba(18, 20, 26, .04); transform: translateX(2px); }
.menu a:hover .bi { transform: scale(1.12); color: var(--accent); }
.menu a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.menu a.active::before { transform: scaleY(1); }
.menu a.active .num, .menu a.active .bi { color: var(--accent); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.mode-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  font: 600 .82rem var(--mono); color: var(--text); cursor: pointer; padding: 10px 12px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); transition: all .25s;
}
.mode-toggle:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 8px 22px -10px rgba(67, 56, 202, .5); transform: translateY(-1px); }
.mode-toggle span { display: inline-flex; align-items: center; gap: 8px; }
html.mode-gfx .when-retro, html.mode-retro .when-gfx { display: none !important; }
.socials { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.socials a {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  color: var(--muted); border: 1px solid var(--line); background: rgba(255, 255, 255, .7); transition: all .25s;
}
.socials a:hover { color: #fff; background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

.topbar { display: none; }
.scrim { display: none; }

/* ---------- Contenido ---------- */
.main { margin-left: var(--sidebar); padding: 56px clamp(20px, 4.5vw, 72px) 36px; max-width: calc(var(--sidebar) + 1160px); min-height: 100vh; }

.sec-head { margin: 0 0 30px; }
.prompt { font: 500 .8rem var(--mono); color: var(--dim); margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.prompt .p-user { color: var(--accent2); }
.prompt .p-path { color: var(--accent); }
.prompt .p-cmd { color: var(--muted); }
.caret { display: inline-block; width: .55em; height: 1.05em; background: var(--accent); vertical-align: -3px; margin-left: 3px; animation: blink 1.1s steps(1) infinite; opacity: .8; }
@keyframes blink { 50% { opacity: 0; } }
.sec-head h1 {
  margin: 0; font: 500 clamp(2.3rem, 4.8vw, 3.7rem)/1.04 var(--serif); letter-spacing: -.025em; color: var(--ink);
  display: flex; align-items: center; gap: 16px; font-variation-settings: 'opsz' 144, 'SOFT' 50;
}
.sec-head h1 .bi {
  font-size: .62em; width: 1.6em; height: 1.6em; display: inline-grid; place-items: center; flex: none;
  border-radius: 18px; color: #fff; background: var(--grad); box-shadow: 0 14px 30px -12px rgba(67, 56, 202, .6);
}
.glitch:hover span { animation: none; }
h2.block-title {
  font: 500 1.65rem/1.2 var(--serif); color: var(--ink); margin: 54px 0 20px; display: flex; align-items: center; gap: 14px; letter-spacing: -.015em;
}
h2.block-title::before { content: ''; width: 26px; height: 2px; border-radius: 2px; background: var(--grad); flex: none; }
h2.block-title .bi { color: var(--accent); font-size: .8em; }
h2.block-title .count { font: 600 .72rem var(--mono); color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 3px 10px; }
h2.block-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }

.prose { color: var(--text); max-width: 76ch; }
.prose p { margin: 0 0 1em; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(67, 56, 202, .3); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { color: var(--ink); font-weight: 650; }
.prose h2, .prose h3 { color: var(--ink); line-height: 1.25; margin: 1.6em 0 .6em; font-family: var(--serif); font-weight: 500; }
.prose h2 { font-size: 1.55rem; }
.prose h3 { font-size: 1.22rem; }
.prose h4 { color: var(--ink); margin: 1.4em 0 .4em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--accent); }
.prose img { border-radius: 12px; }
.prose iframe, .prose video { max-width: 100%; border: 0; border-radius: 14px; }
.prose blockquote { margin: 1em 0; padding: .7em 1.1em; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; }
.prose code { font-family: var(--mono); font-size: .88em; background: rgba(18, 20, 26, .05); padding: .1em .35em; border-radius: 5px; }
.intro { margin-bottom: 30px; font-size: 1.06rem; color: #3a3f4a; max-width: 78ch; }
.intro-panel {
  background: rgba(255, 255, 255, .8); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px 28px;
}
.intro p:first-child::first-letter { float: left; font: 500 3.4em/0.86 var(--serif); margin: .07em .1em 0 0; color: var(--accent); }

/* ---------- Tarjetas ---------- */
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .3s, box-shadow .35s, transform .45s cubic-bezier(.2, .8, .2, 1);
  transform-style: preserve-3d; will-change: transform;
}
.card:hover { border-color: rgba(67, 56, 202, .18); box-shadow: var(--shadow-lg); }
.card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(67, 56, 202, .06), transparent 50%);
}
.card:hover::after { opacity: 1; }
.card-body { padding: 20px 22px; }
.card h3 { margin: 0 0 6px; font: 600 1.08rem/1.35 var(--font); color: var(--ink); letter-spacing: -.005em; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--accent); }
.card .meta { font: 500 .76rem var(--mono); color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; align-items: center; }
.card .meta .bi { color: var(--accent); margin-right: 5px; }
.card p { margin: 0 0 .6em; color: #444a55; font-size: .95rem; }
.thumb { position: relative; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; aspect-ratio: 16 / 9; background: var(--bg2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
.card:hover .thumb img { transform: scale(1.045); }
.thumb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 65%, rgba(18, 20, 26, .18)); pointer-events: none; }

.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.grid.narrow { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font: 600 .68rem/1 var(--mono); letter-spacing: .02em;
  padding: 5px 9px; border-radius: 99px; color: var(--accent); background: var(--accent-soft); white-space: nowrap; border: 0;
}
.badge.v { color: #6d28d9; background: rgba(109, 40, 217, .08); }
.badge.g { color: var(--accent2); background: var(--accent2-soft); }
.badge.y { color: var(--accent3); background: var(--accent3-soft); }
.badge.r { color: var(--danger); background: rgba(190, 18, 60, .08); }
.badge.solid { background: var(--ink); color: #fff; }

.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 10px; cursor: pointer;
  font: 600 .8rem var(--font); color: var(--text); background: #fff; border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm); transition: all .25s; text-decoration: none;
}
.btn:hover { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 10px 24px -10px rgba(67, 56, 202, .6); transform: translateY(-1px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 10px 24px -10px rgba(67, 56, 202, .6); }

/* ---------- Filtros y buscador ---------- */
.toolbar {
  position: sticky; top: 12px; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px; margin: 0 0 26px; border-radius: 16px; background: rgba(255, 255, 255, .82); border: 1px solid var(--line);
  box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 600 .78rem var(--font); color: var(--muted); background: transparent; border: 1px solid var(--line-strong);
  padding: 6px 12px; border-radius: 99px; cursor: pointer; transition: all .2s; display: inline-flex; gap: 6px; align-items: center;
}
.chip .n { color: var(--dim); font: 500 .7rem var(--mono); }
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip.on { color: #fff; background: var(--ink); border-color: var(--ink); }
.chip.on .n { color: rgba(255, 255, 255, .6); }
.search { flex: 1; min-width: 180px; position: relative; }
.search input {
  width: 100%; font: 500 .9rem var(--font); color: var(--text); background: var(--bg);
  border: 1px solid transparent; border-radius: 11px; padding: 9px 12px 9px 36px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.search input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(67, 56, 202, .1); }
.search .bi { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
select.year { font: 600 .8rem var(--font); color: var(--text); background: var(--bg); border: 1px solid transparent; border-radius: 11px; padding: 8px 10px; outline: none; }
.result-count { font: 500 .76rem var(--mono); color: var(--muted); margin-left: auto; padding-right: 6px; }
.empty { display: none; padding: 40px; text-align: center; color: var(--muted); font-family: var(--mono); }
.empty.show { display: block; }

/* ---------- Estadísticas ---------- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)); margin: 30px 0; }
.stat {
  padding: 18px 18px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
  position: relative; overflow: hidden; color: inherit; box-shadow: var(--shadow-sm); transition: transform .3s, box-shadow .3s;
}
a.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: inherit; }
.stat::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); transform: scaleX(.18); transform-origin: left; transition: transform 1s cubic-bezier(.2, .8, .2, 1); }
.stat.in::before { transform: scaleX(1); }
.stat .v { font: 500 2.4rem/1 var(--serif); color: var(--ink); letter-spacing: -.02em; }
.stat .v small { font: 600 .5em var(--font); color: var(--accent); margin-left: 3px; }
.stat .k { font: 500 .76rem/1.35 var(--font); color: var(--muted); margin-top: 8px; display: flex; gap: 6px; align-items: flex-start; }
.stat .k .bi { color: var(--accent); }

/* ---------- Pestañas ---------- */
.tabs { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; padding: 5px; border-radius: 14px; background: rgba(18, 20, 26, .045); }
.tab {
  font: 600 .85rem var(--font); color: var(--muted); background: none; border: 0; padding: 8px 14px; cursor: pointer; border-radius: 10px;
  display: inline-flex; gap: 8px; align-items: center; transition: color .2s, background .2s, box-shadow .2s;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }
.tab .n { font: 500 .7rem var(--mono); padding: 1px 7px; border-radius: 99px; background: rgba(18, 20, 26, .06); }
.tab.on .n { background: var(--accent-soft); color: var(--accent); }

/* ---------- Línea temporal (noticias, charlas) ---------- */
.timeline { position: relative; padding-left: 36px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 1px; background: linear-gradient(180deg, var(--accent), rgba(15, 118, 110, .5) 60%, transparent); }
.tl-year { position: relative; font: 500 1.9rem/1 var(--serif); color: var(--ink); margin: 38px 0 18px; letter-spacing: -.02em; }
.tl-year::before {
  content: ''; position: absolute; left: -31px; top: 50%; width: 11px; height: 11px; border-radius: 50%; transform: translateY(-50%);
  background: #fff; border: 2px solid var(--accent); box-shadow: 0 0 0 5px var(--accent-soft);
}
.tl-year:first-child { margin-top: 4px; }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before { content: ''; position: absolute; left: -28px; top: 28px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent2); }
.news-card { display: grid; grid-template-columns: 250px 1fr; overflow: hidden; }
.news-card .thumb { border-radius: var(--radius) 0 0 var(--radius); aspect-ratio: auto; min-height: 100%; }
.news-card .thumb::after { display: none; }
.news-card .date-pill {
  position: absolute; left: 12px; top: 12px; z-index: 2; font: 600 .7rem var(--mono); color: var(--ink);
  background: rgba(255, 255, 255, .92); padding: 5px 9px; border-radius: 99px; box-shadow: var(--shadow-sm);
}
.news-card .sub { font: 500 .8rem var(--font); color: var(--accent2); margin-bottom: 8px; }

/* ---------- Portada ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: center; margin-bottom: 10px; }
.hero h1 { font: 500 clamp(2.6rem, 5.6vw, 4.6rem)/1 var(--serif); letter-spacing: -.035em; margin: 6px 0 18px; color: var(--ink); font-variation-settings: 'opsz' 144, 'SOFT' 30; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-style: italic; padding-right: .06em; }
.hero .roles { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.typer { font: 500 1rem var(--mono); color: var(--accent2); min-height: 1.6em; }
.typer::before { content: '› '; color: var(--dim); }
.typer .caret { background: var(--accent2); }
.model-wrap {
  position: relative; aspect-ratio: 1; border-radius: 50%; max-width: 420px; width: 100%; justify-self: center;
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, rgba(255, 255, 255, .6) 45%, rgba(67, 56, 202, .08) 70%, transparent 71%);
}
.model-wrap::before { content: ''; position: absolute; inset: 4%; border-radius: 50%; border: 1px dashed rgba(67, 56, 202, .25); animation: rot 60s linear infinite; pointer-events: none; }
.model-wrap::after { content: ''; position: absolute; inset: -2%; border-radius: 50%; border: 1px solid transparent; border-top-color: rgba(15, 118, 110, .55); border-right-color: rgba(67, 56, 202, .25); animation: rot 9s linear infinite; pointer-events: none; }
@keyframes rot { to { transform: rotate(360deg); } }
.model-wrap model-viewer, .model-wrap .model-fallback { width: 100%; height: 100%; position: relative; z-index: 2; --poster-color: transparent; background: transparent; }
.model-fallback { display: grid; place-items: center; }
.model-fallback img { width: 64%; border-radius: 50%; box-shadow: var(--shadow-lg); }
.model-wrap.failed model-viewer, .model-wrap.failed .model-hint { display: none; }
.model-wrap:not(.failed) .model-fallback.alt { display: none; }
.model-hint { position: absolute; bottom: 2%; left: 50%; transform: translateX(-50%); font: 500 .7rem var(--mono); color: var(--muted); z-index: 3; white-space: nowrap; background: rgba(255,255,255,.85); padding: 3px 10px; border-radius: 99px; pointer-events: none; }

.roles-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.role-card { padding: 18px 20px; }
.role-card .when { font: 600 .72rem var(--mono); color: var(--accent2); letter-spacing: .02em; }
.role-card .what { font: 500 1.15rem/1.25 var(--serif); color: var(--ink); margin: 6px 0 4px; }
.role-card .detail { color: var(--muted); font-size: .88rem; line-height: 1.5; }

.affiliations { display: flex; flex-wrap: wrap; gap: 14px; }
.aff { display: flex; align-items: center; gap: 16px; padding: 14px 18px; flex: 1 1 240px; color: var(--text); }
.aff img { height: 44px; width: auto; max-width: 110px; object-fit: contain; filter: grayscale(1) contrast(1.1); opacity: .75; transition: filter .3s, opacity .3s; }
.aff:hover img { filter: none; opacity: 1; }
.aff .n { font-weight: 650; color: var(--ink); }
.aff .d { font-size: .8rem; color: var(--muted); }

/* ---------- Publicaciones ---------- */
.pub { display: grid; grid-template-columns: 86px 1fr; gap: 18px; padding: 18px; align-items: start; }
.pub .cover { width: 86px; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: var(--bg2); box-shadow: 0 8px 18px -8px rgba(18, 20, 26, .35); }
.pub .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub h3 { font-size: 1.02rem; }
.pub .authors { font-size: .88rem; color: #444a55; }
.pub .authors b { color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: rgba(15, 118, 110, .45); text-underline-offset: 3px; }
.pub .venue { font: italic 500 .95rem var(--serif); color: var(--accent); }
.pub .details { font: 500 .74rem var(--mono); color: var(--muted); }
.pub .impact { font: 500 .74rem var(--mono); color: var(--muted); margin-top: 6px; }
.pub-profiles { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 28px; }

/* ---------- Proyectos ---------- */
.project .thumb { aspect-ratio: 2 / 1; background: var(--bg2); }
.project .thumb img { object-fit: cover; }
.project .thumb::after { display: none; }
.project .period { position: absolute; z-index: 2; right: 12px; top: 12px; }
.project .money { font: 500 1.35rem var(--serif); color: var(--accent2); margin: 4px 0 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag { font: 500 .7rem var(--mono); color: var(--muted); padding: 2px 8px; border-radius: 6px; background: rgba(18, 20, 26, .05); }
.tag::before { content: '#'; color: var(--accent); }

/* ---------- Libros ---------- */
.books { display: grid; gap: 28px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.book { display: grid; grid-template-columns: 130px 1fr; gap: 20px; padding: 22px; align-items: start; }
.book-cover { perspective: 900px; }
.book-cover .b3d {
  position: relative; width: 130px; aspect-ratio: 3 / 4.3; transform-style: preserve-3d;
  transform: rotateY(-22deg) rotateX(3deg); transition: transform .8s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 16px 18px 28px -12px rgba(18, 20, 26, .45);
}
.book:hover .b3d { transform: rotateY(-4deg) rotateX(0) translateZ(14px); }
.b3d img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 2px 6px 6px 2px; }
.b3d::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 16px; transform-origin: left; transform: rotateY(90deg); background: linear-gradient(90deg, #d9d6cc, #efede6); }
.b3d::after { content: ''; position: absolute; inset: 0; border-radius: 2px 6px 6px 2px; background: linear-gradient(90deg, rgba(0,0,0,.22) 0 3%, rgba(255,255,255,.35) 4%, transparent 9%, transparent 80%, rgba(255,255,255,.12)); pointer-events: none; }
.book .isbn { font: 500 .72rem var(--mono); color: var(--muted); }

/* ---------- Moliendo Bits ---------- */
.mb-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; padding: 24px; margin-bottom: 30px;
  background: linear-gradient(120deg, rgba(255, 255, 255, .95), rgba(238, 236, 255, .85) 60%, rgba(223, 245, 241, .85));
}
.mb-hero .logo { width: 150px; border-radius: 10px; box-shadow: var(--shadow-sm); }
.mb-title { font: 600 clamp(1.9rem, 4vw, 2.8rem)/1 var(--mono); color: var(--ink); letter-spacing: -.03em; }
.mb-title .z { color: var(--accent); }
.rotator { font: 500 1rem var(--mono); color: var(--accent2); min-height: 1.5em; margin-top: 6px; }
.onair { display: inline-flex; align-items: center; gap: 8px; font: 700 .74rem var(--mono); color: var(--danger); }
.onair::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 4px rgba(190, 18, 60, .15); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.episode .num { position: absolute; z-index: 2; left: 12px; top: 12px; font: 600 .74rem var(--mono); color: var(--ink); background: rgba(255,255,255,.92); padding: 4px 9px; border-radius: 99px; }
.episode .play {
  position: absolute; z-index: 2; right: 12px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: var(--accent);
  font-size: 1.3rem; transition: all .3s; box-shadow: var(--shadow);
}
.episode:hover .play { background: var(--accent); color: #fff; transform: scale(1.08); }
.player { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; margin: 10px 0 26px; max-width: 900px; box-shadow: var(--shadow); }
.player iframe { width: 100%; height: 100%; aspect-ratio: 16/9; border: 0; display: block; }
.player audio { width: 100%; display: block; background: #fff; }

/* ---------- Trabajos dirigidos ---------- */
.thesis { display: grid; grid-template-columns: 108px 1fr; gap: 18px; padding: 16px; align-items: start; }
.thesis .shot { width: 108px; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--bg2); }
.thesis .shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s; }
.thesis:hover .shot img { transform: scale(1.07); }
.thesis h3 { font-size: .98rem; }
.thesis .author { color: var(--accent2); font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.award-ribbon { color: var(--accent3); font-weight: 600; }

/* ---------- Detalle ---------- */
.detail-hero { border-radius: var(--radius); overflow: hidden; margin: 0 0 26px; max-height: 480px; box-shadow: var(--shadow); }
.detail-hero img { width: 100%; max-height: 480px; object-fit: cover; display: block; }
.back { display: inline-flex; gap: 8px; align-items: center; font: 500 .82rem var(--mono); margin-bottom: 18px; color: var(--muted); }
.back:hover { color: var(--accent); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; flex-wrap: wrap; }
.pager a { max-width: 48%; }

/* ---------- Contacto ---------- */
.contact-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.contact-big { display: flex; align-items: center; gap: 18px; padding: 24px; color: inherit; }
.contact-big .ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.45rem; color: #fff; background: var(--grad); flex: none; box-shadow: 0 12px 26px -12px rgba(67, 56, 202, .7); }
.contact-big .k { font: 500 .76rem var(--mono); color: var(--muted); }
.contact-big .v { font: 500 1.25rem var(--serif); color: var(--ink); word-break: break-all; }
.map { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16/10; }
.map iframe { width: 100%; height: 100%; border: 0; filter: grayscale(.35) contrast(1.02); display: block; }

/* ---------- Sobre mí ---------- */
.awards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin: 12px 0 30px; }
.award { padding: 18px 20px; display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.award .trophy { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent3-soft); color: var(--accent3); font-size: 1.2rem; }
.award .y { font: 600 .72rem var(--mono); color: var(--accent3); }
.award h3 { font-size: .98rem; margin: 2px 0 4px; }
.award .d { font-size: .86rem; color: var(--muted); }

/* ---------- Divulgación ---------- */
.out-item { display: grid; grid-template-columns: 46px 1fr; gap: 16px; padding: 16px 18px; align-items: start; }
.out-item .kind { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.2rem; background: var(--accent-soft); color: var(--accent); }
.out-item .kind.video { background: rgba(190, 18, 60, .08); color: var(--danger); }
.out-item .kind.audio { background: rgba(109, 40, 217, .08); color: #6d28d9; }
.out-item .kind.texto { background: var(--accent2-soft); color: var(--accent2); }
.out-item h3 { font-size: .98rem; font-weight: 600; }
.list { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(246, 245, 241, .94); backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity .25s; padding: 4vw; }
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-height: 90vh; max-width: 92vw; border-radius: 12px; box-shadow: var(--shadow-lg); transform: scale(.95); transition: transform .3s; }
.lightbox.open img { transform: none; }
.lightbox button { position: absolute; top: 16px; right: 16px; font-size: 1.6rem; background: none; border: 0; color: var(--ink); cursor: pointer; }

/* ---------- Pie ---------- */
.footer { margin-top: 80px; padding-top: 22px; border-top: 1px solid var(--line); font: 500 .78rem var(--mono); color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.foot-meta { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- Apariciones ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s cubic-bezier(.2, .8, .2, 1), transform .8s cubic-bezier(.2, .8, .2, 1); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- 404 ---------- */
.e404 { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.e404 .code { font: 500 clamp(5rem, 18vw, 11rem)/1 var(--serif); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-style: italic; }

/* ---------- Gráfica de barras (bloque surveys) ---------- */
.chart { margin: 14px 0 30px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 18px; font: 500 .8rem var(--font); color: var(--muted); margin-bottom: 18px; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 7px; vertical-align: -1px; }
.bars { display: flex; gap: 8px; align-items: flex-end; height: 240px; overflow-x: auto; padding-bottom: 4px; }
.bar-group { flex: 1 0 44px; display: flex; flex-direction: column; height: 100%; }
.bar-stack { flex: 1; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--line-strong); }
.bar { flex: 1; height: 0; background: var(--c); opacity: .85; border-radius: 6px 6px 0 0; position: relative; transition: height 1.2s cubic-bezier(.2, .8, .2, 1); }
.chart.in .bar { height: var(--h); }
.bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font: 600 .62rem var(--mono); color: var(--muted); opacity: 0; transition: opacity .3s; white-space: nowrap; }
.bar-group:hover .bar span { opacity: 1; }
.bar-label { font: 500 .7rem var(--mono); color: var(--muted); text-align: center; margin-top: 6px; }
html.mode-retro .bar { background: var(--c); opacity: 1; transition: height 1s steps(10); }
html.mode-retro .bar-label, html.mode-retro .chart-legend { font: 18px var(--font); color: var(--W); }

/* ---------- Sobre mí / figuras ---------- */
.about .about-intro { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 10px 34px; align-items: start; }
.about .about-intro > p:first-child { grid-row: span 6; margin: 0; }
.about .about-intro img { border-radius: 18px; box-shadow: var(--shadow); }
.about > p > a > img, .about > p > img { max-width: 520px; width: 100%; box-shadow: var(--shadow); }
.about h2 { font-size: 1.65rem; display: flex; align-items: center; gap: 14px; margin-top: 2em; }
.about h2::before { content: ''; width: 26px; height: 2px; border-radius: 2px; background: var(--grad); }
.about .btn { text-decoration: none; }
.outreach-intro { margin-bottom: 4px; }
.outreach-intro .prose { display: flow-root; max-width: none; }
.outreach-intro .prose img { float: left; width: 240px; max-width: 40%; margin: 0 22px 6px 0; border-radius: 12px; }
.outreach-intro .prose p:has(> img:only-child) { margin: 0; }
html.mode-retro .outreach-intro .prose .zx-canvas { float: left; width: 240px; max-width: 40%; height: auto; margin: 0 20px 6px 0; }
.intro figure, .prose figure { margin: 18px 0; max-width: 460px; }
.intro figure img, .prose figure img { border-radius: 14px; display: block; box-shadow: var(--shadow); }
figcaption { font: 500 .76rem var(--mono); color: var(--muted); margin-top: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .model-wrap { max-width: 320px; order: -1; }
}
@media (max-width: 960px) {
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 25; padding: 10px 16px;
    background: rgba(246, 245, 241, .86); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .topbar-name { font: 600 1.05rem var(--serif); color: var(--ink); flex: 1; }
  .topbar .mode-toggle.mini { width: auto; padding: 7px 10px; }
  .burger { width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: 11px; background: #fff; display: grid; place-content: center; gap: 5px; cursor: pointer; }
  .burger span { width: 18px; height: 2px; background: var(--ink); display: block; transition: transform .3s, opacity .3s; }
  body.menu-open .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.menu-open .burger span:nth-child(2) { opacity: 0; }
  body.menu-open .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .sidebar { transform: translateX(-102%); transition: transform .35s cubic-bezier(.2, .8, .2, 1); box-shadow: 20px 0 60px rgba(18, 20, 26, .15); background: rgba(255, 255, 255, .96); }
  body.menu-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 28; background: rgba(18, 20, 26, .25); opacity: 0; pointer-events: none; transition: opacity .3s; display: block; }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; padding: 28px 16px 24px; }
}
@media (min-width: 961px) { .topbar .mode-toggle { display: none; } }
@media (max-width: 680px) {
  body { font-size: 16px; }
  .intro-panel { padding: 16px 18px; }
  .news-card { grid-template-columns: 1fr; }
  .news-card .thumb { border-radius: var(--radius) var(--radius) 0 0; aspect-ratio: 16 / 9; }
  .timeline { padding-left: 22px; }
  .timeline::before { left: 4px; }
  .tl-year::before { left: -23px; }
  .tl-item::before { left: -20px; }
  .pub, .thesis { grid-template-columns: 70px 1fr; gap: 12px; }
  .pub .cover, .thesis .shot { width: 70px; }
  .book { grid-template-columns: 96px 1fr; }
  .book-cover .b3d { width: 96px; }
  .mb-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .toolbar { position: static; }
  .result-count { margin-left: 0; }
  .about .about-intro { grid-template-columns: 1fr; }
  .about .about-intro > p:first-child { grid-row: auto; max-width: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Plató giratorio (modelo 3D pre-renderizado) ---------- */
.turntable { position: relative; z-index: 2; width: 100%; height: 100%; display: grid; place-items: center; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; outline: none; }
.turntable.grab { cursor: grabbing; }
.turntable img { width: 88%; height: 88%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 22px 26px rgba(30, 27, 75, .18)); }
.turntable:focus-visible { outline: 2px solid var(--accent); outline-offset: -6px; border-radius: 50%; }
.foot-meta a { color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.foot-meta a:hover { color: var(--accent); }

/* ---------- Objetos 3D (canvas) ---------- */
canvas.obj3d { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; outline: none; }
canvas.obj3d.grab { cursor: grabbing; }
canvas.obj3d:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 50%; }
.model-wrap canvas.obj3d { position: relative; z-index: 2; }
.model-wrap:not(.failed) .model-fallback.alt { display: none; }
.model-wrap.failed canvas.obj3d, .model-wrap.failed .model-hint { display: none; }
.sec-top { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: center; margin-bottom: 8px; }
.sec-top .intro { margin-bottom: 18px; }
.sec-obj { position: relative; width: 300px; height: 300px; justify-self: end; align-self: start; margin-top: -24px; }
.sec-obj::before { /* suelo/halo suave bajo el objeto */
  content: ''; position: absolute; left: 18%; right: 18%; bottom: 6%; height: 14%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(67, 56, 202, .16), transparent); filter: blur(4px); pointer-events: none;
}
@media (max-width: 1100px) {
  .sec-top { grid-template-columns: minmax(0, 1fr) 170px; gap: 16px; }
  .sec-obj { width: 170px; height: 170px; }
}
@media (max-width: 680px) {
  .sec-top { display: block; position: relative; }
  .sec-obj { position: absolute; right: -6px; top: 18px; width: 92px; height: 92px; margin: 0; }
  .sec-top .sec-head { padding-right: 92px; }
}
html.mode-retro .sec-obj::before { display: none; }
html.mode-retro canvas.obj3d { image-rendering: pixelated; }

/* ---------- Subsecciones en el menú (Moliendo Bits, Mente Artificial → Divulgación) ---------- */
.menu li.sub { position: relative; margin-left: 30px; }
.menu li.sub::before { /* línea de árbol */
  content: ''; position: absolute; left: -12px; top: -4px; bottom: 50%; width: 10px;
  border-left: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); border-bottom-left-radius: 7px;
}
.menu li.sub + li.sub::before { top: -16px; }
.menu li.sub a { padding: 3px 10px; font-size: .84rem; gap: 9px; }
.menu li.sub a .num { display: none; }
.menu li.sub a .bi { font-size: .95rem; }
.menu a.branch { color: var(--ink); }
.menu a.branch .bi { color: var(--accent); }

/* Tarjetas de subsección dentro de Divulgación */
.subsections { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin: 0 0 28px; }
.subsec { display: flex; align-items: center; gap: 16px; padding: 16px 18px; color: var(--text); }
.subsec .ic { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; color: #fff; background: var(--grad); }
.subsec .t { display: block; font: 500 1.2rem var(--serif); color: var(--ink); }
.subsec .d { display: block; font-size: .84rem; color: var(--muted); line-height: 1.4; }
.subsec .go { margin-left: auto; color: var(--accent); transition: transform .3s; }
.subsec:hover .go { transform: translateX(4px); }
.ma-hero .logo { width: 190px; }

/* Vídeo emergente */
.video-modal { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 4vw; background: rgba(18, 20, 26, .78); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s; }
.video-modal.open { opacity: 1; }
.video-modal .frame { width: min(1100px, 92vw); aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; box-shadow: var(--shadow-lg); }
.video-modal iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-modal button { position: absolute; top: 16px; right: 16px; font-size: 1.7rem; background: none; border: 0; color: #fff; cursor: pointer; }

/* Sobre mí: apartados secundarios en cajitas */
.about-boxes { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); margin: 18px 0 10px; }
.about-box { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.about-box .thumb { aspect-ratio: 16 / 9; border-radius: var(--radius) var(--radius) 0 0; }
.about-box .card-body { padding: 14px 16px 16px; font-size: .86rem; }
.about-box h3 { font: 600 .98rem/1.3 var(--font) !important; margin: 0 0 6px !important; display: block !important; }
.about-box h3::before { display: none !important; }
.about-box .prose { max-width: none; font-size: .86rem; line-height: 1.55; }
.about-box .prose p, .about-box .prose li { text-align: left; }
.about-box .prose h4 { font-size: .84rem; margin: .8em 0 .3em; }
.about-box .prose ul { padding-left: 1em; margin: .3em 0; }
.about-box .btn { font-size: .74rem; padding: 5px 10px; margin-top: 4px; }
html.mode-retro .menu li.sub::before { border-color: var(--b); }
html.mode-retro .subsec .ic { background: var(--R); }
.about-box .thumb { aspect-ratio: 2 / 1; }
.about-box .prose p, .about-box .prose li, .about-box .prose h4 { font-size: .82rem; line-height: 1.5; color: #4a505c; }
.about-box .prose p { margin-bottom: .6em; }
.about-boxes { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

/* ---------- Conferencias: play, vídeo y destacadas ---------- */
.talk .thumb a { display: block; width: 100%; height: 100%; position: relative; }
.play-btn {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; z-index: 3;
  display: grid; place-items: center; border-radius: 50%; font-size: 1.7rem; color: #fff;
  background: rgba(225, 29, 72, .92); box-shadow: 0 10px 26px -6px rgba(225, 29, 72, .65);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), background .3s;
}
.play-btn .bi { margin-left: 3px; }
.play-btn::before, .play-btn::after { /* ondas */
  content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85);
  animation: playPulse 2.2s cubic-bezier(.2, .8, .2, 1) infinite; pointer-events: none;
}
.play-btn::after { animation-delay: 1.1s; }
@keyframes playPulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }
.talk .thumb a:hover .play-btn { transform: scale(1.14); background: #e11d48; }
.talk .thumb a::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(18, 20, 26, .28)); pointer-events: none; }

.btn.btn-video { background: #e11d48; border-color: #e11d48; color: #fff; box-shadow: 0 8px 20px -10px rgba(225, 29, 72, .8); }
.btn.btn-video:hover { background: #be123c; border-color: #be123c; color: #fff; box-shadow: 0 12px 26px -10px rgba(225, 29, 72, .9); }
.btn.btn-video .bi { font-size: 1rem; }

.card.talk.featured { border: 1px solid transparent; background:
  linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
  linear-gradient(120deg, #f59e0b, #e11d48 40%, #6d28d9 75%, #4338ca) border-box;
  box-shadow: 0 18px 44px -20px rgba(245, 158, 11, .55); }
.feat-ribbon {
  position: absolute; top: 12px; right: -6px; z-index: 4; display: inline-flex; align-items: center; gap: 6px;
  font: 700 .7rem/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: #3b2300;
  padding: 7px 12px 7px 10px; border-radius: 8px 4px 0 8px; overflow: hidden;
  background: linear-gradient(120deg, #fbbf24, #f59e0b 55%, #fcd34d);
  box-shadow: 0 8px 18px -8px rgba(245, 158, 11, .9);
}
.feat-ribbon::before { /* doblez */
  content: ''; position: absolute; right: 0; bottom: -6px; border: 3px solid #b45309; border-right-color: transparent; border-bottom-color: transparent;
}
.feat-ribbon::after { /* destello que recorre la cinta */
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent); transform: skewX(-20deg);
  animation: shine 3.2s ease-in-out infinite;
}
.feat-ribbon .bi { animation: twinkle 1.6s ease-in-out infinite; }
@keyframes shine { 0%, 55% { left: -60%; } 85%, 100% { left: 130%; } }
@keyframes twinkle { 50% { transform: scale(1.25) rotate(18deg); } }
.tl-item.is-featured::before { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, .2); width: 8px; height: 8px; left: -29px; }
.chip-star { border-color: #f59e0b; color: #b45309; }
.chip-star .bi { color: #f59e0b; }
.chip-star.on { background: linear-gradient(120deg, #f59e0b, #e11d48); border-color: transparent; color: #fff; }
.chip-star.on .bi { color: #fff; }

html.mode-retro .play-btn { background: var(--R); box-shadow: none; }
html.mode-retro .play-btn::before, html.mode-retro .play-btn::after { border-color: var(--Y); }
html.mode-retro .btn.btn-video { background: var(--R); border-color: var(--R); color: var(--W); }
html.mode-retro .card.talk.featured { background: var(--k); border: 3px solid var(--Y) !important; }
html.mode-retro .feat-ribbon { background: var(--Y); color: var(--k); font: 18px var(--font); border-radius: 0; }
html.mode-retro .feat-ribbon::after { display: none; }
html.mode-retro .chip-star.on { background: var(--Y); color: var(--k); }

/* ---------- Avatar: el pelo sobresale por delante del anillo ---------- */
.avatar { padding: 0; overflow: visible; }
.avatar::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: #fff; }
.avatar img {
  position: absolute; left: 6px; bottom: 6px; width: calc(100% - 12px); height: auto;
  border: 0; border-radius: 0; background: none; object-fit: contain;
  filter: drop-shadow(0 -1px 0 rgba(255, 255, 255, .6));
}
html.mode-retro .avatar::before { background: var(--k); }
html.mode-retro .avatar .zx-canvas { position: absolute; left: 6px; bottom: 6px; width: calc(100% - 12px); height: auto; }

/* ---------- Componente: bloque destacado (texto | imagen) ---------- */
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 38%); gap: 26px; align-items: center; padding: 22px 24px; margin-bottom: 16px;
  background: linear-gradient(120deg, rgba(255, 255, 255, .92), rgba(238, 236, 255, .72) 70%, rgba(223, 245, 241, .7)); overflow: hidden; }
.feature::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.feature-body { max-width: none; }
.feature-body > :last-child { margin-bottom: 0; }
.feature-media { margin: 0; position: relative; }
.feature-media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; border-radius: 14px; box-shadow: var(--shadow); transform: rotate(1.2deg); transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.feature:hover .feature-media img { transform: rotate(0) scale(1.02); }
.feature-media figcaption { font: 500 .72rem var(--mono); color: var(--muted); margin-top: 8px; text-align: right; }
@media (max-width: 760px) { .feature { grid-template-columns: 1fr; } .feature-media { order: -1; } }
html.mode-retro .feature { background: var(--k); }
html.mode-retro .feature-media img { transform: none; }

/* ---------- Divulgación: entradas con imagen a la izquierda ---------- */
.out-item.has-media { grid-template-columns: 220px 1fr; padding: 14px; gap: 18px; }
.out-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--bg2); align-self: start; }
.out-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.out-thumb.kind-pdf img { object-position: top; }
.out-thumb:hover img { transform: scale(1.06); }
.out-thumb .play-btn { width: 46px; height: 46px; margin: -23px 0 0 -23px; font-size: 1.35rem; }
.out-thumb .play-btn.quiet { background: rgba(255, 255, 255, .92); color: var(--accent); box-shadow: var(--shadow); }
.out-thumb .play-btn.quiet::before, .out-thumb .play-btn.quiet::after { display: none; }
.out-thumb .play-btn .bi-headphones, .out-thumb .play-btn .bi-file-earmark-pdf, .out-thumb .play-btn .bi-newspaper { margin-left: 0; }
.out-thumb:hover .play-btn { transform: scale(1.12); }
@media (max-width: 640px) { .out-item.has-media { grid-template-columns: 1fr; } }

/* ---------- Componente: grupo con columna lateral ---------- */
.group-aside { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: stretch; }
.ga-aside { position: relative; display: flex; flex-direction: column; }
.ga-sticky { position: sticky; top: 90px; z-index: 1; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, .95), rgba(238, 236, 255, .8) 70%, rgba(223, 245, 241, .75)); box-shadow: var(--shadow-sm); }
.ga-media { display: block; border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.ga-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.ga-media:hover img { transform: scale(1.04); }
.ga-text { font-size: .86rem; line-height: 1.55; max-width: none; }
.ga-text p { text-align: left; margin: 0 0 .6em; color: #444a55; }
.ga-text > :last-child { margin-bottom: 0; }
.ga-rail { flex: 1; margin: 10px auto 0; width: calc(100% - 28px); min-height: 40px; border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(180deg, rgba(67, 56, 202, .10), rgba(15, 118, 110, .04) 60%, transparent);
  border-left: 2px solid rgba(67, 56, 202, .25); border-right: 2px solid rgba(67, 56, 202, .08); }
@media (max-width: 1000px) {
  .group-aside { grid-template-columns: 1fr; }
  .ga-sticky { position: static; display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: start; }
  .ga-media { margin: 0; }
  .ga-rail { display: none; }
}
@media (max-width: 560px) { .ga-sticky { grid-template-columns: 1fr; } }
html.mode-retro .ga-sticky { background: var(--k); }
html.mode-retro .ga-rail { background: none; border-color: var(--b); }

/* ---------- Logos institucionales de la portada ---------- */
.hero-logos { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin-top: 24px; }
.hero-logos a { display: block; line-height: 0; opacity: .72; transition: opacity .25s, transform .25s; }
.hero-logos a:hover { opacity: 1; transform: translateY(-2px); }
.hero-logos img { height: 34px; width: auto; display: block; }
.hero-logos a:nth-child(3) img { height: 38px; }
@media (max-width: 680px) { .hero-logos { gap: 12px 22px; } .hero-logos img { height: 30px; } .hero-logos a:nth-child(3) img { height: 34px; } }
html.mode-retro .hero-logos img { filter: brightness(0) invert(1); }

/* Logos de la portada: al pie de la columna del hero, alineados con las cajas de abajo */
.hero { align-items: stretch; }
.hero > .reveal:first-child { display: flex; flex-direction: column; justify-content: center; padding-top: 24px; }
.hero-logos { margin-top: auto; padding-top: 34px; }
@media (max-width: 1100px) { .hero > .reveal:first-child { padding-top: 0; } .hero-logos { margin-top: 28px; padding-top: 0; } }

/* ---------- Reproductor de audio propio (aspecto del reproductor de CMM) ---------- */
.audio-player { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; user-select: none; }
.audio-player audio { display: none; }
.ap-cover { position: absolute; inset: 0; background: var(--cover) center / cover no-repeat; transition: filter .4s, transform 8s linear; }
.audio-player.playing .ap-cover { transform: scale(1.04); }
.ap-big {
  position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; z-index: 2; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 2.6rem; color: #fff; background: rgba(0, 0, 0, .55);
  transition: transform .25s, background .25s, opacity .3s;
}
.ap-big .bi { margin-left: 5px; }
.ap-big:hover { transform: scale(1.08); background: rgba(225, 29, 72, .9); }
.audio-player.playing .ap-big { opacity: 0; pointer-events: none; }
.audio-player.started:not(.playing) .ap-big { opacity: .9; }
.ap-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 12px; padding: 22px 14px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78)); color: #fff; font: 500 .82rem var(--mono);
}
.ap-bar button, .ap-bar a { background: none; border: 0; color: #fff; cursor: pointer; font-size: 1.25rem; padding: 2px 4px; line-height: 1; opacity: .92; }
.ap-bar button:hover, .ap-bar a:hover { opacity: 1; color: #fff; transform: scale(1.1); }
.ap-rate { font: 700 .78rem var(--mono) !important; min-width: 40px; }
.ap-time { white-space: nowrap; opacity: .92; }
.ap-seek { position: relative; flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); cursor: pointer; touch-action: none; }
.ap-seek:hover { height: 7px; }
.ap-buf, .ap-prog { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; width: 0; }
.ap-buf { background: rgba(255, 255, 255, .35); }
.ap-prog { background: #e11d48; }
.ap-knob { position: absolute; top: 50%; left: 0; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(225, 29, 72, .45); opacity: 0; transition: opacity .2s; }
.audio-player:hover .ap-knob, .ap-seek:focus .ap-knob { opacity: 1; }
@media (max-width: 560px) { .ap-time { font-size: .7rem; } .ap-rate, .ap-dl { display: none; } .ap-big { width: 64px; height: 64px; margin: -32px 0 0 -32px; font-size: 2rem; } }
html.mode-retro .ap-prog { background: var(--R); }
html.mode-retro .ap-big { background: var(--R); box-shadow: none; }

/* ---------- Avatar en ASCII al pasar el ratón ---------- */
.avatar .avatar-ascii { position: absolute; left: 6px; bottom: 6px; pointer-events: none; z-index: 2; }
.avatar img { transition: opacity .15s; }
.avatar.is-ascii { box-shadow: 0 0 0 1px rgba(34, 211, 238, .35), 0 0 28px -4px rgba(34, 211, 238, .7), 0 12px 30px -10px rgba(67, 56, 202, .55); animation-duration: 2.2s; }
html.mode-retro .avatar .avatar-ascii { display: none; }
.avatar.is-ascii::before { background: #05060f; transition: background .2s; }
.who .role-org { display: block; font-size: .9em; margin-top: 1px; opacity: .9; }

/* ---------- Menú lateral en móvil: compacto, sin scroll y sin arrastrar la página ---------- */
@media (max-width: 960px) {
  .sidebar { height: 100vh; height: 100dvh; bottom: auto; padding: 16px 16px 12px; gap: 10px; overscroll-behavior: contain; }
  body.menu-open { overflow: hidden; touch-action: none; }
  body.menu-open .sidebar { touch-action: pan-y; }
  .profile { flex-direction: row; align-items: center; text-align: left; gap: 14px; padding: 4px 4px 0 6px; }
  .avatar { width: 66px; height: 66px; flex: none; }
  .avatar img { left: 4px; bottom: 4px; width: calc(100% - 8px); }
  .avatar::before { inset: 2px; }
  .who .name { font-size: 1.2rem; }
  .who .role { font-size: .72rem; margin-top: 3px; }
  .menu ul { gap: 0; }
  .menu a { padding: 5px 12px; font-size: .9rem; line-height: 1.35; }
  .side-foot { gap: 8px; }
  .side-foot .mode-toggle { display: none; }          /* ya está en la barra superior */
  .socials a { width: 34px; height: 34px; }
}
@media (max-width: 960px) and (max-height: 620px) {
  .menu a { padding: 3px 12px; font-size: .86rem; }
  .avatar { width: 56px; height: 56px; }
}
