/* ==========================================================================
   P9 Apps — apps.p9tech.ai · Portal de accesos a producto
   Sistema de diseño heredado de p9tech.ai
   ========================================================================== */

:root {
  --bg:            #07070b;
  --surface:       rgba(255, 255, 255, 0.035);
  --surface-2:     rgba(255, 255, 255, 0.06);
  --border:        rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text:          #f5f6f8;
  --text-2:        rgba(245, 246, 248, 0.72);
  --text-3:        rgba(245, 246, 248, 0.5);
  --text-4:        rgba(245, 246, 248, 0.32);

  --accent:        #7dd3fc;
  --accent-2:      #a78bfa;

  --grad-accent:   linear-gradient(120deg, #7dd3fc 0%, #a78bfa 50%, #f0abfc 100%);
  --grad-text:     linear-gradient(180deg, #ffffff 0%, #b8c0cc 100%);

  --maxw:          1240px;
  --pad-x:         clamp(20px, 4vw, 56px);
  --radius:        18px;
  --radius-lg:     26px;

  --ease-out:      cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--accent); color: #07070b; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ==========================================================================
   Fondo
   ========================================================================== */
.bg-stage {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(167, 139, 250, .14), transparent 60%),
    radial-gradient(1000px 700px at -10% 30%, rgba(125, 211, 252, .10), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(96, 165, 250, .10), transparent 55%),
    linear-gradient(180deg, #06060a 0%, #08080f 50%, #06060a 100%);
  overflow: hidden;
}

.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 30%, transparent 75%);
}

.bg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .5;
  pointer-events: none;
  will-change: transform;
}
.bg-orb--a {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(125,211,252,.55), transparent 70%);
  top: -140px; left: -120px;
  animation: floatA 22s ease-in-out infinite;
}
.bg-orb--b {
  width: 620px; height: 620px;
  background: radial-gradient(circle, rgba(167,139,250,.45), transparent 70%);
  bottom: -220px; right: -160px;
  animation: floatB 26s ease-in-out infinite;
}
@keyframes floatA { 0%,100% { transform: translate(0,0); } 50% { transform: translate(120px, 80px); } }
@keyframes floatB { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-90px,-60px); } }

.bg-noise {
  position: absolute; inset: 0; pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ==========================================================================
   Reveal
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .bg-orb { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   Nav
   ========================================================================== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--pad-x);
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s, padding .3s, backdrop-filter .3s;
}
.nav.is-scrolled {
  background: rgba(7, 7, 11, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom-color: var(--border);
  padding-top: 12px; padding-bottom: 12px;
}

.nav__brand { display: inline-flex; align-items: center; gap: 12px; }
.nav__mark {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: #fff; color: #07070b;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 15px;
  letter-spacing: -.02em;
  box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 8px 24px rgba(125,211,252,.18);
}
.nav__wordmark {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; letter-spacing: -.02em;
  font-size: 17px;
}
.nav__dot { color: var(--accent); }

.nav__cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
  transition: color .2s, border-color .2s, gap .2s, background .2s;
}
.nav__cta:hover { color: var(--text); border-color: #fff; background: var(--surface-2); gap: 11px; }

/* ==========================================================================
   Hero compacto
   ========================================================================== */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(130px, 18vh, 190px) var(--pad-x) clamp(40px, 6vw, 64px);
}

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px; color: var(--text-2);
  letter-spacing: .14em; text-transform: uppercase;
  font-weight: 500;
  width: max-content; max-width: 100%;
  margin-bottom: 30px;
  backdrop-filter: blur(8px);
}
.hero__eyebrow .dot {
  flex-shrink: 0;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(125,211,252,.18);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(125,211,252,.18); }
  50%     { box-shadow: 0 0 0 8px rgba(125,211,252,.06); }
}

.hero__title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: clamp(40px, 7vw, 88px);
  line-height: 1.05;
  letter-spacing: -.035em;
  margin-bottom: 26px;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__title span { display: block; padding-bottom: .06em; }
.hero__title--accent {
  background: var(--grad-accent);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-style: italic; font-weight: 500;
}

.hero__sub {
  font-size: clamp(16px, 1.4vw, 18px);
  color: var(--text-2);
  max-width: 620px;
  line-height: 1.65;
  margin-bottom: 40px;
}
.hero__sub strong { color: var(--text); font-weight: 600; }

/* ==========================================================================
   Toolbar: buscador + filtros
   ========================================================================== */
.toolbar {
  display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
/* `display:flex` gana a `hidden`, así que hay que anularlo explícitamente */
.toolbar[hidden] { display: none; }

.search {
  position: relative;
  display: flex; align-items: center;
  flex: 0 1 340px;
  min-width: 240px;
}
.search__icon {
  position: absolute; left: 15px;
  color: var(--text-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  font: inherit; font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 46px 12px 44px;
  transition: border-color .2s, background .2s;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus {
  outline: none;
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.search input::-webkit-search-cancel-button { filter: invert(1); opacity: .4; cursor: pointer; }
.search__kbd {
  position: absolute; right: 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px; color: var(--text-4);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 7px;
  pointer-events: none;
}
.search input:focus ~ .search__kbd { opacity: 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px; font-weight: 500;
  color: var(--text-3);
  transition: color .2s, border-color .2s, background .2s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active {
  color: #07070b;
  background: #fff;
  border-color: #fff;
  font-weight: 600;
}

/* ==========================================================================
   Sección
   ========================================================================== */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-x) clamp(60px, 9vw, 110px);
}
.section--cta { padding-top: clamp(20px, 4vw, 40px); }

.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  margin-bottom: 28px;
}

.kicker {
  display: inline-flex; align-items: center; gap: 14px;
  font-size: 12px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-2);
}
.kicker__n {
  display: inline-block; padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 600; letter-spacing: .1em;
}

.count {
  font-size: 12.5px; color: var(--text-4);
  letter-spacing: .1em; text-transform: uppercase;
}

/* ==========================================================================
   Grid de productos
   ========================================================================== */
.apps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 1040px) { .apps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 660px)  { .apps { grid-template-columns: 1fr; } }

.app {
  --c:  #7dd3fc;
  --c2: #a78bfa;
  position: relative;
  display: flex; flex-direction: column;
  min-height: 300px;
  padding: 28px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(255,255,255,.045), rgba(255,255,255,0) 60%);
  overflow: hidden;
  isolation: isolate;
  transition: transform .4s var(--ease-out), border-color .3s, background .3s;
}
/* Borde gradiente en hover */
.app::before {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, var(--c), transparent 45%, transparent 60%, var(--c2));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .4s;
  pointer-events: none;
}
/* Halo de color propio del producto */
.app::after {
  content: '';
  position: absolute;
  inset: auto -110px -110px auto;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 22%, transparent), transparent 65%);
  pointer-events: none; z-index: -1;
  opacity: .55;
  transition: opacity .4s, transform .4s var(--ease-out);
}
.app:hover { transform: translateY(-5px); border-color: transparent; }
.app:hover::before { opacity: 1; }
.app:hover::after  { opacity: 1; transform: scale(1.12); }
.app:focus-within { border-color: transparent; }
.app:focus-within::before { opacity: 1; }

/* Enlace que cubre toda la tarjeta */
.app__hit {
  position: absolute; inset: 0;
  z-index: 2;
  border-radius: inherit;
}

.app__top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.app__icon {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--c) 20%, transparent),
    color-mix(in srgb, var(--c2) 14%, transparent));
  color: var(--c);
  transition: transform .35s var(--ease-out);
}
.app__icon svg { width: 23px; height: 23px; }
.app:hover .app__icon { transform: scale(1.06) rotate(-3deg); }

.app__status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  white-space: nowrap;
}
.app__status::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.app__status--live {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, .3);
  background: rgba(110, 231, 183, .08);
}
.app__status--soon {
  color: var(--text-4);
  background: var(--surface);
}

.app__name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(24px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin-bottom: 8px;
}
.app__tag {
  display: inline-block;
  font-size: 11.5px; color: var(--c);
  letter-spacing: .14em; text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 16px;
}
.app__desc {
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.app__go {
  display: inline-flex; align-items: center; gap: 8px;
  width: fit-content;
  margin-top: auto;
  padding-bottom: 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14.5px; font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: color .2s, gap .2s, border-color .2s;
}
.app:hover .app__go { color: var(--c); gap: 12px; border-color: var(--c); }
.app__go--muted { color: var(--text-4); border-color: transparent; font-style: italic; }
.app:hover .app__go--muted { color: var(--text-3); gap: 8px; border-color: transparent; }

/* Tarjetas aún no publicadas y tarjeta de roadmap */
.app--soon,
.app--more {
  background: linear-gradient(165deg, rgba(255,255,255,.022), rgba(255,255,255,0) 60%);
  border-style: dashed;
}
.app--soon .app__name,
.app--soon .app__icon { opacity: .62; }
.app--more .app__icon { opacity: .72; }
.app--soon:hover,
.app--more:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.app--soon:hover::before,
.app--more:hover::before { opacity: 0; }

/* El "avísame" del roadmap sí es un enlace real */
a.app__go--muted {
  position: relative; z-index: 2;
  font-style: normal;
  border-bottom-color: var(--border);
}
.app:hover a.app__go--muted { color: var(--text-3); }
a.app__go--muted:hover { color: var(--text); gap: 12px; border-bottom-color: var(--border-strong); }

/* Filtrado */
.app[hidden] { display: none; }

.empty {
  text-align: center;
  color: var(--text-3);
  font-size: 15px;
  padding: 60px 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty__reset {
  margin-left: 8px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   CTA
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 26px;
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  white-space: nowrap;
  transition: transform .2s var(--ease-out), gap .2s, box-shadow .2s;
}
.btn--primary {
  background: #fff; color: #07070b;
  box-shadow: 0 12px 36px rgba(255,255,255,.08), 0 0 0 1px rgba(255,255,255,.5);
}
.btn--primary:hover {
  transform: translateY(-2px); gap: 14px;
  box-shadow: 0 20px 60px rgba(125,211,252,.28), 0 0 0 1px rgba(255,255,255,.7);
}

.cta-card {
  display: flex; align-items: center; justify-content: space-between; gap: 36px;
  flex-wrap: wrap;
  padding: 44px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(600px 280px at 80% 50%, rgba(167,139,250,.16), transparent 70%),
    radial-gradient(500px 240px at 0% 100%, rgba(125,211,252,.12), transparent 70%),
    linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  position: relative; overflow: hidden;
}
.cta-card::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 30px 30px;
  mask: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  pointer-events: none;
}
.cta-card > * { position: relative; }
.cta-card__eyebrow {
  font-size: 12px; color: var(--accent);
  letter-spacing: .2em; text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 10px;
}
.cta-card__h {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(21px, 2.2vw, 28px);
  font-weight: 600;
  letter-spacing: -.02em;
  max-width: 560px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.foot {
  border-top: 1px solid var(--border);
  padding: 70px var(--pad-x) 32px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.foot__inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 56px;
}
@media (max-width: 880px) { .foot__inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px) { .foot__inner { grid-template-columns: 1fr; gap: 32px; } }

.foot__logo { width: 170px; height: auto; margin-bottom: 18px; filter: invert(1) brightness(1.1); }
.foot__brand p { color: var(--text-3); font-style: italic; font-size: 14px; }
.foot__col h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--accent);
  margin-bottom: 14px;
}
.foot__col p { color: var(--text-2); font-size: 14.5px; }
.foot__col a { transition: color .2s; }
.foot__col a:hover { color: var(--accent); }

.foot__bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  color: var(--text-4);
  font-size: 12.5px;
  letter-spacing: .04em;
  flex-wrap: wrap; gap: 12px;
}
.foot__bottom-r { letter-spacing: .2em; text-transform: uppercase; color: var(--text-3); }

/* ==========================================================================
   Ajustes móviles
   ========================================================================== */
@media (max-width: 640px) {
  .hero { padding-top: 120px; }
  .hero__eyebrow { letter-spacing: .1em; line-height: 1.45; }
  .search { flex: 1 1 100%; }
  .search__kbd { display: none; }
  .filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
  .app { min-height: auto; padding: 24px 22px; }
  .cta-card { padding: 32px 26px; }
}
