/* Base común a las plantillas: reset, accesibilidad, botones, formularios, galería y lightbox.
   Los colores y fuentes vienen del tema (variables --color-* y --fuente-* en <style> del index).
   Cada plantilla añade su personalidad en su styles.css. */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-fondo);
  color: var(--color-texto);
  font-family: var(--fuente-texto);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* "anywhere": un email o nombre larguísimo se parte antes que desbordar la página. */
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--fuente-titulos);
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}

p {
  margin: 0;
}

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

a {
  color: var(--color-enlace);
}

ul,
ol {
  margin: 0;
  padding: 0;
}

:focus-visible {
  outline: 3px solid var(--color-principal);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.saltar {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--color-texto);
  color: var(--color-fondo);
}

.saltar:focus {
  top: 1rem;
}

.contenedor {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Botones ---------- */

/* Los botones no parten palabras ("Me-nú"): como mucho pasan a otra línea por los espacios. */
button,
.boton {
  overflow-wrap: normal;
}

.nav__boton {
  flex-shrink: 0;
  white-space: nowrap;
}

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.65rem 1.25rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, background-color 0.15s ease;
}

.boton:hover {
  transform: translateY(-1px);
}

.boton svg {
  flex-shrink: 0;
  width: 1.15em;
  height: 1.15em;
}

.boton--principal {
  background: var(--color-principal);
  color: var(--color-sobre-principal);
}

.boton--principal:hover {
  filter: brightness(1.08);
}

.boton--borde {
  border-color: currentColor;
  background: transparent;
  color: var(--color-texto);
}

.boton--suave {
  background: var(--color-superficie);
  border-color: var(--color-borde);
  color: var(--color-texto);
}

.boton--grande {
  min-height: 54px;
  padding: 0.85rem 1.6rem;
  font-size: 1.02rem;
}

/* ---------- Horario (tabla y lista) ---------- */

.horario {
  width: 100%;
  border-collapse: collapse;
}

.horario th,
.horario td {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--color-borde);
  text-align: left;
  vertical-align: top;
}

.horario th {
  padding-right: 1rem;
  font-weight: 600;
}

.horario td {
  color: var(--color-texto-suave);
  text-align: right;
}

.horario tr:last-child > * {
  border-bottom: 0;
}

.horario-lista {
  list-style: none;
}

.horario-lista li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--color-borde);
}

.horario-lista li:last-child {
  border-bottom: 0;
}

.horario__dias {
  font-weight: 600;
}

.horario__horas {
  color: var(--color-texto-suave);
}

/* ---------- Servicios (estructura que genera el script) ---------- */

.servicio__cabecera {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.servicio__nombre {
  min-width: 0;
}

.servicio__precio {
  flex-shrink: 0;
  font-weight: 700;
  white-space: nowrap;
}

.servicio__detalle {
  margin-top: 0.35rem;
  color: var(--color-texto-suave);
}

/* ---------- Formulario ---------- */

.formulario {
  display: grid;
  gap: 1rem;
}

.campo {
  display: grid;
  gap: 0.35rem;
}

.campo label {
  font-size: 0.92rem;
  font-weight: 600;
}

.campo input,
.campo textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--color-borde);
  border-radius: 10px;
  background: var(--color-fondo);
  color: var(--color-texto);
  font: inherit;
}

.campo textarea {
  resize: vertical;
}

.campo input:focus,
.campo textarea:focus {
  border-color: var(--color-principal);
  outline: 3px solid color-mix(in srgb, var(--color-principal) 30%, transparent);
  outline-offset: 0;
}

.campo [aria-invalid="true"] {
  border-color: #d14343;
}

.trampa {
  position: absolute;
  left: -9999px;
}

.formulario__estado {
  min-height: 1.5em;
  font-size: 0.95rem;
}

.formulario__estado.ok {
  color: #2f9e5b;
}

.formulario__estado.error {
  color: #d14343;
}

/* ---------- Galería y lightbox ---------- */

.galeria {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  list-style: none;
}

@media (min-width: 760px) {
  .galeria {
    grid-template-columns: repeat(3, 1fr);
  }
}

.galeria__enlace {
  display: block;
  overflow: hidden;
  border-radius: 12px;
}

.galeria img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.galeria__enlace:hover img {
  transform: scale(1.04);
}

.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(0 0 0 / 0.92);
  color: #fff;
}

.lightbox::backdrop {
  background: rgb(0 0 0 / 0.6);
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  max-width: min(92vw, 1400px);
  max-height: 84vh;
  border-radius: 8px;
  object-fit: contain;
}

.lightbox button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

.lightbox button:hover {
  background: rgb(255 255 255 / 0.25);
}

.lightbox__cerrar {
  top: 1rem;
  right: 1rem;
}

.lightbox__anterior {
  left: 1rem;
  top: 50%;
}

.lightbox__siguiente {
  right: 1rem;
  top: 50%;
}

.lightbox__pie {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.8;
}

/* ---------- Animación al hacer scroll (solo si comun.js la activa) ---------- */

.revelar-activo [data-revelar] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.revelar-activo [data-revelar].visible {
  opacity: 1;
  transform: none;
}

/* ---------- Pie y aviso de demo ---------- */

.creditos-fotos,
.creditos-fotos a {
  color: inherit;
  font-size: 0.85em;
  opacity: 0.75;
}

.aviso-demo {
  position: fixed;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 60;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgb(20 20 22 / 0.85);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .revelar-activo [data-revelar] {
    opacity: 1;
    transform: none;
  }
}
