/* ============================================================
   NAPIX Labs · napixlabs.it · pagina di attesa
   Direzione: "laboratorio premium al buio" - base quasi nera,
   foto d'atmosfera velata, tipografia enorme, un solo accento
   blu elettrico, griglia sottile, glow che respira.
   Zero dipendenze, font di sistema + mono per i dettagli.
   ============================================================ */

:root {
  --nero:     #0a0b0f;                   /* base */
  --bianco:   #f2f5f9;                   /* testo principale */
  --grigio:   #b9c2cf;                   /* testo secondario (~9:1) */
  --muto:     #8a94a4;                   /* dettagli mono (~5,4:1) */
  --accento:  #2f81f7;                   /* blu elettrico, unico accento */
  --linea:    rgba(255, 255, 255, 0.12);

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Helvetica, Roboto, sans-serif;

  --morbido: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
  background: var(--nero);
  color: var(--bianco);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
}

:focus-visible {
  outline: 2px solid var(--accento);
  outline-offset: 2px;
}

::selection { background: rgba(47, 129, 247, 0.35); color: var(--bianco); }

/* ---------- Strati di fondo ---------- */

.sfondo,
.sfondo img,
.velo, .griglia, .glow, .grana {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.sfondo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* la foto sostiene, non domina: scurita e leggermente desaturata */
  filter: brightness(0.78) saturate(0.9);
}

/* velo: pozze di buio che fanno dominare il testo, piu' vignettatura */
.velo {
  background:
    radial-gradient(115% 90% at 50% 58%, rgba(10, 11, 15, 0.18) 0%, rgba(10, 11, 15, 0.55) 78%, rgba(10, 11, 15, 0.82) 100%),
    linear-gradient(180deg, rgba(10, 11, 15, 0.5) 0%, rgba(10, 11, 15, 0.16) 30%, rgba(10, 11, 15, 0.26) 62%, rgba(10, 11, 15, 0.78) 100%);
}

/* griglia sottilissima, passo 24px, che svanisce verso i bordi */
.griglia {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(90% 75% at 50% 45%, #000 25%, transparent 100%);
          mask-image: radial-gradient(90% 75% at 50% 45%, #000 25%, transparent 100%);
}

/* l'elemento vivo: una pozza di luce blu che respira, dietro il titolo */
.glow {
  background: radial-gradient(48% 38% at 50% 46%, rgba(47, 129, 247, 0.26) 0%, rgba(47, 129, 247, 0.08) 55%, transparent 100%);
  animation: respiro 6s ease-in-out infinite;
}

/* grana sottile, generata inline: niente file in piu' */
.grana {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: overlay;
}

/* ---------- Scena ---------- */

.scena {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: clamp(1.1rem, 2.5vw, 2.2rem) clamp(1.25rem, 4vw, 3.5rem);
  padding-top: max(clamp(1.1rem, 2.5vw, 2.2rem), env(safe-area-inset-top));
  padding-bottom: max(clamp(1.1rem, 2.5vw, 2.2rem), env(safe-area-inset-bottom));
}

/* ---------- Testata ---------- */

.testata {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.marchio {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.marchio span { color: var(--muto); font-weight: 400; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grigio);
  border: 1px solid var(--linea);
  border-radius: 999px;
  padding: 0.5em 1em;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.badge:hover {
  border-color: rgba(47, 129, 247, 0.5);
  box-shadow: 0 0 18px rgba(47, 129, 247, 0.18);
}

.punto {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accento);
  box-shadow: 0 0 8px 1px rgba(47, 129, 247, 0.85);
  animation: pulsa 2.6s ease-in-out infinite;
}

/* ---------- Centro ---------- */

.centro {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: clamp(2rem, 6vh, 4rem) 0;
}

.titolo {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-weight: 800;
  font-size: clamp(4.2rem, 16.5vw, 15rem);
  margin-bottom: clamp(1.4rem, 3.5vh, 2.6rem);
  will-change: transform;
}

.riga { display: block; }

/* N·API·X: il nome racconta il mestiere - le API nel cuore del nome */
.riga-piena { color: var(--bianco); white-space: nowrap; }

.tit-lato { color: var(--bianco); }

.tit-api {
  background: linear-gradient(115deg, #2f81f7 20%, #7fb1ff 50%, #2f81f7 80%);
  background-size: 220% 100%;
  background-position: 0% 0;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px rgba(47, 129, 247, 0.45));
  animation: luce 7s ease-in-out infinite alternate;
}

/* LABS: contorno sottile, architettura pura (stroke fine: gli overlap
   interni dei glifi di sistema si notano solo con tratti spessi) */
.riga-contorno {
  color: rgba(242, 245, 249, 0.05);
  -webkit-text-stroke: clamp(1px, 0.09vw, 1.6px) rgba(242, 245, 249, 0.55);
  letter-spacing: 0.02em;
}

.tagline {
  font-size: clamp(1.05rem, 0.95rem + 0.7vw, 1.45rem);
  font-weight: 450;
  color: var(--grigio);
  max-width: 34ch;
  text-wrap: balance;
  margin-bottom: clamp(0.9rem, 2.2vh, 1.4rem);
}

/* le aree di lavoro: elenco statico senza JS, una voce alla volta col rotator */
.attivita {
  font-family: var(--mono);
  font-size: clamp(0.8rem, 0.76rem + 0.2vw, 0.95rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ccd5e2;
  max-width: 44ch;
  min-height: 1.7em;
  margin-bottom: clamp(0.8rem, 2vh, 1.2rem);
}

.attivita .voce { display: inline-block; }

.nota {
  font-family: var(--mono);
  font-size: clamp(0.72rem, 0.7rem + 0.12vw, 0.8rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muto);
}

/* ---------- Fondo ---------- */

.fondo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: clamp(0.8rem, 1.8vh, 1.2rem);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--muto);
}

/* il marchio di casa, discreto: chi sa, capisce */
.cortex-marchio {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  white-space: nowrap;
  opacity: 0.7;
  transition: opacity 0.3s ease, color 0.3s ease;
}
.cortex-marchio:hover { opacity: 1; color: var(--grigio); }
.cortex-marchio svg { flex: none; }

/* i tre domini del brand: il principale in evidenza, gli altri accennati */
.domini { white-space: nowrap; }
.domini-alt { opacity: 0.62; }

.cortex-punto {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accento);
  box-shadow: 0 0 6px 1px rgba(47, 129, 247, 0.7);
  animation: pulsa 3.2s ease-in-out infinite;
}

/* ---------- Movimento ---------- */

@keyframes comparsa {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes respiro {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.06); }
}

@keyframes pulsa {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

@keyframes luce {
  from { background-position: 0% 0; }
  to   { background-position: 100% 0; }
}

/* le animazioni d'ingresso esistono SOLO sotto html.anima (classe messa da JS
   prima del primo paint): senza JS, o a moto ridotto, la pagina nasce completa.
   html.anima-fine (fail-safe a 2,6 s) le neutralizza a corsa ormai finita. */

@keyframes voce-esce {
  to { opacity: 0; transform: translateY(-9px); }
}

@keyframes voce-entra {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: translateY(0); }
}

html.anima .anim { animation: comparsa 0.9s var(--morbido) both; }
html.anima .titolo .riga-piena    { animation-delay: 0.10s; }
html.anima .titolo .riga-contorno { animation-delay: 0.22s; }
html.anima .tagline  { animation-delay: 0.38s; }
html.anima .attivita { animation-delay: 0.50s; }
html.anima .nota     { animation-delay: 0.60s; }
html.anima .badge    { animation-delay: 0.70s; }
html.anima .fondo    { animation-delay: 0.82s; }

html.anima-fine .anim { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .glow, .punto, .tit-api, .cortex-punto { animation: none !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 359.98px) {
  .marchio { font-size: 0.74rem; letter-spacing: 0.12em; white-space: nowrap; }
  .badge   { font-size: 0.62rem; letter-spacing: 0.1em; padding: 0.45em 0.75em; white-space: nowrap; }
}

@media (max-width: 480px) {
  .titolo { font-size: clamp(4rem, 21vw, 6.5rem); }
  .fondo { flex-direction: column; gap: 0.5rem; text-align: center; }
  .fondo p:last-child { display: none; }
}

@media (min-width: 2200px) {
  .scena { padding-inline: 6vw; }
}

/* schermi molto bassi (telefono orizzontale): niente tagli */
@media (max-height: 480px) {
  .titolo { font-size: clamp(3rem, 18vh, 6rem); }
  .centro { padding: 1.2rem 0; }
}
