/* =============================================================================
 * KINT RH Power · Credencialización y VCards (credencializacion-vcards.html)
 * Se carga después de css/rh-power.css y reutiliza sus tokens (--rhp-*).
 * Componentes propios con prefijo .cv-*
 * ========================================================================== */

/* ---------- Hero ---------- */
.cv-hero {
  padding-block: clamp(1.75rem, 4vw, 3.5rem) clamp(2.5rem, 5vw, 4rem);
  background: var(--rhp-bg);
}
.cv-hero__grid {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
@media (min-width: 1024px) {
  .cv-hero__grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  }
}
.cv-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  font: 500 0.75rem/1 var(--rhp-mono);
  color: var(--rhp-muted);
}
.cv-crumbs a {
  color: inherit;
  text-decoration: none;
}
.cv-crumbs a:hover {
  color: var(--rhp-cyan-600);
}
.cv-crumbs [aria-current] {
  color: var(--rhp-ink);
}
.rhp-hero__title.cv-title {
  font-size: clamp(2.2rem, 4.3vw, 3.5rem);
  max-width: none;
}
.cv-hero__sub {
  margin: 1.25rem 0 0;
  max-width: 36rem;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  line-height: 1.65;
  color: var(--rhp-muted);
}
.cv-hero__sub strong {
  color: var(--rhp-ink);
}
.cv-hero__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
.cv-hero__facts {
  list-style: none;
  margin: 2rem 0 0;
  padding: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  border-top: 1.5px solid var(--rhp-ink);
  font-size: 0.9rem;
  font-weight: 600;
}
.cv-hero__facts span {
  margin-right: 0.45rem;
  font: 600 0.72rem/1 var(--rhp-mono);
  color: var(--rhp-cyan-600);
}

/* ---------- Configurador de credencial ---------- */
.cv-studio {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
}
@media (min-width: 640px) and (max-width: 1023px) {
  .cv-studio {
    grid-template-columns: auto 1fr;
    align-items: center;
  }
}
.cv-studio__stage {
  position: relative;
  display: grid;
  justify-items: center;
  padding-top: 4.5rem;
  perspective: 1200px;
}
.cv-strap {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1.15rem;
  height: 5.25rem;
  background: repeating-linear-gradient(180deg, var(--rhp-cyan) 0 12px, #0094bd 12px 14px);
  transform: translateX(-50%);
  border-radius: 0 0 3px 3px;
}
.cv-card {
  --card-accent: #002b49;
  --card-ink: #0b1b2b;
  position: relative;
  width: clamp(13rem, 22vw, 15.5rem);
  aspect-ratio: 54 / 85.6; /* proporción real CR80 vertical */
  transform-origin: 50% -3.5rem;
}
.cv-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.cv-card.is-flipped .cv-card__inner {
  transform: rotateY(180deg);
}
.cv-card__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 0.95rem;
  background: #fff;
  color: var(--card-ink);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 30px 60px -24px rgba(0, 20, 40, 0.5), 0 0 0 1px rgba(0, 43, 73, 0.08);
}
.cv-card__back {
  transform: rotateY(180deg);
  justify-content: center;
  gap: 0.9rem;
  padding: 2.5rem 1.25rem 1.5rem;
  text-align: center;
}
.cv-card__slot {
  position: absolute;
  top: 0.7rem;
  left: 50%;
  z-index: 3;
  width: 2.8rem;
  height: 0.5rem;
  border-radius: 99px;
  background: var(--rhp-bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  transform: translateX(-50%);
}
.cv-card__band {
  width: 100%;
  height: 34%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.9rem;
  background: var(--card-accent);
  transition: background-color 0.35s ease;
}
.cv-card__brand {
  font: 800 0.95rem/1 var(--rhp-display);
  letter-spacing: 0.18em;
  color: #fff;
}
.cv-card__brand--back {
  color: var(--card-accent);
}
.cv-card__photo {
  width: 42%;
  aspect-ratio: 1;
  object-fit: cover;
  margin-top: -2.4rem;
  border: 4px solid #fff;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 18px -8px rgba(0, 20, 40, 0.5);
  transition: border-radius 0.35s ease;
}
.cv-card[data-shape="rounded"] .cv-card__photo {
  border-radius: 22%;
}
.cv-card[data-shape="square"] .cv-card__photo {
  border-radius: 6%;
}
.cv-card__name {
  margin: 0.8rem 0 0;
  padding-inline: 0.75rem;
  font: 700 1.2rem/1.1 var(--rhp-display);
  text-align: center;
  overflow-wrap: anywhere;
}
.cv-card__role {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--card-accent);
  filter: saturate(1.2);
}
.cv-card__id {
  margin: 0.35rem 0 0;
  font: 500 0.65rem/1 var(--rhp-mono);
  color: #51657a;
}
.cv-card__qr {
  flex-shrink: 0;
  aspect-ratio: 1; /* sin esto el SVG se colapsa dentro del flex en columna */
  height: auto;
  width: 26%;
  margin-top: auto;
  margin-bottom: 1rem;
  color: var(--card-ink);
}
.cv-card__qr--big {
  width: 58%;
  margin: 0;
}
.cv-card__scan {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
}
.cv-card__url {
  margin: 0;
  font: 500 0.68rem/1 var(--rhp-mono);
  color: #51657a;
}

/* Estilo Stripe: franja vertical a la izquierda */
.cv-card[data-tpl="stripe"] .cv-card__front {
  padding-left: 18%;
}
.cv-card[data-tpl="stripe"] .cv-card__band {
  position: absolute;
  top: 0;
  left: 0;
  width: 18%;
  height: 100%;
  padding: 0 0 1rem;
  align-items: flex-end;
}
.cv-card[data-tpl="stripe"] .cv-card__brand {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.8rem;
}
.cv-card[data-tpl="stripe"] .cv-card__photo {
  margin-top: 2.75rem;
  box-shadow: none;
  border-color: #eef3f7;
}
/* Estilo Minimal: blanco con línea de acento */
.cv-card[data-tpl="minimal"] .cv-card__band {
  height: auto;
  padding: 2.1rem 0 0.9rem;
  background: transparent;
  border-bottom: 3px solid var(--card-accent);
  width: 70%;
}
.cv-card[data-tpl="minimal"] .cv-card__brand {
  color: var(--card-accent);
}
.cv-card[data-tpl="minimal"] .cv-card__photo {
  margin-top: 1.1rem;
  box-shadow: none;
  border-color: #eef3f7;
}
/* Estilo Badge: credencial oscura */
.cv-card[data-tpl="badge"] .cv-card__front {
  background: var(--card-accent);
  color: #fff;
}
.cv-card[data-tpl="badge"] .cv-card__band {
  background: transparent;
  height: 28%;
}
.cv-card[data-tpl="badge"] .cv-card__photo {
  margin-top: 0.2rem;
  border-color: rgba(255, 255, 255, 0.9);
}
.cv-card[data-tpl="badge"] .cv-card__role {
  color: #9fe6fa;
  filter: none;
}
.cv-card[data-tpl="badge"] .cv-card__id {
  color: rgba(255, 255, 255, 0.7);
}
.cv-card[data-tpl="badge"] .cv-card__qr {
  color: #fff;
}

/* Controles */
.cv-controls {
  width: 100%;
  max-width: 26rem;
  display: grid;
  gap: 0.9rem;
}
.cv-controls fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.cv-controls legend,
.cv-name > span {
  display: block;
  margin-bottom: 0.4rem;
  font: 600 0.68rem/1 var(--rhp-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rhp-muted);
}
.cv-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.cv-seg label,
.cv-swatches label {
  position: relative;
  cursor: pointer;
}
.cv-seg input,
.cv-swatches input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.cv-seg span {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  border: 1.5px solid var(--rhp-line);
  border-radius: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.cv-seg input:checked + span {
  border-color: var(--rhp-navy);
  background: var(--rhp-navy);
  color: #fff;
}
html.dark .cv-seg input:checked + span {
  border-color: var(--rhp-cyan);
  background: var(--rhp-cyan);
  color: var(--rhp-navy);
}
.cv-seg input:focus-visible + span,
.cv-swatches input:focus-visible + span {
  outline: 3px solid var(--rhp-yellow);
  outline-offset: 2px;
}
.cv-swatches {
  display: flex;
  gap: 0.5rem;
}
.cv-swatches span {
  display: block;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.5rem;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}
.cv-swatches input:checked + span {
  box-shadow: 0 0 0 2px var(--rhp-bg), 0 0 0 4px var(--rhp-ink);
}
.cv-controls__row {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}
.cv-name {
  flex: 1;
  min-width: 0;
}
.cv-name input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--rhp-line);
  border-radius: 0.5rem;
  background: var(--rhp-bg);
  color: var(--rhp-ink);
  font: 600 0.92rem var(--rhp-body);
}
.cv-name input:focus {
  outline: none;
  border-color: var(--rhp-cyan);
  box-shadow: 0 0 0 4px rgba(0, 178, 226, 0.18);
}
.cv-flip {
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
}
.cv-controls__note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--rhp-muted);
}

/* ---------- Las 3 formas ---------- */
.cv-modes {
  padding-block: 0 clamp(1rem, 3vw, 2rem);
  background: var(--rhp-bg);
}
.cv-modes__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  border-top: 1.5px solid var(--rhp-ink);
  border-bottom: 1.5px solid var(--rhp-ink);
}
@media (min-width: 768px) {
  .cv-modes__list {
    grid-template-columns: repeat(3, 1fr);
  }
  .cv-modes__list li + li {
    border-left: 1px solid var(--rhp-line);
  }
}
.cv-modes__list li + li {
  border-top: 1px solid var(--rhp-line);
}
@media (min-width: 768px) {
  .cv-modes__list li + li {
    border-top: 0;
  }
}
.cv-mode {
  display: grid;
  gap: 0.35rem;
  height: 100%;
  padding: 1.35rem 1.25rem;
  color: var(--rhp-ink);
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.cv-mode:hover {
  background: var(--rhp-navy);
  color: #fff;
}
.cv-mode__num {
  font: 600 0.7rem/1 var(--rhp-mono);
  color: var(--rhp-cyan-600);
}
.cv-mode:hover .cv-mode__num {
  color: var(--rhp-yellow);
}
.cv-mode__title {
  font: 700 1.25rem/1.15 var(--rhp-display);
}
.cv-mode__text {
  font-size: 0.9rem;
  color: var(--rhp-muted);
}
.cv-mode:hover .cv-mode__text {
  color: rgba(231, 240, 246, 0.8);
}

/* ---------- Secciones en dos columnas ---------- */
.cv-split {
  display: grid;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
@media (min-width: 1024px) {
  .cv-split {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: start;
  }
  /* El medio acompaña la lectura de la columna de texto */
  .cv-split__media {
    position: sticky;
    top: calc(var(--rhp-header-h) + 2rem);
  }
  .cv-split--media-first {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
}
.cv-split__media {
  display: grid;
  justify-items: center;
  min-width: 0;
}
.cv-split .rhp-head {
  margin-bottom: 1.75rem;
}
.cv-features {
  margin: 0;
  display: grid;
  border-top: 1px solid var(--rhp-line);
}
.cv-features > div {
  display: grid;
  gap: 0.3rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rhp-line);
}
@media (min-width: 640px) {
  .cv-features > div {
    grid-template-columns: 15rem 1fr;
    gap: 1.25rem;
  }
}
.cv-features dt {
  font-weight: 700;
  line-height: 1.35;
}
.cv-features dd {
  margin: 0;
  color: var(--rhp-muted);
  line-height: 1.6;
  font-size: 0.95rem;
}
.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

/* Teléfono con la VCard real */
.cv-phone {
  width: min(19rem, 80%);
  padding: 0.65rem;
  border-radius: 2.6rem;
  background: #0b1622;
  box-shadow: inset 0 0 0 2px #2a3d50, 0 40px 80px -30px rgba(0, 20, 40, 0.55);
}
.cv-phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2rem;
}

/* Autoservicio */
.cv-self {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding: clamp(1.5rem, 3vw, 2rem);
  border-radius: var(--rhp-radius);
  background: var(--rhp-navy);
  color: #fff;
}
.cv-self__label {
  margin: 0 0 1.25rem;
  font: 600 0.72rem/1 var(--rhp-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rhp-yellow);
}
.cv-self__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}
@media (min-width: 768px) {
  .cv-self__steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}
.cv-self__steps li {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  column-gap: 0.5rem;
  line-height: 1.5;
  color: rgba(231, 240, 246, 0.82);
  font-size: 0.95rem;
}
.cv-self__steps span {
  grid-row: span 2;
  font: 600 0.8rem/1.6 var(--rhp-mono);
  color: var(--rhp-cyan);
}
.cv-self__steps strong {
  display: block;
  color: #fff;
}

/* ---------- Sección oscura (credencial impresa) ---------- */
.cv-dark {
  background: var(--rhp-navy-900);
  color: #fff;
}
.cv-dark .rhp-eyebrow {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--rhp-cyan);
}
.cv-dark .rhp-eyebrow::before {
  background: var(--rhp-navy-900);
}
.cv-dark .rhp-h2 em {
  color: var(--rhp-cyan);
}
.cv-dark .rhp-lead,
.cv-dark .cv-features dd {
  color: rgba(231, 240, 246, 0.78);
}
.cv-dark .cv-features,
.cv-dark .cv-features > div {
  border-color: rgba(255, 255, 255, 0.14);
}
.cv-dark .rhp-media--window {
  width: 100%;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7);
}

/* ---------- Expediente de muestra ---------- */
.cv-file {
  width: 100%;
  max-width: 30rem;
  border-radius: var(--rhp-radius);
  background: var(--rhp-card);
  border: 1px solid var(--rhp-line);
  box-shadow: var(--rhp-shadow);
  overflow: hidden;
}
.cv-file__head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
  background: var(--rhp-navy);
  color: #fff;
}
.cv-file__head img {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.85);
}
.cv-file__name {
  margin: 0;
  font-weight: 700;
}
.cv-file__meta {
  margin: 0.2rem 0 0;
  font: 500 0.7rem/1 var(--rhp-mono);
  color: rgba(231, 240, 246, 0.7);
}
.cv-file__docs {
  list-style: none;
  margin: 0;
  padding: 0.35rem 1.25rem;
}
.cv-file__docs li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rhp-line);
}
.cv-file__docs li:last-child {
  border-bottom: 0;
}
.cv-doc {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.cv-doc::before {
  /* hoja de documento dibujada en CSS */
  content: "";
  flex-shrink: 0;
  width: 0.8rem;
  height: 1rem;
  border: 1.5px solid var(--rhp-muted);
  border-radius: 2px;
  background: linear-gradient(var(--rhp-muted), var(--rhp-muted)) 50% 40% / 50% 1.5px no-repeat,
    linear-gradient(var(--rhp-muted), var(--rhp-muted)) 50% 65% / 50% 1.5px no-repeat;
}
.cv-tag {
  padding: 0.3rem 0.55rem;
  border-radius: 0.3rem;
  border: 1px solid var(--rhp-line);
  font: 500 0.66rem/1 var(--rhp-mono);
  color: var(--rhp-muted);
  white-space: nowrap;
}
.cv-tag--ok {
  border-color: rgba(0, 148, 189, 0.4);
  background: rgba(0, 178, 226, 0.1);
  color: var(--rhp-cyan-600);
}
html.dark .cv-tag--ok {
  color: var(--rhp-cyan);
}
.cv-tag--wait {
  border-color: rgba(224, 184, 0, 0.5);
  background: rgba(255, 215, 0, 0.18);
  color: #7a5f00;
}
html.dark .cv-tag--wait {
  color: var(--rhp-yellow);
}
.cv-file__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--rhp-surface);
  font: 500 0.7rem/1 var(--rhp-mono);
  color: var(--rhp-muted);
}
.cv-file__link {
  color: var(--rhp-ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Seguridad "bajo llave" ---------- */
.cv-locks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  border-top: 1.5px solid var(--rhp-ink);
}
@media (min-width: 640px) {
  .cv-locks {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 2.5rem;
  }
}
@media (min-width: 1024px) {
  .cv-locks {
    grid-template-columns: repeat(3, 1fr);
  }
}
.cv-locks li {
  padding: 1.5rem 0 1.75rem;
  border-bottom: 1px solid var(--rhp-line);
}
.cv-locks__num {
  font: 600 0.75rem/1 var(--rhp-mono);
  color: var(--rhp-cyan-600);
}
html.dark .cv-locks__num {
  color: var(--rhp-cyan);
}
.cv-locks h3 {
  margin: 0.8rem 0 0.5rem;
  font: 700 1.15rem/1.25 var(--rhp-display);
}
.cv-locks p {
  margin: 0;
  color: var(--rhp-muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

@media (prefers-reduced-motion: reduce) {
  .cv-card__inner {
    transition: none;
  }
}

/* ---------- Hero: credencial estática + enlace al editor real ---------- */
.cv-studio--hero {
  gap: 1.25rem;
}
.cv-studio__go {
  font-size: 0.88rem;
}

/* ---------- Editor real de KIS-VC (iframe) con respaldo ---------- */
.cv-demo {
  position: relative;
}
.cv-demo__frame {
  display: block;
  width: 100%;
  height: 46rem;
  border: 1px solid var(--rhp-line);
  border-radius: var(--rhp-radius);
  background: var(--rhp-card);
  box-shadow: var(--rhp-shadow);
  transition: opacity 0.4s ease;
}
/* Mientras el editor no confirma que cargó, se ve el respaldo y el iframe queda fuera de vista */
.cv-demo:not(.is-live) .cv-demo__frame {
  position: absolute;
  inset: 0 auto auto 0;
  opacity: 0;
  pointer-events: none;
}
.cv-demo.is-live .cv-demo__fallback {
  display: none;
}
.cv-demo__fallback .cv-studio {
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: var(--rhp-radius);
  background: var(--rhp-card);
  border: 1px solid var(--rhp-line);
}
@media (min-width: 768px) {
  .cv-demo__fallback .cv-studio {
    grid-template-columns: auto minmax(0, 26rem);
    justify-content: center;
    align-items: center;
    column-gap: clamp(2rem, 5vw, 4rem);
  }
}
