/* =========================================================
   WeConnect · Portada
   Héroe con un dispositivo que se transforma (móvil → web → sistema),
   servicios, movilidad y proceso. El cotizador está en quote.css.
   Se carga después de styles.css solo en index.html.
   ========================================================= */

.home .wrap { max-width: var(--max); margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.home main > section { padding-block: clamp(72px, 10vw, 128px); }
.home h1, .home h2, .home h3 { text-wrap: balance; margin: 0; }
.home h2 { font-size: clamp(30px, 4.4vw, 52px); font-weight: 700; line-height: 1.08; letter-spacing: -.02em; margin-top: 14px; }

/* Entrada de secciones: solo movimiento, nunca invisibles */
@supports (animation-timeline: view()) {
  .rise { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
  @keyframes rise { from { transform: translateY(48px) scale(.97); filter: blur(3px); } to { transform: none; filter: none; } }
}

/* ===== HERO ===== */
.home .hero { padding-block: clamp(48px, 7vw, 96px) clamp(56px, 8vw, 110px); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero-grid > * { min-width: 0; }
.hero h1 { font-size: clamp(38px, 6vw, 76px); font-weight: 800; line-height: 1.02; letter-spacing: -.03em; margin-top: 18px; }
.hero h1 .swap { display: inline-block; color: var(--primary-2); min-width: 6ch; }
.hero h1 .swap.flip { animation: flip .55s cubic-bezier(.2,.8,.2,1); }
@keyframes flip { 0% { transform: translateY(.35em) rotateX(70deg); filter: blur(4px); } 100% { transform: none; filter: none; } }
.hero .actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 32px; }
.proof { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.proof div { font-family: var(--f-mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.proof strong { display: block; font-family: var(--f-body); font-size: 28px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* Dispositivo que se transforma */
.stage { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); }
.tabs button { font: 500 13px/1 var(--f-body); color: var(--muted); background: none; border: 0; padding: 10px 16px; border-radius: 999px; cursor: pointer; transition: all .3s; }
.tabs button[aria-selected="true"] { background: var(--primary); color: #fff; }
.device {
  position: relative; width: 240px; height: 460px; max-width: 100%; border-radius: 38px;
  background: #0b1a4d; border: 2px solid rgba(160,200,255,.35);
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.7), 0 0 0 8px rgba(10,124,255,.08), inset 0 0 0 6px #050d2c;
  overflow: hidden;
  transition: width .8s cubic-bezier(.7,0,.2,1), height .8s cubic-bezier(.7,0,.2,1), border-radius .8s cubic-bezier(.7,0,.2,1);
}
.device[data-mode="web"] { width: 520px; height: 340px; border-radius: 14px; }
.device[data-mode="sys"] { width: 520px; height: 380px; border-radius: 22px; }
.screen { position: absolute; inset: 6px; border-radius: inherit; overflow: hidden; transition: opacity .45s, transform .6s, clip-path .7s cubic-bezier(.7,0,.2,1); clip-path: inset(0 0 0 0 round 32px); }
.screen:not(.active) { opacity: 0; transform: scale(1.04); clip-path: inset(0 0 100% 0 round 32px); pointer-events: none; }
.device[data-mode="web"] .screen { clip-path: inset(0 0 0 0 round 10px); }
.device[data-mode="sys"] .screen { clip-path: inset(0 0 0 0 round 18px); }

/* móvil */
.s-mobile { background: #e8f0fb; color: #0c1b33; }
.s-mobile .top { height: 34px; display: flex; justify-content: center; align-items: center; }
.s-mobile .top i { width: 70px; height: 18px; border-radius: 12px; background: #050d2c; }
.s-mobile svg { display: block; width: 100%; height: auto; }
.notif { position: absolute; left: 12px; right: 12px; bottom: 16px; background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: 0 10px 24px rgba(12,27,51,.18); font-size: 12px; line-height: 1.35; display: flex; gap: 10px; align-items: flex-start; animation: pop 4s infinite; }
.notif .dot { flex: none; width: 28px; height: 28px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; font-weight: 700; }
.notif small { display: block; color: #5d6b85; font-family: var(--f-mono); font-size: 10px; }
@keyframes pop { 0%, 10% { transform: translateY(8px); } 18%, 100% { transform: none; } }
.bus { offset-path: path("M30 250 C 60 210, 70 170, 110 160 S 170 120, 190 70"); animation: drive 6s linear infinite; }
@keyframes drive { from { offset-distance: 0%; } to { offset-distance: 100%; } }

/* web */
.s-web { background: #0d1d55; display: flex; flex-direction: column; }
.chrome { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: #07123d; border-bottom: 1px solid var(--line); }
.chrome i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.25); }
.chrome span { margin-left: 10px; flex: 1; font-family: var(--f-mono); font-size: 10px; color: var(--muted); background: rgba(255,255,255,.06); border-radius: 6px; padding: 4px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash { flex: 1; display: grid; grid-template-columns: 96px 1fr; min-height: 0; }
.dash aside { border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.dash aside b { height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); }
.dash aside b.on { background: var(--primary); }
.dash .body { padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.kpi small { font-family: var(--f-mono); font-size: 9px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; display: block; }
.kpi strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.kpi em { font-style: normal; font-size: 10px; color: var(--accent); }
.bars { flex: 1; display: flex; align-items: flex-end; gap: 6px; min-height: 60px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.bars i { flex: 1; background: linear-gradient(var(--primary-2), var(--primary)); border-radius: 4px 4px 0 0; transform-origin: bottom; animation: grow 2.4s ease-in-out infinite alternate; }
.bars i:nth-child(1) { height: 40%; }
.bars i:nth-child(2) { height: 62%; animation-delay: .2s; }
.bars i:nth-child(3) { height: 55%; animation-delay: .4s; }
.bars i:nth-child(4) { height: 80%; animation-delay: .1s; }
.bars i:nth-child(5) { height: 68%; animation-delay: .3s; }
.bars i:nth-child(6) { height: 92%; animation-delay: .5s; }
.bars i:nth-child(7) { height: 74%; animation-delay: .15s; }
.bars i:nth-child(8) { height: 86%; animation-delay: .35s; }
@keyframes grow { from { transform: scaleY(.55); } to { transform: scaleY(1); } }

/* sistema */
.s-sys { background: radial-gradient(circle at 50% 50%, #12286e, #07123d 75%); }
.s-sys svg { width: 100%; height: 100%; display: block; }
.s-sys text { font-family: var(--f-mono); font-size: 10px; fill: #d6e4ff; }
.s-sys .core-title { font-size: 12px; font-weight: 500; }
.s-sys .core-sub { font-size: 9px; fill: #cfe3ff; }
.s-sys .node rect { fill: rgba(10,124,255,.18); stroke: rgba(120,170,255,.6); }
.s-sys .core rect { fill: var(--primary); stroke: #9cc8ff; }
.s-sys .wire { stroke: rgba(120,170,255,.45); stroke-width: 1.2; fill: none; stroke-dasharray: 4 5; animation: flow 1.6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -18; } }
.caption { font-family: var(--f-mono); font-size: 12px; color: var(--muted); text-align: center; min-height: 1.6em; margin: 0; }

/* ===== SERVICIOS ===== */
.services-head { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: end; }
.svc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 48px; }
.svc-card { position: relative; min-width: 0; padding: 30px 26px 28px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow: hidden; display: flex; flex-direction: column; gap: 14px; transition: transform .35s, border-color .35s; }
.svc-card:hover { transform: translateY(-6px); border-color: rgba(61,155,255,.7); }
.svc-card::after { content: ""; position: absolute; inset: auto -40% -60% auto; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(rgba(10,124,255,.35), transparent 70%); transition: transform .5s; pointer-events: none; }
.svc-card:hover::after { transform: translate(-30px, -30px) scale(1.2); }
.svc-card .tag { font-family: var(--f-mono); font-size: 11px; color: var(--accent); letter-spacing: .12em; text-transform: uppercase; }
.svc-card h3 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.svc-card p { margin: 0; color: var(--muted); font-size: 15px; }
.svc-card ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.svc-card li { display: flex; gap: 10px; align-items: baseline; }
.svc-card li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 2px; background: var(--primary-2); transform: translateY(-2px); }
.icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: rgba(10,124,255,.16); border: 1px solid rgba(61,155,255,.4); }
.icon svg { width: 26px; height: 26px; stroke: var(--text); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.extras { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.extras span { font-size: 13px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: rgba(3,10,38,.4); }

/* ===== MOVILIDAD ===== */
.mob { display: grid; grid-template-columns: .95fr 1.05fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.mob > * { min-width: 0; }
.mstats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: 36px; border-radius: 18px; overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.mstats div { background: rgba(5,14,50,.85); padding: 22px 20px; }
.mstats strong { display: block; font-size: clamp(32px, 4vw, 44px); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--text); }
.mstats span { font-size: 13px; color: var(--muted); }
.prods { display: flex; flex-direction: column; gap: 14px; }
.prod { display: grid; grid-template-columns: auto 1fr; gap: 18px; padding: 22px; border-radius: 20px; background: var(--glass); border: 1px solid var(--line); transition: border-color .3s, transform .3s; }
.prod:hover { border-color: rgba(0,194,168,.6); transform: translateX(6px); }
.prod > div { min-width: 0; }
.badge { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; overflow: hidden; box-shadow: 0 8px 20px -8px rgba(0,0,0,.6); }
.badge img { display: block; width: 100%; height: 100%; object-fit: contain; }
.badge.tile { background: #fff; padding: 8px; }
.prod h3 { font-size: 19px; font-weight: 700; }
.prod h3 a:hover { color: var(--primary-2); }
/* Tarjeta completa clicable: el enlace del título se extiende sobre toda la tarjeta */
.prod--link { position: relative; cursor: pointer; }
.prod-link::after { content: ""; position: absolute; inset: 0; border-radius: 20px; }
.prod-link:focus-visible { outline: none; }
.prod-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 3px; }
.prod--link:hover h3 a { color: var(--primary-2); }
.prod-link .ext { font-size: .8em; color: var(--muted); transition: transform .2s, color .2s; display: inline-block; }
.prod--link:hover .ext { color: var(--primary-2); transform: translate(2px, -2px); }
.prod p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips em { font-style: normal; font-family: var(--f-mono); font-size: 11px; padding: 4px 9px; border-radius: 6px; background: rgba(10,124,255,.14); color: #bcd8ff; }

/* ===== PROCESO ===== */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 48px; position: relative; }
.steps::before { content: ""; position: absolute; left: 0; right: 0; top: 27px; height: 1px; background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: .6; }
.step { position: relative; min-width: 0; }
.step .n { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font: 600 14px/1 var(--f-mono); background: var(--ink); border: 1px solid var(--primary-2); color: var(--text); position: relative; transition: background .2s; }
.step:hover .n { background: var(--primary); }
.step h3 { font-size: 20px; margin-top: 20px; }
.step p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

/* ===== Cortina de cambio de pantalla ===== */
.curtain { position: fixed; inset: 0; z-index: 2000; display: grid; grid-template-columns: repeat(5, 1fr); pointer-events: none; }
.curtain i { background: linear-gradient(180deg, var(--primary), #0546a8); transform: scaleY(0); transform-origin: bottom; }
.curtain.in i { animation: cin .45s cubic-bezier(.7,0,.3,1) forwards; }
.curtain.out i { transform: scaleY(1); transform-origin: top; animation: cout .5s cubic-bezier(.7,0,.3,1) forwards; }
.curtain i:nth-child(2) { animation-delay: .05s !important; }
.curtain i:nth-child(3) { animation-delay: .1s !important; }
.curtain i:nth-child(4) { animation-delay: .15s !important; }
.curtain i:nth-child(5) { animation-delay: .2s !important; }
@keyframes cin { to { transform: scaleY(1); } }
@keyframes cout { to { transform: scaleY(0); } }
.curtain-label { position: fixed; inset: 0; z-index: 2001; display: grid; place-items: center; pointer-events: none; font: 700 clamp(28px, 5vw, 56px)/1 var(--f-body); color: #fff; letter-spacing: -.02em; opacity: 0; transition: opacity .2s; }
.curtain-label.show { opacity: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
  .hero-grid, .mob, .services-head { grid-template-columns: 1fr; }
  .svc { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; row-gap: 36px; }
  .steps::before { display: none; }
  .device[data-mode="web"], .device[data-mode="sys"] { width: 100%; }
}
@media (max-width: 520px) {
  .steps { grid-template-columns: 1fr; }
  .device[data-mode="web"] { height: 300px; }
  .dash { grid-template-columns: 1fr; }
  .dash aside { display: none; }
  .kpi strong { font-size: 15px; }
  .hero .actions .btn { width: 100%; }
}
