/* Alan Figueroa — portafolio
   Tokens de color: modifica solo este bloque para cambiar la paleta. */
:root {
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --ink: #16213A;
  --muted: #56627A;
  --line: #D6DCE7;
  --accent: #0B7A71;
  --accent-soft: #DDF1EE;
  --signal: #B4530F;
  --signal-soft: #FBEADB;
  --edge: #B9C3D4;
  --shadow: 0 1px 2px rgba(22, 33, 58, .06), 0 8px 24px -12px rgba(22, 33, 58, .18);
  --radius-s: 6px;
  --radius-m: 12px;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --wrap: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1322; --surface: #131C30; --ink: #E6EBF4; --muted: #9AA7BE; --line: #26324B;
    --accent: #3CC7B6; --accent-soft: #123A3A; --signal: #F2A64B; --signal-soft: #3A2A17; --edge: #34425F;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1322; --surface: #131C30; --ink: #E6EBF4; --muted: #9AA7BE; --line: #26324B;
  --accent: #3CC7B6; --accent-soft: #123A3A; --signal: #F2A64B; --signal-soft: #3A2A17; --edge: #34425F;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- idioma ---------- */
.t-en { display: none; }
:root[data-lang="en"] .t-en { display: revert; }
:root[data-lang="en"] .t-es { display: none; }
/* en SVG, revert no aplica bien a tspan */
:root[data-lang="en"] tspan.t-en { display: inline; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.6 var(--font-body);
  font-feature-settings: "tnum" 0;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: .18em; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.01em; font-weight: 650; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 650; }
.mono {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: var(--bg); font-size: .8rem; letter-spacing: .02em;
}
nav { margin-left: auto; position: relative; }
.nav-list { display: flex; gap: 4px; }
.nav-list a {
  display: block; padding: 6px 10px; border-radius: var(--radius-s);
  color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500;
}
.nav-list a:hover { color: var(--ink); }
.nav-list a.is-active { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.menu-btn { display: none; }
.toggles { display: flex; align-items: center; gap: 8px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface); }
.lang button, .theme-btn, .menu-btn {
  font: 600 .78rem/1 var(--font-body); color: var(--muted); background: none; border: 0; cursor: pointer;
}
.lang button { padding: 6px 9px; border-radius: 999px; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.theme-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.theme-btn svg { width: 16px; height: 16px; fill: var(--muted); }

@media (max-width: 900px) {
  .brand-name { display: none; }
  .menu-btn { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); }
  .nav-list {
    display: none; position: absolute; right: 0; top: 46px; flex-direction: column; min-width: 220px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 6px; box-shadow: var(--shadow);
  }
  .nav-list.is-open { display: flex; }
  .nav-list a { padding: 10px 12px; font-size: 1rem; }
}

/* ---------- hero ---------- */
.hero { padding: 56px 0 40px; }
.hero-in { display: grid; gap: 40px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 980px) { .hero { padding: 88px 0 72px; } .hero-in { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 56px; } }
h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.role { font-family: var(--font-display); font-size: clamp(1.15rem, 2.4vw, 1.45rem); font-weight: 500; color: var(--accent); margin: 14px 0 20px; }
.lede { font-size: 1.08rem; color: var(--ink); max-width: 36em; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 18px; }
.facts li { font-size: .88rem; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.open-to { color: var(--muted); font-size: .95rem; border-left: 3px solid var(--signal); padding-left: 12px; margin: 0; }

/* grafo de trayectoria: el elemento memorable de la página */
.hero-graph { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px 18px 16px; box-shadow: var(--shadow); }
.lineage { width: 100%; height: auto; overflow: visible; font-family: var(--font-body); }
.col-head { font-size: 11.5px; fill: var(--muted); font-weight: 600; }
.edge { fill: none; stroke: var(--edge); stroke-width: 1.6; transition: stroke .2s, opacity .2s; }
.edge.flow { stroke-dasharray: 5 7; animation: flow 1.6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -24; } }
.node { cursor: pointer; outline: none; }
.node rect { fill: var(--bg); stroke: var(--line); stroke-width: 1.2; transition: fill .2s, stroke .2s; }
.node text { font-size: 13px; font-weight: 600; fill: var(--ink); pointer-events: none; }
.node.is-target rect { fill: var(--signal); stroke: var(--signal); }
.node.is-target text { fill: #FFFFFF; }
:root[data-theme="dark"] .node.is-target text { fill: #1A1206; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .node.is-target text { fill: #1A1206; } }
.node:focus-visible rect { stroke: var(--accent); stroke-width: 2.5; }
.lineage.is-tracing .edge { opacity: .25; }
.lineage.is-tracing .edge.on { opacity: 1; stroke: var(--accent); stroke-width: 2.2; }
.lineage.is-tracing .node:not(.on) { opacity: .45; }
.lineage.is-tracing .node.on:not(.is-target) rect { fill: var(--accent-soft); stroke: var(--accent); }
.graph-caption { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); min-height: 5.2em; font-size: .92rem; color: var(--muted); }
.graph-caption .hint { display: block; font-size: .8rem; margin-bottom: 4px; }
.graph-caption strong { color: var(--ink); margin-right: 4px; }
.caption-item { margin: 0; }
@media (prefers-reduced-motion: reduce) { .edge.flow { animation: none; stroke-dasharray: none; } html { scroll-behavior: auto; } }

/* ---------- secciones ---------- */
.section { padding: 64px 0; border-top: 1px solid var(--line); }
@media (min-width: 980px) { .section { padding: 88px 0; } }
.section h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); margin-bottom: 28px; font-weight: 700; }
.section-lede { color: var(--muted); max-width: 40em; margin-top: -12px; }
.two-col { display: grid; gap: 8px; }
@media (min-width: 980px) { .two-col { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 56px; } .two-col > h2 { position: sticky; top: 96px; align-self: start; } }
.prose p { max-width: 38em; font-size: 1.04rem; }
.note { background: var(--accent-soft); border-radius: var(--radius-m); padding: 18px 20px; margin: 28px 0; max-width: 38em; }
.note h3 { font-size: 1.05rem; margin-bottom: 6px; }
.note p { margin: 0; font-size: .98rem; }
.meta-list { display: grid; gap: 0; margin: 0; max-width: 38em; }
.meta-list > div { display: grid; grid-template-columns: 9em 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.meta-list dt { color: var(--muted); font-size: .9rem; }
.meta-list dd { margin: 0; }
@media (max-width: 520px) { .meta-list > div { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  font: 500 .88rem/1 var(--font-body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { opacity: .65; margin-left: 2px; font-variant-numeric: tabular-nums; }
.filter-status { font-size: .85rem; color: var(--muted); min-height: 1.4em; margin: 6px 0 20px; }

/* ---------- experiencia (línea de tiempo real) ---------- */
.timeline { position: relative; }
.job { display: grid; gap: 10px; padding-bottom: 28px; position: relative; }
.job[hidden] { display: none; }
@media (min-width: 860px) {
  .job { grid-template-columns: 170px minmax(0, 1fr); gap: 32px; }
  .timeline::before { content: ""; position: absolute; left: 186px; top: 6px; bottom: 30px; width: 1px; background: var(--line); }
  .job::before { content: ""; position: absolute; left: 181px; top: 10px; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
}
.job-when { font-size: .9rem; color: var(--muted); padding-top: 4px; font-variant-numeric: tabular-nums; }
.job-when time { white-space: nowrap; }
.job-place { display: block; font-size: .82rem; margin-top: 2px; }
.job-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px 22px 16px; }
@media (min-width: 860px) { .job-card { margin-left: 16px; padding: 26px 28px 18px; } }
.job-card h3 { font-size: 1.3rem; }
.company { font-weight: 600; margin: 4px 0 10px; }
.client { font-weight: 400; color: var(--muted); margin-left: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tag { font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.tag-ai { background: var(--signal-soft); color: var(--signal); border-color: transparent; }
.context { color: var(--muted); max-width: 46em; }
.wins { display: grid; gap: 10px; margin: 0 0 14px; }
.wins li { position: relative; padding-left: 20px; max-width: 46em; }
.wins li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.project { border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 4px; }
.project h4 { font-size: 1.02rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.proj-role { font-family: var(--font-body); font-weight: 500; color: var(--muted); font-size: .92rem; }
.proj-dates { font-family: var(--font-body); font-weight: 400; color: var(--muted); font-size: .85rem; margin-left: auto; }
details { border-top: 1px solid var(--line); margin-top: 6px; }
summary { cursor: pointer; padding: 12px 0 4px; font-weight: 600; font-size: .92rem; color: var(--accent); list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; display: inline-block; width: 1.1em; font-weight: 700; }
details[open] summary::before { content: "−"; }
.duties { display: grid; gap: 6px; margin: 8px 0 14px; color: var(--muted); font-size: .95rem; }
.duties li { padding-left: 16px; position: relative; }
.duties li::before { content: "–"; position: absolute; left: 0; }
.stack { display: flex; flex-wrap: wrap; gap: 6px; }
.stack li { font-size: .82rem; padding: 4px 10px; border-radius: var(--radius-s); background: var(--bg); border: 1px solid var(--line); }

/* ---------- formación ---------- */
.degrees { display: grid; gap: 0; }
.degree { padding: 18px 0 18px 22px; border-left: 2px solid var(--line); position: relative; }
.degree::before { content: ""; position: absolute; left: -7px; top: 24px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--muted); }
.degree.is-current::before { background: var(--signal); border-color: var(--signal); }
.degree.is-current { border-left-color: var(--signal); }
.years { font-size: .88rem; color: var(--muted); margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.degree.is-current .years { color: var(--signal); font-weight: 600; }
.degree h3 { font-size: 1.25rem; }
.school { margin: 4px 0 0; }
.honor { margin: 8px 0 0; font-size: .9rem; color: var(--accent); max-width: 34em; }

/* ---------- stack ---------- */
.skills { display: grid; gap: 26px; }
@media (min-width: 640px) { .skills { grid-template-columns: 1fr 1fr; } }
.skill-group h3 { font-size: 1.05rem; margin-bottom: 12px; }
.skill-group .stack li { background: var(--surface); }

/* ---------- certificaciones ---------- */
.certs { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 16px; }
.cert { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.cert[hidden] { display: none; }
.cert-thumb { display: block; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: #FFFFFF; cursor: zoom-in; aspect-ratio: 16 / 10; overflow: hidden; width: 100%; }
.cert-thumb img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s ease; }
.cert-thumb:hover img { transform: scale(1.03); }
.cert-thumb.is-badge {
  cursor: default; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px;
  background: repeating-linear-gradient(135deg, var(--bg) 0 10px, var(--surface) 10px 20px);
}
.badge-issuer { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.badge-kind { font-size: .82rem; color: var(--muted); }
.cert-body { padding: 16px 18px 14px; display: flex; flex-direction: column; flex: 1; }
.feat { align-self: flex-start; font-size: .72rem; font-weight: 600; color: var(--signal); background: var(--signal-soft); padding: 2px 8px; border-radius: 999px; margin-bottom: 8px; }
.cert h3 { font-size: 1.05rem; line-height: 1.25; }
.issuer { margin: 6px 0 2px; font-weight: 500; }
.cert-meta { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.cert-actions { margin: auto 0 0; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.btn-link { font: 600 .9rem/1.4 var(--font-body); color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; }
.btn-link:hover { text-decoration-thickness: 2px; }
.ext { margin-left: 3px; font-size: .85em; }

/* ---------- portafolio ---------- */
.projects { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.proj { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; }
.proj h3 { font-size: 1.2rem; margin-bottom: 8px; }

/* ---------- lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1100px, 94vw); width: 100%; }
.lightbox::backdrop { background: rgba(8, 12, 22, .78); }
.lb-in { background: var(--surface); color: var(--ink); border-radius: 16px; padding: 18px; }
.lb-head { display: flex; align-items: start; gap: 12px; }
.lb-head h2 { font-size: 1.2rem; flex: 1; }
.lb-close { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 1rem; flex: none; }
.lb-issuer { color: var(--muted); margin: 4px 0 12px; font-size: .92rem; }
.lb-img { width: 100%; max-height: 66vh; object-fit: contain; background: #FFFFFF; border-radius: 8px; border: 1px solid var(--line); }
.lb-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.lb-actions { display: flex; gap: 10px; margin: 0; flex-wrap: wrap; }
.lb-nav { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 8px 14px; cursor: pointer; font: 500 .88rem var(--font-body); }
.btn { display: inline-block; font: 600 .9rem/1 var(--font-body); padding: 11px 16px; border-radius: 999px; background: var(--accent); color: #FFFFFF; text-decoration: none; border: 1px solid var(--accent); }
:root[data-theme="dark"] .btn:not(.ghost) { color: #06201D; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost) { color: #06201D; } }
.btn.ghost { background: transparent; color: var(--accent); }
@media (max-width: 600px) { .lb-foot { justify-content: center; } .lb-actions { order: -1; width: 100%; justify-content: center; } }

/* ---------- pie ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .88rem; }
.footer-in { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.footer p { margin: 0; }

@media print {
  .topbar, .filters, .filter-status, details summary, .lightbox, .hero-graph, .cert-thumb { display: none !important; }
  details > * { display: block; }
  .section { padding: 24px 0; }
}
[hidden] { display: none !important; }
@media (max-width: 600px) {
  .node text { font-size: 15px; }
  .col-head { font-size: 14px; }
  .hero-graph { padding: 14px 10px 12px; }
}
