/* ==========================================================================
   ÁRBOL FAMILIAR · estilos
   1) Tokens  2) Reset  3) Layout  4) Componentes  5) Árbol  6) Ficha
   7) Movimiento  8) Responsive  9) Menos movimiento
   Regla: se anima transform y opacity (+ grid-template-rows y colores).
   ========================================================================== */

/* 1) TOKENS ---------------------------------------------------------------- */
:root {
  --bg: #fff7ea;
  --bg-alt: #fde9cc;
  --paper: #ffffff;
  --ink: #14284b;
  --muted: #4f5f7e;
  --line: rgba(20, 40, 75, .2);
  --branch: #2b3f6b;
  --accent: #14284b;
  --accent-ink: #ffffff;
  --em: #e4502f;
  --gold: #ffc93c;
  --sun: #ffc93c;
  --sky: #d6e6ff;
  --coral: #ff7a59;
  --dark: #14284b;
  --dark-ink: #fff7ea;
  --ok: #1f7a4d;
  --danger: #b3261e;

  /* Un color por rubro (el avatar de cada persona toma el de su rubro) */
  --a0: #2f5bea; --a1: #0b7a68; --a2: #b45f06; --a3: #c2386b;
  --a4: #4a5d8f; --a5: #357a2a; --a6: #d2461e; --a-none: #5e6b85;

  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Nunito", system-ui, sans-serif;
  --fs-body: 1.0625rem;
  --fs-h1: clamp(2.35rem, 1.1rem + 5vw, 4.8rem);
  --fs-h2: clamp(1.85rem, 1.1rem + 2.6vw, 3rem);
  --fs-h3: clamp(1.2rem, 1.05rem + .6vw, 1.45rem);

  --radius: 24px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --t-fast: 180ms;
  --t-base: 420ms;
  --t-slow: 700ms;

  --gutter: clamp(20px, 5vw, 40px);
  --header-h: 84px;
  --section-y: clamp(72px, 10vw, 130px);
}

/* 2) RESET ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  scroll-padding-top: calc(var(--header-h) + 12px);
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html.nav-open, html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  font: 400 var(--fs-body)/1.6 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, video, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.section--dark :focus-visible, dialog :focus-visible { outline-color: currentColor; }
::selection { background: var(--accent); color: var(--accent-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* 3) LAYOUT ---------------------------------------------------------------- */
.container { width: min(1200px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); }
.section--dark { background: var(--dark); color: var(--dark-ink); --line: rgba(255, 255, 255, .2); --muted: #b9c5da; }
.eyebrow { font-size: .8125rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; }
.section--dark .eyebrow { color: var(--gold); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.035em; line-height: 1.08; text-wrap: balance; }
h1 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -.04em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
h1 em, h2 em { font-style: normal; color: var(--em); font-weight: inherit; }
.section--dark h2 em { color: var(--gold); }
.lead { font-size: clamp(1.1rem, 1rem + .5vw, 1.3rem); color: var(--muted); max-width: 56ch; text-wrap: pretty; }
.section__head { max-width: 760px; margin-bottom: clamp(32px, 5vw, 56px); }
.section__head .lead { margin-top: 20px; }

/* 4) COMPONENTES ----------------------------------------------------------- */
.btn {
  --_bg: transparent; --_fg: var(--ink); --_bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--_bd); background: var(--_bg); color: var(--_fg);
  font-weight: 600; font-size: 1rem; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; transition: transform var(--t-base) var(--ease); flex: none; }
.btn--primary { --_bg: var(--accent); --_fg: var(--accent-ink); --_bd: var(--accent); }
.btn--dark { --_bg: var(--ink); --_fg: var(--bg); --_bd: var(--ink); }
.btn--sm { min-height: 44px; padding: 0 20px; font-size: .9375rem; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-2px); }
  .btn:active { transform: scale(.97); }
  .btn:hover svg { transform: translateX(3px); }
  .btn--primary:hover { --_bg: color-mix(in srgb, var(--accent) 86%, black); --_bd: color-mix(in srgb, var(--accent) 86%, black); }
  .btn--dark:hover { --_bg: #243a5e; }
  .btn:not(.btn--primary):not(.btn--dark):hover { --_bd: var(--ink); }
}

/* Cabecera */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--header-h); }
.site-header::before {
  content: ""; position: absolute; inset: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(14px); -webkit-backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid var(--line);
  opacity: 0; transition: opacity var(--t-base) var(--ease);
}
.site-header.is-scrolled::before, html.nav-open .site-header::before { opacity: 1; }
.site-header__row { position: relative; z-index: 2; height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.logo { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; letter-spacing: -.02em; }
.logo svg { width: 30px; height: 30px; flex: none; }

.nav { display: flex; align-items: center; gap: 28px; }
.nav ul { display: flex; gap: 2px; }
.nav li a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 13px;
  font-size: .9375rem; font-weight: 500; color: var(--muted);
  transition: color var(--t-fast) var(--ease);
}
.nav li a::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 8px; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: center; transition: transform var(--t-base) var(--ease);
}
.nav li a[aria-current] { color: var(--ink); }
.nav li a[aria-current]::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) {
  .nav li a:hover { color: var(--ink); }
  .nav li a:hover::after { transform: scaleX(1); }
}
.nav-toggle { display: none; position: relative; z-index: 2; width: 48px; height: 48px; margin-right: -10px; border-radius: 50%; }
.nav-toggle span { position: absolute; left: 14px; right: 14px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform var(--t-base) var(--ease); }
.nav-toggle span:nth-child(1) { top: 20px; }
.nav-toggle span:nth-child(2) { top: 27px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }

/* Hero */
.hero { position: relative; padding-top: calc(var(--header-h) + clamp(32px, 6vw, 80px)); padding-bottom: clamp(48px, 7vw, 96px); }
.hero__grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero h1 { margin-bottom: 24px; }
.hero .lead { margin-bottom: 36px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }
.demo-tag { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; padding: 6px 14px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--accent) 13%, var(--paper)); color: var(--accent); font-size: .8125rem; font-weight: 700; letter-spacing: .02em; }
.demo-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Diagrama del hero: el árbol en chico, con líneas */
.hero__grid > * { min-width: 0; }
.mini { min-width: 0; justify-self: end; display: flex; justify-content: center; width: 100%; max-width: 600px; padding: 8px 4px; }
.mt, .mt ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; }
.mt { flex: none; }
.mt ul { position: relative; padding-top: 30px; }
.mt ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 30px; border-left: 2px solid var(--branch); transform: translateX(-1px); }
.mt li { position: relative; display: flex; flex-direction: column; align-items: center; padding: 30px 7px 0; }
.mt > li { padding-top: 0; }
.mt li::before, .mt li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 30px; border-top: 2px solid var(--branch); }
.mt li::after { right: auto; left: 50%; border-left: 2px solid var(--branch); }
.mt > li::before, .mt > li::after, .mt li:only-child::before, .mt li:only-child::after { display: none; }
.mt li:only-child { padding-top: 0; }
.mt > li:only-child { padding-top: 0; }
.mt li:first-child::before, .mt li:last-child::after { border: 0; }
.mt li:last-child::before { border-right: 2px solid var(--branch); border-radius: 0 12px 0 0; }
.mt li:first-child::after { border-radius: 12px 0 0 0; }
.mt__card { width: 184px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.mt__row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; text-align: left; transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.mt__row + .mt__row { border-top: 1px solid var(--line); }
.mt__row .avatar { width: 40px; height: 40px; font-size: .875rem; }
.mt__row--hidden .avatar { background: transparent; border: 1.5px dashed var(--branch); color: var(--muted); }
.mt__txt { min-width: 0; overflow-wrap: anywhere; }
.mt__name { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1rem; line-height: 1.2; letter-spacing: -.01em; }
.mt__role { display: block; margin-top: 2px; font-size: .8125rem; line-height: 1.3; color: var(--muted); }
button.mt__row:active { transform: scale(.985); }
@media (hover: hover) and (pointer: fine) { button.mt__row:hover { background: color-mix(in srgb, var(--accent) 7%, var(--paper)); } }
.js .mt__card { animation: rise 640ms var(--ease) both; animation-delay: calc(var(--d, 0) * 150ms + 200ms); }

/* Tarjetas grandes de entrada */
.explore { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.xcard { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; min-height: 360px; padding: clamp(28px, 4vw, 52px); border-radius: calc(var(--radius) + 6px); overflow: hidden; isolation: isolate; transition: transform var(--t-base) var(--ease); }
.xcard::before, .xcard::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; border: 2px solid currentColor; opacity: .14; }
.xcard::before { width: 340px; height: 340px; right: -100px; top: -110px; }
.xcard::after { width: 200px; height: 200px; right: 70px; top: 30px; }
.xcard--tree { background: var(--dark); color: var(--dark-ink); }
.xcard--people { background: #1e4e9c; color: #fff; }
.xcard h2 { font-size: clamp(2.2rem, 1.5rem + 2.6vw, 3.6rem); margin-top: 14px; }
.xcard h2 em { color: var(--gold); }
.xcard__txt { margin-top: 14px; max-width: 34ch; }
.xcard__eyebrow { font-size: .8125rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.xcard__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.xcard__nums { display: flex; gap: 28px; }
.xcard__nums strong { display: block; font-family: var(--font-display); font-size: 2.4rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.xcard__nums span { display: block; margin-top: 6px; font-size: .875rem; }
.xcard__go { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: currentColor; transition: transform var(--t-base) var(--ease); }
.xcard__go svg { width: 22px; height: 22px; color: var(--dark); }
.xcard--people .xcard__go svg { color: #1e4e9c; }
.xcard:active { transform: scale(.985); }
@media (hover: hover) and (pointer: fine) { .xcard:hover { transform: translateY(-6px); } .xcard:hover .xcard__go { transform: translateX(6px); } }

/* Pestañas con indicador deslizante */
.tabs { position: relative; display: flex; gap: 4px; margin-bottom: 28px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; font-weight: 500; color: var(--muted); transition: color var(--t-fast) var(--ease); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--a-none)); }
@media (hover: hover) and (pointer: fine) { .tab:hover { color: var(--ink); } }
.tabs__ind {
  position: absolute; left: 0; bottom: 0; width: 100px; height: 2px; background: var(--accent);
  transform-origin: left center; transform: translateX(var(--x, 0)) scaleX(var(--s, 0));
  transition: transform var(--t-base) var(--ease); pointer-events: none;
}
.tabs:not(.is-ready) .tabs__ind { transition: none; }

/* Buscador */
.search { position: relative; max-width: 520px; margin-bottom: 20px; }
.search label { display: block; font-size: .9375rem; font-weight: 600; margin-bottom: 8px; }
.search__box { position: relative; }
.search svg { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 52px; padding: 12px 16px 12px 46px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-pill);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.results { min-height: 1.6em; margin-bottom: 20px; font-size: .9375rem; color: var(--muted); }

/* Directorio */
.people { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.pcard {
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 22px 22px 14px; min-height: 210px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform var(--t-base) var(--ease);
}
.pcard::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity var(--t-base) var(--ease); }
.pcard__top { display: flex; align-items: center; gap: 14px; }
.pcard h2 { font-size: 1.25rem; line-height: 1.2; }
.pcard__open { display: inline-flex; align-items: center; min-height: 44px; text-align: left; border-radius: 6px; }
.pcard__open::before { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.pcard__role { font-weight: 600; line-height: 1.3; }
.pcard__meta { color: var(--muted); font-size: .9375rem; line-height: 1.4; }
.pcard__bio { color: var(--muted); font-size: .9375rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.pcard__city { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .875rem; }
.pcard__city svg { width: 16px; height: 16px; }
.in-link { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 12px; margin-right: -12px; border-radius: var(--radius-pill); font-size: .875rem; font-weight: 600; color: var(--ink); transition: background-color var(--t-fast) var(--ease); }
.in-link svg { width: 18px; height: 18px; }
@media (hover: hover) and (pointer: fine) {
  .pcard:hover { transform: translateY(-5px); }
  .pcard:hover::after { opacity: 1; }
  .in-link:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
}
.empty { padding: 36px 24px; border: 1px dashed var(--branch); border-radius: var(--radius); text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* Avatar (iniciales) */
.avatar { flex: none; overflow: hidden; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--c, var(--a-none)); color: #fff; font-weight: 700; font-size: .9375rem; letter-spacing: .02em; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 68px; height: 68px; font-size: 1.35rem; }

/* Contacto */
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: center; }
.contact__list { display: grid; gap: 12px; }
.c-card {
  display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 14px 18px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .05);
  transition: transform var(--t-base) var(--ease), border-color var(--t-fast) var(--ease);
}
.c-card__ico { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--accent); color: var(--accent-ink); }
.c-card__ico svg { width: 22px; height: 22px; }
.c-card small { display: block; color: var(--muted); font-size: .8125rem; }
.c-card strong { font-weight: 600; word-break: break-word; }
.c-card__arrow { margin-left: auto; width: 18px; height: 18px; opacity: .55; transition: transform var(--t-base) var(--ease), opacity var(--t-fast) var(--ease); flex: none; }
@media (hover: hover) and (pointer: fine) { .c-card:hover { transform: translateX(4px); border-color: color-mix(in srgb, var(--dark-ink) 55%, transparent); } .c-card:hover .c-card__arrow { transform: translateX(4px); opacity: 1; } }
.c-card:active { transform: scale(.985); }

/* Botón flotante de contacto */
.fab {
  position: fixed; z-index: 40; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 22px 0 18px; border-radius: var(--radius-pill);
  background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 12px 28px -10px rgba(11, 31, 58, .55);
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(.96); pointer-events: none;
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease), visibility var(--t-base);
}
.fab svg { width: 24px; height: 24px; }
.fab.is-visible { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
@media (hover: hover) and (pointer: fine) { .fab.is-visible:hover { transform: translateY(-3px); } }
.fab:active { transform: scale(.96); }

/* Aviso breve */
.toast { position: fixed; z-index: 60; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); width: min(460px, 100% - 32px); padding: 14px 18px; border-radius: var(--radius-sm); background: var(--dark); color: var(--dark-ink); font-size: .9375rem; box-shadow: var(--shadow-lg); transform: translate(-50%, 16px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease), visibility var(--t-base); }
.toast.is-on { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* Pie */
.footer { padding-block: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9375rem; }
.footer__row { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.footer p + p { margin-top: 2px; }
.footer a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; transition: color var(--t-fast) var(--ease); }
@media (hover: hover) and (pointer: fine) { .footer a:hover { color: var(--ink); } }
.footer__links { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.footer__links a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

/* 5) ÁRBOL ----------------------------------------------------------------- */
.tree-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .875rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tools-btns { display: flex; gap: 8px; }
.pill { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper); font-weight: 600; font-size: .9375rem; transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.pill:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .pill:hover { border-color: var(--ink); } }

.page-head { padding-top: calc(var(--header-h) + clamp(28px, 5vw, 64px)); padding-bottom: clamp(20px, 3vw, 36px); }
.page-head h1 { font-size: clamp(2.4rem, 1.4rem + 4vw, 4.6rem); margin-bottom: 18px; }
.only-desktop { display: none; }
.canvas-wrap { position: relative; padding-bottom: clamp(48px, 7vw, 96px); }
.canvas { position: relative; width: min(1200px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.canvas__size, .canvas__inner { position: relative; }
.zoom { display: none; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.node { position: relative; }

/* Unidad = una persona, o una pareja en la misma tarjeta */
.unit { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.person { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 10px 14px; text-align: left; transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.person + .person { border-top: 1px solid var(--line); }
.person__txt { min-width: 0; overflow-wrap: anywhere; }
.person__name { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; line-height: 1.2; letter-spacing: -.01em; }
.person__role { display: block; margin-top: 1px; font-size: .8125rem; line-height: 1.3; color: var(--muted); }
.person:active { transform: scale(.985); }
@media (hover: hover) and (pointer: fine) { button.person:hover { background: color-mix(in srgb, var(--accent) 8%, var(--paper)); } }
.person--hidden { cursor: default; background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(11, 31, 58, .04) 8px 16px); }
.person--hidden .avatar { background: transparent; border: 1.5px dashed var(--branch); color: var(--muted); }
.person--hidden:active { transform: none; }

.join { position: relative; display: flex; align-items: center; }
.branch-btn { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper); font-size: .875rem; font-weight: 700; justify-content: center; transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.branch-btn svg { width: 16px; height: 16px; transition: transform var(--t-base) var(--ease); }
.branch-btn[aria-expanded="false"] svg { transform: rotate(-90deg); }
.branch-btn:active { transform: scale(.96); }
.branch-btn__w { font-weight: 500; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .branch-btn:hover { border-color: var(--ink); } }

.branch { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; transition: grid-template-rows var(--t-base) var(--ease), visibility 0s linear 0s; }
.branch.is-closed { grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows var(--t-base) var(--ease), visibility 0s linear var(--t-base); }
.branch__in { min-height: 0; overflow: clip; overflow-clip-margin: 20px; }

/* Celular: el árbol se lee como un índice con sangría */
.tree > .node { padding-bottom: 6px; }
.tree > .node + .node { margin-top: 24px; }
.join { padding-top: 8px; padding-left: 4px; }
.branch ul { margin-left: 14px; }
.branch .node { padding: 14px 0 0 18px; }
.branch .node::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px solid var(--branch); }
.branch .node:last-child::before { bottom: auto; height: 48px; }
.branch .node::after { content: ""; position: absolute; left: 0; top: 48px; width: 14px; border-top: 2px solid var(--branch); }

/* Escritorio: lienzo amplio de borde a borde, con zoom y arrastre */
@media (min-width: 860px) {
  .only-desktop { display: inline; }
  .canvas { width: 100%; margin: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; cursor: grab;
    border-block: 1px solid var(--line);
    background: radial-gradient(circle at 1px 1px, rgba(11, 31, 58, .16) 1.2px, transparent 0) 0 0 / 30px 30px local, color-mix(in srgb, var(--paper) 55%, var(--bg)); }
  .canvas.is-dragging { cursor: grabbing; user-select: none; }
  .canvas__inner { position: absolute; left: 0; top: 0; width: max-content; padding: 48px 40px 72px; transform-origin: 0 0; }
  .zoom { position: absolute; right: max(20px, var(--gutter)); bottom: 28px; z-index: 5; display: flex; gap: 8px; align-items: center; }
  .zbtn { display: grid; place-items: center; min-width: 48px; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper); box-shadow: var(--shadow); font-weight: 600; font-size: .9375rem; transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
  .zbtn svg { width: 20px; height: 20px; }
  .zbtn:active { transform: scale(.95); }
  .zbtn--txt { min-width: 64px; font-variant-numeric: tabular-nums; }
  .tree { display: flex; justify-content: center; width: max-content; }
  .tree > .node { padding: 0 12px 6px; }
  .tree > .node + .node { margin-top: 0; }
  .node { display: flex; flex-direction: column; align-items: center; }
  .unit { width: 248px; border-radius: 20px; }
  .person { min-height: 92px; padding: 14px 18px; gap: 14px; }
  .person .avatar { width: 52px; height: 52px; font-size: 1rem; }
  .person__name { font-size: 1.15rem; }
  .person__role { font-size: .875rem; margin-top: 3px; }
  .join { height: 84px; width: 44px; padding: 0; justify-content: center; }
  .join::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2px solid var(--branch); transform: translateX(-1px); }
  .branch__in { overflow-clip-margin: 28px; }
  .branch { grid-template-columns: auto; }
  .branch ul { display: flex; justify-content: center; margin-left: 0; }
  .branch .node { padding: 36px 10px 0; }
  .branch .node::before, .branch .node:last-child::before,
  .branch .node::after { top: 0; bottom: auto; height: 36px; width: 50%; border-left: 0; border-top: 2px solid var(--branch); }
  .branch .node::before, .branch .node:last-child::before { left: auto; right: 50%; }
  .branch .node::after { left: 50%; right: auto; border-left: 2px solid var(--branch); }
  .branch .node:first-child::before { border: 0; }
  .branch .node:last-child::after { border-top: 0; border-left: 2px solid var(--branch); }
  .branch .node:last-child::before { border-right: 2px solid var(--branch); border-radius: 0 14px 0 0; }
  .branch .node:first-child::after { border-radius: 14px 0 0 0; }
  .branch .node:only-child { padding-top: 0; }
  .branch .node:only-child::before, .branch .node:only-child::after { display: none; }
  .branch-btn__w { display: none; }
}

/* 6) FICHA (ventana con los datos de una persona) -------------------------- */
dialog.ficha {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--ink);
  place-items: end center;
  opacity: 0; transition: opacity var(--t-base) var(--ease), overlay var(--t-base) allow-discrete, display var(--t-base) allow-discrete;
}
dialog.ficha[open] { display: grid; opacity: 1; }
@starting-style { dialog.ficha[open] { opacity: 0; } }
dialog.ficha::backdrop { background: rgba(6, 20, 42, .66); backdrop-filter: blur(4px); }
.ficha__panel {
  position: relative; width: 100%; max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: 26px 26px 0 0; padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  transform: translateY(0); transition: transform var(--t-base) var(--ease);
}
@starting-style { dialog.ficha[open] .ficha__panel { transform: translateY(40px); } }
dialog.ficha:not([open]) .ficha__panel { transform: translateY(24px); }
.ficha__close { position: absolute; top: 12px; right: 12px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--ink) 7%, transparent); transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.ficha__close svg { width: 22px; height: 22px; }
.ficha__close:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .ficha__close:hover { background: color-mix(in srgb, var(--ink) 14%, transparent); } }
.ficha__head { display: flex; align-items: center; gap: 18px; padding-right: 44px; margin-bottom: 22px; }
.ficha__head h2 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); }
.ficha__head h2:focus { outline: none; }
.ficha__sub { margin-top: 6px; color: var(--muted); font-size: .9375rem; }
.ficha__facts { display: grid; gap: 14px; padding-block: 20px; border-block: 1px solid var(--line); }
.ficha__facts dt { font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ficha__facts dd { margin-top: 2px; font-weight: 500; }
.ficha__bio { margin-top: 20px; color: var(--muted); text-wrap: pretty; }
.ficha__note { margin-top: 20px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--bg-alt); color: var(--muted); font-size: .9375rem; }
.ficha__cta { margin-top: 22px; }
.ficha__fam { margin-top: 26px; display: grid; gap: 14px; }
.ficha__fam h3 { font-family: var(--font); font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 6px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--bg); font-weight: 600; font-size: .9375rem; transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.chip .avatar { width: 32px; height: 32px; font-size: .75rem; }
.chip:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--ink); } }
.ficha__gen { font-weight: 600; color: var(--ink); }

@media (min-width: 700px) {
  dialog.ficha { place-items: center; }
  .ficha__panel { width: min(580px, 100% - 32px); max-height: min(90dvh, 800px); border-radius: 26px; padding: 36px 36px 32px; }
  .ficha__facts { grid-template-columns: 1fr 1fr; }
  .ficha__facts .wide { grid-column: 1 / -1; }
}

/* Páginas legales */
.legal { padding-top: calc(var(--header-h) + clamp(32px, 6vw, 72px)); padding-bottom: clamp(56px, 8vw, 112px); }
.legal .container { max-width: 760px; }
.legal h1 { font-size: clamp(2.2rem, 1.4rem + 3.4vw, 3.6rem); margin-bottom: 14px; }
.legal__upd { color: var(--muted); margin-bottom: 36px; }
.legal h2 { font-size: clamp(1.35rem, 1.15rem + .8vw, 1.75rem); margin: 38px 0 12px; }
.legal p, .legal li { color: #2a3b55; margin-top: 10px; text-wrap: pretty; }
.legal ul { list-style: disc; padding-left: 22px; }
.legal a { text-decoration: underline; text-underline-offset: 3px; color: var(--accent); font-weight: 600; }

/* 7) MOVIMIENTO ------------------------------------------------------------ */
.js [data-rise] { animation: rise var(--t-slow) var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms + 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.js .reveal.is-in { opacity: 1; transform: none; }


@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* El árbol entra generación por generación al llegar a la pantalla */
.js .canvas:not(.is-shown) .unit, .js .canvas:not(.is-shown) .join { opacity: 0; }
.js .canvas.is-shown .unit, .js .canvas.is-shown .join { animation: rise 640ms var(--ease) both; animation-delay: calc(var(--d, 0) * 120ms); }

/* 8) RESPONSIVE ------------------------------------------------------------ */
@media (max-width: 1024px) { .people { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 899px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed; inset: 0; z-index: 1; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 28px;
    padding: calc(var(--header-h) + 24px) var(--gutter) 32px; background: var(--bg); overflow-y: auto;
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease), visibility 0s linear var(--t-base);
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .nav ul { flex-direction: column; gap: 0; }
  .nav li a { font-family: var(--font-display); font-size: 1.85rem; font-weight: 500; letter-spacing: -.02em; color: var(--ink); min-height: 64px; padding: 0; border-bottom: 1px solid var(--line); width: 100%; }
  .nav li a::after { display: none; }
  .nav li a[aria-current] { color: var(--accent); }
  .nav .btn { width: 100%; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero { padding-top: calc(var(--header-h) + 8px); }
  .explore { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .person { gap: 10px; padding: 10px; }
  .person .avatar { width: 38px; height: 38px; font-size: .8125rem; }
}
@media (max-width: 640px) {
  .people { grid-template-columns: 1fr; }
  .hero__cta .btn { flex: 1 1 100%; }
  .fab span { display: none; }
  .fab { padding: 0; width: 56px; justify-content: center; }
  .xcard { min-height: 280px; }
  .logo { font-size: 1.15rem; }
  .tools-btns { width: 100%; }
  .tools-btns .pill { flex: 1; }
}


/* 10) ESTILO INFORMAL: bordes marcados, sombras "pegadas", formas sueltas ---------------- */
:root { --squiggle-sol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M2 7 Q12 1 22 7T42 7T62 7T82 7T102 7T118 7' fill='none' stroke='%23ffc93c' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
        --squiggle-coral: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M2 7 Q12 1 22 7T42 7T62 7T82 7T102 7T118 7' fill='none' stroke='%23ff7a59' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E"); }
h1, h2, h3 { font-weight: 800; letter-spacing: -.03em; }
h1 { line-height: 1.02; letter-spacing: -.035em; }
h1 em, h2 em { background: var(--squiggle-sol) left bottom / 100% .3em no-repeat; padding-bottom: .14em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.section--dark h2 em { color: var(--sun); background-image: var(--squiggle-coral); }
.lead { font-size: clamp(1.1rem, 1rem + .5vw, 1.3rem); }

/* Botones */
.btn { --_bg: var(--paper); --_fg: var(--ink); --_bd: var(--ink); border-width: 2px; box-shadow: 3px 3px 0 var(--ink); font-weight: 800; }
.btn--primary { --_bg: var(--sun); --_fg: var(--ink); --_bd: var(--ink); }
.btn--dark { --_bg: var(--ink); --_fg: #fff; --_bd: var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translate(-1px, -2px); }
  .btn:active { transform: translate(2px, 2px); }
  .btn--primary:hover { --_bg: #ffd65f; --_bd: var(--ink); }
  .btn--dark:hover { --_bg: #243a66; }
}

/* Cabecera en forma de pastilla */
.site-header { height: auto; padding-top: 12px; pointer-events: none; }
.site-header::before { display: none; }
.site-header__row { pointer-events: auto; height: 60px; padding: 0 8px 0 18px; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius-pill); box-shadow: 3px 3px 0 var(--ink); }
.logo { font-weight: 800; }
.nav li a { font-weight: 700; color: var(--ink); }
.nav li a::after { height: 4px; border-radius: 4px; background: var(--sun); bottom: 9px; }
.nav-toggle { margin-right: 0; }
.nav-toggle span { background: var(--ink); height: 3px; border-radius: 3px; }

/* Etiquetas tipo sticker */
.hero .eyebrow, .page-head .eyebrow { display: inline-block; padding: 7px 16px; background: var(--sun); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--radius-pill); box-shadow: 2px 2px 0 var(--ink); rotate: -2deg; letter-spacing: .04em; text-transform: none; font-size: .9375rem; font-weight: 800; }
.demo-tag { background: var(--sky); border: 2px solid var(--ink); color: var(--ink); rotate: 1.5deg; }
.demo-tag::before { background: var(--coral); }

/* Hero: el diagrama sobre una mancha de color */
.mini { position: relative; isolation: isolate; }
.mini::before { content: ""; position: absolute; inset: 4% 8%; z-index: -1; background: var(--sky); border: 2px solid var(--ink); border-radius: 46% 54% 52% 48% / 56% 44% 56% 44%; rotate: -3deg; }
.mt__card { border: 2px solid var(--ink); border-radius: 20px; box-shadow: 4px 4px 0 var(--ink); }
.mt li::before, .mt li::after { border-color: var(--ink); }
.mt ul::before { border-color: var(--ink); }
.mt li:last-child::before { border-right-color: var(--ink); }
.mt li:first-child::after { border-left-color: var(--ink); }
.mt__row .avatar { border: 2px solid var(--ink); }
@media (hover: hover) and (pointer: fine) { button.mt__row:hover { background: color-mix(in srgb, var(--sun) 40%, var(--paper)); } }

/* Tarjetas */
.avatar { border: 2px solid var(--ink); font-weight: 800; }
.unit, .pcard { border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); border-radius: 24px; }
.person + .person { border-top: 2px solid var(--ink); }
.mt__row + .mt__row { border-top: 2px solid var(--ink); }
@media (hover: hover) and (pointer: fine) { button.person:hover { background: color-mix(in srgb, var(--sun) 40%, var(--paper)); } }
.person[data-local], .mt__row[data-local] { background: color-mix(in srgb, var(--sun) 30%, var(--paper)); }
.pcard::after { display: none; }
@media (hover: hover) and (pointer: fine) { .pcard:hover { transform: translate(-2px, -4px) rotate(-.6deg); } }
.pcard__role { font-weight: 800; }
.branch-btn { border: 2px solid var(--ink); background: var(--paper); box-shadow: 2px 2px 0 var(--ink); }
.pill { border: 2px solid var(--ink); background: var(--paper); box-shadow: 2px 2px 0 var(--ink); font-weight: 800; }
.pill:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.pill--sun { background: var(--sun); }
.pill--danger { color: var(--danger); }
.tabs { border-bottom: 2px solid var(--ink); }
.tab { font-weight: 800; color: var(--muted); }
.tabs__ind { height: 5px; border-radius: 5px; background: var(--em); }
.search input { border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); background: var(--paper); }
.search input:focus-visible { border-color: var(--ink); box-shadow: 3px 3px 0 var(--sun); }
.canvas { border-block-color: var(--ink); }
.empty { border: 2px dashed var(--ink); background: var(--paper); border-radius: 24px; }

/* Entradas grandes: una más baja que la otra, como pegadas al azar */
.xcard { border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); border-radius: 32px; }
.xcard--tree { background: var(--ink); color: var(--dark-ink); }
.xcard--people { background: var(--sun); color: var(--ink); }
.xcard--tree h2 em { color: var(--sun); background-image: var(--squiggle-coral); }
.xcard--people h2 em { color: var(--ink); background-image: var(--squiggle-coral); }
.xcard--people .xcard__go svg { color: var(--sun); }
.xcard__go { border: 2px solid currentColor; }
@media (min-width: 900px) { .xcard--people { margin-top: 36px; rotate: .8deg; } .xcard--tree { rotate: -.6deg; } }

/* Secciones oscuras con borde de arriba redondeado */
.section--dark { background: var(--ink); border-radius: 48px 48px 0 0; }
.c-card { border: 2px solid rgba(255, 247, 234, .5); border-radius: 20px; background: rgba(255, 255, 255, .06); }
.c-card__ico { background: var(--sun); color: var(--ink); border-radius: 14px; }
.c-card__ico svg { color: var(--ink); }
.contact__cta { margin-top: 28px; }
.contact .btn--primary { box-shadow: 4px 4px 0 var(--coral); border-color: var(--sun); }

.fab { background: var(--sun); color: var(--ink); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font-weight: 800; }
.footer { border-top: 2px solid var(--ink); }
.toast { border: 2px solid var(--sun); }

/* Ficha y formularios */
.ficha__panel { border: 2px solid var(--ink); background: var(--paper); }
@media (min-width: 700px) { .ficha__panel { border-radius: 32px; box-shadow: 8px 8px 0 var(--ink); } }
.ficha__close { background: var(--sun); border: 2px solid var(--ink); }
.chip { border: 2px solid var(--ink); background: var(--paper); font-weight: 800; }
@media (hover: hover) and (pointer: fine) { .chip:hover { background: color-mix(in srgb, var(--sun) 40%, var(--paper)); } }
.ficha__facts dd { font-weight: 700; }
.ficha__acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; padding-top: 20px; border-top: 2px dashed var(--line); }

.alta h2 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); padding-right: 52px; }
.alta__sub { margin-top: 8px; color: var(--muted); }
.alta form { display: grid; gap: 16px; margin-top: 20px; }
.field { display: grid; gap: 6px; }
.field label, .choice legend { font-size: .9375rem; font-weight: 800; }
.field input, .field select { width: 100%; min-height: 52px; padding: 12px 16px; background: var(--paper); border: 2px solid var(--ink); border-radius: 16px; }
.field input:focus-visible, .field select:focus-visible { outline: 3px solid var(--sun); outline-offset: 1px; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field__err { min-height: 1.1em; font-size: .875rem; font-weight: 700; color: var(--danger); }
.foto-field__label { font-size: .9375rem; font-weight: 800; }
.foto-field__row { display: flex; align-items: center; gap: 16px; }
.foto-field__btns { display: flex; flex-wrap: wrap; gap: 8px; }
#alta-foto-prev { width: 72px; height: 72px; font-size: 1.4rem; }
.field__hint { font-size: .8125rem; color: var(--muted); }
.field-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 540px) { .field-row { grid-template-columns: 1fr; } }
.choice { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice legend { padding: 0; margin-bottom: 8px; }
.choice__row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-r { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px 0 14px; cursor: pointer; border: 2px solid var(--ink); border-radius: var(--radius-pill); background: var(--paper); font-weight: 800; font-size: .9375rem; transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.chip-r input { appearance: none; -webkit-appearance: none; flex: none; display: grid; place-content: center; width: 20px; height: 20px; margin: 0; border: 2px solid var(--ink); border-radius: 50%; background: transparent; cursor: pointer; }
.chip-r input::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0; }
.chip-r input:checked::before { opacity: 1; }
.chip-r:has(input:checked) { background: var(--sun); }
.chip-r input:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.chip-r:active { transform: scale(.97); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }
.form__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.form__actions .btn { flex: 1 1 180px; }

/* Acciones sobre el árbol */
.tree-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; margin-bottom: 28px; }
.banner { position: fixed; z-index: 45; left: 16px; bottom: 16px; width: min(560px, 100% - 96px); padding: 14px 18px; background: var(--sky); border: 2px solid var(--ink); border-radius: 22px; box-shadow: 4px 4px 0 var(--ink); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; font-size: .9375rem; }
.banner p { flex: 1 1 220px; }
.banner__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.alta__previo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 16px; background: var(--sky); border: 2px solid var(--ink); border-radius: 18px; }
.tree-empty { margin: 8px auto 40px; padding: 36px 24px; max-width: 640px; text-align: center; background: var(--paper); border: 2px dashed var(--ink); border-radius: 28px; }
.tree-empty strong { display: block; font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; }
.tree-empty p { color: var(--muted); }
.tree-empty .btn { margin-top: 18px; }
.mini__empty { padding: 24px; text-align: center; color: var(--muted); font-weight: 700; }

/* 9) MENOS MOVIMIENTO: más suave, no cero (se conservan fundidos, se quita el desplazamiento) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .js [data-rise], .js .mt__card, .js .canvas.is-shown .unit, .js .canvas.is-shown .join { animation-name: fade; animation-duration: 300ms; animation-delay: 0s; }
  .js .reveal { transform: none; transition: opacity 300ms linear; transition-delay: 0s; }
  .ficha__panel, dialog.ficha:not([open]) .ficha__panel { transform: none; }
  .branch { transition-duration: .01ms; }
  .fab { transform: none; }
}
