/* Estilos del sitio (compartidos por todos los idiomas). */
  :root {
    --bg: #f6f5f1;
    --surface: #ffffff;
    --ink: #16201b;
    --muted: #5b665f;
    --line: #dfe3dc;
    --accent: #0f7a4f;
    --accent-soft: #e2f1e9;
    --copper: #b8661f;
    --copper-soft: #f7ebdf;
    --shadow: 0 1px 2px rgba(20,30,25,.06), 0 4px 16px rgba(20,30,25,.05);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #0f1412; --surface: #161d1a; --ink: #e7ece8; --muted: #9aa6a0;
      --line: #26302b; --accent: #4fc890; --accent-soft: #173127;
      --copper: #e39a57; --copper-soft: #3a2a1b; --shadow: none;
    }
  }
  :root[data-theme="dark"] {
    --bg: #0f1412; --surface: #161d1a; --ink: #e7ece8; --muted: #9aa6a0;
    --line: #26302b; --accent: #4fc890; --accent-soft: #173127;
    --copper: #e39a57; --copper-soft: #3a2a1b; --shadow: none;
  }

  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body {
    margin: 0; overflow-wrap: anywhere; background: var(--bg); color: var(--ink);
    font: 16px/1.6 "Inter", system-ui, sans-serif;
  }
  a { color: var(--accent); }
  .wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
  .mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

  /* Nav */
  nav.top {
    position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  }
  nav.top .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
  nav.top .brand { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; }
  nav.top .links { min-width: 0; display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; }
  nav.top .links a { color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
  nav.top .links a:hover { color: var(--ink); }
  #themeToggle {
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    border-radius: 8px; width: 34px; height: 34px; cursor: pointer; flex: none;
  }
  @media (max-width: 720px) { nav.top .brand { display: none; } }

  /* Hero */
  header.hero { padding: 64px 0 40px; }
  .hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; }
  .hero h1 { font-size: clamp(34px, 6vw, 54px); line-height: 1.05; margin: 0 0 10px; letter-spacing: -0.02em; }
  .hero .role { font-size: 18px; color: var(--accent); font-weight: 600; margin: 0 0 18px; }
  .hero p.lead { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 0 24px; }
  .hero img {
    width: 200px; height: 200px; object-fit: cover; border-radius: 50%;
    border: 4px solid var(--surface); box-shadow: var(--shadow), 0 0 0 2px var(--accent);
  }
  .contact-row { display: flex; flex-wrap: wrap; gap: 10px; }
  .chip-link {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    color: var(--ink); text-decoration: none; font-size: 14px;
  }
  .chip-link:hover { border-color: var(--accent); }
  .chip-link.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
  .chip-link.print-btn { cursor: pointer; font: inherit; font-size: 14px; }
  @media (max-width: 720px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero img { width: 120px; height: 120px; order: -1; }
  }

  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 40px; }
  .stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
  .stat b { display: block; font-size: 28px; line-height: 1.1; color: var(--ink); }
  .stat span { font-size: 13px; color: var(--muted); }
  @media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

  /* Sections */
  section.block { padding: 48px 0; border-top: 1px solid var(--line); scroll-margin-top: 56px; }
  .sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
  .sec-head h2 { margin: 0; font-size: 28px; letter-spacing: -0.01em; }
  .sec-head .kicker { font-size: 12px; color: var(--copper); text-transform: uppercase; letter-spacing: .12em; }
  .sec-head p { margin: 0; color: var(--muted); flex-basis: 100%; }

  /* Filters */
  .filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
  .filters button {
    border: 1px solid var(--line); background: var(--surface); color: var(--muted);
    padding: 6px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px;
  }
  .filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

  /* Cards */
  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
  .card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    padding: 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
  }
  .card[hidden] { display: none; }
  .card .date { font-size: 12px; color: var(--copper); font-family: "JetBrains Mono", monospace; }
  .card h3 { margin: 0; font-size: 18px; line-height: 1.3; }
  .card .org { font-size: 13px; color: var(--muted); margin-top: -6px; }
  .card p { margin: 0; color: var(--muted); font-size: 15px; }
  .card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
  .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
  .tag {
    font-size: 12px; padding: 2px 9px; border-radius: 6px;
    background: var(--accent-soft); color: var(--accent); font-family: "JetBrains Mono", monospace;
  }
  .card a.more { font-size: 14px; font-weight: 600; text-decoration: none; }
  .card a.more:hover { text-decoration: underline; }
  .badge {
    align-self: flex-start; font-size: 11px; padding: 2px 8px; border-radius: 6px;
    background: var(--copper-soft); color: var(--copper); font-weight: 600; letter-spacing: .03em;
  }

  /* Timeline */
  .timeline { position: relative; margin: 0; padding: 0; list-style: none; }
  .timeline::before {
    content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line);
  }
  .timeline > li { position: relative; padding: 0 0 26px 34px; }
  .timeline > li::before {
    content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px;
    border-radius: 50%; background: var(--bg); border: 3px solid var(--accent);
  }
  .timeline > li.minor::before { border-color: var(--line); }
  .timeline .when { font-size: 13px; color: var(--copper); font-family: "JetBrains Mono", monospace; }
  .timeline h3 { margin: 2px 0 0; font-size: 18px; }
  .timeline .where { color: var(--muted); font-size: 14px; }
  .timeline ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 15px; }

  /* Two col lists */
  .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
  .panel h3 { margin: 0 0 12px; font-size: 16px; }
  .panel ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 15px; }
  .panel li + li { margin-top: 6px; }
  .panel li b { color: var(--ink); font-weight: 600; }

  footer { padding: 40px 0 60px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
  footer .wrap { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }

  /* Print: sale como un CV limpio */
  @media print {
    :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #333; --line: #ccc; --shadow: none; }
    nav.top, .filters, #themeToggle, .print-btn, .no-print { display: none !important; }
    header.hero { padding: 0 0 12px; }
    section.block { padding: 16px 0; break-inside: auto; }
    .card, .panel, .timeline > li { break-inside: avoid; }
    .card[hidden] { display: flex !important; }
    .grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .card { padding: 10px; }
    a { color: #000; text-decoration: none; }
    body { font-size: 12px; }
  }

  /* Intro: viaje dentro del chip */
  #chipIntro { display: none; }
  .intro-on #chipIntro {
    display: block; position: fixed; inset: 0; z-index: 1000; background: #040706; cursor: pointer;
    animation: introFailsafe .4s 14s forwards;
  }
  #chipIntro canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
  #chipIntro.intro-out { opacity: 0; transition: opacity .8s ease; pointer-events: none; }
  .intro-caption {
    position: absolute; left: 16px; bottom: 16px; color: #8fe3bb;
    font: 12px/1.5 "JetBrains Mono", monospace; letter-spacing: .08em; text-transform: uppercase;
    text-shadow: 0 0 10px rgba(60,255,160,.45); pointer-events: none;
  }
  .intro-caption b { display: block; color: #eafff4; font-size: 13px; }
  .intro-skip {
    position: absolute; right: 16px; bottom: 16px; padding: 8px 14px; border-radius: 999px;
    background: rgba(255,255,255,.08); color: #eafff4; border: 1px solid rgba(255,255,255,.25);
    font: 13px "JetBrains Mono", monospace; cursor: pointer;
  }
  .intro-skip:hover { background: rgba(255,255,255,.16); }
  @keyframes introFailsafe { to { opacity: 0; visibility: hidden; } }
  .intro-reveal nav.top { animation: introPop .7s .05s cubic-bezier(.2,.8,.2,1) both; }
  .intro-reveal header.hero .wrap { animation: introPop 1s .1s cubic-bezier(.2,.8,.2,1) both; }
  @keyframes introPop {
    from { opacity: 0; transform: scale(.96) translateY(14px); filter: blur(6px); }
    to { opacity: 1; transform: none; filter: none; }
  }
  @media print { #chipIntro { display: none !important; } }

  /* Varios enlaces por tarjeta */
  .card .links-row { display: flex; flex-wrap: wrap; gap: 6px 16px; }

  /* Selector de idioma */
  .lang-switch { display: flex; flex: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
  .lang-switch a {
    padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none;
    background: var(--surface); line-height: 1.2;
  }
  .lang-switch a + a { border-left: 1px solid var(--line); }
  .lang-switch a:hover { color: var(--ink); }
  .lang-switch a[aria-current="true"] { background: var(--ink); color: var(--bg); }
  @media (max-width: 520px) { .lang-switch a { padding: 6px 6px; } }

  /* Sugerencia de idioma según el navegador */
  .lang-banner {
    display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
    padding: 8px 16px; background: var(--accent-soft); color: var(--ink); font-size: 14px;
    border-bottom: 1px solid var(--line);
  }
  .lang-banner a { font-weight: 600; }
  .lang-banner button {
    border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px;
  }

  /* Chino: fuentes del sistema con glifos CJK */
  html[lang^="zh"] body {
    font-family: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  }
  html[lang^="zh"] .hero h1 { letter-spacing: -0.01em; }

  /* Alemán: palabras largas */
  html[lang="de"] p, html[lang="de"] .card h3, html[lang="de"] .timeline > li { hyphens: auto; }

  @media print { .lang-switch, .lang-banner { display: none !important; } }

  /* Intro en pantallas angostas: el texto de la etapa va encima del botón de saltar */
  @media (max-width: 600px) {
    .intro-caption { bottom: 64px; right: 16px; }
  }

  .all-repos { margin: 20px 0 0; font-weight: 600; }
  .all-repos a { text-decoration: none; }
  .all-repos a:hover { text-decoration: underline; }
  @media print { .all-repos { display: none; } }
