/* ============================================================
   ESTUDIO CASCALES — styles.css
   Estilos mobile-first, sistema de grillas simple, sin frameworks.
   Modo claro y modo oscuro mediante variables CSS + [data-theme="dark"].

   Marca (fijada en ambos temas):
   - Violeta periwinkle plano : #63669d (--brand-bg, medido del logo)
     header, hero y footer SIEMPRE usan --brand-bg (fondo real del logo).
   Paleta:
   - Violeta / lavanda        : #6d6d9e (claro), #8b8cc6 (oscuro)
   - Plateado metálico        : #c7c9d1, #9a9bb5 (acentos)
   - Fondos de contenido      : #f5f5f7 (claro), #12121f (oscuro)
   ============================================================ */

/* ============ TEMA CLARO (por defecto) ============ */
:root {
  color-scheme: light;

  /* Marca — fondo real del logo; NO se redefine en modo oscuro */
  --brand-bg: #63669d;

  --violeta: #6d6d9e;
  --violeta-claro: #6d6d9e;
  --violeta-oscuro: #2b2a45;

  /* Acentos metálicos */
  --plata: #c7c9d1;
  --plata-oscura: #9a9bb5;

  /* Texto */
  --texto-oscuro: #1f1d2b;        /* texto principal */
  --texto-secundario: #4a4857;    /* párrafos y textos secundarios */
  --texto-acento: #62657f;        /* eyebrows / leads sobre fondos claros (WCAG AA) */
  --texto-sobre-violeta: #f3f4f8; /* texto sobre header/hero/footer fijos (WCAG AA) */
  --texto-seccion-oscura: #d6d7e0; /* texto secundario sobre gradientes oscuros */

  /* Fondos */
  --bg-base: #f5f5f7;              /* body y secciones claras */
  --bg-tarjeta: #ffffff;           /* cards y pilares */
  --bg-seccion-oscura-a: #2b2a45;  /* gradiente: inicio secciones oscuras */
  --bg-seccion-oscura-b: #4b4c7c;  /* gradiente: fin secciones oscuras (WCAG AA) */
  --bg-item-oscuro: rgba(255, 255, 255, 0.06);
  --icono-tarjeta: var(--plata);

  /* Bordes y sombras */
  --borde-tarjeta: #e5e5ea;
  --borde-sutil: rgba(199, 201, 209, 0.2);
  --borde-item: rgba(199, 201, 209, 0.18);
  --borde-mapa: rgba(199, 201, 209, 0.25);
  --sombra-tarjeta: 0 2px 10px rgba(31, 29, 43, 0.06);
  --sombra-tarjeta-hover: 0 10px 28px rgba(31, 29, 43, 0.12);
  --sombra-cabecera: 0 2px 12px rgba(0, 0, 0, 0.15);
  --sombra-mapa: 0 8px 30px rgba(0, 0, 0, 0.25);

  --whatsapp: #25d366;
  --whatsapp-hover: #1eb355;

  /* Tipografías */
  --fuente-titulos: 'Playfair Display', Georgia, serif;
  --fuente-texto: 'Inter', system-ui, -apple-system, sans-serif;

  /* Medidas */
  --header-alto: 72px;
  --contenedor-max: 1120px;
  --borde-radio: 12px;
}

/* ============ TEMA OSCURO ============ */
html[data-theme="dark"] {
  color-scheme: dark;

  /* --brand-bg NO se redefine: header/hero/footer mantienen el fondo del logo */
  --violeta: #8b8cc6;
  --violeta-claro: #9a9bd2;
  --violeta-oscuro: #b9bce0;

  --plata: #c7c9d1;
  --plata-oscura: #9aa0bd;

  --texto-oscuro: #eceef6;
  --texto-secundario: #b3b7cc;
  --texto-acento: #9aa0bd;
  --texto-sobre-violeta: #f3f4f8;
  --texto-seccion-oscura: #d6d7e0;

  --bg-base: #12121f;
  --bg-tarjeta: #1c1c30;
  --bg-seccion-oscura-a: #16162b;
  --bg-seccion-oscura-b: #252545;
  --bg-item-oscuro: rgba(255, 255, 255, 0.07);
  --icono-tarjeta: #eef0f8;

  --borde-tarjeta: #2b2b45;
  --borde-sutil: rgba(202, 204, 220, 0.14);
  --borde-item: rgba(202, 204, 220, 0.16);
  --borde-mapa: rgba(202, 204, 220, 0.18);
  --sombra-tarjeta: 0 2px 10px rgba(0, 0, 0, 0.45);
  --sombra-tarjeta-hover: 0 10px 28px rgba(0, 0, 0, 0.55);
  --sombra-cabecera: 0 2px 12px rgba(0, 0, 0, 0.45);
  --sombra-mapa: 0 8px 30px rgba(0, 0, 0, 0.6);
}

/* ============ RESET / BASE ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Compensa la altura del header fijo al navegar por anclas */
  scroll-padding-top: calc(var(--header-alto) + 10px);
}

body {
  font-family: var(--fuente-texto);
  font-size: 16px;
  line-height: 1.6;
  color: var(--texto-oscuro);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease, color 0.35s ease;
}

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

/* Difumina el borde del recuadro cuadrado del logo contra el fondo de la
   sección: se oculta el pixel más externo de la imagen y se deja ver el
   --brand-bg de la sección (1px), por si hubiera 1-2 unidades de diferencia. */
.header__logo,
.hero__logo,
.footer__logo {
  border: 1px solid transparent;
  -webkit-mask: linear-gradient(#000 0 0) content-box;
          mask: linear-gradient(#000 0 0) content-box;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

.container {
  width: min(100% - 2.5rem, var(--contenedor-max));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2.5rem, 720px);
}

/* ============ BOTONES ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-family: var(--fuente-texto);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--whatsapp {
  background: var(--whatsapp);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.35);
}

.btn--whatsapp:hover {
  background: var(--whatsapp-hover);
}

.btn--sm {
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
}

.btn--hero {
  font-size: 1.05rem;
  padding: 0.9rem 2rem;
}

/* ============ HEADER FIJO ============ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-alto);
  background-color: var(--brand-bg);
  box-shadow: var(--sombra-cabecera);
  transition: background-color 0.35s ease;
}

.header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Switch de tema claro/oscuro */
.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--borde-sutil);
  border-radius: 50%;
  color: var(--plata);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  color: #fff;
  border-color: var(--plata);
  transform: translateY(-1px);
}

.theme-toggle__icon {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

html:not([data-theme="dark"]) .theme-toggle__icon--sun,
html[data-theme="dark"] .theme-toggle__icon--moon {
  opacity: 1;
  transform: none;
}

.header__logo {
  height: 52px;
  width: auto;
}

/* Navegación: por defecto (mobile) desplegable */
.nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;

  position: absolute;
  top: var(--header-alto);
  left: 0;
  right: 0;

  padding: 1.5rem 1.25rem 2rem;
  background-color: var(--brand-bg);
  border-top: 1px solid var(--borde-sutil);

  /* Estado cerrado por defecto */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s,
              background-color 0.35s ease, border-color 0.35s ease;
}

.nav.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.nav__link {
  color: var(--texto-sobre-violeta);
  font-weight: 500;
  font-size: 1.05rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav__link:hover {
  color: #fff;
  border-bottom-color: var(--plata);
}

/* Botón hamburguesa */
.nav__toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 110;
}

.nav__toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--plata);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============ SECCIONES GENERICAS ============ */
.section {
  padding: 4.5rem 0;
}

.section__eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--texto-acento);
  margin-bottom: 0.5rem;
}

.section__eyebrow--light {
  color: var(--plata);
}

.section__title {
  font-family: var(--fuente-titulos);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700;
  color: var(--texto-oscuro);
  margin-bottom: 0.75rem;
  line-height: 1.15;
}

.section__title--light {
  color: #fff;
}

.section__lead {
  max-width: 56ch;
  color: var(--texto-acento);
  margin-bottom: 2.5rem;
}

.section--dark {
  background: linear-gradient(135deg, var(--bg-seccion-oscura-a) 0%, var(--bg-seccion-oscura-b) 100%);
  color: #fff;
}

/* ============ HERO ============ */
.hero {
  padding-top: calc(var(--header-alto) + 4rem);
  padding-bottom: 4.5rem;
  background-color: var(--brand-bg);
  color: #fff;
  text-align: center;
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hero__logo {
  height: 140px;
  width: auto;
  margin-bottom: 0.5rem;
}

.hero__title {
  font-family: var(--fuente-titulos);
  font-size: clamp(2.3rem, 6vw, 3.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.hero__subtitle {
  max-width: 42ch;
  color: var(--texto-sobre-violeta);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

/* ============ SERVICIOS ============ */
.services__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.card {
  background-color: var(--bg-tarjeta);
  border-radius: var(--borde-radio);
  padding: 2rem 1.75rem;
  border: 1px solid var(--borde-tarjeta);
  box-shadow: var(--sombra-tarjeta);
  transition: transform 0.25s ease, box-shadow 0.25s ease,
              background-color 0.35s ease, border-color 0.35s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sombra-tarjeta-hover);
}

.card__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violeta-oscuro) 0%, var(--violeta) 100%);
  color: var(--icono-tarjeta);
  margin-bottom: 1.25rem;
}

.card__icon svg {
  width: 26px;
  height: 26px;
}

.card__title {
  font-family: var(--fuente-titulos);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--texto-oscuro);
  margin-bottom: 0.5rem;
}

.card__text {
  color: var(--texto-secundario);
  font-size: 0.95rem;
}

/* ============ POR QUÉ ELEGIRNOS ============ */
.why__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.why__item {
  background: var(--bg-item-oscuro);
  border: 1px solid var(--borde-item);
  border-radius: var(--borde-radio);
  padding: 1.75rem 1.5rem;
}

.why__item svg {
  width: 30px;
  height: 30px;
  color: var(--plata);
  margin-bottom: 1rem;
}

.why__item h3 {
  font-family: var(--fuente-titulos);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.why__item p {
  color: var(--texto-seccion-oscura);
  font-size: 0.95rem;
}

/* ============ NOSOTROS ============ */
.about {
  background-color: var(--bg-base);
}

.about__text {
  font-size: 1.05rem;
  color: var(--texto-secundario);
  max-width: 65ch;
}

.about__pillars {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.about__pillar {
  background-color: var(--bg-tarjeta);
  border: 1px solid var(--borde-tarjeta);
  border-radius: var(--borde-radio);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--sombra-tarjeta);
}

.about__pillar-title {
  font-family: var(--fuente-titulos);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--texto-oscuro);
  margin-bottom: 0.6rem;
}

.about__pillar-text {
  font-size: 0.98rem;
  color: var(--texto-secundario);
}

.about__values {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.about__values li {
  position: relative;
  padding-left: 1.35rem;
  font-size: 0.98rem;
  color: var(--texto-secundario);
}

.about__values li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--violeta);
}

/* ============ CONTACTO ============ */
.contact__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-top: 2.5rem;
}

.contact__list {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.contact__list li {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.contact__list svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--plata);
  margin-top: 0.2rem;
}

.contact__list strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--plata);
  margin-bottom: 0.15rem;
}

.contact__list a {
  color: #fff;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.35s ease;
}

.contact__list a:hover {
  border-bottom-color: var(--plata);
}

.contact__info {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.contact__info .btn {
  align-self: flex-start;
}

.contact__map {
  border-radius: var(--borde-radio);
  overflow: hidden;
  min-height: 320px;
  border: 1px solid var(--borde-mapa);
  box-shadow: var(--sombra-mapa);
}

.contact__map iframe {
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: block;
  border: 0;
}

/* ============ FOOTER ============ */
.footer {
  background-color: var(--brand-bg);
  color: var(--texto-sobre-violeta);
  padding: 2rem 0;
  transition: background-color 0.35s ease, color 0.35s ease;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.footer__logo {
  height: 40px;
  width: auto;
}

.footer__name {
  font-family: var(--fuente-titulos);
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.04em;
}

.footer__social {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.footer__social:hover {
  color: #fff;
}

.footer__legal {
  font-size: 0.85rem;
  color: var(--texto-sobre-violeta);
}

/* ============ BOTÓN FLOTANTE WHATSAPP ============ */
.wa-float {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--whatsapp);
  color: #fff;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
  transition: background 0.25s ease, transform 0.25s ease;
}

.wa-float:hover {
  background: var(--whatsapp-hover);
  transform: scale(1.08);
}

/* ============ TRANSICIÓN DE TEMA ============ */
.hero,
.hero__title,
.hero__subtitle,
.section__eyebrow,
.section__title,
.section__lead,
.section--dark,
.why__item,
.why__item h3,
.why__item p,
.card__title,
.card__text,
.about__text,
.about__pillar,
.about__pillar-title,
.about__pillar-text,
.about__values li,
.contact__list,
.contact__list strong,
.contact__map,
.footer__name,
.footer__social,
.footer__legal {
  transition: background-color 0.35s ease, color 0.35s ease,
              border-color 0.35s ease;
}

/* ============ TABLETS (>= 640px) ============ */
@media (min-width: 640px) {
  .services__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .why__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about__pillars {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============ DESKTOP (>= 1024px) ============ */
@media (min-width: 1024px) {
  .section {
    padding: 5.5rem 0;
  }

  .nav {
    position: static;
    flex-direction: row;
    gap: 2.75rem;
    padding: 0;
    background: none;
    border: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }

  .nav__list {
    flex-direction: row;
    gap: 2.5rem;
  }

  .nav__toggle {
    display: none;
  }

  .services__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .why__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .contact__grid {
    grid-template-columns: 1fr 1.2fr;
    align-items: stretch;
  }

  .footer__inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* ============ PANTALLAS GRANDES (>= 1440px) ============ */
@media (min-width: 1440px) {
  .hero__logo {
    height: 160px;
  }
}

/* ============ ACCESIBILIDAD ============ */
:focus-visible {
  outline: 2px solid var(--plata);
  outline-offset: 3px;
}

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

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