/* =========================================================================
   Martilleros Río Grande. Mi credencial y la verificación del comercio. Sobre los tokens
   de style.css, pensadas primero para el celular. La credencial es una tarjeta 3D
   (credencial.js la inclina con el giroscopio o el mouse) con brillo holográfico y el QR
   con un aro de luz; la verificación usa el semáforo animado de la ficha
   (paginas/semaforo.css). Sólo se anima transform y opacity; con "reducir movimiento",
   todo quieto.
   ========================================================================= */
[hidden] { display: none !important; }

body.cred { background: var(--papel); min-height: 100vh; }

.cred-barra {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(120deg, var(--azul-800), var(--azul-950)); color: #fff;
  padding: max(.8rem, env(safe-area-inset-top)) 1rem .8rem;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--cobre), var(--oro) 45%, var(--glaciar)) 1;
}
.cred-marca { display: inline-flex; align-items: center; gap: .6rem; color: #fff; font-family: var(--font-display); font-weight: 700; }
.cred-marca, .cred-marca:hover { text-decoration: none; color: #fff; }

.cred-principal { max-width: 480px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.cred-principal h1 { font-size: 1.6rem; }

/* ---------- Entrada: una credencial chiquita que flota ---------- */
.cred-entrada-deco { display: block; width: 150px; margin: .5rem 0 1.25rem; transform: rotate(-6deg); }
.cred-entrada-deco .mini-cred { box-shadow: 0 22px 34px -18px rgba(11, 29, 48, .55), 0 0 0 1px var(--linea); }

/* ---------- Alta de correo: la matrícula no tiene correo cargado ---------- */
.cred-alta, .cred-alta-estado {
  margin-top: 1.25rem; background: #fff; border: 1px solid var(--linea); border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem 1.25rem; box-shadow: var(--s-1); overflow-wrap: anywhere;
}
.cred-alta h2, .cred-alta-estado h2 { font-size: 1.25rem; margin-bottom: .5rem; }
/* El título recibe el foco para que el lector de pantalla lo lea; no es un control, sin anillo. */
.cred-alta h2:focus, .cred-alta-estado h2:focus { outline: none; box-shadow: none; }
.cred-casilla { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .6rem; align-items: start; cursor: pointer; }
.cred-casilla input { margin-top: .2rem; }
.cred-alta-por-que {
  margin: 1rem 0 0; padding: .7rem .9rem; border-left: 3px solid var(--cobre); border-radius: var(--r-sm);
  background: var(--cobre-050); color: var(--texto-2); font-size: .9rem;
}
.cred-alta-estado { border-top: 4px solid var(--cobre); }
.cred-alta-estado--no { border-top-color: var(--no-habilitado); }
.cred-alta-ico {
  position: relative; display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: .6rem;
  border-radius: 50%; background: var(--cobre-050); color: var(--cobre-700);
}
.cred-alta-estado--no .cred-alta-ico { background: var(--no-habilitado-050); color: var(--no-habilitado); }

/* ---------- Pestañas ---------- */
.cred-pestanas { display: flex; gap: .4rem; margin-bottom: 1.1rem; padding: .3rem; border-radius: var(--r-full); background: #fff; border: 1px solid var(--linea); }
.cred-pestanas [role="tab"] {
  flex: 1; min-height: 42px; padding: .55rem .8rem; border-radius: var(--r-full); border: 0;
  background: transparent; font-family: var(--font-display); font-weight: 600; color: var(--texto-3); cursor: pointer;
  transition: background 250ms ease, color 250ms ease;
}
.cred-pestanas [role="tab"][aria-selected="true"] { background: var(--azul-700); color: #fff; box-shadow: 0 8px 18px -10px rgba(21, 50, 79, .8); }

/* ---------- La credencial: tarjeta 3D ---------- */
.cred-escena { perspective: 1100px; }
.cred-tarjeta {
  position: relative; overflow: hidden; isolation: isolate; text-align: center; color: var(--azul-100);
  border-radius: 22px; transform-style: preserve-3d; will-change: transform;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120' viewBox='0 0 240 120'%3E%3Cg fill='none' stroke='%238fd3e8' stroke-opacity='.09' stroke-width='1'%3E%3Cpath d='M0 20C40 0 80 40 120 20S200 0 240 20'/%3E%3Cpath d='M0 40C40 20 80 60 120 40S200 20 240 40'/%3E%3Cpath d='M0 60C40 40 80 80 120 60S200 40 240 60'/%3E%3Cpath d='M0 80C40 60 80 100 120 80S200 60 240 80'/%3E%3Cpath d='M0 100C40 80 80 120 120 100S200 80 240 100'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 240px 120px,
    radial-gradient(70% 45% at 100% 0%, rgba(181, 101, 43, .38), transparent 70%),
    radial-gradient(60% 40% at 0% 100%, rgba(143, 211, 232, .16), transparent 70%),
    linear-gradient(160deg, var(--azul-600), var(--azul-900) 55%, var(--azul-950));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 0 0 1px rgba(255, 255, 255, .08) inset, 0 40px 70px -30px rgba(7, 20, 35, .75), 0 18px 30px -18px rgba(7, 20, 35, .5);
}
.cred-tarjeta > :not(.cred-holo) { position: relative; z-index: 2; }
.cred-tarjeta-cabeza {
  display: flex; align-items: center; gap: .7rem; padding: 1rem 1.1rem .9rem; text-align: left;
  color: var(--azul-200); font-size: .78rem; line-height: 1.3;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.cred-tarjeta-cabeza img { flex-shrink: 0; border-radius: 50%; box-shadow: 0 0 0 2px rgba(233, 183, 122, .5); }
.cred-tarjeta-cabeza > span:not([class]) { flex: 1; min-width: 0; }
.cred-tarjeta-cabeza strong { color: #fff; font-family: var(--font-display); font-size: .95rem; }
/* El holograma: una oblea iridiscente, como la de una credencial impresa. */
.cred-holograma {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; position: relative;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .35), 0 6px 14px -6px rgba(0, 0, 0, .6);
}
.cred-holograma::before {
  content: ""; position: absolute; inset: -30%;
  background: conic-gradient(from 0deg, #8fd3e8, #e9b77a, #d6aae6, #a6e3c8, #8fd3e8, #f3c58e, #8fd3e8);
}
.cred-holograma::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .7); }

.cred-principal .cred-nombre { color: #fff; font-size: 1.55rem; margin: 1.15rem 1rem .6rem; overflow-wrap: anywhere; }
.cred-datos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 0 1rem; font-size: .88rem; }
.cred-datos dt { color: var(--azul-200); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.cred-datos dd { margin: .15rem 0 0; color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.cred-situacion {
  display: flex; align-items: center; justify-content: center; gap: .55rem;
  margin: 1rem; padding: .7rem .9rem; border-radius: var(--r-md);
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
}
.cred-situacion::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.cred-situacion--ok { background: var(--habilitado-050); color: var(--habilitado); }
.cred-situacion--ambar { background: var(--cobre-050); color: var(--cobre-800); }
.cred-situacion--no { background: var(--no-habilitado-050); color: var(--no-habilitado); }
.cred-situacion--gris { background: var(--baja-050); color: var(--baja); }
.cred-situacion--gris::before { background: transparent; border: 2px solid currentColor; }

/* El QR, con un aro de luz que gira alrededor (el QR queda quieto y legible). */
.cred-qr-marco { position: relative; isolation: isolate; overflow: hidden; width: min(268px, 74vw); margin: 0 auto; padding: 9px; border-radius: 20px; }
.cred-qr-marco::before {
  content: ""; position: absolute; z-index: -2; left: 50%; top: 50%; width: 160%; aspect-ratio: 1; translate: -50% -50%;
  background: conic-gradient(from 0deg, rgba(143, 211, 232, .15) 0 50%, var(--glaciar) 66%, var(--oro) 78%, var(--cobre) 86%, rgba(143, 211, 232, .15) 96%);
}
.cred-qr-marco::after { content: ""; position: absolute; z-index: -1; inset: 3px; border-radius: 17px; background: #fff; }
.cred-qr { width: 100%; background: #fff; border-radius: 10px; }
.cred-qr svg { display: block; width: 100%; height: auto; }
.cred-tarjeta .cred-verificada { margin: .75rem 1rem 1.15rem; color: var(--azul-200); }

/* Brillo holográfico: credencial.js lo corre según la inclinación; solo, barre despacio. */
.cred-holo { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; border-radius: inherit; }
.cred-holo::before {
  content: ""; position: absolute; top: -25%; bottom: -25%; left: -10%; width: 120%;
  background: linear-gradient(110deg, transparent 30%, rgba(143, 211, 232, .2) 42%, rgba(233, 183, 122, .24) 50%, rgba(214, 170, 230, .18) 57%, transparent 70%);
  mix-blend-mode: screen; transform: translateX(-40%);
  translate: calc(var(--hx, 0) * 40%) 0; transition: translate 250ms ease-out;
}

.cred-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.cred-lista li { background: #fff; border: 1px solid var(--linea); border-radius: var(--r-md); padding: .8rem 1rem; overflow-wrap: anywhere; }

.cred-instalar { margin-top: 1.5rem; background: #fff; border: 1px dashed var(--azul-200); border-radius: var(--r-lg); padding: 1.1rem 1.2rem; }
.cred-instalar h2 { font-size: 1.1rem; }
.cred-instalar svg { width: 100%; max-width: 320px; height: auto; margin-top: .6rem; }

/* ---------- La verificación del comercio ---------- */
.verif {
  margin-top: 1rem; border-radius: 22px; overflow: hidden; background: #fff;
  border: 1px solid var(--linea); box-shadow: var(--s-4);
}
.verif-estado {
  position: relative; display: flex; align-items: center; gap: 1rem; padding: 1.35rem 1.2rem;
  background: linear-gradient(135deg, #5b6573, var(--baja)); color: #fff;
}
.verif-estado::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 140% at 100% 0%, rgba(255, 255, 255, .18), transparent 60%); }
.verif-estado .semaforo { --sem-w: 58px; }
.cred-principal .verif h1 { color: #fff; margin: 0; font-size: clamp(1.45rem, 1.2rem + 1.4vw, 1.85rem); line-height: 1.12; overflow-wrap: anywhere; }
.verif .cargando { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.verif--ok .verif-estado { background: linear-gradient(135deg, #23905a, var(--habilitado)); }
.verif--no .verif-estado { background: var(--no-habilitado); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .14); }
.verif--ambar .verif-estado { background: linear-gradient(135deg, var(--cobre-700), var(--cobre-800)); }
.verif-cuerpo { padding: 1.15rem 1.2rem 1.3rem; }
.verif dl { display: grid; grid-template-columns: fit-content(40%) minmax(0, 1fr); gap: .5rem 1rem; margin: 0 0 .9rem; }
.verif dt { color: var(--texto-3); font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding-top: .15rem; }
.verif dd { margin: 0; color: var(--texto); font-weight: 600; overflow-wrap: anywhere; }
.verif-ficha { margin-top: 1rem; }
/* El semáforo de la verificación dibuja sólo el trazo de su caso. */
.semaforo--ok .t-no, .semaforo--ok .t-duda,
.semaforo--no .t-ok, .semaforo--no .t-duda,
.semaforo--quieto .t-ok, .semaforo--quieto .t-duda,
.semaforo--duda .t-ok, .semaforo--duda .t-no { display: none; }

/* ---------- Movimiento (sólo sin "reducir movimiento") ---------- */
@media (prefers-reduced-motion: no-preference) {
  .cred-entrada-deco .mini-cred { animation: cred-flota 6s ease-in-out infinite; }
  .cred-tarjeta { animation: cred-entra 1s var(--ease-salida) backwards; }
  .cred-holo::before { animation: cred-barre 6.5s ease-in-out 1s infinite; }
  .cred-qr-marco::before { animation: cred-aro 5s linear infinite; }
  .cred-holograma::before { animation: cred-aro 9s linear infinite; }
  .cred-situacion--ok::before { animation: cred-latido 2.2s ease-out infinite; }
  /* El estado del alta entra al aparecer; mientras espera, la aguja gira y un aro late. */
  .cred-alta-estado { animation: cred-sube .55s var(--ease-salida) both; }
  .cred-aguja { transform-origin: 12px 12px; animation: cred-aro 8s linear infinite; }
  .cred-alta-estado:not(.cred-alta-estado--no) .cred-alta-ico::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid currentColor;
    animation: cred-halo 2.6s ease-out infinite;
  }
}
@keyframes cred-sube { from { opacity: 0; transform: translate3d(0, 18px, 0) scale(.98); } }
@keyframes cred-halo { from { opacity: .45; transform: scale(1); } to { opacity: 0; transform: scale(1.6); } }
@keyframes cred-entra { from { opacity: 0; transform: perspective(1100px) rotateX(22deg) translate3d(0, 34px, 0) scale(.94); } }
@keyframes cred-barre { 0%, 100% { transform: translateX(-60%); } 50% { transform: translateX(60%); } }
@keyframes cred-aro { to { transform: rotate(1turn); } }
@keyframes cred-flota { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -8px, 0); } }
@keyframes cred-latido { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.45); } 40% { transform: scale(1); } }

/* ---------- El portal: cuatro pestañas, la tarjeta del teléfono y Mis datos ---------- */
@media (max-width: 480px) {
  .cred-pestanas { display: grid; grid-template-columns: 1fr 1fr; border-radius: 22px; }
}
.cred-telefono { background: #fff; border: 1px solid var(--linea); border-top: 4px solid var(--cobre); border-radius: 18px; padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; }
.cred-telefono h2 { font-size: 1.15rem; margin-bottom: .5rem; }
.cred-check { display: flex; gap: .55rem; align-items: flex-start; font-weight: 600; margin: .6rem 0; cursor: pointer; }
.cred-check input { margin-top: .2rem; width: 1.1rem; height: 1.1rem; flex: none; accent-color: var(--azul-700); }
.cred-mis-datos { display: grid; gap: .5rem; margin: .8rem 0 0; }
.cred-mis-datos div { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr; gap: .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--linea); }
.cred-mis-datos dt { color: var(--texto-3); font-size: .9rem; }
.cred-mis-datos dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cred-candado { margin-top: 0; }

/* ---------- Las herramientas ---------- */
.cred-herramienta { background: #fff; border: 1px solid var(--linea); border-radius: 18px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.cred-herramienta h2 { font-size: 1.15rem; margin-bottom: .6rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.cred-herramienta h3 { font-size: 1rem; margin: 1.1rem 0 .5rem; }
.cred-campo { display: grid; gap: .3rem; margin-bottom: .7rem; }
.cred-resultado { margin: .4rem 0 0; padding: .8rem .9rem; border-radius: 12px; background: var(--azul-050); }
.cred-honorario { font-size: 1.05rem; margin-bottom: .3rem; }
.cred-emitido { margin-top: .8rem; padding: .9rem; border: 1px dashed var(--linea); border-radius: 12px; display: grid; gap: .5rem; justify-items: start; }
.cred-qr--chico { width: 9.5rem; }
.cred-modelo { padding: .7rem 0; border-top: 1px solid var(--linea); }
.cred-modelo:first-of-type { border-top: 0; }

/* ---------- Verificación de lo emitido ---------- */
.verif-hoy { font-weight: 700; margin: .9rem 0 0; }
.verif-form { display: grid; gap: .3rem; max-width: 26rem; }
