/* ==========================================================
   SOS · Componentes reutilizables
   (preloader, nav, botones, tags, cards, modal, botones flotantes)
   ========================================================== */

/* ── PRELOADER ── */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
}
.preloader__logo { position: relative; width: 120px; height: 120px; }
.preloader__logo img { width: 100%; height: 100%; border-radius: 50%; animation: breathe 1.6s var(--ease) infinite; }
.preloader__text { font-size: 12px; color: var(--text-2); }
.preloader__text .dots::after { content: ''; animation: dots 1.2s steps(4) infinite; }
.preloader__bar { width: 180px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.preloader__bar span { display: block; height: 100%; width: 0; background: var(--red); box-shadow: 0 0 12px var(--red); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(.94); } }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* ── SCROLL PROGRESS ── */
.scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 1100;
  height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--red-deep), var(--red));
  transform-origin: left; transform: scaleX(0);
  box-shadow: 0 0 10px var(--red);
}

/* ── CURSOR ── */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 9000;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1.5px solid var(--red); border-radius: 50%;
  pointer-events: none; opacity: 0;
  transition: width .25s var(--ease), height .25s var(--ease), margin .25s var(--ease), background .25s, opacity .3s;
  mix-blend-mode: screen;
}
.cursor::after { content: ''; position: absolute; top: 50%; left: 50%; width: 4px; height: 4px; margin: -2px; background: var(--red); border-radius: 50%; }
.cursor.is-active { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: var(--red-soft); }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ── NAV ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--gutter);
  transition: background .4s, border-color .4s, height .4s var(--ease), transform .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  height: 64px;
  background: rgba(10, 10, 11, .78);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-100%); }

.nav__brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.nav__logo { width: 44px; height: 44px; border-radius: 50%; transition: transform .6s var(--ease); }
.nav__brand:hover .nav__logo { transform: rotate(-20deg) scale(1.06); }
.nav__brand-text { display: flex; flex-direction: column; line-height: 1; }
.nav__brand-text strong { font-family: var(--font-display); font-size: 28px; letter-spacing: .14em; color: var(--red); font-weight: 400; }
.nav__brand-text small { font-family: var(--font-cond); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-2); margin-top: 2px; }

.nav__menu { display: flex; align-items: center; gap: 30px; }
.nav__link {
  font-family: var(--font-cond); font-size: 14px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--text-2);
  position: relative; padding: 6px 0; transition: color .25s;
}
.nav__link::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--red); transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease);
}
.nav__link:hover, .nav__link.is-active { color: var(--text); }
.nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); transform-origin: left; }

.nav__toggle { display: none; width: 44px; height: 44px; position: relative; z-index: 2; }
.nav__toggle span { position: absolute; left: 10px; right: 10px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .35s var(--ease), opacity .2s; }
.nav__toggle span:nth-child(1) { top: 15px; }
.nav__toggle span:nth-child(2) { top: 21px; }
.nav__toggle span:nth-child(3) { top: 27px; }
.nav.is-open .nav__toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav.is-open .nav__toggle span:nth-child(2) { opacity: 0; }
.nav.is-open .nav__toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── BOTONES ── */
.btn {
  --bg-btn: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 28px; border-radius: 999px;
  font-family: var(--font-cond); font-size: 15px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform .3s var(--ease), box-shadow .3s, border-color .3s, color .3s;
  white-space: nowrap;
}
.btn--primary { background: var(--red); color: #fff; box-shadow: 0 10px 30px -10px var(--red-glow); }
.btn--primary::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,.35) 50%, transparent 80%);
  transform: translateX(-120%); transition: transform .7s var(--ease);
}
.btn--primary:hover { box-shadow: 0 16px 40px -10px var(--red-glow); }
.btn--primary:hover::before { transform: translateX(120%); }
.btn--ghost { border: 1px solid var(--line-strong); color: var(--text); background: rgba(255,255,255,.02); }
.btn--ghost:hover { border-color: var(--red); color: var(--red); }
.btn--sm { padding: 10px 20px; font-size: 13px; }
.btn--block { width: 100%; }
.btn:active { transform: scale(.97); }

/* ── CHIP / TAG / BADGE ── */
.chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(255,79,85,.35); background: var(--red-soft);
  font-size: 12px; color: var(--red);
}
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 var(--red-glow); animation: ping 1.8s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 var(--red-glow); } 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--red);
  margin-bottom: 14px;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red); color: #fff; padding: 5px 12px; border-radius: 999px;
  font-family: var(--font-cond); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}

/* ── CARD con spotlight ── */
.card {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  transition: border-color .35s, transform .35s var(--ease);
}
.card:hover { border-color: rgba(255,79,85,.35); transform: translateY(-4px); }
.spotlight::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(255,79,85,.14), transparent 45%);
  opacity: 0; transition: opacity .35s;
}
.spotlight:hover::before { opacity: 1; }
.card__icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: grid; place-items: center; font-size: 24px; color: var(--red);
  background: var(--red-soft); border: 1px solid rgba(255,79,85,.25);
  margin-bottom: 20px; transition: transform .4s var(--ease), background .3s, color .3s;
}
.card:hover .card__icon { transform: rotate(-8deg) scale(1.08); background: var(--red); color: #fff; }
.card h4 { font-family: var(--font-cond); font-size: 22px; font-weight: 700; letter-spacing: .02em; margin-bottom: 8px; }
.card p { font-size: 15px; color: var(--text-2); }

/* ── MODAL ── */
.modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px; visibility: hidden; }
.modal.is-open { visibility: visible; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.75); backdrop-filter: blur(6px); opacity: 0; transition: opacity .35s; }
.modal.is-open .modal__backdrop { opacity: 1; }
.modal__box {
  position: relative; width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px;
  opacity: 0; transform: translateY(30px) scale(.97); transition: opacity .35s, transform .45s var(--ease);
}
.modal.is-open .modal__box { opacity: 1; transform: none; }
.modal__close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.6); border: 1px solid var(--line-strong); font-size: 18px;
}
.modal__close:hover { background: var(--red); }
.modal__screen {
  position: relative; aspect-ratio: 16/8; overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 50% 50%, #1d2a22 0%, #070a08 75%);
  display: grid; place-items: center;
}
.modal__screen .cam__rec { position: absolute; top: 16px; left: 18px; }
.modal__id { position: absolute; top: 16px; right: 70px; font-size: 12px; color: #9fe7c2; }
.modal__time { position: absolute; bottom: 14px; left: 18px; font-size: 12px; color: #9fe7c2; }
.modal__reticle { width: 120px; height: 120px; border: 1px solid rgba(159,231,194,.5); border-radius: 50%; position: relative; animation: breathe 2s infinite; }
.modal__reticle::before, .modal__reticle::after { content: ''; position: absolute; background: rgba(159,231,194,.5); }
.modal__reticle::before { left: 50%; top: -30px; bottom: -30px; width: 1px; }
.modal__reticle::after { top: 50%; left: -30px; right: -30px; height: 1px; }
.modal__scan-icon { position: absolute; font-size: 200px; color: rgba(159,231,194,.06); }
.modal__body { padding: 28px 30px 32px; }
.modal__body h3 { font-family: var(--font-display); font-size: 40px; font-weight: 400; letter-spacing: .03em; line-height: 1; margin-bottom: 10px; }
.modal__body p { color: var(--text-2); margin-bottom: 18px; }
.modal__specs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.modal__specs li { font-family: var(--font-mono); font-size: 12px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); }

/* ── BOTONES FLOTANTES ── */
.fab {
  position: fixed; right: 22px; z-index: 900;
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 12px 30px -8px rgba(0,0,0,.6);
  transition: transform .35s var(--ease), opacity .35s;
}
.fab:hover { transform: translateY(-4px) scale(1.05); }
.fab--wa { bottom: 22px; background: #25D366; color: #fff; }
.fab--wa svg { width: 28px; height: 28px; }
.fab--wa::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #25D366; animation: ripple 2.2s infinite; }
@keyframes ripple { from { transform: scale(1); opacity: .8; } to { transform: scale(1.6); opacity: 0; } }
.fab--top { bottom: 90px; width: 46px; height: 46px; right: 27px; background: var(--surface-2); border: 1px solid var(--line-strong); font-size: 18px; opacity: 0; pointer-events: none; transform: translateY(10px); }
.fab--top.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.fab--top:hover { background: var(--red); }

/* ── FLASH DE ALARMA ── */
.alarm-flash { position: fixed; inset: 0; z-index: 1500; pointer-events: none; box-shadow: inset 0 0 0 0 var(--red); opacity: 0; }
.alarm-flash.is-on { animation: flash .5s steps(2) 6; }
@keyframes flash { 0% { opacity: 1; box-shadow: inset 0 0 140px 30px var(--red-glow); } 100% { opacity: 0; } }

.hint { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 18px; }
