/* ===== Colores y medidas (todo se ajusta aquí) ===== */
:root {
  --bg: #ffffff;
  --shell: #050505;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.56);
  --surface: #161616;
  --surface-hover: #222222;

  --green: #27c95f;
  --orange: #ff8a00;
  --blue: #1689fe;
  --violet: #9b5cff;

  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Tamaños (computadora) */
  --pad: 8px;
  --avatar-big: 66px;
  --avatar: 64px;
  --btn-big: 66px;
  --btn: 54px;
  --gap: 8px;
  --social: 48px;
  --card-w: 440px;
  --gutter: 16px;

  /* Resorte suave, con muy poco rebote (~600 ms) */
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --morph-time: 600ms;
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.0219, 0.0778, 0.1551, 0.2442, 0.338, 0.4311, 0.5198, 0.6019, 0.6759, 0.7412, 0.7977, 0.8456, 0.8856, 0.9183, 0.9447, 0.9654, 0.9814, 0.9933, 1.002, 1.008, 1.0119, 1.0141, 1.015, 1.0151, 1.0145, 1.0135, 1.0122, 1.0108, 1.0094, 1.008, 1.0067, 1.0055, 1.0045, 1.0035, 1.0027, 1);
  }
}

/* Celular */
@media (max-width: 440px) {
  :root {
    --pad: 6px;
    --avatar-big: 60px;
    --avatar: 52px;
    --btn-big: 60px;
    --btn: 44px;
    --gap: 6px;
    --social: 44px;
  }
}

/* Celulares muy angostos */
@media (max-width: 360px) {
  :root {
    --avatar: 46px;
    --btn: 40px;
    --gap: 5px;
    --social: 40px;
    --gutter: 12px;
  }
  .pill .identity { padding-right: 2px; }
  .pill .name { font-size: 16px; }
  .pill .eyebrow { font-size: 12px; }
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
}

body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

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

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
}

/* ===== La píldora (el contenedor que cambia de forma) ===== */
.pill {
  position: relative;
  overflow: hidden;
  background: var(--shell);
  color: var(--text);
  border-radius: 999px;
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.10);
  transition:
    width var(--morph-time) var(--spring),
    height var(--morph-time) var(--spring),
    border-radius var(--morph-time) var(--spring);
}

.pill.no-anim { transition: none; }

/* ===== Cada estado es un "panel" encima del otro ===== */
.panel {
  position: absolute;
  top: 0;
  left: 0;
  width: max-content;
  max-width: calc(100vw - 2 * var(--gutter));
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: var(--pad);

  opacity: 0;
  filter: blur(7px);
  transform: scale(0.96);
  visibility: hidden;
  pointer-events: none;
  /* Salida: rápida */
  transition:
    opacity 140ms ease-out,
    filter 140ms ease-out,
    transform 140ms ease-out,
    visibility 0s linear 140ms;
}

.panel.is-active {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
  visibility: visible;
  pointer-events: auto;
  /* Entrada: espera a que el contenedor empiece a cambiar */
  transition:
    opacity 260ms ease-out 110ms,
    filter 260ms ease-out 110ms,
    transform 320ms var(--spring) 110ms,
    visibility 0s linear 0s;
}

.panel--compact { gap: 10px; }

.panel--profile { padding-right: calc(var(--pad) + 2px); }

.panel--card {
  width: min(var(--card-w), calc(100vw - 2 * var(--gutter)));
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 20px 20px 22px;
}

.panel--bio { cursor: pointer; }

.panel--socials { gap: 4px; padding-right: 12px; }

/* ===== Foto ===== */
.avatar {
  flex: 0 0 auto;
  display: block;
  padding: 3px;
  border: 0;
  margin: 0;
  border-radius: 50%;
  background: #fff;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.avatar--compact { width: var(--avatar-big); height: var(--avatar-big); }
.avatar--profile { width: var(--avatar); height: var(--avatar); cursor: pointer; }
.avatar--small { width: 52px; height: 52px; }

/* ===== Nombre ===== */
.identity {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.1;
  padding-right: 6px;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  white-space: nowrap;
}

.name {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Botones redondos ===== */
.actions { display: flex; gap: var(--gap); flex: 0 0 auto; }

.round-btn, .back-btn, .social {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: transform 220ms var(--spring), background-color 160ms ease;
}

.round-btn { width: var(--btn); height: var(--btn); }
.round-btn--big { width: var(--btn-big); height: var(--btn-big); }

.round-btn--green  { background: var(--green); }
.round-btn--orange { background: var(--orange); }
.round-btn--blue   { background: var(--blue); }
.round-btn--violet { background: var(--violet); }

.back-btn {
  width: 40px;
  height: 40px;
  background: var(--surface);
}
.back-btn--dock { width: var(--social); height: var(--social); background: #303030; margin-right: 4px; }

.social {
  width: var(--social);
  height: var(--social);
  background: transparent;
}

svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.round-btn--big svg { width: 28px; height: 28px; }
.back-btn svg { width: 20px; height: 20px; }
.back-btn--dock svg { width: 22px; height: 22px; }

/* Hover solo en computadora (no cambia de estado, solo crece un poco) */
@media (hover: hover) {
  .round-btn:hover, .back-btn:hover { transform: scale(1.06); }
  .social:hover { transform: translateY(-3px) scale(1.08); background: var(--surface-hover); }
  .contact-row[href]:hover { background: var(--surface-hover); }
}
.round-btn:active, .back-btn:active, .social:active, .avatar--profile:active { transform: scale(0.92); }

/* Foco visible para teclado */
:focus { outline: none; }
.round-btn:focus-visible,
.back-btn:focus-visible,
.social:focus-visible,
.avatar--profile:focus-visible {
  box-shadow: 0 0 0 2px var(--shell), 0 0 0 4px #fff;
}
.contact-row:focus-visible { box-shadow: inset 0 0 0 2px #fff; }

/* Pulso suave en el "+" para invitar a hacer clic */
.pulse { position: relative; }
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(39, 201, 95, 0.55);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(39, 201, 95, 0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(39, 201, 95, 0); }
  100% { box-shadow: 0 0 0 0 rgba(39, 201, 95, 0); }
}

/* ===== Tarjetas (bio y contacto) ===== */
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-head .back-btn { align-self: flex-start; }

.bio-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.contact-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background-color 160ms ease;
}

.contact-who {
  grid-column: 1;
  font-size: 15.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-arrow { grid-column: 2; grid-row: 1 / span 2; }
.contact-arrow { width: 18px; height: 18px; color: var(--muted); }

/* ===== Entrada escalonada de redes ===== */
.panel--socials.is-active .social {
  animation: pop 420ms var(--spring) backwards;
  animation-delay: calc(140ms + var(--i) * 35ms);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.7); }
  to   { opacity: 1; transform: none; }
}

/* ===== Menos movimiento si la persona lo pidió en su sistema ===== */
@media (prefers-reduced-motion: reduce) {
  :root { --morph-time: 1ms; }
  .panel, .panel.is-active { filter: none; transform: none; }
  .panel.is-active { transition: opacity 160ms ease-out, visibility 0s; }
  .panel--socials.is-active .social { animation: none; }
  .pulse::after { animation: none; }
}
