/* ==========================================================================
   VOLVER AL INICIO — control compartido
   ==========================================================================
   Antes de este archivo no existía ninguna forma de regresar a la portada
   (`index.html`) desde el editor, el planificador, el acceso ni las pantallas
   de pago. Quien entraba a `studio.html` o `planificador.html` quedaba en un
   callejón sin salida: el único camino de vuelta era el botón «atrás» del
   navegador, que en una PWA instalada ni siquiera existe.

   Se resuelve con UN archivo compartido y no con reglas repetidas en cada
   hoja: la lección ya registrada en este repositorio es que las listas
   escritas a mano dejan de corresponder al sistema y nadie vuelve a
   comprobarlas.

   Uso:
     <a class="return-home" href="index.html">…</a>               → en línea
     <a class="return-home return-home--float" href="index.html">  → flotante
   ========================================================================== */

.return-home {
  /* Cada superficie reescribe estas tres variables; el valor por defecto es
     para fondos claros (la portada y las páginas legales). */
  --rh-fg: var(--text-muted, #6b6459);
  --rh-fg-hover: var(--text-primary, #2c2620);
  --rh-bg-hover: rgba(197, 160, 89, 0.12);

  display: inline-flex;
  align-items: center;
  gap: 8px;
  /* 44px de alto mínimo: área táctil recomendada por WCAG 2.5.8 y la que ya
     usa el resto de controles del proyecto. Por debajo de 36px el tap falla
     en Android con regularidad. */
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;

  font-family: var(--font-sans, "Inter", system-ui, sans-serif);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--rh-fg);

  cursor: pointer;
  /* Sin esto el primer tap en iOS/Android se consume como hover y el enlace
     parece muerto. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.return-home:hover,
.return-home:focus-visible {
  color: var(--rh-fg-hover);
  background: var(--rh-bg-hover);
}

.return-home:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.return-home__arrow {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  transition: transform 160ms ease;
}

.return-home:hover .return-home__arrow,
.return-home:focus-visible .return-home__arrow {
  transform: translateX(-3px);
}

/* --------------------------------------------------------------------------
   Variante flotante — para pantallas sin cabecera propia (acceso, entrega,
   pago y la invitación de demostración). Se ancla arriba a la izquierda
   respetando el notch y la barra de estado.
   -------------------------------------------------------------------------- */
.return-home--float {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: calc(14px + env(safe-area-inset-left, 0px));
  z-index: 400;
  background: rgba(20, 18, 16, 0.62);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.return-home--float:hover,
.return-home--float:focus-visible {
  background: rgba(20, 18, 16, 0.86);
  color: #fff;
  border-color: rgba(212, 175, 55, 0.55);
}

/* --------------------------------------------------------------------------
   Visibilidad según contexto.
   `data-invitation-guest` lo pone `js/invitation-bootstrap.js` cuando la URL
   trae un pase real (`?id=`, `?code=`, `?nombre=`). Un invitado NO debe
   encontrarse un enlace al sitio comercial dentro de la invitación de los
   novios: ahí el control se retira.
   -------------------------------------------------------------------------- */
.return-home[hidden] {
  display: none !important;
}

html[data-invitation-guest] .return-home--invitation {
  display: none !important;
}

/* Dentro del iframe de vista previa del Studio el control sobra: el editor ya
   tiene su propia barra y el enlace navegaría el iframe, no la aplicación. */
html.in-preview-iframe .return-home--invitation,
html.in-preview-iframe .return-home--float {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .return-home,
  .return-home__arrow {
    transition: none;
  }
  .return-home:hover .return-home__arrow,
  .return-home:focus-visible .return-home__arrow {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Variante «marca clicable» — Studio y planificador.
   En estas dos superficies el retorno se integra en la marca, que ya ocupaba
   ese hueco. Se expande el área táctil con padding y margen negativo para no
   mover ni un píxel del layout existente.
   -------------------------------------------------------------------------- */
.brand-home,
.pl-brand__home {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* Área táctil de 44px sin alterar el flujo: el padding crece, el margen
     negativo lo compensa, la caja visible no se mueve. */
  padding: 10px 8px;
  margin: -10px -8px;
  border-radius: 10px;
  transition: opacity 160ms ease, background-color 160ms ease;
}

.brand-home:hover,
.brand-home:focus-visible,
.pl-brand__home:hover,
.pl-brand__home:focus-visible {
  opacity: 0.75;
}

.brand-home:focus-visible,
.pl-brand__home:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  opacity: 1;
}

.brand-home {
  gap: 10px;
}

.brand-home__arrow {
  display: inline-block;
  font-size: 17px;
  line-height: 1;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

/* La flecha aparece al pasar el cursor… */
.brand-home:hover .brand-home__arrow,
.brand-home:focus-visible .brand-home__arrow {
  opacity: 0.7;
  transform: translateX(0);
}

/* …pero en pantallas táctiles no hay hover: si la flecha no se ve siempre, el
   enlace es invisible y el usuario vuelve al problema original. */
@media (hover: none) {
  .brand-home__arrow {
    opacity: 0.55;
    transform: none;
  }
}

.pl-brand__home {
  gap: 6px;
  /* La línea de firma mide 39px con su padding, por debajo del mínimo táctil.
     Se fija la altura a 44px y se compensa con margen negativo para que la
     caja visible no se mueva. */
  min-height: 44px;
  padding-block: 12px;
  margin-block: -12px;
}

@media (prefers-reduced-motion: reduce) {
  .brand-home,
  .brand-home__arrow,
  .pl-brand__home {
    transition: none;
  }
}

