/* ==========================================================================
   Tarjeta de presentación — estilos base
   Paleta: grafito profundo, texto perla y un solo acento jade (celadón).
   El jade viene de la fruta sin madurar de las fotos del huerto y, en China,
   es un color asociado con la integridad; se usa con moderación.
   ========================================================================== */

:root {
  /* Color */
  --ink-0: #07090b;          /* fondo más profundo */
  --ink-1: #090c0e;          /* fondo de página */
  --ink-2: #0f1417;          /* superficies elevadas */
  --ink-3: #161d21;
  --line: rgba(214, 228, 222, 0.14);
  --line-strong: rgba(214, 228, 222, 0.26);
  --text: #f4f7f5;           /* blanco perla · 18.2:1 sobre --ink-1 */
  --text-2: #eaefec;         /* casi blanco  · 16.9:1 sobre --ink-1 */
  --text-3: #d6ddd9;         /* claro        · 14.2:1 sobre --ink-1 */
  --accent: #9fc7b6;         /* jade         · 10.6:1 sobre --ink-1 */
  --accent-2: #c5e1d4;
  --on-light: #0b1210;       /* texto sobre botón perla */
  --focus: #d4ecdf;
  --danger: #f2b8a8;

  /* Tipografía */
  --serif: "Source Serif 4", "Noto Serif SC", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --zh: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --zh-sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;

  --fs-display: clamp(3rem, 7.6vw + 1rem, 6rem);
  --fs-h2: clamp(2rem, 3.4vw + 1.1rem, 3.25rem);
  --fs-value: clamp(1.1875rem, 0.9vw + 1rem, 1.5rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.875rem;
  --fs-micro: 0.75rem;

  /* Espaciado (base 4) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;
  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 1180px;

  /* Radios */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 22px;
  --r-photo: 4px;

  /* Movimiento */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --topbar-h: 64px;
  --veil: 0.58;

  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────────── */

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

html {
  background: var(--ink-1);
  color: var(--text);
  font-family: var(--sans);
  font-size: 100%;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + env(safe-area-inset-top));
  -webkit-tap-highlight-color: transparent;
}

html:focus-within { scroll-behavior: smooth; }

/* Color, fuente e interlineado explícitos en body: así ningún estilo base
   externo (p. ej. el visor de vista previa) cambia el texto heredado. */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ink-1);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  font-size: var(--fs-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

html.is-locked, html.is-locked body { overflow: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; }
a { color: inherit; }
p, h1, h2, h3, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
[hidden] { display: none !important; }

:lang(zh-Hans), :lang(zh) { font-family: var(--zh-sans); }

::selection { background: rgba(159, 199, 182, 0.35); color: var(--text); }

/* Foco visible: anillo claro con separación, en todo lo interactivo. */
:where(a, button, [tabindex]):focus { outline: none; }
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed; top: 10px; left: 10px; z-index: 200;
  padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--text); color: var(--on-light);
  font-weight: 600; text-decoration: none;
  transform: translateY(-160%);
  transition: transform .2s var(--ease-out);
}
.skip:focus-visible { transform: none; }

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Mientras app.js pinta los datos, el contenido espera (máx. 2.5 s). */
html.js:not(.is-ready) .app,
html.js:not(.is-ready) .topbar,
html.js:not(.is-ready) .site-footer {
  opacity: 0;
  animation: failsafe-show 0s linear 2.5s forwards;
}
@keyframes failsafe-show { to { opacity: 1; } }

/* ── Fondo: estático (siempre) + canvas Liquid Metal (si está activo) ── */

.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.bg__static {
  position: absolute; inset: 0;
  background:
    radial-gradient(70% 48% at 88% 6%, rgba(159, 199, 182, 0.15), transparent 70%),
    radial-gradient(60% 44% at 4% 42%, rgba(134, 156, 204, 0.09), transparent 70%),
    radial-gradient(80% 50% at 62% 104%, rgba(214, 226, 221, 0.06), transparent 70%),
    linear-gradient(180deg, #0b1013 0%, #090c0e 46%, #07090b 100%);
}
/* Dos reflejos metálicos quietos: sugieren el líquido sin moverse. */
.bg__static::before,
.bg__static::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
}
.bg__static::before {
  width: 62vmax; height: 36vmax; right: -18vmax; top: -12vmax;
  background: radial-gradient(closest-side, rgba(215, 226, 221, 0.20), rgba(96, 116, 118, 0.10) 55%, transparent);
  transform: rotate(-18deg);
}
.bg__static::after {
  width: 50vmax; height: 30vmax; left: -20vmax; top: 48vh;
  background: radial-gradient(closest-side, rgba(159, 199, 182, 0.16), rgba(60, 78, 82, 0.08) 60%, transparent);
  transform: rotate(14deg);
}

.bg__fx {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 1.4s var(--ease-out);
}
.bg__veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 30%, rgba(7, 9, 11, 0.55) 100%),
    rgba(9, 12, 14, var(--veil));
  opacity: 0;
  transition: opacity 1.4s var(--ease-out);
}
html.fx-liquid-on .bg__fx,
html.fx-liquid-on .bg__veil { opacity: 1; }

.bg__grain {
  position: absolute; inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.045;
}

.app, .topbar, .site-footer { position: relative; z-index: 1; }

/* ── Barra superior ───────────────────────────────────────────────────── */

.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
  transition: background-color .35s var(--ease-out), border-color .35s var(--ease-out), backdrop-filter .35s;
  border-bottom: 1px solid transparent;
}
.topbar.is-scrolled {
  background: rgba(9, 12, 14, 0.84);
  -webkit-backdrop-filter: blur(14px) saturate(1.1) brightness(0.8);
  backdrop-filter: blur(14px) saturate(1.1) brightness(0.8);
  border-bottom-color: var(--line);
}
.topbar__inner {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
}

.lang {
  display: inline-flex; align-items: center;
  padding: 3px; gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lang__btn {
  min-width: 44px; height: 34px; padding: 0 10px;
  border: 0; border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em;
  cursor: pointer;
  transition: color .2s, background-color .2s;
}
.lang__btn:hover { color: var(--text); }
.lang__btn[aria-pressed="true"] { background: rgba(237, 241, 238, 0.12); color: var(--text); }

.menu-toggle {
  display: inline-flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 16px 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 12, 14, 0.35);
  color: var(--text);
  font-size: 0.875rem; font-weight: 500; letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.menu-toggle:hover { border-color: var(--line-strong); background: rgba(237, 241, 238, 0.06); }
.menu-toggle__icon { display: grid; gap: 5px; width: 18px; }
.menu-toggle__icon i { display: block; height: 1.5px; background: currentColor; border-radius: 2px; transition: transform .3s var(--ease-out); }
.menu-toggle__icon i:last-child { width: 12px; justify-self: end; }
.menu-toggle:hover .menu-toggle__icon i:last-child { transform: scaleX(1.5); transform-origin: right; }

/* ── Hero / Perfil (tipográfico; el Liquid Metal es la imagen) ─────────── */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-top: calc(var(--topbar-h) + env(safe-area-inset-top) + var(--s-7));
  padding-bottom: clamp(40px, 7vw, 96px);
}
.hero > .wrap { width: 100%; }
.hero__inner { max-width: 60rem; }

.name {
  font-family: var(--serif);
  font-size: clamp(3.1rem, 13.2vw, 8rem);
  line-height: 0.96;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.name__given { display: block; }
.name__family { display: block; font-style: italic; font-weight: 400; letter-spacing: -0.012em; color: var(--text); }

.name-zh {
  margin-top: var(--s-3);
  font-family: var(--zh);
  font-weight: 500;
  font-size: clamp(1.25rem, 2.2vw + 0.8rem, 1.75rem);
  letter-spacing: 0.32em;
  color: var(--text-2);
}

.hero__aside {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px;
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-strong);
  max-width: 34rem;
}
.hero__aside > * { margin: 0; }
.role { font-size: 1rem; font-weight: 600; color: var(--text); }
.org  { font-size: 1rem; color: var(--text-2); }
.loc  { font-size: 0.9375rem; color: var(--text-3); }

.bio {
  margin-top: var(--s-5);
  max-width: 34em;
  font-size: var(--fs-body);
  line-height: 1.62;
  color: var(--text-2);
  text-wrap: pretty;
}
.hero__actions { margin-top: var(--s-6); max-width: 34rem; }

/* ── Botones ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 56px; padding: 0 28px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 1rem; font-weight: 600; letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .15s var(--ease-out), box-shadow .3s;
}
.btn--primary {
  width: 100%;
  background: var(--text);
  color: var(--on-light);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 18px 40px -18px rgba(159, 199, 182, 0.45);
}
.btn--primary:hover { background: #ffffff; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 22px 48px -18px rgba(159, 199, 182, 0.6); }
.btn--primary:active { transform: translateY(1px) scale(0.995); }
.btn--primary .icon { width: 22px; height: 22px; stroke-width: 1.8; }
.btn[aria-busy="true"] { opacity: .75; pointer-events: none; }

.hint {
  margin-top: var(--s-3);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-3);
}
.hint :lang(zh-Hans) { display: block; margin-top: 4px; }
.hint--notice {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--text-2);
  background: rgba(15, 20, 23, 0.6);
}

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-small); font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
.chip:hover { background: rgba(237, 241, 238, 0.07); border-color: rgba(214, 228, 222, 0.4); }
.chip .icon { width: 16px; height: 16px; }
.chip.is-done { color: var(--accent); border-color: rgba(159, 199, 182, 0.5); }

/* ── Secciones ───────────────────────────────────────────────────────── */

.section-head { display: flex; align-items: center; gap: var(--s-5); }
.section-head::after { content: ""; flex: 1; height: 1px; background: var(--line); transform: translateY(0.2em); }
.section-title {
  font-family: var(--serif);
  font-size: var(--fs-h2);
  line-height: 1.05;
  font-weight: 400;
  letter-spacing: -0.012em;
}
.section-title:focus { outline: none; }
.section-lead {
  margin-top: var(--s-4);
  max-width: 36em;
  color: var(--text-2);
  line-height: 1.55;
}

/* ── Contacto ─────────────────────────────────────────────────────────── */

.contact { padding-block: clamp(64px, 10vw, 128px) clamp(48px, 8vw, 96px); }

.contact__grid {
  display: grid;
  gap: var(--s-7);
  margin-top: var(--s-6);
}

.ledger { border-top: 1px solid var(--line); }
.ledger__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px var(--s-4);
  min-height: 84px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background-color .25s;
}
.ledger__label { grid-column: 1; font-size: 0.8125rem; color: var(--text-3); letter-spacing: 0.01em; }
.ledger__value {
  grid-column: 1;
  font-family: var(--serif);
  font-size: var(--fs-value);
  line-height: 1.25;
  font-weight: 450;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.ledger__go {
  grid-column: 2; grid-row: 1 / span 2;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-2);
  transition: transform .35s var(--ease-out), border-color .25s, color .25s, background-color .25s;
}
.ledger__go .icon { width: 18px; height: 18px; }
a.ledger__row:hover { background: linear-gradient(90deg, rgba(237, 241, 238, 0.04), transparent); }
a.ledger__row:hover .ledger__go { transform: translateX(3px); border-color: var(--accent); color: var(--accent); }

/* WeChat */
.wechat {
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(170deg, rgba(22, 29, 33, 0.72), rgba(9, 12, 14, 0.55));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.wechat__title {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--serif); font-weight: 400;
  font-size: 1.75rem; line-height: 1.1;
}
.wechat__title [lang] { font-family: var(--zh); font-size: 1.25rem; color: var(--text-2); letter-spacing: 0.12em; }
.wechat__body { display: grid; gap: var(--s-5); margin-top: var(--s-5); }
.wechat__qr {
  width: min(100%, 232px);
  aspect-ratio: 1;
  padding: 14px;
  border-radius: 14px;
  background: #f5f7f5;
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.9);
}
.wechat__qr img { width: 100%; height: 100%; object-fit: contain; image-rendering: crisp-edges; }
.wechat__qr.is-missing {
  display: grid; place-items: center; align-content: center; gap: 10px;
  background: transparent;
  border: 1px dashed var(--line-strong);
  box-shadow: none;
  color: var(--text-3);
  font-size: 0.8125rem;
  text-align: center;
}
.wechat__qr.is-missing .icon { width: 40px; height: 40px; stroke-width: 1.2; }
.wechat__scan { color: var(--text-2); line-height: 1.5; }
.wechat__id {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}
.wechat__id-label { font-size: 0.8125rem; color: var(--text-3); }
.wechat__id-value { font-family: var(--serif); font-size: 1.25rem; font-variant-numeric: tabular-nums; margin-right: auto; overflow-wrap: anywhere; }
.wechat__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.wechat__hint { font-size: 0.8125rem; line-height: 1.5; color: var(--text-3); }

.contact__save { margin-top: var(--s-7); }

/* ── Pie ─────────────────────────────────────────────────────────────── */

.site-footer { padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom)); }
.site-footer__inner {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 24px;
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--text-3);
}
.site-footer__name { font-family: var(--serif); font-size: 1.0625rem; color: var(--text-2); }
.site-footer__top { color: var(--text-2); text-decoration: none; }
.site-footer__top:hover { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }

/* ── Aviso flotante ──────────────────────────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 120;
  transform: translate(-50%, 16px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--text); color: var(--on-light);
  font-size: var(--fs-small); font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .35s var(--ease-out);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── Entrada (solo con movimiento permitido) ─────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  html.is-ready [data-reveal] {
    animation: rise 1s var(--ease-out) both;
    animation-delay: calc(var(--d, 0) * 90ms + 80ms);
  }
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ── Escritorio ───────────────────────────────────────────────────────── */

@media (min-width: 720px) {
  .contact__grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .contact__grid:has(> .wechat[hidden]) { grid-template-columns: minmax(0, 44rem); }
  .btn--primary { width: auto; min-width: 280px; }
}

@media (min-width: 960px) {
  :root { --topbar-h: 76px; }

  .hero { align-items: center; }
  .hero__inner { padding-top: 4vh; }
  .role, .org { font-size: 1.0625rem; }
  .wechat { padding: var(--s-6); }
  .wechat__body { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .wechat__qr { width: 200px; }
}
