/* Flink · animaciones y mejoras de experiencia.
   Todo vive aquí para no tocar el CSS compilado (styles.css).
   Se usan las propiedades individuales translate/scale para no pisar los
   transform de Tailwind (rotate, etc.). */

:root {
  --noche: #131921;
  --pizarra: #667788;
  --crema: #F6F3ED;
  --arena: #BC8F68;
  --cobre: #AC6B3E;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

::selection { background: var(--cobre); color: var(--crema); }

/* ---------- Accesibilidad ---------- */
:focus-visible { outline: 2px solid var(--arena); outline-offset: 3px; border-radius: 6px; }
.skip-link {
  position: fixed; left: 1rem; top: -4rem; z-index: 100;
  background: var(--cobre); color: var(--crema);
  padding: .75rem 1.25rem; border-radius: 999px; font-weight: 600; font-size: .875rem;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 1rem; }

/* ---------- Transición entre páginas (Chrome/Edge/Safari recientes) ---------- */
@view-transition { navigation: auto; }
header.site-header-vt { view-transition-name: site-header; }
::view-transition-old(root) { animation: vt-out .22s ease both; }
::view-transition-new(root) { animation: vt-in .38s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; translate: 0 10px; } }

/* ---------- Barra de progreso de lectura ---------- */
.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: linear-gradient(90deg, var(--cobre), var(--arena));
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  pointer-events: none;
}

/* ---------- Header ---------- */
header[class*="fixed"] { transition: background-color .3s ease, box-shadow .3s ease, backdrop-filter .3s ease; }
header[class*="fixed"] > div:first-child { transition: height .3s var(--ease); }
header.is-scrolled {
  background-color: rgba(19, 25, 33, 0.94) !important;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .7);
}
header.is-scrolled > div:first-child { height: 4rem; }
header nav a { position: relative; }
header nav a.is-active { background: rgba(102, 119, 136, .28); color: var(--crema); }
[data-mobile-nav] a.is-active { color: var(--arena); }

/* Menú móvil: aparece deslizando */
[data-mobile-nav]:not(.hidden) { animation: menu-drop .32s var(--ease) both; transform-origin: top; }
[data-mobile-nav]:not(.hidden) > * { animation: rise-sm .4s var(--ease) both; }
[data-mobile-nav]:not(.hidden) > *:nth-child(2) { animation-delay: .05s; }
[data-mobile-nav]:not(.hidden) > *:nth-child(3) { animation-delay: .1s; }
[data-mobile-nav]:not(.hidden) > *:nth-child(4) { animation-delay: .15s; }
@keyframes menu-drop { from { opacity: 0; translate: 0 -8px; } }
@keyframes rise-sm { from { opacity: 0; translate: 0 10px; } }

/* ---------- Ventana de contacto ---------- */
[data-contact-modal] { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
[data-contact-modal].flex { animation: fade-in .25s ease both; }
[data-contact-modal].flex > div { animation: pop-in .42s cubic-bezier(.2, .9, .3, 1.15) both; }
[data-contact-modal].flex > div a { animation: rise-sm .45s var(--ease) both; }
[data-contact-modal].flex > div a:nth-of-type(1) { animation-delay: .08s; }
[data-contact-modal].flex > div a:nth-of-type(2) { animation-delay: .14s; }
[data-contact-modal].flex > div a:nth-of-type(3) { animation-delay: .2s; }
[data-contact-modal].flex > div a:nth-of-type(4) { animation-delay: .26s; }
[data-contact-modal].flex > div a:nth-of-type(5) { animation-delay: .32s; }
[data-contact-modal].closing { animation: fade-out .2s ease both; }
[data-contact-modal].closing > div { animation: pop-out .2s ease both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; scale: .92; translate: 0 16px; } }
@keyframes pop-out { to { opacity: 0; scale: .96; translate: 0 8px; } }

/* ---------- Botón flotante de contacto y subir ---------- */
.fab-wrap {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 45;
  display: flex; flex-direction: column; align-items: center; gap: .65rem;
  opacity: 0; translate: 0 20px; pointer-events: none;
  transition: opacity .35s ease, translate .35s var(--ease);
}
.fab-wrap.show { opacity: 1; translate: 0 0; pointer-events: auto; }
.fab {
  display: flex; align-items: center; justify-content: center;
  width: 3.5rem; height: 3.5rem; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--cobre); color: var(--crema);
  box-shadow: 0 12px 28px -8px rgba(172, 107, 62, .75);
  transition: background-color .25s, color .25s, scale .25s var(--ease), box-shadow .25s;
}
.fab:hover { background: var(--arena); color: var(--noche); scale: 1.08; }
.fab svg { width: 1.5rem; height: 1.5rem; }
.fab-up {
  width: 2.5rem; height: 2.5rem; background: rgba(19, 25, 33, .85);
  border: 1px solid rgba(102, 119, 136, .5); color: var(--crema); box-shadow: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.fab-up svg { width: 1.1rem; height: 1.1rem; }
.fab-up:hover { background: var(--crema); color: var(--noche); }
.fab::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(188, 143, 104, .55); animation: ring 3.2s ease-out infinite; pointer-events: none;
}
.fab-up::after { display: none; }
.fab { position: relative; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(188, 143, 104, .5); } 70%, 100% { box-shadow: 0 0 0 18px rgba(188, 143, 104, 0); } }

/* ---------- Botones y enlaces ---------- */
a[class*="rounded-full"], button[class*="rounded-full"] {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, translate .25s var(--ease), box-shadow .25s ease;
}
a[class*="rounded-full"][class*="bg-cobre"]:hover,
button[class*="rounded-full"][class*="bg-cobre"]:hover {
  translate: 0 -3px; box-shadow: 0 14px 30px -12px rgba(172, 107, 62, .8);
}
a[class*="rounded-full"]:active, button[class*="rounded-full"]:active { translate: 0 0; scale: .98; }
a[class*="rounded-full"] svg, button[class*="rounded-full"] svg { transition: translate .25s var(--ease); }
a[class*="rounded-full"]:hover svg:last-child, button[class*="rounded-full"]:hover svg:last-child { translate: 4px 0; }
.group:hover svg { translate: 4px 0; }

/* ---------- Tarjetas: elevación + foco de luz que sigue al cursor ---------- */
.card-lift { transition: translate .35s var(--ease), border-color .3s ease, box-shadow .35s ease, background-color .3s ease; }
.card-lift:hover { translate: 0 -6px; box-shadow: 0 22px 40px -22px rgba(0, 0, 0, .55); }
.spot { position: relative; overflow: hidden; }
.spot > * { position: relative; }
.spot::before {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(188, 143, 104, .20), transparent 60%);
  transition: opacity .3s ease;
}
.spot:hover::before { opacity: 1; }
.spot:hover > span:first-child { scale: 1.08; rotate: -6deg; }
.spot > span:first-child { transition: scale .35s var(--ease), rotate .35s var(--ease), background-color .3s; }

/* Filas de listas: pequeño desplazamiento al pasar el cursor */
.nudge { transition: translate .3s var(--ease), background-color .3s ease; }
.nudge:hover { translate: 8px 0; }
.nudge:hover > span:first-child { color: var(--arena); }

/* Valores de la portada */
.value-row { transition: background-color .3s ease, padding-left .3s var(--ease); }
.value-row:hover { padding-left: 1rem; background: rgba(172, 107, 62, .06); }

/* ---------- Fondo ambiental del hero ---------- */
.ambient { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.ambient i {
  position: absolute; border-radius: 50%; opacity: .32;
  animation: drift 18s ease-in-out infinite alternate;
}
.ambient i:nth-child(1) { width: 34rem; height: 34rem; right: -8rem; top: 8%; background: radial-gradient(circle, rgba(172, 107, 62, .38), transparent 65%); }
.ambient i:nth-child(2) { width: 28rem; height: 28rem; left: -10rem; bottom: -6rem; background: radial-gradient(circle, rgba(102, 119, 136, .35), transparent 65%); animation-duration: 24s; animation-direction: alternate-reverse; }
@keyframes drift { to { translate: -40px 50px; scale: 1.15; } }

/* ---------- Titulares palabra por palabra ---------- */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .16em; margin-bottom: -.16em; }
.w > i { display: inline-block; font-style: normal; translate: 0 110%; }
.words-in .w > i { translate: 0 0; transition: translate .9s var(--ease); transition-delay: calc(var(--i) * 70ms + 120ms); }

/* ---------- Aparición al hacer scroll ---------- */
.rv { opacity: 0; transition: opacity .9s var(--ease) var(--d, 0ms), translate .9s var(--ease) var(--d, 0ms), scale .9s var(--ease) var(--d, 0ms), clip-path 1s var(--ease) var(--d, 0ms); }
.rv[data-rv="up"] { translate: 0 34px; }
.rv[data-rv="left"] { translate: -36px 0; }
.rv[data-rv="right"] { translate: 36px 0; }
.rv[data-rv="zoom"] { scale: .86; }
.rv[data-rv="img"] { scale: 1.06; clip-path: inset(0 0 14% 0); }
.rv[data-rv="line"] { scale: 0 1; transform-origin: left center; }
.rv.in { opacity: 1; translate: 0 0; scale: 1; }
.rv[data-rv="img"].in { clip-path: inset(0 0 0 0); }

/* ---------- Formulario ---------- */
#quote-form input, #quote-form select, #quote-form textarea { transition: border-color .25s ease, box-shadow .25s ease, background-color .25s ease; }
#quote-form input:focus, #quote-form select:focus, #quote-form textarea:focus {
  border-color: var(--arena); box-shadow: 0 0 0 4px rgba(188, 143, 104, .15); background-color: rgba(102, 119, 136, .06);
}
#quote-form .is-invalid { border-color: #d96a5a; animation: shake .4s ease; }
@keyframes shake { 20%, 60% { translate: -5px 0; } 40%, 80% { translate: 5px 0; } }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.form-actions > * { min-height: 3.5rem; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; cursor: pointer;
  border: 1px solid var(--pizarra); color: var(--crema); background: transparent;
  border-radius: 999px; padding: 0 2rem; font-weight: 600; font-size: 1rem; line-height: 1.5rem; box-sizing: border-box;
  transition: border-color .25s, background-color .25s, color .25s, translate .25s var(--ease);
}
.btn-ghost:hover { border-color: var(--crema); background: rgba(246, 243, 237, .06); translate: 0 -3px; }
.btn-ghost svg { width: 1.1rem; height: 1.1rem; }
.form-status { min-height: 1.5rem; font-size: .95rem; color: var(--arena); transition: opacity .3s; }
.form-status.error { color: #e8907f; }
@media (max-width: 639px) { .form-actions > * { width: 100%; } }

/* ---------- Respeto a quien prefiere menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0ms !important; }
  .rv { opacity: 1; translate: 0 0; scale: 1; clip-path: none; }
  .w > i { translate: 0 0; }
  .ambient { display: none; }
  @view-transition { navigation: none; }
}

/* Botón principal del hero del panel: no se parte en dos líneas */
a.w-fit[class*="rounded-full"] { white-space: nowrap; flex-shrink: 0; }
