/* =========================================================================
   COMPONENTES — botones, navbar, imágenes, tarjetas, footer, CTA flotante
   ========================================================================= */

/* -------------------------------------------------------------------------
   Botones
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-align: center;
  cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast),
    color var(--t-fast), transform var(--t-fast);
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background-color: var(--brand);
  color: var(--on-brand);
}

.btn--primary:hover {
  background-color: var(--brand-strong);
}

.btn--outline {
  border-color: var(--border-strong);
  color: var(--text);
  background-color: var(--surface);
}

.btn--outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn--light {
  background-color: var(--white);
  color: var(--blue-dark);
}

.btn--light:hover {
  background-color: var(--blue-soft);
}

.btn--ghost-light {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--white);
}

.btn--ghost-light:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.7);
}

.btn--lg {
  min-height: 58px;
  padding: 17px 32px;
  font-size: 1.0625rem;
}

.btn--block {
  display: flex;
  width: 100%;
}

/* En móvil los botones principales ocupan el ancho y son cómodos de tocar */
@media (max-width: 599px) {
  .btn {
    min-height: 50px;
  }

  .btn--lg {
    min-height: 54px;
    padding: 15px 24px;
    font-size: 1rem;
  }
}

/* Enlace con flecha (uso discreto, sin parecer botón) */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--brand);
}

.link-arrow .icon {
  width: 16px;
  height: 16px;
  transition: transform var(--t-fast);
}

.link-arrow:hover .icon {
  transform: translateX(4px);
}

/* -------------------------------------------------------------------------
   Navbar
   ------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 1px 20px -12px rgba(28, 39, 51, 0.4);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Logotipo real. Mientras el archivo no exista, script.js activa
   .brand--no-logo y se muestra el lockup de texto de reserva. */
.brand__logo {
  width: auto;
  height: 42px;
  object-fit: contain;
}

.brand__fallback {
  display: none;
  align-items: center;
  gap: 11px;
}

.brand--no-logo .brand__logo {
  display: none;
}

.brand--no-logo .brand__fallback {
  display: inline-flex;
}

/* Monograma JR: logo temporal mientras no esté el archivo definitivo */
.brand__mark {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--radius-xs);
  background-color: var(--brand-strong);
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand__name {
  font-size: 0.9375rem;
}

.brand__tag {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav__links {
  display: none;
  align-items: center;
  gap: 30px;
}

.nav__link {
  position: relative;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  padding-block: 6px;
  transition: color var(--t-fast);
}

.nav__link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-fast);
}

.nav__link:hover,
.nav__link.is-active {
  color: var(--text);
}

.nav__link.is-active::after {
  transform: scaleX(1);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav__cta {
  display: none;
}

/* CTA compacto SIEMPRE visible en la barra móvil */
.nav__cta-sm {
  min-height: 38px;
  padding: 8px 14px;
  gap: 6px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.nav__cta-sm .icon {
  width: 15px;
  height: 15px;
}

.nav__toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  border-radius: var(--radius-xs);
  color: var(--text);
}

.nav__toggle .icon {
  width: 22px;
  height: 22px;
}

.nav__toggle .icon--close,
.nav__toggle[aria-expanded='true'] .icon--menu {
  display: none;
}

.nav__toggle[aria-expanded='true'] .icon--close {
  display: block;
}

/* Panel móvil */
.nav__panel {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  z-index: 99;
  max-height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 8px var(--gutter) 28px;
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-base), transform var(--t-base),
    visibility var(--t-base);
}

.nav__panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.nav__panel-link {
  display: block;
  padding: 15px 0;
  font-size: 1.0625rem;
  font-weight: 600;
  border-bottom: 1px solid var(--gray-100);
}

.nav__panel .btn {
  margin-top: 22px;
}

body.nav-open {
  overflow: hidden;
}

/* Pantallas muy angostas: se sacrifica el descriptor, nunca el CTA */
@media (max-width: 379px) {
  .brand__tag {
    display: none;
  }

  .nav__cta-sm {
    padding-inline: 12px;
  }
}

@media (min-width: 900px) {
  .brand__logo {
    height: 48px;
  }

  .brand__mark {
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
  }

  .brand__name {
    font-size: 1rem;
  }

  .brand__tag {
    font-size: 0.6875rem;
  }

  .nav__links {
    display: flex;
  }

  .nav__cta {
    display: inline-flex;
  }

  .nav__cta-sm,
  .nav__toggle,
  .nav__panel {
    display: none;
  }
}

/* -------------------------------------------------------------------------
   Imágenes con placeholder
   Si el archivo real todavía no existe, se muestra un marcador con el
   nombre del archivo esperado en lugar de una imagen rota.
   ------------------------------------------------------------------------- */
.media {
  position: relative;
  overflow: hidden;
  background-color: var(--gray-100);
  border-radius: var(--radius-md);
  isolation: isolate;
}

.media::after {
  content: attr(data-file);
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 16px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--gray-100) 0 12px,
    var(--gray-050) 12px 24px
  );
  opacity: 0;
  pointer-events: none;
}

.media.is-empty::after {
  opacity: 1;
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.7s var(--ease);
}

.media.is-empty img {
  opacity: 0;
}

.media--zoom:hover img {
  transform: scale(1.03);
}

/* Proporciones */
.ratio-square {
  aspect-ratio: 1 / 1;
}
.ratio-portrait {
  aspect-ratio: 4 / 5;
}
.ratio-landscape {
  aspect-ratio: 3 / 2;
}
.ratio-wide {
  aspect-ratio: 16 / 9;
}

/* -------------------------------------------------------------------------
   Tarjetas
   ------------------------------------------------------------------------- */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--t-base), transform var(--t-base),
    box-shadow var(--t-base);
}

.card__body {
  padding: clamp(22px, 3vw, 34px);
}

/* -------------------------------------------------------------------------
   Lista de características
   ------------------------------------------------------------------------- */
.feature-list {
  display: grid;
  gap: 11px;
}

.feature-list li {
  position: relative;
  padding-left: 26px;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 12px;
  height: 1.5px;
  background-color: var(--brand);
  border-radius: 2px;
}

/* -------------------------------------------------------------------------
   Chips de confianza
   ------------------------------------------------------------------------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.chip .icon {
  width: 16px;
  height: 16px;
  color: var(--brand);
  stroke-width: 2.25;
}

/* -------------------------------------------------------------------------
   Redes sociales
   ------------------------------------------------------------------------- */
.social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.social__link {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background-color: var(--surface);
  transition: color var(--t-fast), border-color var(--t-fast),
    background-color var(--t-fast);
}

.social__link:hover {
  color: var(--brand);
  border-color: var(--brand);
  background-color: var(--blue-soft);
}

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
.site-footer {
  background-color: var(--text);
  color: rgba(255, 255, 255, 0.72);
  padding-block: clamp(48px, 6vw, 72px) 28px;
  font-size: 0.9375rem;
}

.site-footer .brand {
  color: var(--white);
}

.site-footer .brand__logo {
  height: 58px;
}

.site-footer .brand__mark {
  background-color: var(--white);
  color: var(--blue-dark);
}

.site-footer .brand__tag {
  color: rgba(255, 255, 255, 0.55);
}

.footer__grid {
  display: grid;
  gap: 32px;
}

.footer__title {
  margin-bottom: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.footer__list {
  display: grid;
  gap: 10px;
}

.footer__list a:hover {
  color: var(--white);
}

.site-footer .social__link {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
}

.site-footer .social__link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--white);
}

.footer__social {
  margin-top: 18px;
}

.footer__intro p {
  margin-top: 18px;
  max-width: 30ch;
  font-size: 0.9375rem;
}

.footer__bottom {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
}

@media (min-width: 640px) {
  .footer__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .footer__grid {
    grid-template-columns: 1.4fr 1fr 1fr 1.1fr;
    gap: 32px;
  }
}

/* -------------------------------------------------------------------------
   CTA flotante en móvil
   ------------------------------------------------------------------------- */
/* Barra fija inferior: visible desde que carga la página, sin esperar scroll */
.mobile-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  gap: 10px;
  padding: 9px var(--gutter) calc(9px + env(safe-area-inset-bottom));
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px -20px rgba(28, 39, 51, 0.5);
  transition: transform var(--t-base);
}

/* Solo se esconde cuando el menú móvil está abierto */
.mobile-cta.is-hidden {
  transform: translateY(110%);
}

.mobile-cta .btn--primary {
  flex: 1;
}

.mobile-cta__wa {
  width: 52px;
  padding-inline: 0;
}

/* Reserva espacio para que la barra fija no tape el footer */
@media (max-width: 899px) {
  body:has(.mobile-cta) {
    padding-bottom: calc(var(--mobile-cta-h) + env(safe-area-inset-bottom));
  }
}

@media (min-width: 900px) {
  .mobile-cta {
    display: none;
  }
}
