/* ==========================================================================
   PROFILE CARD — Portfolio Nadir Jara (nadirjara.tech)
   Tilt 3D + brillo holográfico, adaptado al Design System:
   Mist Gray / Dark Truffle / Carmine Signature / Velvet Wine.
   Sin #fff ni #000. Solo transform y opacity animados.
   Requiere css/tokens.css cargado antes.
   ========================================================================== */

.pc-card-wrapper {
  --pointer-x: 50%;
  --pointer-y: 50%;
  --pointer-from-center: 0;
  --pointer-from-top: 0.5;
  --pointer-from-left: 0.5;
  --rx: 0deg;
  --ry: 0deg;
  --glow: 0;

  position: relative;
  width: 100%;
  max-width: 360px;
  margin-inline: auto;
  perspective: 900px;
  touch-action: pan-y; /* permite scroll vertical en móvil */
}

/* Halo Carmine detrás de la tarjeta, sigue al puntero */
.pc-card-wrapper::before {
  content: "";
  position: absolute;
  inset: 6% 4%;
  z-index: 0;
  background: radial-gradient(
    circle at var(--pointer-x) var(--pointer-y),
    rgba(127, 15, 29, 0.65) 0%,
    rgba(82, 14, 13, 0.35) 45%,
    transparent 72%
  );
  filter: blur(42px);
  opacity: calc(0.2 + var(--glow) * 0.3);
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.pc-card {
  position: relative;
  z-index: 1;
  aspect-ratio: 0.718;
  max-height: 540px;
  margin-inline: auto;
  border-radius: 30px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(160deg, var(--color-text) 0%, var(--color-accent-deep) 100%);
  border: 1px solid rgba(243, 243, 245, 0.2);
  box-shadow:
    calc((var(--pointer-from-left) * 16px) - 8px)
    calc((var(--pointer-from-top) * 24px) - 4px)
    40px -8px rgba(24, 24, 27, 0.40);
  transform: rotateX(var(--ry)) rotateY(var(--rx));
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.pc-card.is-active {
  transition: transform 0.08s linear;
}

/* ---------- Foto ---------- */
.pc-photo {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.pc-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: calc(1 - var(--pointer-from-center) * 0.12);
  filter: saturate(0.9) contrast(1.05);
}

/* Degradado para legibilidad de la barra inferior */
.pc-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(24, 24, 27, 0.85) 0%, rgba(24, 24, 27, 0) 38%);
}

/* ---------- Brillo holográfico cálido ---------- */
.pc-shine {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: calc(0.1 + var(--glow) * 0.25);
  transition: opacity 0.4s ease;
  background:
    radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
      rgba(243, 243, 245, 0.6) 0%, rgba(243, 243, 245, 0.1) 35%, transparent 65%),
    conic-gradient(from 140deg at var(--pointer-x) var(--pointer-y),
      rgba(127, 15, 29, 0.3), rgba(243, 243, 245, 0.3),
      rgba(82, 14, 13, 0.3), rgba(243, 243, 245, 0.3), rgba(127, 15, 29, 0.3));
}

/* ---------- Barra inferior (glass cálido) ---------- */
.pc-user-info {
  position: absolute;
  left: var(--space-2);
  right: var(--space-2);
  bottom: var(--space-2);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 10px 12px;
  background: var(--pc-bar-bg, rgba(243, 243, 245, 0.12));
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--pc-bar-border, rgba(243, 243, 245, 0.2));
  border-radius: var(--radius-md);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.pc-user-details {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pc-mini-avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(243, 243, 245, 0.2);
  border: 1px solid rgba(243, 243, 245, 0.35);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.pc-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.pc-user-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pc-handle {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--text-caption);
  line-height: 1;
  color: var(--color-bg);
  transition: color 0.3s ease;
}

.pc-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  line-height: 1;
  color: var(--color-bg);
  opacity: 0.8;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.pc-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-bg);
  animation: pc-pulse 2s ease-in-out infinite;
  transition: background-color 0.3s ease;
}

.pc-contact-btn {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--text-caption);
  color: var(--color-text);
  background: var(--color-bg);
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.pc-contact-btn:hover {
  background: var(--color-accent);
  color: var(--color-bg);
  transform: translateY(-1px);
}

.pc-contact-btn:focus-visible {
  outline: 2px solid var(--color-bg);
  outline-offset: 2px;
}

@keyframes pc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---------- Adaptaciones Modo Oscuro ---------- */
html[data-theme="dark"] .pc-user-info {
  background: var(--pc-bar-bg);
  border-color: var(--pc-bar-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .pc-mini-avatar {
  background: var(--color-surface);
  border-color: var(--pc-bar-border);
}

html[data-theme="dark"] .pc-handle {
  color: var(--color-text);
}

html[data-theme="dark"] .pc-status {
  color: var(--color-text);
  opacity: 0.9;
}

html[data-theme="dark"] .pc-status::before {
  background: var(--color-text);
}

html[data-theme="dark"] .pc-contact-btn {
  background: var(--color-carmine);
  color: var(--color-text);
}

html[data-theme="dark"] .pc-contact-btn:hover {
  background: var(--color-velvet);
  color: var(--color-text);
}

html[data-theme="dark"] .pc-contact-btn:focus-visible {
  outline: 2px solid var(--color-carmine);
  outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .pc-card-wrapper { max-width: 300px; }
  .pc-mini-avatar { width: 36px; height: 36px; }
  .pc-contact-btn { padding: 6px 12px; font-size: 0.75rem; }
}

/* ---------- Accesibilidad ---------- */
@media (prefers-reduced-motion: reduce) {
  .pc-card,
  .pc-card.is-active { transition: none; transform: none; }
  .pc-status::before { animation: none; }
}
