/* ==========================================================================
   Ismael Rodríguez Maestre — hoja de estilo única
   Mobile-first. Sin dependencias externas. Claro/oscuro automático.
   ========================================================================== */

/* --- 1. Tokens ----------------------------------------------------------- */
:root {
  --bg:        #ffffff;
  --bg-soft:   #f6f6f4;
  --bg-card:   #ffffff;
  --ink:       #16181d;
  --ink-soft:  #5a6068;
  --ink-faint: #8b9199;
  --line:      #e3e3e0;
  --line-soft: #eeeeec;
  --accent:    #1f4f6b;
  --accent-ink:#ffffff;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, Georgia, "Times New Roman", serif;

  --w-wide: 1120px;
  --w-text: 720px;
  --r: 2px;

  --step: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0f1113;
    --bg-soft:   #15181b;
    --bg-card:   #15181b;
    --ink:       #e9eaec;
    --ink-soft:  #a3a9b0;
    --ink-faint: #767d85;
    --line:      #262a2f;
    --line-soft: #1e2226;
    --accent:    #8ec3e0;
    --accent-ink:#0f1113;
  }
}
:root[data-theme="dark"] {
  --bg:        #0f1113;
  --bg-soft:   #15181b;
  --bg-card:   #15181b;
  --ink:       #e9eaec;
  --ink-soft:  #a3a9b0;
  --ink-faint: #767d85;
  --line:      #262a2f;
  --line-soft: #1e2226;
  --accent:    #8ec3e0;
  --accent-ink:#0f1113;
}

/* --- 2. Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); font-weight: 500; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.9rem); }
h3 { font-size: clamp(1.05rem, 1rem + 0.35vw, 1.2rem); }
p  { margin: 0 0 1.1em; }
a  { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.2em; }
li { margin-bottom: .4em; }
small { font-size: .85em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* --- 3. Layout ----------------------------------------------------------- */
.wrap { width: min(100% - 2.5rem, var(--w-wide)); margin-inline: auto; }
.wrap--text { width: min(100% - 2.5rem, var(--w-text)); margin-inline: auto; }
@media (min-width: 700px) { .wrap, .wrap--text { width: min(100% - 4rem, var(--w-wide)); } }
@media (min-width: 700px) { .wrap--text { width: min(100% - 4rem, var(--w-text)); } }

section { padding-block: clamp(2.75rem, 6vw, 5rem); }
.section-soft { background: var(--bg-soft); }

.eyebrow {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--ink-faint); font-weight: 600; margin: 0 0 1rem;
}

.lead { font-size: 1.15em; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }

/* --- 4. Cabecera / navegación -------------------------------------------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.site-head__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 60px;
}
.brand { font-weight: 600; letter-spacing: -0.01em; font-size: .95rem; }
.brand span { color: var(--ink-faint); font-weight: 400; }

.nav-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  background: none; border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); font: inherit; font-size: .85rem; padding: .4rem .7rem;
  cursor: pointer;
}
.nav-toggle svg { width: 16px; height: 16px; }

.nav {
  display: none;
  gap: 1.5rem;
  font-size: .9rem;
}
.nav a { color: var(--ink-soft); padding-block: .25rem; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* menú desplegable en móvil */
.nav.is-open {
  display: flex; flex-direction: column; gap: 0;
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: .5rem 0 1rem;
}
.nav.is-open a {
  padding: .7rem clamp(1.25rem, 5vw, 2rem);
  border-bottom: 1px solid var(--line-soft);
}

@media (min-width: 820px) {
  .nav-toggle { display: none; }
  .nav { display: flex; }
  .nav.is-open { position: static; flex-direction: row; border: 0; padding: 0; background: none; }
  .nav.is-open a { padding: .25rem 0; border-bottom: 1px solid transparent; }
}

/* --- 5. Portada ---------------------------------------------------------- */
.hero { padding-block: clamp(2.25rem, 5vw, 4rem); }
.hero__grid { display: grid; gap: clamp(1.75rem, 5vw, 3.5rem); align-items: start; }
@media (min-width: 860px) {
  /* retrato a la izquierda; en móvil sigue el orden del documento, debajo del texto */
  .hero__grid { grid-template-columns: 300px minmax(0, 1fr); align-items: center; }
  .hero__grid > .portrait { order: -1; }
}

.portrait {
  filter: grayscale(1) contrast(1.04);
  border-radius: var(--r);
  width: 100%;
  max-width: 260px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--bg-soft);
}
@media (min-width: 860px) { .portrait { max-width: 100%; } }

.hero h1 { margin-bottom: .35em; }
.hero__role { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 1.5rem; }
.hero__role strong { color: var(--ink); font-weight: 600; }

/* --- 6. Las dos facetas -------------------------------------------------- */
.tracks { display: grid; gap: 1rem; }
@media (min-width: 760px) { .tracks { grid-template-columns: 1fr 1fr; gap: 1.25rem; } }
/* variante de tres columnas (portada: universidad + dos líneas profesionales) */
@media (min-width: 980px) { .tracks--3 { grid-template-columns: repeat(3, 1fr); } }

.track {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-card);
  padding: clamp(1.25rem, 4vw, 2rem);
  transition: border-color .18s ease, transform .18s ease;
}
.track:hover { border-color: var(--accent); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .track:hover { transform: none; } }
.track h3 { margin-bottom: .4em; }
.track p { color: var(--ink-soft); margin-bottom: .9em; font-size: .95em; }
.track__more { font-size: .85rem; color: var(--accent); font-weight: 600; }
.track ul { list-style: none; padding: 0; margin: 0 0 1em; }
.track ul li {
  font-size: .9em; color: var(--ink-soft);
  padding-left: 1rem; position: relative; margin-bottom: .3em;
}
.track ul li::before {
  content: ""; position: absolute; left: 0; top: .65em;
  width: 5px; height: 1px; background: var(--ink-faint);
}

/* --- 6b. Perfiles en pestañas -------------------------------------------- */
.tabs {
  display: flex; gap: .25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  appearance: none; background: none; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-faint); font: inherit; font-weight: 600;
  font-size: clamp(.9rem, .85rem + .2vw, 1rem);
  padding: .7rem .9rem; margin-bottom: -1px;
  cursor: pointer; white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab small { display: block; font-weight: 400; font-size: .72rem; color: var(--ink-faint); margin-top: .1rem; }
.tab[aria-selected="true"] small { color: var(--ink-soft); }

@media (min-width: 700px) {
  .tabs { gap: 1.5rem; }
  .tab { padding: .7rem .25rem; }
}

/* barra de pestañas fija bajo la cabecera, en las páginas Universidad y Empresa */
.tabbar {
  position: sticky; top: 60px; z-index: 40;
  background: var(--bg);           /* opaca: si no, el texto se transparenta al pasar por debajo */
  border-bottom: 1px solid var(--line);
}
.tabbar .tabs { border-bottom: 0; margin-bottom: 0; overflow-x: auto; }
.tabbar + .tabpanel > section:first-child { padding-top: clamp(2rem, 4vw, 3rem); }

.tabpanel[hidden] { display: none; }
.tabpanel__lead { font-size: 1.05em; color: var(--ink-soft); margin: 0 0 1.75rem; max-width: 62ch; }

.highlights { list-style: none; padding: 0; margin: 2rem 0 1.5rem; display: grid; gap: .8rem; }
@media (min-width: 780px) { .highlights { grid-template-columns: 1fr 1fr; gap: .9rem 2.5rem; } }
.highlights li {
  position: relative; padding-left: 1.15rem; margin: 0;
  font-size: .95em; color: var(--ink-soft); line-height: 1.55;
}
.highlights li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.highlights strong { color: var(--ink); font-weight: 600; }

/* --- 6c. Carrusel de servicios ------------------------------------------- */
.slider__viewport { display: grid; }

.slide {
  grid-area: 1 / 1;                 /* todas apiladas: la más alta fija la altura */
  display: grid; gap: 1.5rem;
  opacity: 0; visibility: hidden;
  transition: opacity .45s ease;
}
.slide[data-active="true"] { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .slide { transition: none; } }
@media (min-width: 820px) {
  .slide { grid-template-columns: minmax(0, 40%) minmax(0, 1fr); gap: 3rem; align-items: center; }
}

.slide__media { margin: 0; }
.slide__media img {
  width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover;
  border: 1px solid var(--line); border-radius: var(--r);
  filter: grayscale(1); background: #ecebe8;
}
.slide__body h3 { font-size: clamp(1.15rem, 1rem + .7vw, 1.6rem); margin-bottom: .6rem; }
.slide__body > p { color: var(--ink-soft); margin-bottom: 1.1rem; }
.slide__body ul { list-style: none; padding: 0; margin: 0; }
.slide__body li {
  position: relative; padding-left: 1.05rem; margin-bottom: .45rem;
  font-size: .95em; color: var(--ink-soft);
}
.slide__body li::before {
  content: ""; position: absolute; left: 0; top: .68em;
  width: 6px; height: 1px; background: var(--ink-faint);
}

.slider__bar { display: flex; align-items: center; gap: 1rem; margin-top: 2.25rem; }
.slider__nav { display: flex; gap: .4rem; }
.slider__btn {
  width: 42px; height: 42px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r);
  background: none; color: var(--ink); cursor: pointer;
  display: grid; place-items: center;
}
.slider__btn:hover { border-color: var(--accent); color: var(--accent); }
.slider__btn svg { width: 18px; height: 18px; }
.slider__count { font-size: .82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.slider__dots { display: flex; gap: .45rem; margin-left: auto; }
.slider__dot {
  width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%;
  background: var(--line); cursor: pointer;
}
.slider__dot[aria-current="true"] { background: var(--accent); }
.slider__dot:hover { background: var(--ink-faint); }

@media print {
  .slide { opacity: 1 !important; visibility: visible !important; position: static; grid-area: auto; margin-bottom: 2rem; }
  .slider__bar { display: none; }
}

/* --- 7. Cifras ----------------------------------------------------------- */
.figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
@media (min-width: 720px) { .figures { grid-template-columns: repeat(4, 1fr); } }
.figure { background: var(--bg); padding: 1.25rem 1rem; }
.figure__n { font-family: var(--font-display); font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); line-height: 1; display: block; margin-bottom: .35rem; }
.figure__l { font-size: .78rem; color: var(--ink-soft); line-height: 1.35; display: block; }

/* --- 8. Listas de contenido (timeline, publicaciones, proyectos) ---------- */
.entries { list-style: none; padding: 0; margin: 0; }
.entry {
  display: grid; gap: .15rem .5rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line-soft);
}
.entry:last-child { border-bottom: 1px solid var(--line-soft); }
@media (min-width: 760px) {
  .entry { grid-template-columns: 150px minmax(0, 1fr); gap: 0 2rem; padding: 1.35rem 0; }
}
.entry__date { font-size: .82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; padding-top: .18rem; }
.entry__title { font-weight: 600; margin: 0 0 .2em; font-size: 1rem; }
.entry__meta { font-size: .9em; color: var(--ink-soft); margin: 0; }

/* etiquetas */
.tag {
  display: inline-block; font-size: .68rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px;
  padding: .12rem .5rem; color: var(--ink-soft);
  margin-right: .3rem; vertical-align: 2px;
}
.tag--q1 { border-color: var(--accent); color: var(--accent); }
.tag--ip { border-color: var(--accent); color: var(--accent); }

/* dos columnas para listas cortas emparejadas (trayectoria / formación) */
.cols2 { display: grid; gap: 2.5rem; }
@media (min-width: 900px) { .cols2 { grid-template-columns: 1fr 1fr; gap: 3.5rem; } }
.cols2 > div > h2:first-child { margin-top: 0; }

/* --- 9. Bloques de texto largo ------------------------------------------- */
.prose h2 { margin-top: 2.5rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.75rem; color: var(--ink); }

/* --- 10. Botones --------------------------------------------------------- */
.btn {
  display: inline-block; font-size: .9rem; font-weight: 600;
  padding: .6rem 1.15rem; border-radius: var(--r);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
}
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }

/* --- 11. Contacto -------------------------------------------------------- */
.contact-grid { display: grid; gap: 1.5rem; }
@media (min-width: 760px) { .contact-grid { grid-template-columns: 1fr 1fr; gap: 2.5rem; } }
.contact-block + .contact-block { margin-top: 2.75rem; }
.contact-block h2 { margin-bottom: .35rem; }
.contact-mail {
  font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
  margin: 0 0 1.25rem;
}
.contact-mail a { border-bottom: 1px solid var(--accent); padding-bottom: 1px; }
.contact-mail a:hover { color: var(--accent); }

.dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1.25rem; font-size: .95rem; margin: 0; }
.dl dt { color: var(--ink-faint); font-size: .82rem; padding-top: .15rem; }
.dl dd { margin: 0; }
.dl a { border-bottom: 1px solid var(--line); }
.dl a:hover { border-bottom-color: var(--accent); }

/* --- 11b. Muro de logos -------------------------------------------------- */
.logos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  /* las líneas las dibuja cada celda con box-shadow, no el hueco entre ellas:
     así la última fila incompleta no deja un bloque de color */
  gap: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
@media (min-width: 560px) { .logos { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

.logo {
  background: #fff;                /* tarjeta blanca: 8 de los logos traen fondo sólido */
  box-shadow: 0 0 0 1px var(--line);
  display: grid; place-items: center;
  padding: 1rem .9rem;
  min-height: 78px;
}
.logo img {
  max-height: 38px; max-width: 100%; width: auto;
  object-fit: contain;
  filter: grayscale(1);
  opacity: .68;
  transition: opacity .18s ease;
}
.logo:hover img { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .logo img { transition: none; } }

/* --- 12. Pie ------------------------------------------------------------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem;
  font-size: .85rem;
  color: var(--ink-faint);
}
.site-foot__inner { display: grid; gap: 1rem; }
@media (min-width: 760px) { .site-foot__inner { grid-template-columns: 1fr auto; align-items: center; } }
.site-foot a { border-bottom: 1px solid var(--line); }

/* --- 13. Utilidades ------------------------------------------------------ */
.stack > * + * { margin-top: 1rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.scroll-x { overflow-x: auto; }

/* --- 14. Impresión ------------------------------------------------------- */
@media print {
  .site-head, .site-foot, .nav-toggle, .btn-row, .tabbar { display: none; }
  body { font-size: 10.5pt; color: #000; background: #fff; }
  .entry { break-inside: avoid; }
  /* al imprimir se muestran todas las pestañas, no solo la activa */
  .tabpanel[hidden] { display: block !important; }
}
