/* Home — hero · Propuesta 2 (scroll-driven, without the loose pieces of Propuesta 1).
   Base rules = static stacked layout (phones, reduced motion, browsers without
   animation-timeline). The @supports block below turns on the scroll animation. */

.hp-wrap { position: relative; background: var(--bg); overflow: clip; }
.hp-stick { position: relative; max-width: 1120px; margin: 0 auto; padding: 56px 24px 72px; display: flex; flex-direction: column; gap: 40px; }
.hp-abs { position: relative; z-index: 2; }
.hp-text { max-width: 780px; display: flex; flex-direction: column; gap: 22px; }
.hp-head { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.hp-mock { z-index: 1; width: 100%; max-width: 1040px; margin: 0 auto; }
.hp-foot { display: flex; gap: 6px; justify-content: center; }

/* Brand glow behind the hero */
.hp-glow {
  position: absolute; inset: -10% -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 46% at 18% 32%, color-mix(in srgb, var(--alpha-400) 20%, transparent), transparent 70%),
    radial-gradient(34% 42% at 84% 64%, color-mix(in srgb, var(--alpha-500) 30%, transparent), transparent 70%);
  filter: blur(8px);
}

/* Eyebrow pill with a live brand dot */
.hero-pill { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; border: 1px solid color-mix(in srgb, var(--alpha-400) 35%, var(--border)); border-radius: 999px; padding: 6px 12px; background: color-mix(in srgb, var(--alpha-400) 8%, transparent); }
.hero-pill .t-eyebrow { color: var(--foreground); }
.hero-pill-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--alpha-400); }
.hero-pill-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--alpha-400); animation: pillPing 2.4s cubic-bezier(0, 0, .2, 1) 2; }
@keyframes pillPing { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(2.8); opacity: 0; } }
.hp-text .t-b1 { font-size: 20px; line-height: 30px; max-width: 560px; }

/* Product capture */
.hero-mock { position: relative; }
.hero-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mid); display: inline-block; }
.hero-float { position: absolute; right: -22px; bottom: 28px; width: 230px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; box-shadow: 0 12px 26px var(--sh); display: flex; flex-direction: column; gap: 7px; }
@media (max-width: 767.98px) { .hero-float { right: 8px; bottom: -20px; width: 180px; } .hp-text .t-b1 { font-size: 18px; line-height: 28px; } }

/* Static layout: a short entrance on load */
@keyframes hpLoad { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.hp-text { animation: hpLoad .7s cubic-bezier(.22, .61, .36, 1) both; }
.hp-head { animation: hpLoad .7s cubic-bezier(.22, .61, .36, 1) .25s both; }
.hp-mock { animation: hpLoad .8s cubic-bezier(.22, .61, .36, 1) .4s both; }
@media (prefers-reduced-motion: reduce) { .hp-text, .hp-head, .hp-mock, .hero-pill-dot::after { animation: none !important; } }

/* ---------- Scroll animation ---------- */
@keyframes hpMock {
  0%       { transform: translate(-50%, -50%) translateX(36%) perspective(1600px) rotateY(-16deg) rotateX(4deg) scale(.56); }
  55%      { transform: translate(-50%, -50%) translateX(0) perspective(1600px) rotateY(0deg) rotateX(0deg) scale(1); }
  80%, 100% { transform: translate(-50%, -50%) translateY(min(64px, 7vh)) perspective(1600px) rotateY(0deg) rotateX(0deg) scale(.78); }
}
@keyframes hpText { 0% { opacity: 1; transform: translateY(-50%); } 40%, 100% { opacity: 0; transform: translate(-60px, -50%); } }
@keyframes hpHead { 0%, 58% { opacity: 0; transform: translateY(-18px); } 78%, 100% { opacity: 1; transform: none; } }
@keyframes hpIn   { 0%, 72% { opacity: 0; transform: translateY(12px); } 88%, 100% { opacity: 1; transform: none; } }
@keyframes hpGlow { 0% { transform: translateX(-6%); opacity: .8; } 55% { transform: translateX(4%); opacity: 1; } 100% { transform: translateX(0); opacity: .6; } }

@supports (animation-timeline: view()) {
  @media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
    .hp-wrap { height: 320vh; view-timeline-name: --hp; overflow: visible; }
    .hp-stick { position: sticky; top: 70px; height: calc(100vh - 70px); max-width: none; margin: 0; padding: 0; overflow: hidden; display: block; }
    .hp-abs { position: absolute; }
    .hp-text { left: max(24px, calc((100% - 1120px) / 2)); top: 50%; width: min(540px, 44%); max-width: none; transform: translateY(-50%); }
    .hp-head { left: 0; right: 0; top: 28px; padding: 0 24px; }
    .hp-mock { left: 50%; top: 50%; width: min(1040px, 86%, calc((100vh - 330px) * 1.65)); max-width: none; margin: 0; }
    .hp-foot { left: 0; right: 0; bottom: 22px; }

    .hp-mock { animation: hpMock linear both; animation-timeline: --hp; animation-range: contain 0% contain 100%; }
    .hp-text { animation: hpText linear both; animation-timeline: --hp; animation-range: contain 0% contain 100%; }
    .hp-head { animation: hpHead linear both; animation-timeline: --hp; animation-range: contain 0% contain 100%; }
    .hp-foot, .hp-in2 { animation: hpIn linear both; animation-timeline: --hp; animation-range: contain 0% contain 100%; }
    .hp-glow { animation: hpGlow linear both; animation-timeline: --hp; animation-range: contain 0% contain 100%; }
  }
}

/* ===================== Home · rhythm details =====================
   Beats (classes from site.css): hero → backing → intro (raised, roomy) → capabilities (dense)
   → segments (raised + the Home's statement) → Qualia (brand) → closing banner. */
.h-stats .t-data { font-size: 64px; line-height: 64px; letter-spacing: -2px; font-weight: 600; }
.h-stats .stat-row { grid-template-columns: 216px minmax(0, 1fr); padding-top: 26px; padding-bottom: 26px; }
.sec--dense .cap-grid { gap: 12px; }
.sec--statement > div { gap: 64px !important; }
.h-cta { padding: 64px 56px; gap: 40px !important; }
.h-cta .t-h2 { font-size: 40px; line-height: 46px; letter-spacing: -1px; }
@media (max-width: 639.98px) {
  .h-stats .t-data { font-size: 44px; line-height: 44px; }
  .h-stats .stat-row { grid-template-columns: 140px minmax(0, 1fr); }
  .h-cta { padding: 36px 24px; }
  .h-cta .t-h2 { font-size: 28px; line-height: 34px; }
}

/* ===================== Hero · piezas (Opción 3) =====================
   Shown only where the scroll animation runs (desktop, motion allowed, scroll-timeline support).
   Each piece travels to the centre of the stage while the capture grows: --dx/--dy come from home.js. */
.hp-pieces { display: none; z-index: 1; }
.hp-wrap .hp-glow { opacity: .55; }
@keyframes pcConverge {
  0%   { transform: translate(0, 0) scale(var(--s, 1)); opacity: var(--o); }
  100% { transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(.22); opacity: 0; }
}
@supports (animation-timeline: view()) {
  @media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
    .hp-pieces { display: block; }
    .hp-pieces .pc { animation: pcConverge linear both; animation-timeline: --hp; animation-range: contain 2% contain 50%; }
  }
}

/* ===================== Hero · product views pager =====================
   Same pattern as Funcionalidades (Producto): progress segments + prev/next + counter + skip. */
.hs-slides { position: relative; aspect-ratio: 16 / 9; background: var(--faint); }
.hs-slide { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; color: var(--mid); opacity: 0; transition: opacity .45s ease; }
.hs-slide.is-active { opacity: 1; }
.hs-slide span { font-size: 12px; color: var(--txt); }
.hero-pager { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.hs-segs { display: flex; gap: 6px; }
.hs-seg { position: relative; width: 44px; height: 24px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; }
.hs-bar { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: var(--radius-full); background: color-mix(in srgb, var(--foreground) 14%, transparent); overflow: hidden; }
.hs-bar::after { content: ""; position: absolute; inset: 0; background: var(--alpha-400); transform: scaleX(0); transform-origin: left center; transition: transform .35s ease; }
.hs-seg.is-filled .hs-bar::after { transform: scaleX(1); }
.hs-seg:hover .hs-bar { background: color-mix(in srgb, var(--foreground) 24%, transparent); }
.hs-count { min-width: 56px; text-align: center; font: 500 13px/20px var(--font-sans); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.hs-skip { margin-left: 4px; }
@media (prefers-reduced-motion: reduce) { .hs-slide, .hs-bar::after { transition: none; } }
@media (max-width: 639.98px) { .hs-seg { width: 32px; } .hs-skip { width: 100%; justify-content: center; margin-left: 0; } }

/* Closing banner title at the same scale as every other banner and section title */
.h-cta .t-h2 { font-size: 32px !important; line-height: 40px !important; letter-spacing: -0.6px !important; }
@media (max-width: 639.98px) { .h-cta .t-h2 { font-size: 28px !important; line-height: 34px !important; } }

/* ===================== Home · product carousel (real screenshots) =====================
   Image size: 16:10 crop of a full 1440×900 screen, the same for the four views.
   Treatment: thin glass bezel (same glass as the brand images) with a taller top edge that
   holds the classic browser elements, rounded image, deep shadow and a soft brand glow. */
.hero-mock { isolation: isolate; }
.hero-mock::before { content: ""; position: absolute; z-index: -1; inset: 6% -6% -8% -6%; pointer-events: none;
  background: radial-gradient(50% 55% at 50% 60%, color-mix(in srgb, var(--alpha-500) 40%, transparent), transparent 72%); filter: blur(24px); }
.hm-frame { padding: 0 10px 10px; border-radius: 24px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--foreground) 10%, transparent), color-mix(in srgb, var(--foreground) 3%, transparent));
  border: 1px solid color-mix(in srgb, var(--foreground) 14%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--foreground) 14%, transparent), 0 40px 90px -40px rgb(0 0 0 / .8); }
.hm-bar { display: flex; align-items: center; height: 42px; padding: 0 6px; }
.hm-dots { display: flex; gap: 6px; }
.hm-dots i { width: 9px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--foreground) 20%, transparent); }
.hm-url { margin: 0 auto; transform: translateX(-21px); width: 34%; height: 22px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  font: 500 11px/1 var(--font-sans); color: var(--muted-foreground); background: color-mix(in srgb, var(--foreground) 6%, transparent); }
.hero-mock .hs-slides { aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; background: var(--sec-base); }
img.hs-slide { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
@media (max-width: 639.98px) {
  .hm-frame { padding: 0 6px 6px; border-radius: 16px; }
  .hm-bar { height: 30px; } .hm-dots i { width: 7px; height: 7px; } .hm-url { display: none; }
  .hero-mock .hs-slides { border-radius: 10px; }
}
/* the stage keeps the whole frame on screen: ratio of the framed 16:10 image ≈ 1.48 */
@supports (animation-timeline: view()) {
  @media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
    .hp-mock { width: min(1040px, 86%, calc((100vh - 330px) * 1.48)); }
  }
}

/* Hero → Producto transition. Start: the frame is large and anchored to the right edge, with
   roughly its last third cut off by the viewport. It then travels to the centre at its stage
   size (--hpw) and settles under the section header. */
@supports (animation-timeline: view()) {
  @media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
    .hp-mock { --hpw: min(1040px, 86%, calc((100vh - 330px) * 1.48)); width: var(--hpw); animation-name: hpMockEdge; }
  }
}
@keyframes hpMockEdge {
  0% { left: 52vw; width: min(72vw, calc((100vh - 140px) * 1.48));
       transform: translate(0, -50%) perspective(1800px) rotateY(-6deg) rotateX(2deg) scale(1); }
  55% { left: 50%; width: var(--hpw);
        transform: translate(-50%, -50%) perspective(1800px) rotateY(0deg) rotateX(0deg) scale(1); }
  80%, 100% { left: 50%; width: var(--hpw);
        transform: translate(-50%, -50%) translateY(min(64px, 7vh)) perspective(1800px) rotateY(0deg) rotateX(0deg) scale(.78); }
}

/* Round 5 · smaller hero image overall (start, stage and settled sizes) */
@supports (animation-timeline: view()) {
  @media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
    .hp-mock { --hpw: min(900px, 76%, calc((100vh - 360px) * 1.48)); width: var(--hpw); animation-name: hpMockEdge5; }
  }
}
@keyframes hpMockEdge5 {
  0% { left: 54vw; width: min(62vw, calc((100vh - 200px) * 1.48));
       transform: translate(0, -50%) perspective(1800px) rotateY(-6deg) rotateX(2deg) scale(1); }
  55% { left: 50%; width: var(--hpw);
        transform: translate(-50%, -50%) perspective(1800px) rotateY(0deg) rotateX(0deg) scale(1); }
  80%, 100% { left: 50%; width: var(--hpw);
        transform: translate(-50%, -50%) translateY(min(64px, 7vh)) perspective(1800px) rotateY(0deg) rotateX(0deg) scale(.74); }
}
