/* Estilos comunes: animaciones, comparador antes/después y panel de edición */

.js [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal="2"] { transition-delay: .12s; }
.js [data-reveal="3"] { transition-delay: .24s; }
.js [data-reveal="4"] { transition-delay: .36s; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}

[data-logo] { display: inline-block; line-height: 0; }
[data-logo] svg { width: 100%; height: 100%; }

/* Comparador antes / después */
[data-compare] { --pos: 50%; position: relative; overflow: hidden; user-select: none; }
[data-compare] .cmp-layer { position: absolute; inset: 0; }
[data-compare] .cmp-layer img { width: 100%; height: 100%; object-fit: cover; display: block; }
[data-compare] .cmp-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); z-index: 1; }
[data-compare] .cmp-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; z-index: 2; pointer-events: none; }
[data-compare] .cmp-line::after { content: "‹ ›"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; background: #fff; color: #222; display: grid; place-items: center; font: 600 18px/1 system-ui, sans-serif; box-shadow: 0 4px 18px rgba(0,0,0,.25); }
[data-compare] input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; z-index: 3; margin: 0; }
[data-compare] .cmp-tag { position: absolute; bottom: 16px; z-index: 2; padding: 6px 12px; background: rgba(0,0,0,.55); color: #fff; font: 600 11px/1 system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; border-radius: 99px; pointer-events: none; }
[data-compare] .cmp-tag--before { left: 16px; }
[data-compare] .cmp-tag--after { right: 16px; }

/* Titulares que suben desde una máscara */
.js [data-rise] { clip-path: inset(0 0 100% 0); transform: translateY(40px); transition: clip-path 1.1s cubic-bezier(.7,0,.2,1), transform 1.1s cubic-bezier(.7,0,.2,1); }
.js [data-rise].is-in { clip-path: inset(0 0 -10% 0); transform: none; }
.js [data-rise="2"] { transition-delay: .15s; }
.js [data-rise="3"] { transition-delay: .3s; }
@media (prefers-reduced-motion: reduce) { .js [data-rise] { clip-path: none; transform: none; transition: none; } }

/* Intro animada */
html.is-loading { overflow: hidden; }
.ti-pre { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; background: var(--pl-bg, #E2BC2C); color: var(--pl-fg, #fff); transition: transform 1s cubic-bezier(.8,0,.2,1); }
.ti-pre__in { text-align: center; }
.ti-pre [data-logo] { width: 120px; height: 120px; }
.ti-pre svg * { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ti-draw 1.5s cubic-bezier(.6,0,.2,1) forwards; }
.ti-pre svg path { animation-delay: .25s; animation-duration: 1.3s; }
.ti-pre__name { margin: 22px 0 0; font: 500 22px/1 "Cormorant Garamond", Georgia, serif; letter-spacing: .3em; text-transform: uppercase; color: var(--pl-name, #6E6248); opacity: 0; animation: ti-fade .8s .7s forwards; }
html.is-loaded .ti-pre { transform: translateY(-100%); }
@keyframes ti-draw { to { stroke-dashoffset: 0; } }
@keyframes ti-fade { to { opacity: 1; } }
.draw-ring svg * { stroke-dasharray: 1; stroke-dashoffset: 1; }
html.is-loaded .draw-ring svg * { animation: ti-draw 2.2s .2s cubic-bezier(.6,0,.2,1) forwards; }
.ti-editing .draw-ring svg * { stroke-dashoffset: 0; animation: none; }

/* Logo girando */
.spin svg { animation: ti-spin 60s linear infinite; }
@keyframes ti-spin { to { transform: rotate(360deg); } }

/* Presentaciones */
[data-slides] { position: relative; }
[data-slide] { transition: opacity 1.2s ease, visibility 1.2s; }
[data-slides]:not(.slides-flow) [data-slide] { position: absolute; inset: 0; opacity: 0; visibility: hidden; }
[data-slides]:not(.slides-flow) [data-slide].is-active { opacity: 1; visibility: visible; z-index: 1; }
.kenburns [data-slide] img, .kenburns [data-slide] .bg { transform: scale(1.12); transition: transform 7s linear; }
.kenburns [data-slide].is-active img, .kenburns [data-slide].is-active .bg { transform: scale(1); }
.cap-src { display: none; }
.ti-editing [data-slide].is-active .cap-src { display: block; position: absolute; top: 112px; left: 20px; z-index: 25; padding: 8px 12px; background: rgba(0,0,0,.6); color: #fff; font: 500 14px system-ui, sans-serif; border-radius: 8px; }
[data-dots] { display: flex; gap: 8px; }
[data-dots] button { width: 28px; height: 3px; padding: 0; border: 0; border-radius: 3px; background: currentColor; opacity: .35; cursor: pointer; transition: opacity .3s, width .3s; }
[data-dots] button.is-active { opacity: 1; width: 46px; }

/* Carruseles */
[data-track] { display: flex; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
[data-track]::-webkit-scrollbar { display: none; }
[data-track] > * { scroll-snap-align: start; flex: 0 0 auto; }
[data-track].is-drag { scroll-snap-type: none; cursor: grabbing; }
[data-progress] { --p: 0; height: 2px; background: rgba(0,0,0,.1); position: relative; overflow: hidden; }
[data-progress]::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 25%; background: currentColor; transform: translateX(calc(var(--p) * 300%)); }

/* Galería ampliable */
[data-lightbox] img { cursor: zoom-in; }
.ti-editing [data-lightbox] img { cursor: pointer; }
.ti-lightbox { position: fixed; inset: 0; z-index: 9500; background: rgba(15,14,12,.94); display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .3s; }
.ti-lightbox.is-open { opacity: 1; pointer-events: auto; }
.ti-lightbox img { max-width: min(1400px, 90vw); max-height: 82vh; object-fit: contain; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.ti-lightbox button { position: absolute; border: 0; background: rgba(255,255,255,.1); color: #fff; width: 54px; height: 54px; border-radius: 50%; font-size: 30px; line-height: 1; cursor: pointer; transition: background .2s; }
.ti-lightbox button:hover { background: rgba(255,255,255,.25); }
.ti-lb-close { top: 20px; right: 20px; }
.ti-lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.ti-lb-next { right: 20px; top: 50%; transform: translateY(-50%); }
.ti-lb-cap { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.8); font: 400 14px system-ui, sans-serif; letter-spacing: .06em; margin: 0; }

/* Vista previa que sigue al ratón */
[data-hover-preview] .hp-img { position: fixed; left: var(--mx, 50%); top: var(--my, 50%); width: 300px; height: 210px; margin: -105px 0 0 40px; pointer-events: none; z-index: 30; opacity: 0; transform: scale(.85) rotate(-3deg); transition: opacity .3s, transform .4s cubic-bezier(.2,.7,.2,1); overflow: hidden; border-radius: 6px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
[data-hover-preview] .hp-img img { width: 100%; height: 100%; object-fit: cover; }
[data-hover-preview] .hp-row:hover .hp-img { opacity: 1; transform: none; }
@media (hover: none), (pointer: coarse), (max-width: 1000px) { [data-hover-preview] .hp-img { display: none; } }
.ti-editing [data-hover-preview] .hp-img { position: relative; left: auto; top: auto; margin: 0; opacity: 1; transform: none; width: 140px; height: 96px; display: block; pointer-events: auto; }
.ti-editing [data-hover-preview] .hp-img .ti-img-btn { top: 6px; right: 6px; padding: 6px; }
.ti-editing [data-hover-preview] .hp-img .ti-img-btn span { display: none; }

[data-magnetic] { transition: transform .35s cubic-bezier(.2,.7,.2,1); }

/* Botón flotante de WhatsApp */
.wa-float { position: fixed; right: 22px; bottom: 22px; z-index: 60; display: flex; align-items: center; gap: 10px; padding: 0; height: 60px; border-radius: 99px; background: #25a35a; color: #fff; text-decoration: none; box-shadow: 0 12px 30px rgba(20, 110, 60, .35); font: 600 15px system-ui, sans-serif; transition: transform .3s, box-shadow .3s; }
.wa-float:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(20, 110, 60, .45); }
.wa-float svg { width: 60px; height: 60px; padding: 15px; flex: none; }
.wa-float span { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width .4s, padding .4s; }
.wa-float:hover span { max-width: 240px; padding-right: 22px; }
.wa-float::before { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(37,163,90,.5); animation: ti-pulse 2.6s infinite; }
@keyframes ti-pulse { 70% { box-shadow: 0 0 0 16px rgba(37,163,90,0); } 100% { box-shadow: 0 0 0 0 rgba(37,163,90,0); } }
.ti-editing .wa-float { display: none; }
@media (max-width: 600px) { .wa-float { right: 14px; bottom: 14px; height: 54px; } .wa-float svg { width: 54px; height: 54px; padding: 13px; } }

/* ===== Animaciones con GSAP (ti-motion.js) ===== */
.has-motion [data-reveal], .has-motion [data-rise] { transition: none; }
.has-motion .band__track, .has-motion .ticker__track { animation: none; }
html.lenis, html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto !important; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.ti-line { padding-bottom: .1em; margin-bottom: -.1em; }

.ti-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: #E2BC2C; transform-origin: 0 50%; transform: scaleX(0); z-index: 9700; pointer-events: none; }

.ti-cursor { position: fixed; left: 0; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #E2BC2C; pointer-events: none; z-index: 9600; opacity: 0; display: grid; place-items: center; transition: width .35s cubic-bezier(.2,.7,.2,1), height .35s cubic-bezier(.2,.7,.2,1), margin .35s cubic-bezier(.2,.7,.2,1), opacity .3s, background .3s, border-color .3s; border: 1px solid transparent; }
.ti-cursor.is-on { opacity: 1; }
.ti-cursor span { font: 600 12px/1 system-ui, sans-serif; letter-spacing: .08em; color: #fff; opacity: 0; transition: opacity .2s; white-space: nowrap; }
.ti-cursor.is-link { width: 48px; height: 48px; margin: -24px 0 0 -24px; background: rgba(226,188,44,.18); border-color: #E2BC2C; }
.ti-cursor.is-label { width: 86px; height: 86px; margin: -43px 0 0 -43px; background: #1d1b16; border-color: #1d1b16; }
.ti-cursor.is-label span { opacity: 1; }
@media (hover: none), (pointer: coarse) { .ti-cursor { display: none; } }

[data-pin-scroll].is-pinned [data-track] { overflow: visible; scroll-snap-type: none; cursor: default; }
[data-pin-scroll].is-pinned [data-prev], [data-pin-scroll].is-pinned [data-next] { display: none; }

/* Volver a la portada de propuestas */
.ti-back { position: fixed; left: 22px; bottom: 22px; z-index: 60; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px 0 8px; border-radius: 99px; background: #1d1b16; color: #fff; text-decoration: none; font: 600 14px system-ui, -apple-system, "Segoe UI", sans-serif; box-shadow: 0 12px 30px rgba(0,0,0,.25); transition: transform .3s, background .3s; }
.ti-back:hover { transform: translateY(-3px); background: #2d2a22; }
.ti-editing .ti-back { display: none; }
.ti-btn { text-decoration: none; }
.ti-back i { width: 36px; height: 36px; border-radius: 50%; background: #E2BC2C; color: #fff; padding: 5px; display: block; line-height: 0; transition: transform .6s; }
.ti-back:hover i { transform: rotate(-90deg); }
.ti-back b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #E2BC2C; color: #1d1b16; font-size: 19px; line-height: 1; transition: transform .3s; }
.ti-back:hover b { transform: translateX(-3px); }
.ti-back svg { width: 100%; height: 100%; }
@media (max-width: 600px) { .ti-back { left: 14px; bottom: 14px; height: 48px; font-size: 13px; padding-right: 16px; } .ti-back i { width: 32px; height: 32px; } }
@media print { .ti-back, .wa-float, .ti-progress, .ti-cursor { display: none !important; } }

/* Formularios de demostración */
[data-demo-form] .form-ok { display: none; }
[data-demo-form].is-sent .form-ok { display: block; }

/* ================= Panel de edición ================= */

.ti-editing [contenteditable] { outline: 1px dashed transparent; outline-offset: 3px; border-radius: 2px; transition: outline-color .15s, background-color .15s; cursor: text; }
.ti-editing [contenteditable]:hover { outline-color: rgba(226, 188, 44, .9); background-color: rgba(226, 188, 44, .08); }
.ti-editing [contenteditable]:focus { outline: 2px solid #E2BC2C; background-color: rgba(226, 188, 44, .12); }
.ti-editing .ti-img { outline: 2px dashed transparent; outline-offset: -2px; transition: outline-color .15s; }
.ti-editing .ti-img:hover { outline-color: rgba(226, 188, 44, .95); }
.ti-editing .ti-img img { cursor: pointer; }
.ti-editing body { padding-bottom: 96px; }

.ti-ui, .ti-ui * { box-sizing: border-box; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

.ti-img-btn { position: absolute; top: 12px; right: 12px; z-index: 20; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 0; border-radius: 99px; background: #1d1b16; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.3); opacity: .92; transition: transform .15s, background .15s; }
.ti-img-btn:hover { background: #E2BC2C; color: #1d1b16; transform: translateY(-1px); opacity: 1; }

.ti-bar { position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; bottom: 18px; z-index: 9999; display: flex; align-items: center; gap: 6px; padding: 8px; background: #1d1b16; color: #fff; border-radius: 16px; box-shadow: 0 14px 40px rgba(0,0,0,.35); max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; }
.ti-bar__status { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px; font-size: 13px; color: #cfc9b8; white-space: nowrap; }
.ti-dot { width: 9px; height: 9px; border-radius: 50%; background: #4cc38a; box-shadow: 0 0 0 3px rgba(76,195,138,.2); }
.ti-bar.is-dirty .ti-dot { background: #f2a93b; box-shadow: 0 0 0 3px rgba(242,169,59,.25); }
.ti-bar.is-dirty .ti-status { color: #f6c97a; }
.ti-bar__lang { display: flex; background: #2d2a22; border-radius: 10px; padding: 3px; }
.ti-bar__lang button { border: 0; background: transparent; color: #cfc9b8; font-size: 12px; font-weight: 700; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.ti-bar__lang button.is-active { background: #E2BC2C; color: #1d1b16; }
.ti-btn { border: 0; background: #2d2a22; color: #fff; font-size: 13px; font-weight: 600; padding: 10px 14px; border-radius: 10px; cursor: pointer; transition: background .15s, transform .15s; }
.ti-btn:hover { background: #3c382d; }
.ti-btn--primary { background: #E2BC2C; color: #1d1b16; }
.ti-btn--primary:hover { background: #f0cc45; }
.ti-btn--ghost { background: transparent; color: #cfc9b8; }

.ti-help { position: fixed; right: 18px; bottom: 96px; z-index: 9999; width: 300px; max-width: calc(100vw - 32px); padding: 20px; background: #fff; color: #1d1b16; border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.25); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s, transform .2s; }
.ti-help.is-open { opacity: 1; transform: none; pointer-events: auto; }
.ti-help strong { display: block; font-size: 16px; margin-bottom: 10px; }
.ti-help p { margin: 0 0 8px; font-size: 14px; line-height: 1.45; color: #4a463c; }
.ti-help .ti-btn { margin-top: 8px; width: 100%; }

.ti-toast { position: fixed; left: 50%; top: 20px; transform: translate(-50%, -20px); z-index: 10000; padding: 12px 18px; background: #1d1b16; color: #fff; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.3); opacity: 0; transition: opacity .25s, transform .25s; }
.ti-toast.is-in { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .ti-bar { bottom: 10px; gap: 4px; padding: 6px; border-radius: 14px; }
  .ti-bar__status { width: 100%; justify-content: center; padding: 4px 0 2px; }
  .ti-btn { padding: 9px 10px; font-size: 12px; }
  .ti-help { right: 16px; bottom: 130px; }
  .ti-editing body { padding-bottom: 130px; }
}
