/* CV de Javier Polanco · prototipo FUN-001
   Porcelana fría y grafito, azul petróleo de acento y vino (ARCIORA) solo en detalles.
   Relieve con jerarquía: e1 (chips), e2 (tarjetas), e3 (ficha abierta). */

:root {
  color-scheme: light;
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #161c22;
  --muted: #535d68;
  --line: rgba(22, 28, 34, 0.08);
  --line-strong: rgba(22, 28, 34, 0.16);
  --accent: #1f4f60;
  --accent-soft: rgba(31, 79, 96, 0.08);
  --wine: #7a2232;
  --grid: rgba(31, 79, 96, 0.08);
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --e1: 0 1px 1px rgba(16, 24, 32, 0.05), 0 2px 4px -1px rgba(16, 24, 32, 0.06);
  --e2: 0 1px 1px rgba(16, 24, 32, 0.04), 0 6px 12px -4px rgba(16, 24, 32, 0.08), 0 18px 36px -14px rgba(16, 24, 32, 0.16);
  --e2-up: 0 2px 2px rgba(16, 24, 32, 0.04), 0 12px 20px -6px rgba(16, 24, 32, 0.12), 0 28px 48px -18px rgba(16, 24, 32, 0.22);
  --e3: 0 2px 4px rgba(16, 24, 32, 0.06), 0 30px 70px -20px rgba(16, 24, 32, 0.38);
  --plate: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --wrap: 1000px;
}

/* Oscuro: por el sistema salvo que el usuario elija claro, o por elección expresa */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1114;
    --surface: #1a2026;
    --surface-2: #151a1f;
    --ink: #e8ebee;
    --muted: #a2abb4;
    --line: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.14);
    --accent: #86b6c6;
    --accent-soft: rgba(134, 182, 198, 0.1);
    --wine: #e07a89;
    --grid: rgba(134, 182, 198, 0.07);
    --hi: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --e1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --e2: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 30px -12px rgba(0, 0, 0, 0.6);
    --e2-up: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 44px -16px rgba(0, 0, 0, 0.75);
    --e3: 0 2px 6px rgba(0, 0, 0, 0.5), 0 40px 80px -20px rgba(0, 0, 0, 0.85);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1114;
  --surface: #1a2026;
  --surface-2: #151a1f;
  --ink: #e8ebee;
  --muted: #a2abb4;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #86b6c6;
  --accent-soft: rgba(134, 182, 198, 0.1);
  --wine: #e07a89;
  --grid: rgba(134, 182, 198, 0.07);
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --e1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --e2: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 30px -12px rgba(0, 0, 0, 0.6);
  --e2-up: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 44px -16px rgba(0, 0, 0, 0.75);
  --e3: 0 2px 6px rgba(0, 0, 0, 0.5), 0 40px 80px -20px rgba(0, 0, 0, 0.85);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
@media (max-width: 380px) { .wrap, .topbar-inner { padding-left: 16px; padding-right: 16px; } }
.dot { color: var(--wine); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 10px 14px;
  background: var(--ink); color: var(--bg); border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- Entrada ---------- */
.intro-screen { display: none; }
.intro .intro-screen {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 60; background: var(--bg);
  animation: intro-open 0.9s var(--ease) 1.5s forwards;
}
.intro body { overflow: hidden; }
.intro.intro-done body { overflow: auto; }
.intro.intro-done .intro-screen { display: none; }
.intro-inner { text-align: center; }
.intro-mark { font-family: var(--serif); font-size: clamp(4.5rem, 16vw, 8.5rem); line-height: 1; letter-spacing: -0.04em; }
.intro-mark span { display: inline-block; opacity: 0; transform: translateY(14px); animation: rise 0.7s var(--ease) forwards; }
.intro-mark .intro-p { animation-delay: 0.12s; }
.intro-mark .dot { animation-delay: 0.42s; transform: scale(0.4); }
.intro-rule {
  width: 120px; height: 1px; margin: 22px auto 16px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; animation: draw 0.8s var(--ease) 0.5s forwards;
}
.intro-name { color: var(--muted); font-size: 0.95rem; letter-spacing: 0.2em; opacity: 0; animation: fade 0.8s ease 0.75s forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes draw { to { transform: scaleX(1); } }
@keyframes fade { to { opacity: 1; } }
@keyframes intro-open { to { opacity: 0; transform: translateY(-3%); visibility: hidden; } }
.intro .profile-card { opacity: 0; transform: translateY(16px); }
.intro.intro-done .profile-card { animation: rise 0.9s var(--ease) forwards; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 16px; height: 64px; }
.brand {
  font-family: var(--serif); font-size: 1.4rem; letter-spacing: -0.03em; text-decoration: none; flex: none;
  display: inline-flex; align-items: center; min-height: 44px; min-width: 44px;
}
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a {
  position: relative; flex: none; padding: 10px 12px; font-size: 0.93rem; font-weight: 500;
  color: color-mix(in srgb, var(--ink) 72%, transparent); text-decoration: none; transition: color 0.2s ease;
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); }
.nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; border-radius: 1px;
  background: var(--wine); transform: scaleX(0); transition: transform 0.3s var(--ease);
}
.nav a:hover::after { transform: scaleX(0.4); }
.nav a[aria-current="true"]::after { transform: scaleX(1); }
.actions { display: flex; align-items: center; gap: 8px; flex: none; }

.theme-toggle {
  position: relative; display: none; align-items: center; width: 68px; height: 36px; padding: 0 4px;
  border-radius: 999px; cursor: pointer; background: var(--plate); border: 1px solid var(--line-strong);
  box-shadow: var(--hi), var(--e1);
}
.js .theme-toggle { display: inline-flex; }
.theme-toggle svg {
  position: relative; z-index: 1; width: 28px; height: 18px; flex: none; fill: none;
  stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.3s ease;
}
.theme-knob {
  position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--wine); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); transition: transform 0.35s var(--ease);
}
.theme-toggle .ico-sun { stroke: #fff; }
.theme-toggle[aria-checked="true"] .theme-knob { transform: translateX(32px); }
.theme-toggle[aria-checked="true"] .ico-sun { stroke: var(--muted); }
.theme-toggle[aria-checked="true"] .ico-moon { stroke: #fff; }

.menu-toggle {
  display: none; align-items: center; gap: 10px; height: 40px; padding: 0 12px 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--plate); box-shadow: var(--hi), var(--e1);
  font-size: 0.88rem; font-weight: 500; cursor: pointer;
}
.menu-icon { position: relative; width: 16px; height: 10px; }
.menu-icon i { position: absolute; left: 0; width: 16px; height: 1.6px; border-radius: 1px; background: currentColor; transition: transform 0.3s var(--ease), top 0.3s var(--ease); }
.menu-icon i:first-child { top: 0; }
.menu-icon i:last-child { top: 8px; }
.menu-toggle[aria-expanded="true"] .menu-icon i:first-child { top: 4px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-icon i:last-child { top: 4px; transform: rotate(-45deg); }

@media (max-width: 719px) {
  .actions { margin-left: auto; }
  .js .menu-toggle { display: inline-flex; }
  .nav { overflow-x: auto; scrollbar-width: none; }
  .js .nav {
    position: absolute; top: 64px; left: 0; right: 0; margin: 0; display: grid; gap: 0; padding: 8px 20px 20px;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--e3);
    opacity: 0; transform: translateY(-8px); visibility: hidden;
    transition: opacity 0.25s ease, transform 0.3s var(--ease), visibility 0s linear 0.3s;
  }
  .js .nav.is-open { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
  .js .nav a { padding: 14px 0; font-size: 1.05rem; border-bottom: 1px solid var(--line); }
  .js .nav a:last-child { border-bottom: 0; }
  .js .nav a::after { left: 0; right: auto; width: 24px; bottom: 10px; }
}

/* ---------- Perfil: banner, foto y datos ---------- */
.profile { padding-bottom: 8px; }
.cover {
  position: relative; height: clamp(150px, 26vw, 300px); overflow: hidden;
  background-color: var(--surface);
  background-image:
    radial-gradient(120% 90% at 85% 10%, var(--accent-soft), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px;
  border-bottom: 1px solid var(--line);
}
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% center; }

.profile-card { position: relative; margin-top: -64px; display: grid; gap: 18px; }
/* Avatar que gira: JP. delante, foto detrás */
.avatar {
  position: relative; display: block; width: 120px; height: 120px; padding: 0; border: 0; border-radius: 50%;
  background: none; cursor: pointer; perspective: 900px;
  font-family: var(--serif); font-size: 2.7rem; letter-spacing: -0.04em; color: var(--ink);
}
.avatar-inner {
  position: relative; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform 1s var(--ease);
}
.face {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; border-radius: 50%;
  background: var(--plate); border: 4px solid var(--bg); box-shadow: var(--e2);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.face-back { transform: rotateY(180deg); }
.face-back img { width: 100%; height: 100%; object-fit: cover; }
.avatar.is-flipped .avatar-inner,
html:not(.js) .avatar:not(.no-photo) .avatar-inner { transform: rotateY(180deg); }
.avatar.no-photo .avatar-inner { transform: none; }
.avatar:hover .face { box-shadow: var(--e2-up); }
.avatar:focus-visible { outline-offset: 6px; }

h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.06; letter-spacing: -0.035em; text-wrap: balance; }
.headline { margin-top: 12px; max-width: 46ch; font-size: clamp(1.02rem, 2.2vw, 1.16rem); line-height: 1.5; }
.meta { margin-top: 6px; color: var(--muted); font-size: 0.92rem; }
.link-out {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding: 10px 18px; border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff) 0%, var(--accent) 100%);
  color: var(--bg); font-size: 0.9rem; font-weight: 600; text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), var(--e2); transition: transform 0.2s var(--ease), box-shadow 0.2s ease;
}
.link-out:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), var(--e2-up); }
.link-out svg, .pub-title svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 720px) {
  .profile-card { grid-template-columns: auto 1fr; align-items: start; gap: 32px; margin-top: -80px; }
  .avatar { width: 168px; height: 168px; font-size: 3.6rem; }
  .face { border-width: 6px; }
  .profile-text { padding-top: 96px; }
}

.about { margin-top: 44px; display: grid; gap: 28px; }
.about-text p { max-width: 66ch; color: var(--muted); }
.about-text p + p { margin-top: 14px; }
.about .lead { color: var(--ink); font-size: clamp(1.08rem, 2.2vw, 1.22rem); line-height: 1.55; margin-top: 16px; }
.interests { margin-top: 24px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pills li {
  padding: 6px 14px; border-radius: 999px; font-size: 0.85rem; background: var(--plate);
  border: 1px solid var(--line); box-shadow: var(--hi), var(--e1);
}

.facts {
  margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; overflow: hidden;
  background: var(--line); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--e2);
}
.facts div { padding: 20px 18px; background: var(--plate); box-shadow: var(--hi); }
.facts dt { font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.2rem); letter-spacing: -0.02em; color: var(--accent); line-height: 1.1; }
.facts dd { margin: 6px 0 0; font-size: 0.85rem; color: var(--muted); line-height: 1.4; }
@media (min-width: 900px) {
  .about { grid-template-columns: 1fr 280px; gap: 48px; align-items: start; }
  .facts { grid-template-columns: 1fr; }
}

/* ---------- Secciones ---------- */
.section { padding: clamp(56px, 9vw, 96px) 0 0; }
.section-title { font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.4rem); letter-spacing: -0.025em; }
.section > .wrap > .section-title, .section-head { margin-bottom: 28px; }
.section-head { display: grid; gap: 8px; }
.sub-title { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; }
.hint { color: var(--muted); font-size: 0.9rem; }

/* ---------- Línea temporal: cada puesto es una placa ---------- */
.timeline { position: relative; padding-left: 26px; display: grid; gap: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 1px; background: var(--line-strong); }
.job {
  position: relative; padding: 20px 20px 18px; border-radius: 18px;
  background: var(--plate); border: 1px solid var(--line); box-shadow: var(--hi), var(--e2);
  transition: box-shadow 0.4s var(--ease);
}
.job::before {
  content: ""; position: absolute; left: -26px; top: 28px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--accent);
}
.job.is-current::before { background: var(--wine); border-color: var(--wine); box-shadow: 0 0 0 5px color-mix(in srgb, var(--wine) 16%, transparent); }
.job.is-academic::before { border-style: dashed; border-color: var(--muted); }
.job.is-highlight { box-shadow: var(--hi), 0 0 0 2px var(--accent), var(--e2-up); }

.job-when { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.job-dates { color: var(--ink); font-weight: 600; }
.job-len::before { content: ", "; }
.job-title { display: flex; gap: 14px; align-items: flex-start; }
.logo {
  position: relative; flex: none; width: 112px; height: 56px; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center; background: var(--plate); border: 1px solid var(--line);
  box-shadow: var(--hi), var(--e1);
  font-family: var(--serif); font-size: 1rem; letter-spacing: -0.02em; color: var(--accent);
}
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 6px 8px; background: #fff; }
@media (max-width: 519px) {
  .job-title { flex-direction: column; gap: 12px; }
  .logo { width: 104px; height: 48px; }
}
.job-role { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.job-org { margin-top: 2px; color: var(--accent); font-weight: 500; }
.job-place { color: var(--muted); font-weight: 400; }
.badge {
  display: inline-block; margin-bottom: 4px; padding: 2px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 600;
  color: var(--muted); background: var(--accent-soft);
}
.roles { margin-top: 14px; display: grid; gap: 10px; border-left: 2px solid var(--line-strong); padding-left: 14px; }
.roles h4 { font-size: 0.98rem; font-weight: 600; }
.role-when { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.roles li > p:last-child { margin-top: 2px; font-size: 0.9rem; color: var(--muted); }
.job-summary { margin-top: 12px; color: var(--muted); max-width: 66ch; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag {
  text-align: left; min-height: 32px; padding: 5px 12px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  font-size: 0.78rem; font-weight: 500; color: var(--accent); background: var(--accent-soft);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.tag:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

.job-toggle {
  display: none; margin-top: 12px; padding: 6px 0; border: 0; background: none; cursor: pointer;
  font-size: 0.86rem; font-weight: 600; border-bottom: 1px solid var(--line-strong); transition: border-color 0.2s ease;
}
.js .job-toggle { display: inline-block; }
.job-toggle:hover { border-color: var(--wine); }
.job-toggle::after { content: " +"; color: var(--wine); }
.job-toggle[aria-expanded="true"]::after { content: " −"; }
.job-detail { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.45s var(--ease); }
.js .job-detail { grid-template-rows: 0fr; }
.js .job-detail.is-open { grid-template-rows: 1fr; }
.job-detail > ul { overflow: hidden; max-width: 66ch; }
.job-detail li { position: relative; padding-left: 16px; margin-top: 8px; color: var(--muted); font-size: 0.95rem; }
.job-detail li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 6px; height: 1px; background: var(--accent); }

@media (min-width: 760px) {
  .timeline { padding-left: 0; gap: 20px; }
  .timeline::before { left: 163px; }
  .job { display: grid; grid-template-columns: 1fr; margin-left: 186px; padding: 22px 26px 20px; }
  .job::before { left: -28px; }
  .job-when { position: absolute; right: calc(100% + 38px); top: 24px; width: 146px; text-align: right; margin: 0; }
  .job-dates { white-space: nowrap; }
  .job-len { display: block; }
  .job-len::before { content: none; }
  .job-toggle { justify-self: start; }
}

/* ---------- Formación ---------- */
.edu { display: grid; gap: 12px; }
@media (min-width: 720px) { .edu { grid-template-columns: 1fr 1fr; } }
.edu li { padding: 20px 22px; background: var(--plate); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--hi), var(--e1); }
.edu-when { font-size: 0.8rem; color: var(--muted); }
.edu h3 { margin-top: 4px; font-size: 1.04rem; font-weight: 600; }
.edu-org { margin-top: 4px; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.edu-link, .pub-title a {
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 4px; text-decoration-thickness: 1px; transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.edu-link:hover, .pub-title a:hover { color: var(--accent); text-decoration-color: currentColor; }

.certs { margin-top: 56px; }
.certs-head { display: grid; gap: 14px; }
@media (min-width: 760px) { .certs-head { grid-template-columns: auto 1fr; align-items: center; } .chips { justify-content: flex-end; } }
.certs .hint { margin: 8px 0 18px; }
.chips { display: none; flex-wrap: wrap; gap: 8px; }
.js .chips { display: flex; }
.chip {
  min-height: 36px; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 0.84rem; font-weight: 500;
  color: var(--muted); background: var(--plate); border: 1px solid var(--line-strong); box-shadow: var(--hi), var(--e1);
  transition: color 0.2s ease, background 0.2s ease;
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); box-shadow: var(--e1); }

.cert-grid { display: grid; gap: 14px; }
@media (min-width: 560px) { .cert-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .cert-grid { grid-template-columns: repeat(3, 1fr); } }
.cert-grid li[hidden] { display: none; }

/* Tarjetas pulsables: certificaciones y aptitudes */
.cert-card, .skill-card {
  position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; text-align: left; cursor: pointer;
  padding: 18px 18px 20px; border-radius: 16px; background: var(--plate); border: 1px solid var(--line);
  box-shadow: var(--hi), var(--e2); transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.cert-card:hover, .skill-card:hover { transform: translateY(-3px); box-shadow: var(--hi), var(--e2-up); }
.cert-card:active, .skill-card:active { transform: translateY(-1px); }
.cert-card.is-key { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)) 0%, var(--surface-2) 100%); }
.cert-year { font-size: 0.78rem; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.cert-title { margin-top: 6px; font-size: 0.97rem; font-weight: 600; line-height: 1.35; }
.cert-org { margin-top: 6px; font-size: 0.84rem; color: var(--muted); line-height: 1.45; }
.cert-flag {
  align-self: flex-start; margin-top: auto; padding-top: 12px; font-size: 0.76rem; font-weight: 600; color: var(--accent);
  display: inline-flex; align-items: center; gap: 6px;
}
.cert-flag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Aptitudes ---------- */
.tablist { display: none; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); box-shadow: inset 0 1px 3px rgba(16, 24, 32, 0.08); }
.js .tablist { display: flex; }
[role="tab"] {
  flex: 1 0 auto; min-height: 40px; padding: 8px 14px; border: 0; border-radius: 10px; cursor: pointer; background: transparent;
  color: var(--muted); font-size: 0.9rem; font-weight: 500; transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
[role="tab"]:hover { color: var(--ink); }
[role="tab"][aria-selected="true"] { background: var(--plate); color: var(--ink); box-shadow: var(--hi), var(--e1); font-weight: 600; }
.panel[hidden] { display: block; }
.js .panel[hidden] { display: none; }
.panel { margin-top: 20px; }
.panel:focus-visible { outline-offset: 6px; }
.skills { display: grid; gap: 14px; }
@media (min-width: 720px) { .skills { grid-template-columns: 1fr 1fr; } }
.skill-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.skill-name { font-size: 0.98rem; font-weight: 600; line-height: 1.35; }
.skill-years { flex: none; font-size: 0.78rem; color: var(--muted); }
.skill-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 0.8rem; }
.skill-lvl { font-weight: 700; color: var(--accent); }
.skill-ev { color: var(--muted); }
.skill-ev::after { content: " ›"; }

.meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 14px; width: 100%; }
.meter i { height: 6px; border-radius: 3px; background: var(--line-strong); position: relative; overflow: hidden; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.08); }
.meter i::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent));
  transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease);
}
[data-level="1"] .meter i:nth-child(-n+1)::after,
[data-level="2"] .meter i:nth-child(-n+2)::after,
[data-level="3"] .meter i:nth-child(-n+3)::after,
[data-level="4"] .meter i:nth-child(-n+4)::after,
[data-level="5"] .meter i:nth-child(-n+5)::after { transform: scaleX(1); }
.js .skill-card:not(.is-filled) .meter i::after { transform: scaleX(0) !important; }
.meter i:nth-child(2)::after { transition-delay: 0.06s; }
.meter i:nth-child(3)::after { transition-delay: 0.12s; }
.meter i:nth-child(4)::after { transition-delay: 0.18s; }
.meter i:nth-child(5)::after { transition-delay: 0.24s; }
.scale-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 18px; font-size: 0.78rem; color: var(--muted); }

/* ---------- Idiomas, publicación, voluntariado ---------- */
.duo { display: grid; gap: 16px; }
@media (min-width: 720px) { .duo { grid-template-columns: 1fr 1fr; } }
.card { padding: 24px; border-radius: 18px; background: var(--plate); border: 1px solid var(--line); box-shadow: var(--hi), var(--e2); }
.langs { margin-top: 14px; }
.langs li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.langs li:last-child { border-bottom: 0; }
.lang-name { display: inline-flex; align-items: center; gap: 10px; }
.lang-level { color: var(--muted); font-size: 0.9rem; text-align: right; }
.flag { width: 26px; height: 17px; flex: none; border-radius: 4px; box-shadow: 0 0 0 1px var(--line-strong), var(--e1); }
.pub-title { margin-top: 14px; font-family: var(--serif); font-size: 1.14rem; line-height: 1.45; }
.pub-title svg { width: 14px; height: 14px; margin-left: 4px; vertical-align: -1px; }
.pub-meta { margin-top: 10px; font-size: 0.86rem; color: var(--muted); }
.vol { margin-top: 14px; display: grid; gap: 16px; }
.vol h4 { font-size: 0.96rem; font-weight: 600; line-height: 1.35; }
.vol-when { margin-top: 2px; font-size: 0.8rem; color: var(--accent); }
.vol li > p:last-child:not(.vol-when) { margin-top: 6px; font-size: 0.88rem; color: var(--muted); }

/* ---------- Ficha (diálogo) ---------- */
.sheet {
  width: min(560px, calc(100vw - 32px)); max-height: min(86vh, 760px); padding: 0; border: 1px solid var(--line);
  border-radius: 22px; background: var(--plate); color: var(--ink); box-shadow: var(--hi), var(--e3); overflow: hidden;
}
.sheet::backdrop { background: rgba(10, 14, 18, 0.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet[open] { animation: sheet-in 0.4s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }
.sheet-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 12px 0 16px; }
.sheet-back, .sheet-close {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; box-shadow: var(--hi), var(--e1);
  font-size: 0.86rem; font-weight: 600;
}
.sheet-back[hidden] { display: none; }
.sheet-back::before { content: "‹"; margin-right: 6px; font-size: 1.1rem; line-height: 1; }
.sheet-close { margin-left: auto; padding: 0; }
.sheet-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sheet-body { padding: 8px 26px 28px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-kicker { font-size: 0.84rem; font-weight: 600; color: var(--accent); }
.sheet-title { margin-top: 6px; font-family: var(--serif); font-weight: 400; font-size: clamp(1.5rem, 4vw, 1.9rem); line-height: 1.15; letter-spacing: -0.02em; }
.sheet-sub { margin-top: 8px; color: var(--muted); }
.sheet .meter { max-width: 280px; margin-top: 18px; }
.sheet-level { margin-top: 8px; font-size: 0.9rem; }
.sheet-level strong { color: var(--accent); }
.sheet-group { margin-top: 24px; }
.sheet-group h3 { font-size: 0.95rem; font-weight: 600; }
.sheet-list { margin-top: 10px; display: grid; gap: 8px; }
.sheet-link {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 14px;
  text-align: left; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  box-shadow: var(--hi), var(--e1); transition: transform 0.25s var(--ease), box-shadow 0.25s ease;
}
.sheet-link:hover { transform: translateX(2px); box-shadow: var(--hi), var(--e2); }
.sheet-link small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8rem; }
.sheet-link::after { content: "›"; color: var(--wine); font-size: 1.3rem; line-height: 1; }
.sheet-note { padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 0.9rem; }
.sheet-note small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8rem; }
.sheet-verify {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding: 10px 16px; border-radius: 999px; min-height: 44px;
  background: var(--accent); color: var(--bg); font-weight: 600; font-size: 0.88rem; text-decoration: none; box-shadow: var(--e1);
}
.sheet-verify::after { content: "↗"; }

@media (max-width: 599px) {
  .sheet { width: 100vw; max-width: 100vw; max-height: 88vh; margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0; }
  .sheet[open] { animation: sheet-up 0.42s var(--ease); }
  .sheet-bar { position: relative; padding-top: 18px; }
  .sheet-bar::before {
    content: ""; position: absolute; left: 50%; top: 8px; width: 40px; height: 4px; margin-left: -20px;
    border-radius: 2px; background: var(--line-strong);
  }
  .sheet-body { padding: 8px 20px 32px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ---------- Contacto ---------- */
.contact {
  display: grid; gap: 22px; align-items: center; padding: clamp(24px, 5vw, 40px); border-radius: 22px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--surface)) 0%, var(--surface-2) 70%);
  border: 1px solid var(--line); box-shadow: var(--hi), var(--e2);
}
.contact-text { margin-top: 12px; max-width: 54ch; color: var(--muted); }
.contact-cta { margin-top: 0; justify-self: start; }
@media (min-width: 760px) { .contact { grid-template-columns: 1fr auto; gap: 40px; } }

/* ---------- Pie ---------- */
.footer { margin-top: clamp(72px, 12vw, 120px); border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; padding-top: 18px; padding-bottom: 24px; font-size: 0.78rem; color: var(--muted); }
.footer a { display: inline-block; padding: 14px 0; text-decoration: none; letter-spacing: 0.06em; font-weight: 600; color: var(--ink); border-bottom: 1px solid transparent; transition: border-color 0.2s ease; }
.footer a:hover { border-color: var(--wine); }
.brand-sm { font-family: var(--serif); font-size: 0.95rem; color: var(--ink); margin-right: 4px; }

/* ---------- Revelado al hacer scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-delay: 0s !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* Pestañas de aptitudes en 2×2 en pantallas estrechas (al final para prevalecer) */
@media (max-width: 519px) {
  .js .tablist { display: grid; grid-template-columns: 1fr 1fr; }
  [role="tab"] { min-height: 44px; }
}

/* ---------- Página legal (SEG-001) ---------- */
.legal { padding: clamp(40px, 7vw, 72px) 0 0; }
.legal h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.legal-updated { margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
.legal-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 28px; }
.legal-toc a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px; border-radius: 999px; text-decoration: none;
  font-size: 0.9rem; font-weight: 500; background: var(--plate); border: 1px solid var(--line-strong); box-shadow: var(--hi), var(--e1);
}
.legal-card {
  margin-top: 18px; padding: clamp(22px, 4vw, 34px); border-radius: 18px; max-width: 760px;
  background: var(--plate); border: 1px solid var(--line); box-shadow: var(--hi), var(--e2);
}
.legal-card h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.5rem, 3.5vw, 1.9rem); letter-spacing: -0.02em; }
.legal-card h3 { margin-top: 22px; font-size: 1rem; font-weight: 600; }
.legal-card p, .legal-card li { margin-top: 8px; color: var(--muted); max-width: 66ch; }
.legal-card strong { color: var(--ink); }
.legal-card ul { margin-top: 6px; padding-left: 20px; list-style: disc; }
.legal-card a { color: var(--accent); text-underline-offset: 3px; }

/* ---------- Portada (FUN-001) ---------- */
.home { padding: clamp(48px, 9vw, 112px) 0 0; }
.home-hero { margin-top: 0; display: grid; gap: 28px; align-items: center; }
.home-hero .avatar { width: 132px; height: 132px; }
.home h1 { font-size: clamp(2.6rem, 8vw, 4.6rem); }
.home-headline { margin-top: 14px; max-width: 34ch; font-size: clamp(1.15rem, 2.6vw, 1.45rem); line-height: 1.45; color: var(--ink); }
.home-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.home-cta .link-out { margin-top: 0; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px; min-height: 44px;
  font-size: 0.9rem; font-weight: 600; text-decoration: none; color: var(--ink);
  background: var(--plate); border: 1px solid var(--line-strong); box-shadow: var(--hi), var(--e1);
  transition: transform 0.2s var(--ease), box-shadow 0.2s ease;
}
.btn-ghost:hover { transform: translateY(-1px); box-shadow: var(--hi), var(--e2); }
.btn-ghost svg, .link-out svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-lines { display: grid; gap: 16px; margin-top: clamp(40px, 7vw, 72px); }
.home-line {
  display: flex; flex-direction: column; padding: clamp(22px, 4vw, 32px); border-radius: 20px;
  background: var(--plate); border: 1px solid var(--line); box-shadow: var(--hi), var(--e2);
}
.home-line h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.45rem, 3.4vw, 1.85rem); letter-spacing: -0.02em; }
.home-line p { margin-top: 10px; color: var(--muted); max-width: 52ch; }
.home-more {
  align-self: flex-start; margin-top: auto; padding-top: 18px; font-size: 0.9rem; font-weight: 600; color: var(--accent);
  text-decoration: none; display: inline-flex; min-height: 44px; align-items: flex-end;
}
.home-more::after { content: " ›"; color: var(--wine); margin-left: 4px; }
.home-more:hover { text-decoration: underline; text-underline-offset: 4px; }
.home-nav { display: flex; }
@media (min-width: 720px) {
  .home-hero { grid-template-columns: auto 1fr; gap: 44px; }
  .home-hero .avatar { width: 176px; height: 176px; font-size: 3.6rem; }
  .home-lines { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 719px) {
  .js .home-nav { position: static; display: flex; opacity: 1; visibility: visible; transform: none; padding: 0; box-shadow: none; border: 0; background: none; margin-left: auto; }
  .js .home-nav a { padding: 10px 12px; font-size: 0.93rem; border: 0; }
}
.intro .home-hero { opacity: 0; transform: translateY(16px); }
.intro.intro-done .home-hero { animation: rise 0.9s var(--ease) forwards; }
.home-page .actions { margin-left: 0; }

/* ---------- Botones de la portada: mismo tamaño, separados; LinkedIn con su color ---------- */
.home-cta { gap: 14px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; min-width: 150px; padding: 0 24px; border-radius: 999px;
  font-size: 0.98rem; font-weight: 600; text-decoration: none; letter-spacing: 0.005em;
  transition: transform 0.2s var(--ease), box-shadow 0.2s ease, filter 0.2s ease;
}
.btn svg { width: 16px; height: 16px; flex: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn .li-logo { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  color: #fff; background: linear-gradient(180deg, #2a6377 0%, #1f4f60 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--e2);
}
.btn-linkedin {
  color: #fff; background: linear-gradient(180deg, #1673d6 0%, #0a66c2 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--e2);
}
.btn-primary:hover, .btn-linkedin:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--e2-up); filter: brightness(1.05); }
@media (max-width: 400px) { .home-cta .btn { flex: 1 1 100%; } }

/* ---------- Página legal: lectura más cómoda ---------- */
.legal .wrap { max-width: 820px; }
.legal-card { max-width: none; margin-top: 24px; padding: clamp(26px, 5vw, 44px); }
.legal-card h2 { margin-bottom: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.legal-card h3 { margin-top: 30px; font-size: 1.06rem; color: var(--ink); }
.legal-card p, .legal-card li {
  margin-top: 10px; max-width: 68ch; font-size: 1.02rem; line-height: 1.75;
  color: color-mix(in srgb, var(--ink) 84%, var(--bg));
}
.legal-card p + p { margin-top: 14px; }
.legal-card ul { margin-top: 10px; }
.legal-card li + li { margin-top: 6px; }
.legal-updated { margin-top: 12px; }
.legal-toc { position: sticky; top: 72px; z-index: 5; padding: 10px 0; margin: 26px 0 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.legal section { scroll-margin-top: 140px; }
