/* =========================================================
   Tarjeta digital ADALTRA · v2
   Un solo archivo, sin prefijos antiguos, con variables de marca.
   ========================================================= */

:root {
  --morado: #463a86;          /* color corporativo ADALTRA */
  --morado-oscuro: #3a2f70;
  --azul-cta: #2f1bec;        /* botones principales */
  --rosa: #e017c1;            /* anillo del avatar (inicio) */
  --violeta: #a532c8;         /* anillo del avatar (fin) */
  --fondo: #f9fafb;
  --gris-tarjeta: #e5e7eb;
  --texto: #1f1f2e;
  --linkedin: #0077b5;
  --youtube: #ff0000;
  --radio: 1rem;
  --suave: cubic-bezier(.22, .61, .36, 1);   /* curva "soft" para todas las animaciones */
}

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

html { background: var(--morado); -webkit-text-size-adjust: 100%; }

body {
  margin: 0 auto;
  max-width: 30rem;
  min-height: 100vh;
  font-family: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--texto);
  background: var(--morado);
  -webkit-font-smoothing: antialiased;
}

body.sin-scroll { overflow: hidden; }

a { text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; height: auto; user-select: none; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Cabecera con el logo animado ---------- */

.cabecera {
  position: relative;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  background: var(--morado);
}

.cabecera__acciones {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: .5rem;
}

.icono-btn {
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background .3s var(--suave), transform .3s var(--suave);
}
.icono-btn svg { width: 1.5rem; height: 1.5rem; }
.icono-btn:hover { background: rgba(255, 255, 255, .18); }
.icono-btn:active { transform: scale(.94); }

/* ---------- Selector de idioma ---------- */

.idioma {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 5;
}

.idioma__btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  height: 3rem;
  padding: 0 .85rem 0 .75rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: .9rem;
  font-weight: 500;
  line-height: 1;
  transition: background .3s var(--suave), transform .3s var(--suave);
}
.idioma__btn:hover { background: rgba(255, 255, 255, .18); }
.idioma__btn:active { transform: scale(.96); }
.idioma__btn--abierto { background: rgba(255, 255, 255, .18); }

.idioma__globo { width: 1.35rem; height: 1.35rem; flex: none; }
.idioma__codigo { letter-spacing: .03em; }
.idioma__flecha {
  width: 1rem;
  height: 1rem;
  flex: none;
  opacity: .8;
  transition: transform .3s var(--suave);
}
.idioma__btn--abierto .idioma__flecha { transform: rotate(180deg); }

.idioma__lista {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  min-width: 10rem;
  padding: .35rem;
  border-radius: .9rem;
  background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
  display: grid;
  gap: .15rem;
  animation: aparecer .25s var(--suave) both;
}

.idioma__opcion {
  width: 100%;
  padding: .7rem .85rem;
  border: 0;
  border-radius: .6rem;
  background: transparent;
  color: var(--morado);
  font-size: .95rem;
  text-align: left;
  transition: background .2s var(--suave);
}
.idioma__opcion:hover,
.idioma__opcion:focus-visible { background: rgba(70, 58, 134, .09); }
.idioma__opcion[aria-checked="true"] { font-weight: 600; background: rgba(70, 58, 134, .12); }

.logo {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .9rem;
  pointer-events: none;
}
.logo__marca { width: 62%; }
.logo__claim { width: 100%; }

/* ---------- Cuerpo de la tarjeta ---------- */

.tarjeta {
  background: var(--fondo);
  padding: 0 1rem 2.5rem;
  border-radius: 1.5rem 1.5rem 0 0;
}

.perfil {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.perfil__marco {
  position: relative;
  width: 120px;
  height: 120px;
  margin-top: -60px;   /* la foto "pisa" la cabecera morada */
}

.perfil__anillo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}
.perfil__anillo circle {
  fill: none;
  stroke: url(#anilloGrad);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 364.5;   /* 2·π·58 */
  stroke-dashoffset: 364.5;
}

.perfil__foto {
  position: absolute;
  inset: 7px;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}

.perfil__nombre {
  margin: 1rem 0 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--morado);
  line-height: 1.25;
}
.perfil__cargo {
  margin: .3rem 0 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--morado);
}

/* Tres accesos rápidos: teléfono, WhatsApp, email */

.acciones {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: 1.75rem;
}
.accion {
  flex: 1 1 0;
  max-width: 8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  color: var(--morado);
}
.accion__icono {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--morado);
  color: #fff;
  display: grid;
  place-items: center;
  transition: transform .3s var(--suave), box-shadow .3s var(--suave), background .3s var(--suave);
}
.accion__icono svg { width: 1.5rem; height: 1.5rem; }
.accion:hover .accion__icono { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(70, 58, 134, .22); }
.accion:active .accion__icono { transform: scale(.94); }

/* Botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 3rem;
  padding: .8rem 1.5rem;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: transform .3s var(--suave), box-shadow .3s var(--suave), filter .3s var(--suave);
}
.btn svg { width: 1.35rem; height: 1.35rem; flex: none; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn--cta { background: var(--azul-cta); box-shadow: 0 12px 24px rgba(47, 27, 236, .18); }
.btn--morado { background: var(--morado); box-shadow: 0 10px 20px rgba(70, 58, 134, .15); }

.redondo {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  flex: none;
  transition: transform .3s var(--suave), box-shadow .3s var(--suave);
}
.redondo svg { width: 1.3rem; height: 1.3rem; }
.redondo:hover { transform: translateY(-1px); }
.redondo:active { transform: scale(.94); }
.redondo--grande { width: 3.1rem; height: 3.1rem; }
.redondo--linkedin { background: var(--linkedin); box-shadow: 0 8px 18px rgba(0, 119, 181, .2); }
.redondo--youtube { background: var(--youtube); box-shadow: 0 8px 18px rgba(255, 0, 0, .18); }

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  margin-top: 1.5rem;
}

/* Secciones de marcas y catálogo */

.seccion {
  margin: 2rem 0 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--morado);
}

.marca {
  margin-top: 1rem;
  overflow: hidden;
  border-radius: var(--radio);
  background: var(--gris-tarjeta);
  box-shadow: 0 10px 30px rgba(70, 58, 134, .06);
}
.marca > img { width: 100%; }
.marca__cuerpo { padding: 1.75rem 1rem 1.5rem; text-align: center; }
.marca__titulo { margin: 0 0 .75rem; font-size: 1.125rem; font-weight: 700; }
.marca__texto { margin: 0; font-size: .875rem; line-height: 1.55; padding: 0 .35rem; }
.marca__meta { margin: 0; font-size: .875rem; }
.marca__acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-top: 1.25rem;
}

/* ---------- Ventana QR / compartir ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity .3s var(--suave);
}
.modal--abierto { opacity: 1; }

.modal__fondo {
  position: absolute;
  inset: 0;
  background: rgba(58, 47, 112, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 22rem;
  padding: 2.5rem 1.5rem 1.75rem;
  border-radius: 1.5rem;
  background: #fff;
  color: var(--morado);
  text-align: center;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .25);
  transform: translateY(12px) scale(.98);
  transition: transform .35s var(--suave);
}
.modal--abierto .modal__panel { transform: none; }

.modal__cerrar {
  position: absolute;
  top: .6rem;
  right: .6rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--morado);
  display: grid;
  place-items: center;
  transition: background .3s var(--suave);
}
.modal__cerrar svg { width: 1.4rem; height: 1.4rem; }
.modal__cerrar:hover { background: rgba(70, 58, 134, .08); }

.modal__titulo { margin: 0 0 .4rem; font-size: 1.15rem; font-weight: 700; }
.modal__texto { margin: 0 0 1.25rem; font-size: .95rem; line-height: 1.5; }

/* El QR se dibuja sobre blanco puro con margen de silencio (quiet zone) alrededor,
   y nada se superpone a él porque el modal es fixed y está al final del DOM. */
.qr {
  width: min(260px, 70vw);
  aspect-ratio: 1 / 1;
  margin: 0 auto 1.25rem;
  padding: .75rem;
  background: #fff;
  border-radius: .5rem;
  box-shadow: 0 0 0 1px var(--gris-tarjeta);
}
.qr svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }

/* ---------- Animaciones de entrada (suaves) ---------- */

@keyframes aparecer {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes barrer {              /* el claim se revela desde el centro hacia los lados */
  from { opacity: 0; clip-path: inset(0 50% 0 50%); }
  to   { opacity: 1; clip-path: inset(0 0 0 0); }
}
@keyframes trazar { to { stroke-dashoffset: 0; } }

.logo__marca { animation: aparecer 1.1s var(--suave) .1s both; }
.logo__claim { animation: barrer 1.3s var(--suave) .6s both; }

.perfil__marco { animation: aparecer .9s var(--suave) .25s both; }
.perfil__anillo circle { animation: trazar 1.8s var(--suave) .5s forwards; }

.tarjeta > * { animation: aparecer .8s var(--suave) both; }
.tarjeta > :nth-child(1) { animation: none; }         /* el perfil ya anima por su cuenta */
.tarjeta > :nth-child(2) { animation-delay: .55s; }
.tarjeta > :nth-child(3) { animation-delay: .7s; }
.tarjeta > :nth-child(4) { animation-delay: .85s; }
.tarjeta > :nth-child(5) { animation-delay: .95s; }
.tarjeta > :nth-child(6) { animation-delay: 1.05s; }
.tarjeta > :nth-child(7) { animation-delay: 1.15s; }
.tarjeta > :nth-child(8) { animation-delay: 1.25s; }
.perfil__nombre { animation: aparecer .8s var(--suave) .55s both; }
.perfil__cargo  { animation: aparecer .8s var(--suave) .65s both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .perfil__anillo circle { stroke-dashoffset: 0; }
  .logo__claim { clip-path: none; }
}
