/* ==========================================================================
   Sistema de tarjetas de visita — estilos base
   Todo el color viene de variables; el tema por cliente se genera aparte
   (theme-<slug>.css) para no depender de estilos inline ni de unsafe-inline.
   ========================================================================== */

:root {
  --acento: #d00000;
  --acento-2: #7ebec5;
  --acento-3: #e09900;
  --fondo: #f1f1f4;
  --fondo-2: #ffffff;
  --tarjeta: #ffffff;
  --texto: #151517;
  --texto-2: #5c5c66;
  --borde: #e6e6ec;
  --radio: 22px;
  --radio-sm: 13px;
  --sombra: 0 18px 44px -20px rgba(18, 18, 30, 0.38);
  --ancho: 430px;
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fuente-titulo: var(--fuente);
  --tap: 44px;
  --dur: 0.65s;
  --curva: cubic-bezier(0.22, 0.61, 0.36, 1);
  --nom: clamp(1.65rem, 6vw, 2.15rem);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, iframe { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3 { font-family: var(--fuente-titulo); line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--acento);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--acento);
  color: #fff;
  padding: 12px 18px;
  z-index: 99;
  border-radius: 0 0 var(--radio-sm) 0;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- tarjeta */
.card {
  width: min(var(--ancho, 560px), 100%);
  margin: 0 auto;
}

.card--esencial {
  width: min(560px, 100%);
  background: var(--tarjeta);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 0 22px 30px;
  margin: clamp(0px, 3vw, 28px) auto 44px;
  overflow: hidden;
}
.card--esencial .hero {
  margin: 0 -22px 26px;
  border-radius: var(--radio) var(--radio) 0 0;
}

.card--profesional {
  width: min(560px, 100%);
  background: var(--tarjeta);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 0 22px 30px;
  margin: clamp(0px, 3vw, 28px) auto 44px;
  overflow: hidden;
}
.card--profesional .hero {
  margin: 0 -22px 26px;
  border-radius: var(--radio) var(--radio) 0 0;
}

.card--portafolio {
  width: min(780px, 100%);
  padding: 0 20px 56px;
  margin: 0 auto;
}
.card--portafolio .hero {
  margin: 0 -20px 30px;
  border-radius: 0;
}

/* ------------------------------------------------------------------ hero */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--hero-fondo, var(--fondo-2));
  min-height: clamp(320px, 48vw, 400px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero__velo {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0) 38%, rgba(0, 0, 0, 0.78) 100%);
}
.hero__texto {
  position: relative;
  padding: 22px;
  color: #fff;
}
.hero--foto .hero__texto { padding-right: 112px; }
.hero__eslogan {
  font-size: calc(var(--nom) * 2);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.04;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}
.hero__eslogan--partido {
  font-size: calc(var(--nom) * 1.4);
  line-height: 1.08;
}
.hero__eslogan-marca {
  display: block;
  margin-top: 8px;
  font-size: 0.56em;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.9);
}
.hero__tel {
  font-family: var(--fuente-titulo);
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
}
.hero__foto {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

/* ------------------------------------------------------------------ logo */
.logo {
  display: flex;
  justify-content: center;
  padding: 6px 0 14px;
}
.logo__link { display: inline-block; }
.logo img {
  width: auto;
  height: 46px;
  max-width: 100%;
  object-fit: contain;
}
.card--profesional .logo img,
.card--portafolio .logo img { height: 54px; }

/* -------------------------------------------------------------- identidad */
.identidad { text-align: center; padding: 4px 0 18px; }
.identidad__nombre {
  font-size: var(--nom);
  font-weight: 800;
  letter-spacing: -0.025em;
}
.identidad__linea {
  margin-top: 6px;
  color: var(--texto-2);
  font-size: 0.97rem;
  font-weight: 500;
}
.card--profesional .identidad,
.card--portafolio .identidad { text-align: left; }

/* --------------------------------------------------------------- acciones */
.acciones {
  display: grid;
  gap: 9px;
  margin: 4px 0 18px;
}
.btn-enlace {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 11px 14px;
  border-radius: var(--radio-sm);
  background: var(--fondo);
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.2s var(--curva), transform 0.2s var(--curva), border-color 0.2s var(--curva);
}
.btn-enlace:hover { background: var(--fondo-2); border-color: var(--borde); }
.btn-enlace:active { transform: scale(0.985); }
.btn-izq { flex: 0 0 auto; }
.icono-caja {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--acento);
  color: #fff;
}
.icono-caja .ic { width: 19px; height: 19px; fill: currentColor; }
.btn-textos { display: grid; flex: 1 1 auto; min-width: 0; }
.btn-titulo { font-weight: 650; font-size: 0.96rem; }
.btn-sub {
  font-size: 0.84rem;
  color: var(--texto-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flecha-icono { flex: 0 0 auto; color: var(--texto-2); }
.flecha-icono .ic { width: 20px; height: 20px; fill: currentColor; transform: rotate(-90deg); }

/* ------------------------------------------------------- acciones finales */
.finales {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 6px;
}
.btn-qr, .btn-vcard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--tap);
  padding: 10px 12px;
  border-radius: var(--radio-sm);
  border: 1px solid var(--borde);
  background: var(--fondo-2);
  font-weight: 650;
  font-size: 0.92rem;
  text-decoration: none;
  transition: transform 0.2s var(--curva), border-color 0.2s var(--curva), background 0.2s var(--curva);
}
.btn-qr:hover, .btn-vcard:hover { border-color: var(--acento); }
.btn-qr:active, .btn-vcard:active { transform: scale(0.98); }
.btn-qr__img {
  width: 64px;
  height: 64px;
  padding: 4px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--borde);
}
.btn-vcard .ic { width: 18px; height: 18px; fill: var(--acento); }

/* --------------------------------------------------------------- botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 11px 18px;
  border-radius: var(--radio-sm);
  border: 1px solid transparent;
  background: var(--acento);
  color: #fff;
  font-weight: 650;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.2s var(--curva), filter 0.2s var(--curva);
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(0.98); }
.btn .ic { width: 19px; height: 19px; fill: currentColor; }
.btn--wa { background: #25d366; }
.btn--share { background: var(--texto); }
.btn--mapa { background: var(--acento); width: 100%; }
.btn--sm { padding: 8px 14px; min-height: 40px; font-size: 0.88rem; }

/* ------------------------------------------------------------- secciones */
.sec { padding: 22px 0; border-top: 1px solid var(--borde); }
.card--esencial .sec:first-of-type { border-top: 0; }
.sec__titulo {
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.sec__texto { color: var(--texto-2); font-size: 0.96rem; }

/* ---------------------------------------------------------------- acordeon */
.acordeon { display: grid; gap: 8px; }
.acc {
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
  background: var(--fondo);
  overflow: hidden;
}
.acc__sum {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 13px 15px;
  cursor: pointer;
  font-weight: 650;
  font-size: 0.97rem;
  list-style: none;
}
.acc__sum::-webkit-details-marker { display: none; }
.acc__sum::marker { content: ""; }
.acc__titulo { flex: 1 1 auto; }
.acc__chev { flex: 0 0 auto; color: var(--texto-2); transition: transform 0.25s var(--curva); }
.acc__chev .ic { width: 20px; height: 20px; fill: currentColor; }
.acc[open] .acc__chev { transform: rotate(180deg); }
.acc[open] { background: var(--fondo-2); }
.acc__cuerpo { padding: 0 15px 15px; box-sizing: border-box; overflow: hidden; }
.acc__cuerpo-inner { min-height: 0; }
.acc--animating .acc__cuerpo { overflow: hidden; }
.acc__cuerpo .acc__texto { margin-top: 0; }
.acc__img {
  margin-top: 12px;
  width: 100%;
  height: auto;
  border-radius: var(--radio-sm);
  object-fit: cover;
}
.acc__cuerpo .btn { margin-top: 12px; }

/* --------------------------------------------------------------- galeria */
.gal {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.gal__li { margin: 0; }
.gal__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  border-radius: var(--radio-sm);
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.gal__btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s var(--curva);
}
.gal__btn:hover img { transform: scale(1.06); }

/* -------------------------------------------------------------- lightbox */
.lb {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100dvh;
  overflow: visible;
}
.lb::backdrop { background: rgba(8, 8, 12, 0.92); }
.lb__img {
  max-width: min(94vw, 1100px);
  max-height: 86dvh;
  width: auto;
  height: auto;
  margin: auto;
  border-radius: 10px;
  object-fit: contain;
}
.lb__cerrar {
  position: fixed;
  top: 16px;
  right: 16px;
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(6px);
}
.lb__cerrar .ic { width: 22px; height: 22px; fill: currentColor; }

/* --------------------------------------------------------------- ubicacion */
.ubi__dir, .ubi__horario {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--texto-2);
  font-size: 0.95rem;
  margin-bottom: 10px;
}
.ubi__dir .ic, .ubi__horario .ic { width: 19px; height: 19px; fill: var(--acento); flex: 0 0 auto; margin-top: 2px; }
.ubi__horario strong { color: var(--texto); }
.mapa {
  margin-top: 12px;
  border-radius: var(--radio-sm);
  overflow: hidden;
  border: 1px solid var(--borde);
  min-height: 180px;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, var(--fondo) 0 12px, var(--fondo-2) 12px 24px);
}
.mapa iframe { width: 100%; height: 260px; border: 0; }
.mapa:not(.mapa--js) .mapa__btn { display: none; }
.mapa__btn {
  min-height: var(--tap);
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid var(--borde);
  background: var(--fondo-2);
  font-weight: 650;
}

/* ----------------------------------------------------------------- barra */
.barra {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--borde);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: center;
  color: var(--texto-2);
  font-size: 0.87rem;
  text-align: center;
}
.barra__link { color: var(--acento); font-weight: 600; text-decoration: none; }
.barra__link:hover { text-decoration: underline; }
.barra__sep { opacity: 0.5; }

/* ----------------------------------------------------------------- modal */
.modal {
  border: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
  max-width: 100vw;
}
/* Fallback para navegadores sin Popover API: el JS usa el atributo open.
   Con Popover nativo manda el estado :popover-open y el UA ya oculta el cerrado. */
@supports not selector(:popover-open) {
  .modal:not([open]), .lb:not([open]) { display: none; }
}
.modal::backdrop { background: rgba(8, 8, 12, 0.72); backdrop-filter: blur(3px); }
.modal__box {
  position: relative;
  width: min(360px, calc(100vw - 32px));
  background: var(--tarjeta);
  color: var(--texto);
  border-radius: var(--radio);
  padding: 26px 22px 22px;
  text-align: center;
  box-shadow: var(--sombra);
  animation: modal-entra 0.2s var(--curva) both;
}
@keyframes modal-entra {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal__cerrar {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--fondo);
  color: var(--texto-2);
}
.modal__cerrar .ic { width: 18px; height: 18px; fill: currentColor; }
.modal__titulo { font-size: 1.12rem; font-weight: 750; margin-bottom: 12px; }
.modal__qr {
  display: inline-block;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
}
.modal__qr img { width: 240px; height: 240px; }
.modal__texto { color: var(--texto-2); font-size: 0.9rem; margin-top: 12px; }
.modal__url {
  margin-top: 8px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--texto-2);
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}
.modal__url a { color: var(--acento); text-decoration: underline; }
.modal__acciones { display: grid; gap: 9px; margin-top: 18px; }

/* --------------------------------------------------------------- marcas */
.marcas {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.marcas__li {
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
  background: var(--fondo);
  box-shadow: none;
  transition: box-shadow 0.25s var(--curva);
}
.marcas__li:hover,
.marcas__li:focus-within {
  box-shadow: 0 12px 26px -14px rgba(18, 18, 30, 0.55);
}
.marcas__li img { width: 100%; height: auto; max-height: 46px; object-fit: contain; }

/* ------------------------------------------------------------- mision etc */
.mv__grid, .serv__grid { display: grid; gap: 12px; }
.mv {
  padding: 16px;
  border-radius: var(--radio-sm);
  background: var(--fondo);
  border: 1px solid var(--borde);
}
.mv__titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 750;
  margin-bottom: 6px;
}
.mv__titulo .ic { width: 18px; height: 18px; fill: var(--acento); }
.mv__texto { color: var(--texto-2); font-size: 0.93rem; }
.serv {
  padding: 18px;
  border-radius: var(--radio-sm);
  background: var(--fondo);
  border: 1px solid var(--borde);
}
.serv__titulo { font-size: 1.02rem; font-weight: 750; margin-bottom: 6px; }
.serv__texto { color: var(--texto-2); font-size: 0.93rem; }
.serv__fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.serv__fotos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; }
.serv .btn { margin-top: 12px; }

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--texto);
  color: var(--fondo-2);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.25s var(--curva);
}
.toast[hidden] { display: none; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ------------------------------------------------------------ animaciones */
/* El estado inicial solo se aplica si el navegador puede ejecutar scripts:
   sin JS, todo el contenido queda visible (degradacion elegante). */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  [data-reveal] { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1 !important; }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 380px) {
  .finales { grid-template-columns: 1fr; }
  .gal { grid-template-columns: repeat(2, 1fr); }
  .card--profesional { padding: 0 16px 26px; }
  .card--profesional .hero { margin: 0 -16px 22px; }
}

@media (min-width: 900px) {
  .card--profesional, .card--portafolio { margin-top: 36px; }
  .card--portafolio .mv__grid { grid-template-columns: 1fr 1fr; }
  .card--portafolio .serv__grid { grid-template-columns: 1fr 1fr; }
}

@media print {
  .finales, .modal, .toast, .mapa { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
