/* =====================================================================
   Anmar Home Solutions — capa de mejoras visuales (2026)
   Se carga DESPUÉS del CSS del build. No modifica el build original.
   Todo lo animado depende de html.ah-js (lo pone enhance.js), así que
   sin JS el sitio se ve exactamente como antes.
   ===================================================================== */

:root {
  --ah-ease: cubic-bezier(.16, 1, .3, 1);          /* expo-out */
  --ah-ease-io: cubic-bezier(.65, 0, .35, 1);
  --ah-orange: hsl(24 85% 51%);
  --ah-orange-soft: hsl(30 100% 68%);
  --ah-navy: hsl(240 51% 12%);
}

/* ---------- Lenis (smooth scroll) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Tipografía ---------- */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.font-display {
  font-kerning: normal;
  font-feature-settings: "kern", "liga", "dlig";
  letter-spacing: -0.015em;
}
h1, h2, h3, h4 { text-wrap: balance; }
p, li, blockquote { text-wrap: pretty; }

::selection { background: hsl(24 85% 51% / .85); color: #fff; }

/* Scrollbar fina con acento naranja */
html { scrollbar-color: hsl(24 85% 51% / .7) hsl(240 51% 9%); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: hsl(240 51% 9%); }
::-webkit-scrollbar-thumb { background: hsl(24 85% 51% / .6); border: 3px solid hsl(240 51% 9%); border-radius: 10px; }

/* Texto naranja en itálica → degradado vivo con brillo lento */
.font-display em.text-primary:not(:has(.ah-w)),
.font-display em.text-primary .ah-w {
  background: linear-gradient(100deg, var(--ah-orange) 0%, var(--ah-orange-soft) 35%, var(--ah-orange) 55%, hsl(18 90% 52%) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  padding: 0 .08em .12em 0;
  margin: 0 -.08em -.12em 0;
  /* un solo barrido: animar background-clip:text en bucle repinta en cada frame */
  animation: ah-sheen 2.6s var(--ah-ease-io) .8s 1 both;
}
@keyframes ah-sheen { from { background-position: 100% 0; } to { background-position: 0% 0; } }

/* =====================================================================
   DIAGRAMACIÓN DE TEXTOS (auditoría de las 7 rutas, escritorio y móvil)
   ===================================================================== */

/* 1. Cormorant usa números "old-style" por defecto: "100+" se leía "IOO+"
      y los pasos 1-5 parecían "I". Se fuerzan números de caja alta. */
.font-display { font-variant-numeric: lining-nums proportional-nums; }

/* 2. Interlineado de titulares: ajustado para que los de 2 líneas se lean como bloque */
h1.font-display:not([class*="leading-[0.95]"]) { line-height: 1.04; }
h2.font-display { line-height: 1.08; }
h3.font-display { line-height: 1.2; text-wrap: balance; }

/* 3. Párrafos: el sitio usaba 1.9 de interlineado (demasiado aireado, las líneas
      "flotaban"). Se lleva a 1.7 en texto de lectura y 1.6 en tarjetas. */
main p:not(.font-display):not(.section-tag),
main li { line-height: 1.7; }
main .glass-card p:not(.font-display) { line-height: 1.6; }
main li.flex { line-height: 1.45; }

/* 4. Textos centrados: líneas equilibradas, sin palabras sueltas ("on Google.") */
.text-center p, p.mx-auto, .text-center h1, .text-center h2 { text-wrap: balance; }

/* 5. Tarjetas angostas (servicios en 5 columnas, proceso en 5 pasos):
      texto un punto menor + guionado para evitar bordes muy dentados */
main .glass-card p.text-\[15px\] { font-size: 14.5px; hyphens: auto; -webkit-hyphens: auto; }
main .glass-card h3.font-display.text-xl { margin-bottom: .6rem; }
@media (min-width: 1024px) {
  main p.text-\[15px\].leading-relaxed { font-size: 14px; hyphens: auto; -webkit-hyphens: auto; }
}

/* 6. Portafolio: la descripción quedaba apretada y pegada a las etiquetas */
main p.text-\[14px\].text-muted-foreground.mt-1 {
  font-size: 15px;
  line-height: 1.65;
  margin-top: .75rem;
  max-width: 62ch;
}

/* 7. Comparador antes/después: ubicación casi ilegible (12 px) */
main p.font-display.text-lg.text-foreground { font-size: 1.3rem; line-height: 1.25; }
main p.text-xs.text-muted-foreground.mt-1 { font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; margin-top: .35rem; opacity: .75; }

/* 8. Blog: tarjeta del listado y artículo con medida de lectura cómoda */
main p.line-clamp-2 { line-height: 1.65; }
article p { font-size: 18px; line-height: 1.75; }
article p strong { color: hsl(0 0% 100%); font-weight: 600; }
article h2.font-display { line-height: 1.12; text-wrap: balance; }
article p.italic { font-family: "Cormorant Garamond", Georgia, serif; font-size: 21px; line-height: 1.5; }

/* 9. Footer: texto de cobertura con muy poco contraste (60 %) */
footer p.text-\[14px\] { opacity: 1; color: hsl(0 1% 86% / .8); line-height: 1.7; }
footer p.text-sm { line-height: 1.7; }

/* 10. Móvil */
@media (max-width: 639px) {
  /* etiqueta de sección partida en 2 líneas ("25+ YEARS OF PROVEN / EXCELLENCE") */
  .section-tag, html.ah-js .section-tag[data-ah-in] { font-size: 12px; letter-spacing: .14em; }
  .section-tag::before, html.ah-js .section-tag[data-ah-in]::before { width: 1.5rem; }
  /* párrafos de 18 px → 16.5 px: menos líneas, mejor ritmo */
  main p:not([class*="text-["]):not(.text-sm):not(.text-xs):not(.font-display):not(.section-tag),
  article p { font-size: 16.5px; line-height: 1.68; }
  article p.italic { font-size: 19px; }
  /* listas de 2 columnas de 165 px partían cada ítem en dos líneas */
  main ul.grid.grid-cols-2 { grid-template-columns: 1fr; gap: .7rem; }
  h1.font-display:not([class*="leading-[0.95]"]) { line-height: 1.08; }
}

/* ---------- Grano cinematográfico + barra de progreso ---------- */
/* Solo en equipos con mouse; sin mix-blend-mode (obligaba a recomponer toda la
   pantalla en cada frame de scroll). Capa propia y estática = costo casi cero. */
@media (hover: hover) and (pointer: fine) {
html.ah-js body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: .03;
  will-change: transform;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
}

#ah-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 9999;
  pointer-events: none;
  transform-origin: 0 50%;
  transform: scaleX(var(--ah-p, 0));
  background: linear-gradient(90deg, var(--ah-orange), var(--ah-orange-soft));
  box-shadow: 0 0 12px hsl(24 85% 51% / .6);
}
@supports (animation-timeline: scroll()) {
  #ah-progress { animation: ah-progress linear both; animation-timeline: scroll(root block); }
  @keyframes ah-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---------- Navegación ---------- */
nav.fixed { transition-property: all; transition-duration: .5s !important; transition-timing-function: var(--ah-ease) !important; }
nav.fixed:not(.bg-transparent) {
  background: hsl(240 51% 10% / .62) !important;
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 10px 40px -20px rgb(0 0 0 / .6);
}
nav.fixed[data-ah-hidden] { translate: 0 -100%; }

/* Logo del header: el original (72/86 px) desbordaba la barra de 80 px */
nav.fixed a[href="/"] > img {
  height: 50px !important;
  transition: height .5s var(--ah-ease) !important;
}
@media (min-width: 1024px) {
  nav.fixed a[href="/"] > img { height: 56px !important; }
  nav.fixed:not(.bg-transparent) a[href="/"] > img { height: 48px !important; }
}

/* Subrayado animado en enlaces del menú */
@media (min-width: 1024px) {
  nav a.font-body { position: relative; }
  nav a.font-body::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -6px;
    height: 1px;
    background: var(--ah-orange);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .5s var(--ah-ease);
  }
  nav a.font-body:hover::after,
  nav a.font-body.text-primary::after { transform: scaleX(1); transform-origin: left; }
}

/* ---------- Botones ---------- */
.btn-primary, .btn-secondary {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: color .4s var(--ah-ease), background-color .4s var(--ah-ease), border-color .4s var(--ah-ease),
              box-shadow .5s var(--ah-ease), translate .5s var(--ah-ease) !important;
}
.btn-primary {
  background-image: linear-gradient(120deg, hsl(24 85% 51%), hsl(18 88% 50%));
  box-shadow: 0 8px 24px -10px hsl(24 85% 51% / .65), inset 0 1px 0 rgb(255 255 255 / .18);
}
.btn-primary::after {           /* destello que cruza el botón */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / .35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .9s var(--ah-ease);
}
.btn-primary:hover { box-shadow: 0 16px 40px -12px hsl(24 85% 51% / .85), inset 0 1px 0 rgb(255 255 255 / .25); }
.btn-primary:hover::after { transform: translateX(120%); }

.btn-secondary::before {        /* relleno que entra desde la izquierda */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: hsl(0 0% 100%);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .6s var(--ah-ease);
}
.btn-secondary:hover { color: var(--ah-navy) !important; border-color: #fff !important; }
.btn-secondary:hover::before { transform: scaleX(1); transform-origin: left; }

.btn-primary:focus-visible, .btn-secondary:focus-visible {
  outline: 2px solid var(--ah-orange-soft);
  outline-offset: 3px;
}

/* ---------- Tarjetas ---------- */
.glass-card:not(.absolute):not(.fixed) { position: relative; }
.glass-card {
  transition: border-color .6s var(--ah-ease), box-shadow .6s var(--ah-ease), translate .6s var(--ah-ease), background-color .6s;
}
.glass-card:has(> img) { overflow: hidden; }
.glass-card:has(> img):hover {
  translate: 0 -6px;
  border-color: hsl(24 85% 51% / .35);
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / .7), 0 0 0 1px hsl(24 85% 51% / .12);
}
/* Reflector que sigue al cursor */
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), hsl(24 85% 51% / .12), transparent 60%);
}
.glass-card:hover::before { opacity: 1; }
.glass-card > img { transition: scale 1.2s var(--ah-ease), clip-path 1.4s var(--ah-ease), filter .8s; }
.glass-card:hover > img[data-ah-in] { scale: 1.06; }

/* Flechas "Explore →" */
a.text-primary svg { transition: translate .5s var(--ah-ease); }
a.text-primary:hover svg { translate: 4px 0; }

/* ---------- Formularios ---------- */
.input-dark {
  transition: border-color .4s var(--ah-ease), box-shadow .4s var(--ah-ease), background-color .4s !important;
}
.input-dark:hover { border-color: rgb(255 255 255 / .18); }
.input-dark:focus {
  background-color: rgb(255 255 255 / .06);
  box-shadow: 0 0 0 1px hsl(24 85% 51% / .4), 0 0 0 6px hsl(24 85% 51% / .1) !important;
}

/* ---------- Revelados que ya trae el sitio (los hace React) ----------
   El build usa "duration-600", clase que Tailwind no genera: las
   transiciones duraban 150 ms. Aquí les damos duración real + desenfoque. */
.duration-600 {
  transition-duration: 1.1s !important;
  transition-timing-function: var(--ah-ease) !important;
}
.duration-600.opacity-0 { filter: blur(10px); }

/* ---------- Revelados propios (solo con JS) ---------- */
html.ah-js [data-ah-reveal] {
  opacity: 0;
  translate: 0 28px;
  filter: blur(8px);
  transition: opacity 1s var(--ah-ease), translate 1.2s var(--ah-ease), filter 1s var(--ah-ease);
  transition-delay: var(--ah-d, 0ms);
}
html.ah-js [data-ah-reveal][data-ah-in] { opacity: 1; translate: 0 0; filter: none; }

/* Títulos palabra por palabra */
html.ah-js [data-ah-split] { animation: none !important; opacity: 1 !important; }
html.ah-js .ah-w {
  display: inline-block;
  opacity: 0;
  translate: 0 .5em;
  rotate: 2deg;
  filter: blur(10px);
  transition: opacity .9s var(--ah-ease), translate 1.1s var(--ah-ease), rotate 1.1s var(--ah-ease), filter .9s var(--ah-ease);
  transition-delay: calc(var(--i) * 55ms + var(--ah-d, 0ms));
}
html.ah-js [data-ah-in] .ah-w { opacity: 1; translate: 0 0; rotate: 0deg; filter: none; }

/* Etiquetas de sección: la línea crece y el texto se compacta */
html.ah-js .section-tag[data-ah-reveal]::before { width: 0; transition: width 1.2s var(--ah-ease) .15s; }
html.ah-js .section-tag[data-ah-reveal] { letter-spacing: .4em; transition-property: opacity, translate, filter, letter-spacing; transition-duration: 1s, 1.2s, 1s, 1.4s; }
html.ah-js .section-tag[data-ah-in]::before { width: 2rem; }
html.ah-js .section-tag[data-ah-in] { letter-spacing: .2em; }

/* Imágenes: telón que se abre + zoom out */
html.ah-js img[data-ah-img] {
  clip-path: inset(8% 8% 8% 8%);
  scale: 1.14;
  transition: clip-path 1.4s var(--ah-ease), scale 1.8s var(--ah-ease);
}
html.ah-js img[data-ah-img][data-ah-in] { clip-path: inset(0 0 0 0); scale: 1; }

/* ---------- Hero ---------- */
[data-ah-hero] > img[aria-hidden="true"] {
  animation: ah-kenburns 26s ease-in-out infinite alternate;
  will-change: scale, translate;
}
@keyframes ah-kenburns { from { scale: 1.02; } to { scale: 1.12; } }

[data-ah-hero]::after {           /* resplandor ambiental cálido */
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(40% 35% at 15% 80%, hsl(24 85% 51% / .16), transparent 70%),
    radial-gradient(35% 30% at 85% 15%, hsl(250 70% 55% / .14), transparent 70%);
  animation: ah-drift 18s ease-in-out infinite alternate;
  will-change: translate;
}
/* Hero fuera de pantalla: animaciones en pausa (enhance.js pone data-ah-off) */
[data-ah-hero][data-ah-off]::after,
[data-ah-hero][data-ah-off] > img[aria-hidden="true"] { animation-play-state: paused; }
@keyframes ah-drift { from { translate: -3% 2%; } to { translate: 3% -2%; } }

[data-ah-tilt] {
  transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .9s var(--ah-ease);
}

/* Transición entre páginas */
[data-ah-enter] { animation: ah-page-in .9s var(--ah-ease) both; }
@keyframes ah-page-in { from { opacity: 0; filter: blur(8px); translate: 0 16px; } to { opacity: 1; filter: blur(0); translate: 0 0; } }

/* ---------- Celulares y tablets: misma estética, menos costo de GPU ----------
   Los desenfoques (filter/backdrop-filter) y clip-path animados son lo más caro
   en GPUs móviles: se reemplazan por opacidad + desplazamiento (compositor). */
@media (hover: none), (pointer: coarse) {
  html.ah-js [data-ah-reveal], html.ah-js .ah-w, .duration-600.opacity-0 { filter: none !important; }
  html.ah-js .ah-w { transition-property: opacity, translate, rotate; }
  html.ah-js img[data-ah-img] { clip-path: none; scale: 1.08; opacity: 0; transition: opacity 1s var(--ah-ease), scale 1.4s var(--ah-ease); }
  html.ah-js img[data-ah-img][data-ah-in] { opacity: 1; scale: 1; }
  nav.fixed:not(.bg-transparent) { -webkit-backdrop-filter: none; backdrop-filter: none; background: hsl(240 51% 10% / .94) !important; }
  [data-ah-hero]::after { animation: none; }
  [data-ah-hero] > img[aria-hidden="true"] { animation: none; will-change: auto; }
}

/* ---------- Accesibilidad: sin movimiento si el usuario lo pide ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
  html.ah-js [data-ah-reveal], html.ah-js .ah-w, html.ah-js img[data-ah-img] { opacity: 1; translate: none; filter: none; clip-path: none; scale: none; rotate: none; }
  [data-ah-tilt] { transform: none; }
}
