/* ===== Tokens (basados en marca/pia-brand.css) ===== */
:root {
  --bg: var(--pia-blanco);
  --bg-alt: #EEF2F7;
  --surface: #ffffff;
  --text: var(--pia-noche);
  --muted: var(--pia-gris-oscuro);
  --border: #E2E8F0;
  --primary: var(--pia-azul);      /* fondos de botones, la "P", acentos */
  --primary-text: var(--pia-azul); /* acento usado como texto */
  --primary-soft: #E0F2FE;
  --puntos: var(--pia-puntos-claro);
  --shadow: 0 10px 30px rgba(11, 18, 32, .07);
  --radius: 16px;
}
[data-theme="dark"] {
  --bg: var(--pia-noche);
  --bg-alt: #0F1829;
  --surface: #131D30;
  --text: var(--pia-texto-claro);
  --muted: var(--pia-gris-claro);
  --border: #1F2C44;
  --primary-text: #38BDF8;         /* más claro para que se lea sobre fondo oscuro */
  --primary-soft: rgba(2, 132, 199, .16);
  --puntos: var(--pia-puntos-oscuro);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

/* ===== Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--pia-font-base), system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
.container { width: min(1140px, 100% - 32px); margin-inline: auto; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -.01em; font-weight: 600; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.5rem); }
h3 { font-size: 1.15rem; }
em { font-style: normal; color: var(--primary-text); }
.eyebrow {
  display: inline-block; font-size: .75rem; font-weight: 500; letter-spacing: .28em;
  text-transform: uppercase; color: var(--primary-text); margin-bottom: 16px;
}
/* Grilla de puntos de la marca */
.grilla {
  background-image: radial-gradient(var(--puntos) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
}
.lead { font-size: 1.15rem; color: var(--muted); margin: 20px 0 28px; max-width: 560px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600;
  padding: 14px 24px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; font-size: 1rem; font-family: inherit; transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn--primary:hover { background: #0369A1; }
.btn--ghost { border-color: var(--border); background: var(--surface); }
.btn--sm { padding: 10px 18px; font-size: .9rem; }

/* ===== Header ===== */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.logo { font-size: 30px; --pia-secundario: var(--muted); }
.logo .pia-logo__bajada { font-size: 8px; }
.footer__logo { display: inline-block; }
.logo-img { display: block; width: 160px; height: auto; }
.logo-img--oscuro, [data-theme="dark"] .logo-img--claro { display: none; }
[data-theme="dark"] .logo-img--oscuro { display: block; }
.nav { display: flex; align-items: center; gap: 28px; font-weight: 500; white-space: nowrap; }
.nav a:not(.btn) { color: var(--muted); transition: color .2s; }
.nav a:not(.btn):hover { color: var(--text); }
.header__actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 1.1rem;
}
.menu-btn { display: none; }
.lang-btn { font-family: inherit; font-size: .8rem; font-weight: 600; letter-spacing: .04em; }

/* ===== Hero ===== */
.hero { padding: 80px 0 100px; position: relative; overflow: hidden; }

.hero__inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 60px; align-items: center; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__visual { position: relative; }

.dash { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.dash__head { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot--r { background: #f87171; } .dot--y { background: #fbbf24; } .dot--g { background: #34d399; }
.dash__title { margin-left: 10px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.dash__status { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--primary-text); margin-bottom: 16px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.dash__kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--bg-alt); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.kpi__label { font-size: .75rem; color: var(--muted); }
.kpi__value { font-size: 1.5rem; font-weight: 600; }
.kpi__delta { font-size: .7rem; color: #10b981; }
.dash__chart { display: flex; align-items: flex-end; gap: 8px; height: 130px; margin-top: 18px; padding: 10px; background: var(--bg-alt); border-radius: 12px; }
.dash__chart span { flex: 1; height: var(--h); border-radius: 6px 6px 2px 2px; background: var(--primary); animation: grow 1s ease-out both; }
@keyframes grow { from { height: 0; } }
.dash__foot { font-size: .7rem; color: var(--muted); text-align: right; margin-top: 8px; }
.float-badge {
  position: absolute; top: -18px; right: -12px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: .85rem;
  animation: float 4s ease-in-out infinite;
}
.float-badge--2 { top: auto; bottom: -20px; right: auto; left: -20px; animation-delay: -2s; }
@keyframes float { 50% { transform: translateY(-8px); } }

/* ===== Sections ===== */
.section { padding: 100px 0; }
.section--alt { background: var(--bg-alt); }
.section__head { text-align: center; max-width: 720px; margin: 0 auto 56px; }
.section__head p { color: var(--muted); margin-top: 16px; font-size: 1.05rem; }

.grid { display: grid; gap: 20px; }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card__icon {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem;
  background: var(--primary-soft); margin-bottom: 16px;
}
.card p { color: var(--muted); margin-top: 8px; font-size: .95rem; }

/* Steps */
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: s; position: relative; }
.steps::before {
  content: ""; position: absolute; top: 28px; left: 16%; right: 16%; height: 2px;
  background: var(--primary); opacity: .3;
}
.step { text-align: center; padding: 0 12px; position: relative; }
.step__num {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px;
  font-weight: 600; font-size: 1.3rem; color: #fff; background: var(--primary);
  box-shadow: 0 0 0 8px var(--bg-alt);
}
.step p { color: var(--muted); margin-top: 8px; }

/* Services */
.service { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; padding: 36px 0; }
.service + .service { border-top: 1px solid var(--border); }
.service--rev .service__text { order: 2; }
.service__text h3 { font-size: 1.6rem; margin: 14px 0 12px; }
.service__text p, .list { color: var(--muted); }
.list { padding-left: 20px; display: grid; gap: 8px; }
.tag { display: inline-block; font-size: .85rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-alt); }
.service__visual {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius);
  min-height: 220px; display: grid; place-items: center; padding: 28px;
}
.flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.flow span { background: var(--surface); border: 1px solid var(--border); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); }
.flow i { font-style: normal; color: var(--primary-text); font-weight: 700; }
.chat { width: 100%; max-width: 320px; display: grid; gap: 10px; }
.chat__msg { padding: 10px 14px; border-radius: 14px; font-size: .9rem; max-width: 85%; }
.chat__msg--in { background: var(--surface); border: 1px solid var(--border); }
.chat__msg--out { background: #dcf8c6; color: #0f1b2d; justify-self: end; }
.cam { position: relative; width: 100%; max-width: 320px; height: 170px; border-radius: 12px; background: repeating-linear-gradient(90deg, var(--surface) 0 40px, var(--bg-alt) 40px 80px); border: 1px solid var(--border); overflow: hidden; }
.cam__box { position: absolute; left: 30px; top: 40px; width: 90px; height: 70px; border: 2px solid var(--primary); border-radius: 6px; font-size: .75rem; font-weight: 700; color: var(--primary-text); padding: 2px 6px; animation: slide 4s linear infinite; }
.cam__box--2 { animation-delay: -2s; }
@keyframes slide { from { left: -100px; } to { left: 340px; } }
.cam__label { position: absolute; right: 10px; bottom: 10px; background: var(--text); color: var(--bg); font-size: .75rem; font-weight: 700; padding: 4px 8px; border-radius: 6px; }
/* Mini tablero de KPIs (servicio "Seguimiento con indicadores") */
.kpi-board { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; }
.kpi-board__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.kpi-board__head b { font-size: .9rem; }
.kpi-board__head span, .kpi-board__legend { font-size: .72rem; color: var(--muted); }
.kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.kpi-row > div { display: grid; }
.kpi-row__label { font-size: .78rem; color: var(--muted); }
.kpi-row__value { font-size: 1.35rem; font-weight: 600; line-height: 1.2; }
.kpi-row__meta { font-size: .7rem; color: var(--muted); }
.kpi-row__meta--ok { color: #10b981; font-weight: 600; }
.spark { width: 130px; height: 44px; flex-shrink: 0; overflow: visible; }
.spark polyline { fill: none; stroke: var(--primary-text); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; }
.spark circle { fill: var(--primary-text); }
.spark__meta { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: .55; }
.reveal.visible .spark polyline { animation: draw 1.4s ease-out both; }
@keyframes draw { from { stroke-dashoffset: 1; } }
.kpi-board__legend { display: flex; align-items: center; gap: 6px; padding-top: 10px; }
.key { width: 14px; height: 2.5px; border-radius: 2px; background: var(--primary-text); }
.key--meta { margin-left: 10px; background: repeating-linear-gradient(90deg, var(--muted) 0 3px, transparent 3px 6px); opacity: .7; }

/* Team */
.team { max-width: 760px; text-align: center; }
.team__text p { color: var(--muted); margin-top: 16px; }
.team__people { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.person { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; text-align: center; }
.person p { color: var(--muted); font-size: .9rem; }
.avatar {
  width: 80px; height: 80px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center;
  font-size: 2rem; font-weight: 600; color: #fff; background: var(--primary);
}
.avatar--2 { background: var(--pia-noche); }
.team__skills { grid-column: 1 / -1; text-align: center; font-size: .9rem; color: var(--muted); }

/* Contact */
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.contact__info > p { color: var(--muted); margin-top: 16px; }
.contact__items { list-style: none; margin-top: 32px; display: grid; gap: 18px; }
.contact__items li { display: flex; gap: 14px; align-items: center; }
.contact__items li > span { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-alt); border: 1px solid var(--border); }
.contact__items b { display: block; font-size: .85rem; }
.contact__items div { color: var(--muted); }
.form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; }
.form input, .form textarea {
  font: inherit; font-weight: 400; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); resize: vertical;
}
.form input:focus, .form textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
.form__ok { color: #10b981; font-weight: 600; }
.form__error { color: #ef4444; font-weight: 600; }
.form__trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form button:disabled { opacity: .7; cursor: wait; transform: none; }

/* Footer */
.footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 56px 0 24px; }
.footer__inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.footer__inner p { color: var(--muted); margin-top: 14px; max-width: 380px; font-size: .95rem; }
.footer__inner .footer__ubicacion { margin-top: 6px; }
.footer h4 { margin-bottom: 12px; font-size: .75rem; font-weight: 500; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); }
.footer__inner a:not(.footer__logo) { display: block; color: var(--muted); margin-bottom: 8px; font-size: .95rem; }
.footer__inner a:hover { color: var(--text); }
.footer__bottom { border-top: 1px solid var(--border); margin-top: 40px; padding-top: 20px; font-size: .85rem; color: var(--muted); }

/* Globo flotante de WhatsApp */
.wpp-flotante {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: #25D366; color: #fff; box-shadow: 0 8px 24px rgba(11, 18, 32, .25);
  transition: transform .2s, box-shadow .2s;
}
.wpp-flotante svg { width: 30px; height: 30px; }
.wpp-flotante:hover { transform: scale(1.08); box-shadow: 0 10px 28px rgba(11, 18, 32, .32); }
.wpp-flotante:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation: none !important; }
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .hero__inner, .contact, .service { grid-template-columns: 1fr; }
  .service--rev .service__text { order: 0; }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .hero__visual { max-width: 520px; margin: 0 auto; width: 100%; }
}
/* El menú pasa a hamburguesa antes de que los links se partan en dos renglones */
@media (max-width: 900px) {
  .menu-btn { display: block; }
  .nav {
    position: absolute; top: 70px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 16px 16px; display: none;
  }
  .nav.open { display: flex; }
  .nav a:not(.btn) { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .nav .btn { margin-top: 12px; justify-content: center; }
}
@media (max-width: 760px) {
  .steps { grid-template-columns: 1fr; gap: 36px; }
  .steps::before { display: none; }
  .section { padding: 72px 0; }
  .hero { padding: 48px 0 72px; }
  .footer__inner { grid-template-columns: 1fr; }
  .float-badge { right: 0; } .float-badge--2 { left: 0; }
  .wpp-flotante { right: 16px; bottom: 16px; width: 54px; height: 54px; }
}
@media (max-width: 520px) {
  .grid--4 { grid-template-columns: 1fr; }
  .dash__kpis { grid-template-columns: 1fr 1fr; }
  .dash__kpis .kpi:last-child { display: none; }
  .spark { width: 100px; }
}
