/* ==========================================================================
   Portafolio — Ana Patricia Medina Aguirre
   Dirección estética: "Flujo de proceso" (BPMN / pipelines ETL)
   La página es un proceso: evento de inicio (hero) → tareas (secciones)
   → evento final (contacto), unidos por un conector a la izquierda.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Escala tipográfica (razón ~1.25, fluida) */
  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.1875rem;
  --fs-lg: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem);
  --fs-xl: clamp(1.35rem, 1.15rem + 0.9vw, 1.75rem);
  --fs-h2: clamp(2rem, 1.35rem + 2.8vw, 3.25rem);
  --fs-h1: clamp(2.5rem, 1.5rem + 4.4vw, 4.6rem);

  --wrap: 1180px;
  --gutter: 16px;
  --rail-x: 5px;        /* posición del conector dentro del contenedor */
  --hero-pad: clamp(2.5rem, 1.5rem + 5vw, 5.5rem);  /* margen superior del hero */
  --content-x: 30px;    /* sangría del contenido respecto del conector */
  --header-h: 64px;

  --r-lg: 16px;
  --r-md: 10px;
  --r-sm: 6px;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Oscuro (por defecto) */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1A2B;
  --bg-dot: rgba(63, 193, 201, 0.10);
  --surface: #16243A;
  --surface-2: #1C2D47;
  --line: #2A3D5A;
  --line-strong: #5A7394;     /* 3.4:1 sobre --bg: bordes de controles */
  --text: #E8EEF5;
  --muted: #A9B6C6;
  --accent: #3FC1C9;
  --accent-soft: rgba(63, 193, 201, 0.14);
  --event: #F2B84B;
  --event-soft: rgba(242, 184, 75, 0.14);
  --on-accent: #0F1A2B;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.6);
  --photo-filter: grayscale(1) contrast(1.06) brightness(1.04);
  /* Marcas de gráfico (validadas: banda de luminosidad, croma, daltonismo y contraste) */
  --chart-1: #1E9AA3;
  --chart-2: #C4861E;
  /* Efectos con el cursor: degradado cian → ámbar con tonos que mantienen
     el ícono blanco legible, y luz de fondo */
  --fx-grad: linear-gradient(135deg in oklch, #1E9AA3, #C4861E);
  --fx-spot: radial-gradient(closest-side, rgba(63, 193, 201, 0.13), rgba(242, 184, 75, 0.05) 55%, transparent);
  --fx-glow: rgba(63, 193, 201, 0.10);
  --ok: #3FCF8E;          /* éxito (OK, PASS) en los visuales */
  --fx-ring: rgba(63, 193, 201, 0.75);
}

/* Claro */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F5F7FA;
  --bg-dot: rgba(11, 107, 116, 0.12);
  --surface: #FFFFFF;
  --surface-2: #EAF0F5;
  --line: #D3DCE6;
  --line-strong: #7D8B9C;     /* 3.4:1 sobre --bg */
  --text: #14202F;
  --muted: #4A5768;
  --accent: #0B6B74;
  --accent-soft: rgba(11, 107, 116, 0.10);
  --event: #8F5A0B;
  --event-soft: rgba(143, 90, 11, 0.10);
  --on-accent: #FFFFFF;
  --shadow: 0 18px 40px -26px rgba(20, 32, 47, 0.35);
  --photo-filter: grayscale(1) contrast(1.04);
  --chart-1: #008C99;
  --chart-2: #9A5F00;
  --fx-grad: linear-gradient(135deg in oklch, #1E9AA3, #C4861E);
  --fx-spot: radial-gradient(closest-side, rgba(11, 107, 116, 0.09), rgba(143, 90, 11, 0.04) 55%, transparent);
  --fx-glow: rgba(11, 107, 116, 0.07);
  --ok: #15803D;
  --fx-ring: rgba(11, 107, 116, 0.60);
}

@media (min-width: 900px) {
  :root { --gutter: 32px; --rail-x: 10px; --content-x: 64px; --header-h: 72px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  /* clip (no hidden): recorta el desborde horizontal sin convertir el body en
     un contenedor de scroll, que anularía position: sticky */
  overflow-x: hidden;
  overflow-x: clip;
}

/* Transición suave al cambiar de tema (solo durante el cambio) */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color .35s ease, color .35s ease, border-color .35s ease,
              fill .35s ease, stroke .35s ease, box-shadow .35s ease !important;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.1;
  text-wrap: balance;
}
p { text-wrap: pretty; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--event);
  outline-offset: 3px;
  border-radius: 4px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.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;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.ic { width: 1.25em; height: 1.25em; flex: none; }
.ic-lg { width: 28px; height: 28px; }

/* ---------- Skip link ---------- */
.skip-link {
  position: fixed; left: 16px; top: 12px; z-index: 100;
  padding: 10px 16px;
  background: var(--event); color: #14202F;
  font-weight: 700; border-radius: var(--r-md);
  text-decoration: none;
  transform: translateY(-200%);
}
/* visibility:hidden impediría recibir el foco; se oculta solo desplazándolo */
.skip-link:not(:focus) { clip-path: inset(50%); }
.skip-link:focus { transform: none; }

/* ---------- Header / navegación ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.nav { height: 100%; display: flex; align-items: center; gap: 16px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-stretch: 112%;
  font-size: 1.0625rem; letter-spacing: .005em;
  margin-right: auto;
  white-space: nowrap;
}
.brand-mark { width: 36px; height: 22px; fill: none; stroke-width: 2; }
.brand-mark circle { stroke: var(--event); }
.brand-mark path { stroke: var(--accent); }
.brand-mark rect { stroke: var(--accent); fill: var(--accent-soft); }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  display: block; padding: 8px 12px;
  color: var(--muted); text-decoration: none;
  font-size: 0.975rem; border-radius: var(--r-sm);
  position: relative;
}
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="true"] { color: var(--text); }
.nav-links a[aria-current="true"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px;
  height: 2px; background: var(--accent); border-radius: 2px;
}

.nav-actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  background: transparent; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn .ic { width: 20px; height: 20px; }
/* Botón de idioma: mismo formato que el de tema, con el código del otro idioma */
/* Descarga del CV: siempre visible en el header */
.cv-btn {
  height: 44px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--r-md);
  font-family: var(--font-display); font-weight: 700; font-size: 0.875rem; letter-spacing: 0.04em;
  text-decoration: none;
}
.cv-btn:hover { background: color-mix(in srgb, var(--accent) 86%, var(--text)); }
.cv-btn .ic { width: 18px; height: 18px; }
/* Móvil: cuatro controles junto a la marca sin partir el nombre */
@media (max-width: 479px) {
  .nav-actions { gap: 6px; }
  .icon-btn, .cv-btn { width: 40px; height: 40px; }
  .cv-btn { padding: 0; justify-content: center; }
  .cv-btn-text { display: none; }
}
@media (max-width: 359px) {
  .nav { gap: 8px; }
  .brand { font-size: 0.9375rem; }
  .brand-mark { display: none; }
}
.lang-toggle {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  text-decoration: none;
}

/* sol en oscuro (para pasar a claro), luna en claro */
.ic-moon { display: none; }
[data-theme="light"] .ic-sun { display: none; }
[data-theme="light"] .ic-moon { display: block; }

.menu-toggle .ic-close { display: none; }
.menu-toggle[aria-expanded="true"] .ic-close { display: block; }
.menu-toggle[aria-expanded="true"] .ic-menu { display: none; }

/* Navegación móvil */
@media (max-width: 1079px) {
  .nav-panel {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px;
    display: none;
  }
  .nav-panel.is-open { display: block; }
  .nav-links { flex-direction: column; gap: 0; }
  .nav-links a { padding: 14px 4px; font-size: 1.0625rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav-links li:last-child a { border-bottom: 0; }
  .nav-links a[aria-current="true"]::after { left: auto; right: 4px; top: 50%; bottom: auto; width: 8px; height: 8px; border-radius: 2px; transform: translateY(-50%); }
}
@media (min-width: 1080px) {
  .menu-toggle { display: none; }
  .nav-panel { display: block; }
}

/* ---------- Conector del proceso ---------- */
.flow {
  position: relative;
  padding-top: var(--header-h);
  padding-left: calc(var(--gutter) + var(--content-x));
}
.flow:focus { outline: none; }
.flow::before,
.flow::after {
  content: "";
  position: absolute;
  left: calc(var(--gutter) + var(--rail-x));
  /* Antes de que main.js mida, el conector ya empieza donde quedará
     (header + margen del hero + 28 px): así no salta al cargar (CLS 0). */
  top: var(--rail-top, calc(var(--header-h) + var(--hero-pad) + 28px));
  height: var(--rail-height, calc(100% - 400px));
  width: 2px;
  border-radius: 2px;
}
.flow::before { background: var(--line); }
.flow::after {
  background: var(--accent);
  transform-origin: top;
  transform: scaleY(var(--flow, 0));
}

/* Nodos sobre el conector */
.step-head { position: relative; }
.step-head::before,
.hero::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: calc(var(--rail-x) - var(--content-x) + 1px);
  translate: -50% 0;
  background: var(--bg);
}
/* Tarea BPMN: cuadrado redondeado */
.step-head::before {
  top: 0.45em;
  width: 18px; height: 18px;
  border: 2px solid var(--line-strong);
  border-radius: 5px;
  transition: background-color .3s ease, border-color .3s ease;
}
.step.is-passed .step-head::before { border-color: var(--accent); background: var(--accent); }

/* Evento de inicio: círculo fino */
.hero::before {
  top: calc(var(--hero-pad) + 6px);
  width: 22px; height: 22px;
  border: 2px solid var(--event);
  border-radius: 50%;
}
/* Evento final: círculo grueso */
.step--end .step-head::before {
  width: 24px; height: 24px;
  border: 5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
}
.step--end.is-passed .step-head::before { border-color: var(--event); background: var(--bg); }

/* ---------- Secciones ---------- */
.step { padding-block: clamp(4rem, 3rem + 5vw, 7.5rem) 0; }
.step-head { max-width: 46rem; margin-bottom: clamp(2rem, 1.5rem + 2vw, 3rem); }
.step-head h2 {
  font-size: var(--fs-h2);
  font-weight: 750;
  font-stretch: 122%;
  letter-spacing: -0.01em;
}
.lede { margin-top: 14px; color: var(--muted); font-size: var(--fs-md); max-width: 40rem; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px;
  font: 700 1rem/1 var(--font-body);
  border-radius: var(--r-md);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .2s var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--text)); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface); border-color: var(--accent); }
.btn-icon { width: 48px; padding: 0; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.9375rem; }
@media (prefers-reduced-motion: no-preference) {
  .btn:active { transform: translateY(1px); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-top: var(--hero-pad);
  display: grid;
  gap: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  align-items: center;
}
/* Escritorio: nombre a la izquierda, datos a la derecha y el pipeline a todo el ancho */
@media (min-width: 1000px) {
  .hero-text {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    column-gap: 56px;
    align-items: center;
  }
  .hero h1 { max-width: 14ch; }
  .hero-detail > :first-child { margin-top: 0; }
  .hero-detail .hero-role { margin-top: 14px; }
  .hero-detail .hero-term { margin-top: 12px; }
  .hero-detail .hero-meta { margin-top: 16px; }
  .hero-detail .hero-actions { margin-top: 22px; }
  .hero-canvas { padding: 28px 32px; }
  .hero-canvas .diagram { max-width: 700px; margin-inline: auto; }
}

.hero h1 {
  font-size: var(--fs-h1);
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.02em;
  line-height: 1.02;
  max-width: 12ch;
}
.hero h1:focus { outline: none; }
.hero-role {
  margin-top: 20px;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  font-stretch: 100%;
  line-height: 1.25;
  color: var(--accent);
  max-width: 26ch;
}
/* Línea de terminal con frases que rotan. Todas las frases están apiladas
   como "fantasmas" invisibles en la misma celda: el alto y el ancho reservados
   son los de la frase más larga, así la animación no mueve el diseño. */
.hero-term {
  margin-top: 14px; max-width: 40rem;
  display: flex; gap: 10px; align-items: baseline;
  font-family: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 0.9375rem; line-height: 1.6;
  color: var(--muted);
  border-radius: var(--r-sm);
}
.term-prompt { color: var(--event); font-weight: 700; }
.term-line { display: grid; flex: 1; min-width: 0; }
.term-ghost, .term-typed { grid-area: 1 / 1; }
.term-ghost { visibility: hidden; }
.term-ghost::after { content: ""; display: inline-block; width: 0.6em; margin-left: 2px; }
.term-typed { color: var(--text); }
/* Cursor de bloque: es el fondo del final del texto, no una caja aparte.
   El texto empieza siempre en el mismo punto y solo crece, así que escribir
   letra a letra no cuenta como desplazamiento de diseño (CLS 0). Parpadea
   solo mientras la animación corre. */
.term-text {
  padding-right: calc(0.6em + 2px);
  background: linear-gradient(var(--accent), var(--accent)) no-repeat right center / 0.6em 1.15em;
}
@media (prefers-reduced-motion: no-preference) {
  .hero-term.is-animating:not(.is-paused) .term-text { animation: caret-blink 1s steps(1) infinite; }
  /* Evita ver la primera frase un instante antes de que empiece a escribirse */
  .js .hero-term:not(.is-animating):not(.is-done) .term-text { color: transparent; }
}
@keyframes caret-blink { 50% { background-size: 0 0; } }
.hero-meta { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px 22px; color: var(--text); }
.hero-meta li { display: inline-flex; align-items: center; gap: 8px; }
.hero-meta .ic { color: var(--muted); }
.hero-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }

.hero-canvas {
  position: relative;
  padding: clamp(12px, 2vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background-color: var(--surface);
  background-image: radial-gradient(var(--bg-dot) 1.2px, transparent 1.4px);
  background-size: 20px 20px;
  box-shadow: var(--shadow);
}

/* ---------- Diagramas SVG (tokens de tema) ---------- */
.diagram { width: 100%; height: auto; overflow: visible; }
.diagram text { font-family: var(--font-display); }
.d-lane { fill: var(--muted); font-size: 12.5px; font-weight: 600; }
.d-sep { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 6; fill: none; }
.d-sep--solid { stroke-dasharray: none; stroke-width: 1; }
.d-node rect, .d-node circle { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.d-node--accent rect, .d-node--accent > circle { stroke: var(--accent); stroke-width: 2; fill: var(--surface-2); }
.d-node--event rect { stroke: var(--event); }
.d-node--ghost rect { stroke-dasharray: 5 5; fill: transparent; }
.d-label { fill: var(--text); font-size: 15px; font-weight: 650; }
.d-label--sm { font-size: 14px; }
.d-label--xs { font-size: 12.5px; }
.d-label--node { font-size: 12.5px; font-weight: 650; }
.d-group { fill: none; stroke: var(--line-strong); stroke-width: 1.25; stroke-dasharray: 4 5; }
.d-stage { stroke: var(--line-strong); stroke-width: 1.5; stroke-linecap: round; fill: none; }
.d-label--lg { font-size: 17px; font-weight: 700; }

/* versión horizontal o vertical de un diagrama según el ancho */
.only-wide { display: none; }
@media (min-width: 700px) {
  .only-wide { display: block; }
  .only-narrow { display: none; }
}
.d-sub { fill: var(--muted); font-size: 12.5px; font-weight: 500; }
.d-sub--sm { font-size: 11.5px; }
.d-strong { fill: var(--text); font-weight: 600; }
.d-icon { color: var(--text); }
.d-icon--muted { color: var(--muted); }
.d-icon--event { color: var(--event); }
.d-links path { fill: none; stroke: var(--accent); stroke-width: 1.75; }
.d-dashed { stroke-dasharray: 5 5; }
.d-arrowhead { fill: var(--accent); }
/* Conector secundario en ámbar (resumen diario, alertas) */
.d-links-event path { fill: none; stroke: var(--event); stroke-width: 1.75; }
.d-arrowhead-event { fill: var(--event); }
.d-end { fill: var(--bg); stroke: var(--event); stroke-width: 4.5; }
.d-start { fill: var(--surface); stroke: var(--event); stroke-width: 1.75; }
.d-gateway { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.d-net { fill: none; stroke: var(--line-strong); stroke-width: 1.25; stroke-dasharray: 2 6; stroke-linecap: round; }
.d-chip { fill: var(--accent-soft); stroke: none; }
.d-chip-txt { fill: var(--text); font-size: 12.5px; font-weight: 600; }
.d-end-label { font-size: 13px; }
.d-pill { fill: var(--surface); stroke: var(--accent); stroke-width: 1.25; }
.d-pill-txt { fill: var(--accent); font-size: 12px; font-weight: 700; }
.d-frame { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.25; }
.d-tile rect, .d-tile-r { fill: var(--surface-2); stroke: none; }
.d-bars-soft rect { fill: var(--line); }
.d-accent-fill, .d-accent-fill rect { fill: var(--accent); }
.d-line-event { fill: none; stroke: var(--event); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }


/* ---------- Sobre mí ---------- */
.about { display: grid; gap: 32px; }
.about-photo {
  width: min(260px, 70%);
  position: relative;
  align-self: start;
  aspect-ratio: 1;
}
.about-photo picture { display: block; }
.about-photo img {
  width: 100%;
  border-radius: var(--r-lg);
  filter: var(--photo-filter);
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
}
/* el retrato es un nodo más: borde desplazado en color de acento */
.about-photo::after {
  content: ""; position: absolute; inset: 0;
  translate: 10px 10px; z-index: -1;
  border: 2px solid var(--accent);
  border-radius: var(--r-lg);
}
.about-text { display: grid; gap: 1em; max-width: 38rem; font-size: var(--fs-md); }
.about-text p:first-child { color: var(--text); }
.facts {
  display: grid; gap: 0;
  border-top: 1px solid var(--line);
  align-self: start;
}
.facts > div { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; align-content: start; }
.facts dt { color: var(--muted); font-size: var(--fs-sm); }
.facts dd { font-weight: 700; }

/* Escritorio: foto | texto */
@media (min-width: 760px) {
  .about { grid-template-columns: 260px minmax(0, 1fr); column-gap: 48px; align-items: center; }
  .about-photo { width: calc(100% - 10px); }
}
@media (min-width: 1100px) {
  .about { grid-template-columns: 340px minmax(0, 1fr); column-gap: 72px; }
}

/* Cifras + ficha | mini línea de tiempo */
.about-more { display: grid; gap: 48px; margin-top: clamp(2.5rem, 2rem + 2vw, 4rem); }
@media (min-width: 900px) { .about-more { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 64px; align-items: start; } }

.about-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, auto)); justify-content: start;
  gap: 24px 44px;
  padding-bottom: 28px; border-bottom: 1px solid var(--line);
}
.about-stats > div { display: flex; flex-direction: column; }
.about-stats dd {
  order: -1;
  font-family: var(--font-display); font-weight: 800; font-stretch: 112%;
  font-size: clamp(2.6rem, 2rem + 2.4vw, 3.6rem); line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.about-stats dt { margin-top: 8px; max-width: 16ch; color: var(--muted); font-size: var(--fs-sm); font-weight: 700; line-height: 1.35; }
/* El mérito es texto, no número: ocupa la fila completa */
.about-stats .stat-merit { grid-column: 1 / -1; }
.about-stats .stat-merit dd { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); color: var(--event); }
.about-stats .stat-merit dt { max-width: none; }
@media (max-width: 479px) { .about-stats { gap: 22px 26px; } }

.about-side .facts { margin-top: 8px; border-top: 0; }

/* Mini línea de tiempo: un conector con nodos, como el resto del proceso */
.journey-title { font-size: var(--fs-md); font-weight: 700; font-stretch: 110%; margin-bottom: 22px; }
.journey { position: relative; padding-left: 30px; }
.journey::before {
  content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px;
  width: 2px; border-radius: 2px; background: var(--line);
}
.journey > li { position: relative; display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 2px 20px; align-items: baseline; }
.journey > li + li { margin-top: 24px; }
.j-dot {
  position: absolute; left: -30px; top: .45em;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--bg);
}
.journey > li.is-now .j-dot { border-color: var(--event); background: var(--event); box-shadow: 0 0 0 5px var(--event-soft); }
.j-years { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.journey > li.is-now .j-years { color: var(--event); }
.j-title { font-weight: 700; line-height: 1.35; }
.j-org { margin-top: 2px; color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 479px) { .journey > li { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Proyectos ---------- */
.projects { display: grid; gap: 24px; }
@media (min-width: 820px) { .projects { grid-template-columns: 1fr 1fr; } }

.project {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.project-art {
  padding: 20px;
  background-color: var(--surface-2);
  background-image: radial-gradient(var(--bg-dot) 1.2px, transparent 1.4px);
  background-size: 18px 18px;
  border-bottom: 1px solid var(--line);
}
.project-body { padding: 24px; display: grid; gap: 14px; align-content: start; }
.project .project-title { font-size: var(--fs-lg); font-weight: 700; font-stretch: 108%; }
.project p { color: var(--muted); }

.project-client { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: var(--fs-sm); }
.client-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--event);
  color: var(--event);
  font-weight: 700;
}
.client-badge .ic { width: 14px; height: 14px; }
.project .client-name { color: var(--text); font-weight: 700; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tags li {
  padding: 4px 10px;
  font-size: var(--fs-sm);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: var(--r-sm);
}

/* Subsecciones: profesionales / personales */
.projects-group-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  font-stretch: 112%;
  margin: 0 0 20px;
}
.projects + .projects-group-title, .pj-rows + .projects-group-title { margin-top: clamp(3rem, 2.5rem + 2vw, 4.5rem); }
.projects-empty {
  display: grid; grid-template-columns: 28px 1fr; gap: 16px; align-items: start;
  padding: 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  max-width: 46rem;
}
.projects-empty .ic-lg { color: var(--accent); }
.projects-empty-title { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 650; }
.projects-empty-hint { margin-top: 4px; color: var(--muted); }
.personal-project .project-title { overflow-wrap: anywhere; }
/* Tarjetas personales: misma estructura en todas (ícono y estado arriba,
   enlace fijo al pie) para que queden alineadas aunque cambie el contenido */
.personal-project .project-body { flex: 1; display: flex; flex-direction: column; align-items: stretch; }
.personal-project .project-body > .pcard-link { align-self: flex-start; }
.pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.pcard-top .status-badge { margin: 0; }
.pcard-link { margin-top: auto; }
.project-updated { color: var(--muted); font-size: var(--fs-sm); }
.project-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
/* Enlace secundario (p. ej., linaje de dbt): texto, no botón */
.project-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  color: var(--accent); font-weight: 700; font-size: 0.9375rem;
  text-underline-offset: 3px;
}
.project-link .ic { width: 16px; height: 16px; }
/* Estado "En desarrollo": punto ámbar que late unas veces (menos de 5 s) */
.status-badge {
  display: inline-flex; align-items: center; gap: 8px; justify-self: start;
  padding: 4px 12px 4px 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--event) 55%, transparent);
  background: var(--event-soft); color: var(--event);
  font-size: var(--fs-sm); font-weight: 700;
}
.status-pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--event); }
@media (prefers-reduced-motion: no-preference) {
  .status-pulse::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    background: var(--event);
    animation: status-pulse 1.6s ease-out 3;
  }
}
@keyframes status-pulse { from { transform: scale(1); opacity: .7; } to { transform: scale(2.8); opacity: 0; } }

/* Métricas agregadas: el mismo tema y escala que el resto del sitio. */
.site-metrics { padding-top: clamp(3rem, 2rem + 3vw, 4.5rem); padding-bottom: 48px; }
/* La tarjeta se alinea con la columna de contenido, como el resto de secciones */
.site-metrics { padding-left: calc(var(--gutter) + var(--content-x)); }
.metrics-panel {
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  padding: clamp(20px, 1rem + 1.5vw, 32px);
}
.metrics-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; }
.metrics-head h2 { font-size: var(--fs-xl); font-weight: 700; font-stretch: 110%; }
.metrics-since { color: var(--muted); font-size: var(--fs-sm); }

/* KPIs */
.metrics-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; margin: 24px 0 28px; }
.kpi-lang { grid-column: 1 / -1; }
@media (min-width: 640px) { .metrics-kpis { grid-template-columns: 1fr 1fr 1.6fr; gap: 24px 40px; } .kpi-lang { grid-column: auto; } }
.kpi dt { color: var(--muted); font-size: var(--fs-sm); }
.kpi dd { margin-top: 6px; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.kpi-lang dd { font-size: var(--fs-base); font-family: var(--font-body); font-weight: 400; }
.kpi-pending { display: block; margin-top: 4px; color: var(--muted); font-size: var(--fs-sm); }
.lang-split { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.lang-item { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.lang-item strong { font-family: var(--font-display); font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.lang-swatch { width: 10px; height: 10px; border-radius: 3px; }
.lang-item--es .lang-swatch, .lang-seg--es { background: var(--chart-1); }
.lang-item--en .lang-swatch, .lang-seg--en { background: var(--chart-2); }
.lang-bar { display: flex; gap: 2px; height: 8px; margin-top: 10px; max-width: 320px; }
.lang-seg { flex: 1 1 0; border-radius: 999px; min-width: 4px; }

/* Gráfico de barras (HTML): el eje ocupa todo el ancho de la tarjeta */
.mchart { margin: 0; }
.mchart-caption { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 12px; }
.mchart-area { position: relative; }
.mchart-plot {
  --slots: 7;
  height: clamp(120px, 9rem + 4vw, 180px);
  border-bottom: 1.5px solid var(--line-strong);
  padding-top: 22px;              /* espacio para los valores sobre las barras */
  border-radius: 2px;
}
.mchart-plot:focus-visible { outline: 3px solid var(--event); outline-offset: 6px; }
.mchart-cols { display: flex; align-items: flex-end; height: 100%; }
.mchart-col {
  flex: 0 0 calc(100% / var(--slots));
  height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  position: relative;
  border-radius: 6px 6px 0 0;
}
.mchart-col[data-index] { cursor: default; }
.mchart-col.is-active { background: var(--accent-soft); }
.mchart-bar {
  display: block;
  width: min(24px, calc(100% - 4px));
  min-height: 2px;
  background: var(--chart-1);
  border-radius: 4px 4px 0 0;     /* extremo de dato redondeado, base recta */
}
.mchart-col.is-active .mchart-bar { filter: brightness(1.12); }
.mchart-value {
  font-family: var(--font-display); font-size: 0.8125rem; font-weight: 650;
  color: var(--text); font-variant-numeric: tabular-nums; margin-bottom: 4px; line-height: 1;
}
.mchart-axis { display: flex; margin-top: 8px; --slots: 7; min-height: 1.2em; }
.mchart-tick {
  flex: 0 0 calc(100% / var(--slots));
  position: relative; height: 1.2em;
  color: var(--muted); font-size: 0.75rem;
}
/* La fecha se centra bajo su barra; la primera y la última se anclan hacia dentro
   para no salir de la tarjeta. */
.mchart-tick > span { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.mchart-tick:first-child > span { left: 0; transform: none; }
.mchart-tick:last-child > span { left: auto; right: 0; transform: none; }
.mchart-tick:first-child:last-child > span { left: 50%; right: auto; transform: translateX(-50%); }
.mchart-empty { color: var(--muted); padding: 24px 0 8px; }
.mchart-tip {
  position: absolute; top: 0; transform: translate(-50%, -100%);
  display: grid; gap: 2px; padding: 8px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; z-index: 2;
  font-size: var(--fs-sm);
}
.mchart-tip strong { font-family: var(--font-display); font-size: 1rem; }
.mchart-tip span { color: var(--muted); }
.mchart-tip[hidden] { display: none; }

/* Tabla equivalente al gráfico */
.metrics-table { margin-top: 20px; font-size: var(--fs-sm); }
.metrics-table summary { cursor: pointer; color: var(--accent); font-weight: 700; width: fit-content; }
.metrics-table table { margin-top: 12px; border-collapse: collapse; min-width: 220px; }
.metrics-table th, .metrics-table td { padding: 6px 16px 6px 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }
.metrics-table thead th { color: var(--muted); }
.metrics-table td { font-variant-numeric: tabular-nums; text-align: right; }

/* Skeleton (solo en la primera carga) */
.skel { display: inline-block; background: var(--line); border-radius: 6px; }
.skel-num { width: 3.5ch; height: 1.1em; vertical-align: middle; }
.skel-line { width: min(220px, 100%); height: 1.1em; vertical-align: middle; }
.skel-bars .mchart-bar { background: var(--line); }
.skel-bars .mchart-col:nth-child(1) .mchart-bar { height: 38%; }
.skel-bars .mchart-col:nth-child(2) .mchart-bar { height: 62%; }
.skel-bars .mchart-col:nth-child(3) .mchart-bar { height: 30%; }
.skel-bars .mchart-col:nth-child(4) .mchart-bar { height: 74%; }
.skel-bars .mchart-col:nth-child(5) .mchart-bar { height: 48%; }
.skel-bars .mchart-col:nth-child(6) .mchart-bar { height: 86%; }
.skel-bars .mchart-col:nth-child(7) .mchart-bar { height: 56%; }
@media (prefers-reduced-motion: no-preference) {
  [data-state="loading"] .skel { animation: skel-pulse 1.4s ease-in-out infinite; }
}
@keyframes skel-pulse { 50% { opacity: 0.45; } }

/* Estado de error o sin configuración */
.metrics-state { display: grid; grid-template-columns: 28px 1fr; gap: 16px; align-items: start; padding: 28px 0 8px; }
.metrics-state[hidden] { display: none; }
.metrics-state .ic-lg { color: var(--muted); }
.metrics-state-title { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 650; }
.metrics-state-hint { color: var(--muted); margin-top: 4px; }
.metrics-state .btn { margin-top: 14px; }
html:not(.js) .metrics-body, html:not(.js) .metrics-state { display: none; }
.metrics-noscript { color: var(--muted); margin-top: 16px; }

.metrics-note { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-sm); }
.metrics-note > span { display: block; max-width: 70ch; }

/* ---------- Experiencia: pestañas (escritorio, con JS) y acordeón ---------- */
.xp--tabs { display: none; }
@media (min-width: 760px) {
  .js .xp--tabs { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; align-items: start; }
  .js .xp-acc { display: none; }
}
@media (min-width: 1100px) { .js .xp--tabs { grid-template-columns: 260px minmax(0, 1fr); gap: 48px; } }

.xp-tabs { position: relative; display: flex; flex-direction: column; gap: 4px; }
/* Píldora de fondo que se desliza hasta la pestaña elegida (main.js) */
.xp-ind {
  position: absolute; left: 0; top: 0; width: 100%; height: 0;
  border-radius: var(--r-md); background: var(--surface);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .xp-ind { transition: transform .45s var(--ease), height .45s var(--ease); }
}
.xp-tab {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 13px 18px; border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--muted);
  font: 700 1rem/1.3 var(--font-body); cursor: pointer;
  transition: color .25s ease;
}
.xp-tab-role { display: block; margin-top: 2px; font-size: 0.875rem; font-weight: 700; color: var(--muted); }
.xp-tab[aria-selected="true"] .xp-tab-role { color: var(--text); }
.xp-tab small { display: block; margin-top: 4px; font: 700 0.8125rem/1.2 var(--font-display); color: var(--muted); transition: color .25s ease; }
.xp-tab:hover, .xp-tab[aria-selected="true"] { color: var(--text); }
.xp-tab[aria-selected="true"] small { color: var(--accent); }

.xp-panels {
  padding: clamp(22px, 1rem + 1.5vw, 34px);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
}
.xp-panel:focus-visible { outline-offset: 8px; }
.xp-panel h3 { font-size: var(--fs-xl); font-weight: 750; font-stretch: 108%; line-height: 1.25; }
.xp-at { color: var(--accent); }
.xp-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  margin: 10px 0 22px; color: var(--muted); font-size: var(--fs-sm);
}
.xp-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.xp-meta .ic { width: 16px; height: 16px; }
.now-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--event-soft); color: var(--event);
  border: 1px solid color-mix(in srgb, var(--event) 55%, transparent);
  font-size: 0.8125rem; font-weight: 700;
}
.now-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--event); }
.xp-points { display: grid; gap: 10px; }
.xp-points li { position: relative; padding-left: 22px; color: var(--muted); line-height: 1.6; }
.xp-points li::before {
  content: ""; position: absolute; left: 2px; top: .62em;
  width: 8px; height: 8px; border-radius: 2px; background: var(--accent); opacity: .8;
}
.xp-stack { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: no-preference) {
  .xp-panel:not([hidden]) :is(h3, .xp-meta, .xp-points li) { animation: xp-in .45s var(--ease) both; }
  .xp-panel:not([hidden]) .xp-meta { animation-delay: .05s; }
  .xp-panel:not([hidden]) .xp-points li:nth-child(n) { animation-delay: .1s; }
  .xp-panel:not([hidden]) .xp-points li:nth-child(n+3) { animation-delay: .18s; }
  .xp-panel:not([hidden]) .xp-points li:nth-child(n+5) { animation-delay: .26s; }
}
@keyframes xp-in { from { opacity: 0; transform: translateY(8px); } }

/* Acordeón (móvil o sin JS) */
.xp-acc { display: grid; gap: 12px; }
.xp-item { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.xp-item summary {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px;
  padding: 16px 18px; cursor: pointer; list-style: none;
  border-radius: var(--r-lg);
}
.xp-item summary::-webkit-details-marker { display: none; }
.xp-item summary::after {
  content: ""; grid-column: 2; grid-row: 1 / span 3; align-self: center;
  width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); margin-right: 4px;
}
.xp-item[open] summary::after { transform: rotate(225deg); }
@media (prefers-reduced-motion: no-preference) { .xp-item summary::after { transition: transform .25s var(--ease); } }
.xp-sum-org { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-weight: 700; }
.xp-sum-role { color: var(--accent); font-weight: 700; font-size: var(--fs-sm); }
.xp-item summary small { font: 700 0.8125rem/1.3 var(--font-display); color: var(--muted); }
.xp-body { padding: 0 18px 20px; }
.xp-body .xp-meta { margin-top: 0; }

/* Chips de tecnologías con logos a color (experiencia y proyectos) */
.tech-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tech-chips li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 9px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--line);
  font-size: 0.875rem; font-weight: 700; color: var(--text);
}
.chip-logo { flex: none; width: 20px; height: 20px; object-fit: contain; }
.chip-glyph { display: grid; place-items: center; width: 20px; height: 20px; color: var(--c); }
.chip-glyph .ic { width: 18px; height: 18px; }
:root[data-theme="light"] .chip-glyph { color: var(--c-claro); }
.chip-icon { width: 18px; height: 18px; color: var(--accent); }

/* ---------- Tecnologías ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
  min-height: 40px; padding: 0 14px;
  font: 700 0.9375rem/1 var(--font-body);
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
}
.filter:hover { color: var(--text); border-color: var(--accent); }
.filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.tech-grid { display: grid; gap: 16px; }
@media (min-width: 700px) { .tech-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .tech-grid { grid-template-columns: repeat(3, 1fr); } }
.tech-group {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.tech-group[hidden] { display: none; }
.tech-group h3 { font-size: var(--fs-md); font-weight: 700; font-stretch: 110%; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  font-size: 0.9375rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
}
.chips .ic { width: 18px; height: 18px; color: var(--accent); }

/* ---------- Habilidades ---------- */
.skills { display: grid; gap: 0; border-top: 1px solid var(--line); }
@media (min-width: 700px) { .skills { grid-template-columns: repeat(2, 1fr); column-gap: 40px; } }
@media (min-width: 1100px) { .skills { grid-template-columns: repeat(3, 1fr); } }
.skill {
  display: grid; grid-template-columns: 48px 1fr; column-gap: 16px; row-gap: 4px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.skill .ic-lg { grid-row: span 2; }
.skill h3 { font-size: var(--fs-md); font-weight: 700; font-stretch: 105%; }
.skill p { color: var(--muted); }

/* ---------- Educación ---------- */
.edu { display: grid; gap: 24px; }
@media (min-width: 900px) { .edu { grid-template-columns: 1.2fr 1fr; align-items: start; } }
.edu-main, .edu-extra {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.edu-main > .ic-lg { color: var(--accent); margin-bottom: 14px; }
.edu-main h3 { font-size: var(--fs-xl); font-weight: 750; font-stretch: 110%; }
.edu-org { margin-top: 6px; font-weight: 700; color: var(--accent); }
.edu-date { margin-top: 4px; color: var(--muted); }
.merits, .courses { display: grid; gap: 0; margin-top: 22px; }
.merits li, .courses li {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.merits .ic { color: var(--event); margin-top: 2px; }
.courses .ic { color: var(--accent); margin-top: 2px; }
.merits strong, .courses strong { display: block; line-height: 1.35; }
.merits span, .courses div span { color: var(--muted); font-size: var(--fs-sm); }
.edu-extra h3 { font-size: var(--fs-lg); font-weight: 700; font-stretch: 108%; }
.courses li { grid-template-columns: 44px 1fr; align-items: center; }
/* Insignia de formación: hexágono propio con el ícono al centro */
.course-badge { position: relative; display: grid; place-items: center; width: 44px; height: 44px; color: var(--accent); }
.course-badge-frame { position: absolute; inset: 0; width: 44px; height: 44px; }
.course-badge--progress { color: var(--event); }
.courses .course-badge .ic { width: 18px; height: 18px; margin: 0; color: var(--text); }
.badge-progress {
  grid-column: 2; justify-self: start;
  padding: 2px 10px;
  font-size: 0.8125rem; font-weight: 700;
  color: var(--event);
  background: var(--event-soft);
  border-radius: 999px;
}
@media (min-width: 520px) {
  .courses li { grid-template-columns: 44px 1fr auto; }
  .badge-progress { grid-column: auto; }
}

/* ---------- Contacto ---------- */
.step--end .step-head { max-width: 52rem; }
.step--end .step-head h2 { font-size: clamp(1.5rem, 1rem + 2.4vw, 2.9rem); font-stretch: 100%; line-height: 1.18; }
@media (min-width: 700px) { .step--end .step-head h2 { font-stretch: 115%; line-height: 1.12; } }
.contact-list { display: grid; max-width: 46rem; border-top: 1px solid var(--line); }
.contact-list li {
  display: grid; grid-template-columns: 44px 1fr; gap: 6px 16px; align-items: center;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.contact-list > li > .ic { width: 22px; height: 22px; }
.contact-info { display: grid; min-width: 0; }
.contact-label { color: var(--muted); font-size: var(--fs-sm); }
.contact-info a { color: var(--text); font-weight: 700; font-size: var(--fs-md); overflow-wrap: anywhere; }
.contact-info a:hover { color: var(--accent); }
.placeholder { font-weight: 700; color: var(--event); }
.copy-btn { grid-column: 2; justify-self: start; }
.copy-btn.is-done { border-color: var(--accent); color: var(--accent); }
@media (min-width: 560px) {
  .contact-list li { grid-template-columns: 44px 1fr auto; }
  .copy-btn { grid-column: auto; }
}
.contact-cta { margin-top: 32px; padding-bottom: clamp(4rem, 3rem + 4vw, 6rem); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-block: 28px 32px;
  color: var(--muted); font-size: var(--fs-sm);
}
/* En móvil el botón flotante "volver arriba" (44px a 16px del borde) quedaba sobre el
   texto del pie: se reserva su espacio debajo del contenido. */
.footer-legal { flex-basis: 100%; font-size: .8125rem; }
@media (max-width: 899px) { .footer-inner { padding-bottom: calc(32px + 44px + 16px); } }

/* ---------- Volver arriba ---------- */
.back-to-top {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  color: var(--on-accent);
  background: color-mix(in srgb, var(--accent) 88%, transparent);
  border: 0; border-radius: 50%;
  box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.45), 0 0 0 3px color-mix(in srgb, var(--bg) 70%, transparent);
  cursor: pointer;
}
.back-to-top[hidden] { display: none; }
.back-to-top .ic { width: 22px; height: 22px; }
@media (min-width: 900px) { .back-to-top { right: 28px; bottom: 28px; width: 48px; height: 48px; } }

/* ---------- Aparición al hacer scroll ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .6s var(--ease), transform .6s var(--ease);
  }
  .js .reveal.is-visible { opacity: 1; transform: none; }
  .flow::after { transition: transform .15s linear; }
}

/* ---------- Franja de tecnologías (bajo el hero) ----------
   De borde a borde de la pantalla, aunque está dentro de <main class="wrap">:
   el margen negativo suma la sangría del contenido y el margen lateral del
   contenedor centrado. (100vw incluye la barra de desplazamiento; lo que
   sobra a la derecha lo recorta el overflow-x del body.)
   Sin JS o con movimiento reducido: lista quieta, centrada, en varias líneas.
   Con JS y sin movimiento reducido: una sola línea que avanza sola, con
   los bordes difuminados; el movimiento y el arrastre están en main.js
   (setupBelt). */
.belt {
  position: relative; z-index: 1;               /* tapa el conector del proceso */
  width: 100vw;
  margin-top: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  margin-left: calc(-1 * (var(--gutter) + var(--content-x)) - max(0px, (100vw - var(--wrap)) / 2));
  padding-block: 20px;
  background: color-mix(in srgb, var(--surface) 72%, var(--bg));
  border-block: 1px solid var(--line);
}
.belt:focus-visible { outline-offset: -4px; border-radius: 0; }
.belt-track { display: flex; }
.belt-set {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 16px 40px; padding-inline: var(--gutter);
}
.belt-set li {
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 700; color: var(--muted); white-space: nowrap;
  transition: color .25s ease;
}
/* El tamaño sale de los atributos width/height (los calcula strip.ts) */
.belt-logo { flex: none; pointer-events: none; aspect-ratio: 1; object-fit: contain; }
/* Logos con variante oficial para tema oscuro (Odoo): una u otra según el tema */
.belt-logo--claro { display: none; }
:root[data-theme="light"] .belt-logo--claro { display: block; }
:root[data-theme="light"] .belt-logo--oscuro { display: none; }
.belt-glyph { display: grid; place-items: center; width: 28px; height: 28px; flex: none; color: var(--c); }
.belt-glyph .ic { width: 26px; height: 26px; }
:root[data-theme="light"] .belt-glyph { color: var(--c-claro); }
/* Logos oscuros (Tux, contorno de PostgreSQL): halo claro solo en tema oscuro */
:root:not([data-theme="light"]) .has-contorno .belt-logo {
  filter: drop-shadow(0 0 .6px rgba(232, 238, 245, .9)) drop-shadow(0 0 .6px rgba(232, 238, 245, .6));
}
.belt-set li:hover { color: var(--text); }
:root[data-theme="light"] .belt-set li:hover { color: var(--accent); }

/* Cursor y arrastre: dependen de .is-moving (la pone main.js) */
.belt.is-moving { cursor: grab; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.belt.is-moving.is-dragging { cursor: grabbing; }
/* La disposición en una línea depende de .js (se pone en <head>, antes de
   pintar): así no hay salto de diseño al arrancar el movimiento. */
@media (prefers-reduced-motion: no-preference) {
  .js .belt-viewport {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  }
  .js .belt-track { width: max-content; will-change: transform; }
  .js .belt-set { flex: none; flex-wrap: nowrap; gap: 48px; padding-inline: 0 48px; }
}
@media (max-width: 479px) {
  .belt-set { gap: 14px 28px; }
}
@media (max-width: 479px) and (prefers-reduced-motion: no-preference) {
  .js .belt-set { gap: 36px; padding-right: 36px; }
}

/* ---------- Proyectos profesionales en zigzag ---------- */
.pj-rows { display: grid; gap: clamp(3rem, 2.4rem + 3vw, 5.5rem); }
.pj-row { display: grid; gap: 24px; align-items: center; }
@media (min-width: 900px) {
  .pj-row { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; }
  .pj-row:nth-child(even) .pj-art { order: 2; }
}
.pj-art {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); overflow: hidden;
}
.pj-art .project-art { border-bottom: 0; padding: clamp(14px, 1vw + 8px, 26px); }
/* En la portada el diagrama comparte fila con el texto: la versión vertical
   se lee mejor que la horizontal reducida (asistente, conteo y multisede). */
@media (min-width: 700px) {
  .pj-art .only-wide { display: none; }
  .pj-art .only-narrow { display: block; max-width: 420px; margin-inline: auto; }
}
.pj-text { display: grid; gap: 14px; align-content: center; }
.pj-kind {
  font-family: var(--font-display); font-weight: 700; font-size: 0.8125rem;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent);
}
.pj-kind span { color: var(--muted); }
.pj-title { font-size: var(--fs-xl); font-weight: 750; font-stretch: 108%; line-height: 1.2; }
.pj-desc { color: var(--muted); }
.pj-text .client-name { color: var(--text); font-weight: 700; }

/* "Ver proyecto": la flecha avanza con el cursor o el foco */
.view-link {
  display: inline-flex; align-items: center; gap: 8px; justify-self: start;
  min-height: 40px; color: var(--accent); font-weight: 700; text-decoration: none;
}
.view-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.view-arrow { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .view-arrow { transition: transform .3s var(--ease); }
  .view-link:hover .view-arrow, .view-link:focus-visible .view-arrow { transform: translateX(5px); }
}

/* ---------- Página de caso de estudio ---------- */
.case { padding-top: calc(var(--header-h) + clamp(1.5rem, 1rem + 2vw, 3rem)); }
/* El caso termina con aire de sobra antes de la banda de "Más proyectos" */
.case-content { padding-bottom: clamp(96px, 80px + 2.5vw, 120px); }
.case-back {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  color: var(--muted); font-weight: 700; text-decoration: none;
}
.case-back:hover { color: var(--text); }
.case-hero .pj-kind { margin-top: 18px; }
.case-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-top: 10px; }
.case-head h1 {
  font-size: clamp(2.1rem, 1.4rem + 3vw, 3.6rem); font-weight: 800; font-stretch: 108%;
  line-height: 1.05; letter-spacing: -0.02em; max-width: 22ch; overflow-wrap: anywhere;
}
.case-sub { margin-top: 10px; color: var(--muted); font-size: var(--fs-md); }
.case-badge { margin: 0; }
.case-figure { margin-top: clamp(1.75rem, 1.2rem + 2vw, 2.75rem); }
.case-art {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); overflow: hidden; box-shadow: var(--shadow);
}
.case-art .project-art { border-bottom: 0; padding: clamp(16px, 2vw, 36px); }
.case-art .diagram { max-width: 860px; margin-inline: auto; }
.case-figure-note, .case-figure > figcaption { margin-top: 12px; color: var(--muted); font-size: var(--fs-sm); text-align: center; max-width: 70ch; margin-inline: auto; }

.case-body { display: grid; gap: 40px; margin-top: clamp(2.5rem, 2rem + 2vw, 4rem); }
/* Escritorio: la ficha empieza a la altura del Resumen y acompaña el scroll */
@media (min-width: 960px) {
  .case-body { grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; align-items: start; }
  .case-facts.fx-card { align-self: start; position: sticky; top: calc(var(--header-h) + 24px); }
}
.case-block + .case-block { margin-top: 44px; }
/* Subtítulos del caso: más pequeños que los títulos de sección */
.case-block h2 { font-size: var(--fs-lg); font-weight: 750; font-stretch: 108%; margin-bottom: 16px; }
.case-block > p { color: var(--muted); font-size: var(--fs-md); }
.case-ps { display: grid; gap: 18px; }
@media (min-width: 700px) { .case-ps { grid-template-columns: 1fr 1fr; gap: 28px; } }
.case-ps h3 { font-size: var(--fs-sm); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--event); margin-bottom: 8px; }
.case-ps p { color: var(--text); }

/* "Mi trabajo": checklist en 2 columnas */
.work-list { display: grid; gap: 12px; }
@media (min-width: 700px) { .work-list { grid-template-columns: 1fr 1fr; } }
.work-list li {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  line-height: 1.5;
}
.work-check {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
}
.work-check .ic { width: 14px; height: 14px; }

/* Ficha lateral */
.case-facts {
  padding: 24px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
}
.case-facts h2 { font-size: var(--fs-md); font-weight: 750; margin-bottom: 8px; }
.case-facts dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.case-facts dt { color: var(--muted); font-size: var(--fs-sm); }
.case-facts dd { font-weight: 700; text-align: right; font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: 8px; }
.case-facts h3 { margin: 20px 0 12px; font-size: var(--fs-md); font-weight: 750; }
.status-dot-inline { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot-inline.is-en_curso { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.status-dot-inline.is-en_desarrollo { background: var(--event); box-shadow: 0 0 0 4px var(--event-soft); }
.case-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }

/* Banda de cierre: de borde a borde, con el fondo alternativo de la franja */
.case-band {
  padding-block: clamp(3.5rem, 2.5rem + 4vw, 6rem);
  background: color-mix(in srgb, var(--surface) 72%, var(--bg));
  border-block: 1px solid var(--line);
}
.eyebrow {
  font-family: var(--font-display); font-weight: 700; font-size: 0.8125rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--event);
}
/* Título de sección, como los de la portada */
.case-band .section-title {
  margin: 8px 0 clamp(1.5rem, 1.2rem + 1vw, 2.25rem);
  font-size: var(--fs-h2); font-weight: 750; font-stretch: 122%; letter-spacing: -0.01em; line-height: 1.1;
}
.more-grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .more-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .more-grid { grid-template-columns: repeat(3, 1fr); } }
.more-card {
  display: grid; gap: 8px; align-content: start;
  padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
}
.more-title { font-weight: 750; font-size: var(--fs-md); line-height: 1.3; overflow-wrap: anywhere; }
.more-sub { color: var(--muted); font-size: var(--fs-sm); }

/* Llamado final */
.case-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px;
  margin-top: clamp(3rem, 2.5rem + 2vw, 4.5rem); padding: clamp(22px, 1rem + 2vw, 36px);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-soft), var(--event-soft)), var(--surface);
}
.case-cta h2 { font-size: var(--fs-xl); font-weight: 750; font-stretch: 110%; }
.case-cta p { margin-top: 6px; color: var(--muted); max-width: 60ch; }

/* Diagrama de flujo de proyectos personales */
.case-art--flow {
  padding: clamp(20px, 2vw + 8px, 40px);
  background-color: var(--surface-2);
  background-image: radial-gradient(var(--bg-dot) 1.2px, transparent 1.4px);
  background-size: 18px 18px;
}
.cflow-diagram { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.cflow-node {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  min-width: 200px; padding: 14px 18px; border-radius: var(--r-md);
  background: var(--surface); border: 1.5px solid var(--line-strong);
  font-weight: 700; font-size: 0.9375rem;
}
.cflow-node.is-pending { border-style: dashed; color: var(--muted); }
.cflow-node small { font-weight: 400; color: var(--muted); }
.cflow-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: none; }
.cflow-icon .chip-logo, .cflow-icon .chip-glyph { width: 28px; height: 28px; }
.cflow-icon .ic { width: 24px; height: 24px; }
.cflow-node + .cflow-node::before {
  content: ""; position: absolute; left: 50%; top: -24px; width: 2px; height: 18px;
  background: var(--accent); translate: -50% 0;
}
.cflow-node + .cflow-node::after {
  content: ""; position: absolute; left: 50%; top: -8px; translate: -50% 0;
  border: 5px solid transparent; border-top-color: var(--accent); border-bottom-width: 0;
}
@media (min-width: 900px) {
  .cflow-diagram { flex-direction: row; justify-content: center; align-items: stretch; gap: 34px; }
  .cflow-node { flex-direction: column; justify-content: center; min-width: 0; flex: 1; max-width: 170px; padding: 18px 12px; text-align: center; }
  .cflow-node + .cflow-node::before { left: -30px; top: 50%; width: 20px; height: 2px; translate: 0 -50%; }
  .cflow-node + .cflow-node::after { left: -10px; top: 50%; translate: 0 -50%; border: 5px solid transparent; border-left-color: var(--accent); border-right-width: 0; }
}

/* ---------- Efectos con el cursor ----------
   Solo con mouse ((hover: hover) and (pointer: fine)). Con movimiento
   reducido quedan solo los cambios de color. Todo lo que se mueve usa
   transform, translate u opacity. main.js agrega la luz de fondo (.fx-spot)
   y las capas de brillo (.fx-glow, .fx-ring) solo cuando corresponde. */
.fx-card { position: relative; isolation: isolate; }

/* Recuadro del ícono */
.fx-icon {
  box-sizing: content-box; padding: 10px;
  border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  transition: background-color .35s ease, color .35s ease, transform .45s var(--ease);
}
.contact-list > li > .fx-icon { padding: 11px; }
/* Teclado: el foco dentro de la tarjeta da el mismo cambio de color que el cursor */
.fx-card:has(:focus-visible) .fx-icon {
  background: var(--fx-grad); color: #fff;
  box-shadow: 0 12px 24px -12px var(--fx-ring);
}

/* Línea inferior: se dibuja al entrar en pantalla y se completa con el cursor o el foco */
.fx-card::after {
  content: ""; position: absolute; z-index: 3; pointer-events: none;
  left: var(--r-lg); right: var(--r-lg); bottom: 0; height: 3px;
  border-radius: 3px;
  background: var(--fx-grad);
  transform: scaleX(0); transform-origin: left;
}
.tech-group.fx-card::after { left: var(--r-md); right: var(--r-md); }
.fx-row::after { left: 0; right: 0; bottom: -1px; height: 2px; }
.fx-card.is-in::after { transform: scaleX(.18); }
/* Pantallas táctiles (sin hover): la línea se dibuja completa al entrar */
@media (hover: none), (pointer: coarse) { .fx-card.is-in::after { transform: scaleX(1); } }
.fx-card:has(:focus-visible)::after { transform: scaleX(1); }
@media (prefers-reduced-motion: no-preference) {
  .fx-card::after { transition: transform .9s var(--ease) .25s; }
  .fx-card:has(:focus-visible)::after { transition-delay: 0s; }
}

/* Brillo dentro de la tarjeta (relleno) y en su borde (anillo) */
.fx-glow, .fx-ring {
  position: absolute; inset: 0; border-radius: inherit;
  overflow: hidden; pointer-events: none;
  opacity: 0; transition: opacity .35s ease;
}
.fx-glow { z-index: -1; }
.fx-ring {
  z-index: 2; padding: 1px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* Las filas (habilidades, contacto) no tienen caja: el brillo se extiende un poco a los lados */
.fx-row > .fx-glow, .fx-row > .fx-ring { inset: 0 -12px; border-radius: var(--r-md); }
.fx-glow > i, .fx-ring > i {
  position: absolute; left: 0; top: 0; border-radius: 50%;
  will-change: transform;
}
.fx-glow > i { width: 440px; height: 440px; margin: -220px 0 0 -220px; background: radial-gradient(closest-side, var(--fx-glow), transparent); }
.fx-ring > i { width: 320px; height: 320px; margin: -160px 0 0 -160px; background: radial-gradient(closest-side, var(--fx-ring), transparent); }

/* Luz de fondo que sigue al cursor (detrás del contenido) */
.fx-spot {
  position: fixed; left: 0; top: 0; z-index: -1;
  width: 680px; height: 680px; margin: -340px 0 0 -340px;
  border-radius: 50%; pointer-events: none;
  background: var(--fx-spot);
  opacity: 0; transition: opacity .6s ease;
  will-change: transform;
}
.fx-spot.is-on { opacity: 1; }

@media (hover: hover) and (pointer: fine) {
  .fx-card:hover .fx-icon {
    background: var(--fx-grad); color: #fff;
    box-shadow: 0 12px 24px -12px var(--fx-ring);
  }
  .fx-card:hover::after { transform: scaleX(1); transition-delay: 0s; }
  .fx-card:hover > .fx-glow, .fx-card:hover > .fx-ring { opacity: 1; }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  /* La tarjeta sube un poco (las filas no, para no mover sus separadores) */
  .fx-card { transition: translate .35s var(--ease); }
  .js .fx-card.reveal { transition: opacity .6s var(--ease), transform .6s var(--ease), translate .35s var(--ease); }
  .fx-card:not(.fx-row):hover { translate: 0 -4px; }
  .fx-card:hover .fx-icon { transform: rotate(-8deg) scale(1.06); }
  /* Botones principales con efecto imán (main.js fija el translate) */
  .btn-primary, .cv-btn { transition: background-color .2s ease, border-color .2s ease, transform .2s var(--ease), translate .35s var(--ease); }
  /* Logos de tecnologías: giran y crecen un poco */
  .chips .ic, .belt-logo, .belt-glyph, .tech-chips li :is(.chip-logo, .chip-glyph, .chip-icon) { transition: transform .35s var(--ease); }
  .tech-chips li:hover :is(.chip-logo, .chip-glyph, .chip-icon) { transform: rotate(-8deg) scale(1.15); }
  .tech-chips li.is-intacto:hover .chip-logo { transform: scale(1.15); }
  .chips li:hover .ic, .belt-set li:hover :is(.belt-logo, .belt-glyph) { transform: rotate(-8deg) scale(1.18); }
  /* dbt y Odoo: sus reglas de marca no permiten rotar el logo; solo crece */
  .belt-set li.is-intacto:hover .belt-logo { transform: scale(1.18); }
}
@media (prefers-reduced-motion: reduce) { .fx-spot, .fx-glow, .fx-ring { display: none; } }

/* ---------- Impresión ---------- */
@media print {
  .site-header, .back-to-top, .filters, .skip-link, .fx-spot, .fx-glow, .fx-ring, .belt-set[aria-hidden="true"] { display: none !important; }
  .belt { width: auto; margin-left: 0; background: none; }
  .belt-track { transform: none !important; width: auto !important; }
  .belt-set { flex-wrap: wrap !important; }
  .belt-viewport { -webkit-mask-image: none !important; mask-image: none !important; }
  .flow { padding-top: 0; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}
