/* =====================================================================
   COMPONENTES REUTILIZABLES
   Botones · Anotación tipo cota · Cabecera · Menú · Títulos de sección
   Listas · Animaciones reveal · Flotantes · Lightbox
   ===================================================================== */

/* ---------- Botones ---------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  min-height: 48px;
  padding: .8em 1.5em;
  border: 1.5px solid var(--btn-bd);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  line-height: 1.15;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease),
              box-shadow var(--t) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn__icon { width: 1.15em; height: 1.15em; transition: transform var(--t) var(--ease-out); }
.btn:hover .btn__icon { transform: translateX(4px); }
.btn:active { transform: translateY(1px) scale(.985); }

/* Brillo que recorre el botón principal al pasar el ratón */
.btn--primary::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .7s var(--ease-out);
}
.btn--primary:hover::after { transform: translateX(120%); }

.btn--primary {
  --btn-bg: var(--accent); --btn-fg: #fff; --btn-bd: var(--accent);
  box-shadow: 0 10px 24px -12px rgba(110,69,41,.65);
}
.btn--primary:hover { --btn-bg: var(--accent-strong); --btn-bd: var(--accent-strong); box-shadow: 0 16px 30px -14px rgba(110,69,41,.75); }

.btn--outline { --btn-fg: var(--ink); --btn-bd: var(--ink); }
.btn--outline:hover { --btn-bd: var(--ink); --btn-bg: var(--ink); --btn-fg: var(--on-dark); }

.btn--ghost-light { --btn-fg: #fff; --btn-bd: rgba(255,255,255,.55); backdrop-filter: blur(6px); background: rgba(255,255,255,.06); }
.btn--ghost-light:hover { --btn-bg: #fff; --btn-fg: var(--ink); --btn-bd: #fff; background: #fff; }

.btn--whatsapp { --btn-bg: var(--whatsapp); --btn-fg: #fff; --btn-bd: var(--whatsapp); }
.btn--whatsapp:hover { filter: brightness(.94); }

.btn--sm { min-height: 40px; padding: .6em 1.1em; font-size: .8rem; }
.btn--lg { min-height: 56px; padding: 1em 1.8em; font-size: .95rem; }
.btn--xl { min-height: 62px; padding: 1.1em 2.2em; font-size: 1.02rem; }
.btn--block { width: 100%; }

/* ---------- Anotación tipo cota de plano (eyebrow) ---------- */
.anno {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
/* Línea de cota con topes verticales: |——| */
.anno::before {
  content: "";
  width: 34px; height: 9px;
  border-inline: 1.5px solid currentColor;
  background: linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat;
  flex: none;
}
.anno--light { color: var(--accent-light); }

/* ---------- Cabeceras de sección ---------- */
.section-head { margin-bottom: clamp(36px, 5vw, 64px); }
.section-head--split {
  display: grid;
  gap: 20px 48px;
  align-items: end;
}
@media (min-width: 900px) {
  .section-head--split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}
.section-head--center { text-align: center; max-width: 760px; margin-inline: auto; }
.section-head--center .anno { justify-content: center; }
.section-title { font-size: var(--fs-xl); max-width: 20ch; }
.section-head--center .section-title { margin-inline: auto; }
.section-sub { color: var(--muted); font-size: var(--fs-md); max-width: 46ch; margin: 0; }
.section-head--center .section-sub { margin: 16px auto 0; }

.section-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: clamp(32px, 4vw, 48px); }
.section-actions--center { justify-content: center; }

.demo-note {
  margin: 22px auto 0;
  max-width: 60ch;
  text-align: center;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .02em;
  color: var(--muted);
}
.demo-note::before { content: "DEMO · "; color: var(--accent); }
.demo-note--light { color: var(--on-dark-muted); }
.demo-note--left { text-align: left; margin-left: 0; }

/* ---------- Listas de ticks ---------- */
.checklist { display: grid; gap: 12px; margin: 28px 0 34px; }
.checklist li { display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--ink); }
.checklist svg {
  width: 26px; height: 26px; padding: 5px;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
}

/* =====================================================================
   CABECERA
   ===================================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding-top: env(safe-area-inset-top, 0px);
  color: #fff;
  transition: background var(--t) var(--ease), box-shadow var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--ease);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
  transition: height var(--t) var(--ease);
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 10px 30px -20px rgba(0,0,0,.8);
  color: var(--ink);
}
.site-header.is-scrolled::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: .6; }
.site-header.is-scrolled .header__inner { height: var(--header-h-small); }

/* Logotipo (SVG en el sprite, colores por variables) */
.logo { display: inline-flex; align-items: center; color: inherit; min-width: 0; }
.brand-logo { display: block; width: auto; aspect-ratio: 1105 / 630; }
.logo .brand-logo { height: 64px; transition: height var(--t) var(--ease); }
.is-scrolled .logo .brand-logo { height: 50px; }
/* Sobre la foto de portada (cabecera transparente) y en el menú móvil: versión clara */
.site-header:not(.is-scrolled), .menu-open .site-header {
  --logo-main: var(--accent-light); --logo-text: #FFFFFF; --logo-tag: #E7DCD0;
}
@media (max-width: 480px) { .logo .brand-logo { height: 52px; } .is-scrolled .logo .brand-logo { height: 44px; } }

/* Navegación */
.nav__list { display: flex; gap: clamp(14px, 2vw, 30px); }
.nav__list a {
  position: relative;
  font-size: .9rem;
  font-weight: 600;
  padding: 8px 0;
  opacity: .92;
  transition: opacity var(--t-fast);
}
.nav__list a::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 2px;
  height: 1.5px; background: var(--accent);
  transform: scaleX(0); transform-origin: right;
  transition: transform var(--t) var(--ease-out);
}
.nav__list a:hover::after, .nav__list a.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav__list a:hover, .nav__list a.is-active { opacity: 1; }
.nav__mobile-extra { display: none; }

.header__actions { display: flex; align-items: center; gap: 12px; }

/* Hamburguesa */
.burger {
  display: none;
  width: 46px; height: 46px;
  position: relative;
  border-radius: var(--radius-sm);
  border: 1.5px solid currentColor;
  border-color: color-mix(in srgb, currentColor 35%, transparent);
}
.burger span {
  position: absolute; left: 12px; right: 12px; height: 1.8px;
  background: currentColor; border-radius: 2px;
  transition: transform var(--t) var(--ease-out), opacity var(--t-fast);
}
.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 21.5px; right: 18px; }
.burger span:nth-child(3) { top: 28px; }
.menu-open .burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-open .burger span:nth-child(2) { opacity: 0; }
.menu-open .burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 1023px) {
  .burger { display: inline-block; }
  .header__inner { height: 72px; }
  .site-header.is-scrolled .header__inner { height: 62px; }
  .nav {
    position: fixed;
    inset: 0;
    z-index: -1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: calc(96px + env(safe-area-inset-top, 0px)) var(--gutter) calc(32px + env(safe-area-inset-bottom, 0px));
    background: var(--dark);
    color: var(--on-dark);
    clip-path: inset(0 0 100% 0);
    visibility: hidden;
    transition: clip-path .6s var(--ease-out), visibility 0s linear .6s;
    overflow-y: auto;
  }
  .menu-open .nav { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path .6s var(--ease-out); }
  .menu-open .site-header { color: var(--on-dark); background: transparent; box-shadow: none; backdrop-filter: none; }
  .nav__list { flex-direction: column; gap: 0; }
  .nav__list li { border-bottom: 1px solid rgba(255,255,255,.1); }
  .nav__list a {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 0;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 6vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -.01em;
    opacity: 0; transform: translateY(16px);
    transition: opacity .5s var(--ease), transform .5s var(--ease-out);
  }
  .nav__list a::after { display: none; }
  .nav__list a::before { content: attr(data-n); order: 2; font-family: var(--font-mono); font-size: .75rem; color: var(--accent); font-weight: 500; }
  .menu-open .nav__list a { opacity: 1; transform: none; }
  .menu-open .nav__list li:nth-child(1) a { transition-delay: .12s; }
  .menu-open .nav__list li:nth-child(2) a { transition-delay: .17s; }
  .menu-open .nav__list li:nth-child(3) a { transition-delay: .22s; }
  .menu-open .nav__list li:nth-child(4) a { transition-delay: .27s; }
  .menu-open .nav__list li:nth-child(5) a { transition-delay: .32s; }
  .menu-open .nav__list li:nth-child(6) a { transition-delay: .37s; }
  .nav__mobile-extra { display: grid; gap: 18px; }
  .nav__phone { display: inline-flex; align-items: center; gap: 10px; justify-content: center; color: var(--whatsapp); font-weight: 700; }
  .nav__phone svg { width: 20px; height: 20px; }
  .menu-open { overflow: hidden; }
}
@media (max-width: 480px) {
  .header__cta { padding-inline: .8em; font-size: .72rem; letter-spacing: .04em; }
}
@media (max-width: 360px) {
  .header__cta { display: none; }
}

/* =====================================================================
   ANIMACIONES "REVEAL" (solo si JS está activo y no hay reduced motion)
   ===================================================================== */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease-out);
  transition-delay: var(--d, 0s);
}
.js .reveal--left { transform: translateX(-32px); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* Títulos: aparecen con una máscara de abajo arriba */
.js .reveal-title {
  clip-path: inset(0 0 100% 0);
  transform: translateY(24px);
  transition: clip-path 1s var(--ease-out), transform 1s var(--ease-out);
}
.js .reveal-title.is-in { clip-path: inset(0 0 -10% 0); transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal-title { opacity: 1; transform: none; clip-path: none; }
}

/* =====================================================================
   BOTÓN FLOTANTE WHATSAPP
   ===================================================================== */
.wa-float {
  position: fixed;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--whatsapp);
  color: #fff;
  box-shadow: 0 12px 28px -8px rgba(18, 140, 70, .55);
  transition: transform var(--t) var(--ease-out), opacity var(--t) var(--ease);
  animation: wa-in .8s var(--ease-out) 1.2s both;
}
.wa-float > svg { width: 30px; height: 30px; }
.wa-float::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--whatsapp);
  animation: wa-pulse 2.8s var(--ease) 2s infinite;
}
.wa-float:hover { transform: scale(1.06); }
.wa-float__tip {
  position: absolute; right: calc(100% + 12px); top: 50%;
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  font-size: .85rem; font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0; transform: translate(8px, -50%);
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t) var(--ease-out);
}
.wa-float:hover .wa-float__tip, .wa-float:focus-visible .wa-float__tip { opacity: 1; transform: translate(0, -50%); }
@keyframes wa-in { from { opacity: 0; transform: scale(.6) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes wa-pulse { 0% { transform: scale(1); opacity: .6; } 70%, 100% { transform: scale(1.5); opacity: 0; } }

/* =====================================================================
   BARRA INFERIOR MÓVIL (presupuesto siempre accesible)
   ===================================================================== */
.mobile-bar { display: none; }
@media (max-width: 767px) {
  .mobile-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    display: grid; grid-template-columns: auto 1fr; gap: 10px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -1px 0 var(--line), 0 -12px 30px -18px rgba(0,0,0,.3);
    transform: translateY(110%);
    transition: transform var(--t) var(--ease-out);
  }
  .mobile-bar.is-visible { transform: none; }
  .mobile-bar__call {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 0 16px; min-height: 48px;
    border: 1.5px solid var(--whatsapp); border-radius: var(--radius-sm);
    font-weight: 700; font-size: .9rem; color: #fff; background: var(--whatsapp);
  }
  .mobile-bar__call svg { width: 18px; height: 18px; }
  .mobile-bar__cta { min-height: 48px; }
  /* La barra inferior ya incluye WhatsApp: se oculta el botón flotante mientras está visible */
  body.has-mobile-bar .wa-float { opacity: 0; transform: scale(.6); pointer-events: none; }
  .wa-float { width: 54px; height: 54px; }
  .wa-float__tip { display: none; }
}

/* =====================================================================
   LIGHTBOX
   ===================================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: max(24px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px));
  background: rgba(14, 15, 16, .94);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}
.lightbox.is-open { opacity: 1; }
.lightbox__figure { display: grid; justify-items: center; gap: 14px; min-width: 0; }
.lightbox__figure img {
  max-height: 80vh; max-height: 80dvh; width: auto; max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transform: scale(.96); opacity: 0;
  transition: transform .5s var(--ease-out), opacity .4s var(--ease);
}
.lightbox.is-open .lightbox__figure img.is-loaded { transform: none; opacity: 1; }
.lightbox__figure figcaption { color: var(--on-dark); font-family: var(--font-mono); font-size: .8rem; letter-spacing: .06em; text-align: center; }
.lightbox__figure figcaption b { color: var(--accent); font-weight: 500; margin-right: 8px; }
.lightbox__btn {
  width: 50px; height: 50px; display: grid; place-items: center;
  border-radius: 50%; color: #fff;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  transition: background var(--t-fast), transform var(--t-fast);
}
.lightbox__btn:hover { background: var(--accent); border-color: var(--accent); }
.lightbox__btn svg { width: 22px; height: 22px; }
.lightbox__close { position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); right: 16px; }
@media (max-width: 640px) {
  .lightbox { grid-template-columns: 1fr; padding-inline: 12px; }
  .lightbox__prev, .lightbox__next { position: absolute; bottom: max(20px, env(safe-area-inset-bottom, 0px)); }
  .lightbox__prev { left: calc(50% - 62px); }
  .lightbox__next { right: calc(50% - 62px); }
  .lightbox__figure img { max-height: 70vh; max-height: 70dvh; }
}
