/* ============================================================
   NEXUS — Theme Blue (Cloudflare Pages friendly)
   Palette, layout, components, animations
   ------------------------------------------------------------ */

:root {
  --clr-bg: #070f2a;
  --clr-surface: #0d1b3a;
  --clr-text: #e8eefc;
  --clr-muted: #a6b3d9;
  --clr-primary: #3b82f6;
  --clr-primary-2: #22d3ee;
  --clr-accent: #8b5cf6;
  --clr-success: #22c55e;
  --clr-warning: #f59e0b;
  --clr-danger: #ef4444;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --shadow-sm: 0 6px 18px rgba(0,0,0,.25);
  --shadow-md: 0 12px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 50px rgba(0,0,0,.45);

  --container: 1120px;
  --gap: 20px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Reset & globals */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--clr-text); background: var(--clr-bg);
  font-family: var(--font-sans); -webkit-font-smoothing: antialiased; line-height: 1.6;
}
/* Lock scroll when mobile menu is open */
body.no-scroll { overflow: hidden; }
img { max-width: 100%; height: auto; display: block; }


a { color: inherit; text-decoration: none; }
.text-muted { color: var(--clr-muted); }

/* Spacing utilities */
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 14px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 14px; }

/* Layout helpers */
.container { width: min(calc(100% - 2*var(--gap)), var(--container)); margin-inline: auto; }
.section { padding: clamp(64px, 8vw, 120px) 0; position: relative; }
/* Section variants for different densities */
.section.compact { padding: clamp(36px, 6vw, 72px) 0; }
.section.tight-bottom { padding-bottom: clamp(28px, 5vw, 56px); }
/* Remove double padding when hero (tight-bottom) is followed by a compact section */
.section.tight-bottom + .section.compact { padding-top: 0; }
.section.minfill { min-height: min(72svh, 780px); } /* evita footer a metà su schermi grandi */

/* Ambient gradient */
.bg-gradient {
  position: fixed; inset: -20vmax; z-index: -1;
  background:
    radial-gradient(60vmax 60vmax at 15% 10%, rgba(59,130,246,.10), transparent 55%),
    radial-gradient(60vmax 60vmax at 85% -10%, rgba(34,211,238,.12), transparent 55%),
    radial-gradient(60vmax 60vmax at 70% 80%, rgba(139,92,246,.10), transparent 55%);
  filter: blur(40px);
}

/* Header */
.header { position: sticky; top: 0; backdrop-filter: saturate(160%) blur(10px); background: rgba(7,15,42,.55); border-bottom: 1px solid rgba(255,255,255,.05); z-index: 50; }
.nav { display: flex; align-items: center; gap: 16px; height: 72px; }
.nav .brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: .5px; }
.nav .brand img { width: 36px; height: 36px; border-radius:10px; box-shadow: 0 8px 18px rgba(0,0,0,.35); background: rgba(255,255,255,.04); }
.nav .spacer { flex: 1; }
.nav a { position: relative; padding: 10px 14px; border-radius: 10px; color: var(--clr-muted); transition: .2s ease; }
.nav a:hover { color: var(--clr-text); background: rgba(255,255,255,.04); }
.nav a.active { color: #fff; background: rgba(59,130,246,.16); }
.nav a.active::after { content:""; position:absolute; left:12px; right:12px; bottom:6px; height:2px; background: linear-gradient(90deg, var(--clr-primary), var(--clr-primary-2)); border-radius: 2px; opacity:.9; }
.cta-btn { margin-left: 6px; background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-2)); color: #fff; box-shadow: var(--shadow-sm); animation: pulseGlow 3s ease-in-out infinite; }
.cta-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* Mobile menu */
.nav-menu { display:flex; align-items:center; gap:10px; }
.nav-toggle { display:none; background: transparent; border:1px solid rgba(255,255,255,.14); color: var(--clr-text); padding:8px 12px; border-radius:10px; }
.nav a:focus-visible, .btn:focus-visible { outline: 2px solid rgba(34,211,238,.8); outline-offset: 2px; }
@media (max-width: 840px){
  .nav-menu {
    position: fixed;
    right: 16px;
    top: calc(var(--nav-h, 64px) + 12px);
    background: rgba(7,15,42,.92);
    border:1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    padding: 12px;
    display:none;
    flex-direction: column;
    gap:8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .22s ease, transform .22s ease;
  }
  .nav-menu.open { display:flex; opacity:1; transform: translateY(0); }
  .nav-toggle { display:inline-flex; }
  .nav-menu a { padding: 12px 14px; border-radius: 12px; }
}

/* Hero */
.hero { display: grid; align-items: center; grid-template-columns: 1.1fr .9fr; gap: clamp(24px, 5vw, 48px); }
.hero.compact { grid-template-columns: 1.05fr .95fr; gap: clamp(18px, 4vw, 40px); }
.hero-title { font-size: clamp(36px, 6vw, 64px); line-height: 1.05; font-weight: 900; letter-spacing: .4px; margin: 0 0 14px; display:flex; align-items:center; gap:12px; }
.hero-title img { width:42px; height:42px; border-radius:10px; box-shadow: var(--shadow-sm); }
.hero-sub { font-size: clamp(16px, 2.6vw, 20px); color: var(--clr-muted); margin-bottom: 28px; }
/* Tighter spacing for compact hero and stop logo float on Chi-siamo */
.hero.compact .hero-sub { margin-bottom: 18px; }
.hero.compact .logo-card { animation: none !important; }
/* Uniform hero media frames across pages */
.hero .frame { aspect-ratio: 16 / 10; }
.badge { padding: 8px 12px; border-radius: 999px; font-weight: 700; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; background: rgba(59,130,246,.12); color: #cfe2ff; border: 1px solid rgba(91,154,255,.25); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 10px; border: 1px solid transparent; padding: 12px 18px; border-radius: 14px; font-weight: 700; letter-spacing: .3px; transition: transform .15s ease, box-shadow .15s ease, background .2s ease, border-color .2s ease; }
.btn-primary { background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-2)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { background: rgba(255,255,255,.04); color: var(--clr-text); border-color: rgba(255,255,255,.08); }
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.btn-outline { background: transparent; color: var(--clr-text); border-color: rgba(255,255,255,.14); }
.btn-outline:hover { border-color: rgba(255,255,255,.34); }
.btn-discord { background: linear-gradient(135deg, #5865F2, #3b82f6); color:#fff; box-shadow: var(--shadow-sm); }
.btn-discord:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-group { display:flex; gap:12px; align-items:stretch; }
.btn-group .btn { flex:1; justify-content:center; }

/* Cards & grids */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(12, 1fr); }
.card { grid-column: span 4; background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: rgba(255,255,255,.12); }
.card h3 { margin: 6px 0 8px; font-size: 20px; letter-spacing: .2px; }
.card p { margin: 0; color: var(--clr-muted); }
.card-soft { grid-column: span 6; background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card-soft h4 { margin: 8px 0 6px; }
.list-check { padding-left: 1.1rem; }
.list-check li::marker { content: "• "; color: #9cc2ff; }

.stripe {
  margin-top: clamp(16px, 3vw, 32px);
}
/* Limit the stripe bar to container width (no full-bleed) */
.stripe > .container {
  background: linear-gradient(90deg, rgba(59,130,246,.14), rgba(34,211,238,.12) 45%, rgba(139,92,246,.12));
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.stripe.push-down { margin-bottom: clamp(16px, 3vw, 32px); }
/* Feature stripe items (Progetto) */
.stripe .items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2.6vw, 20px);
  align-items: stretch;
}
.stripe .item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: none; /* più piatto e coerente con la stripe */
  text-align: center;
}
.kpi {
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 800;
  letter-spacing: .3px;
  color: #eaf2ff;
}
.stripe .item .text-muted { margin-top: 2px; }
@media (max-width: 640px){
  .stripe .items { grid-template-columns: 1fr; }
}

/* ---------- PROSE / LEGAL ENHANCEMENTS ---------- */
.prose { color: var(--clr-muted); max-width: 860px; margin-inline: auto; }
.prose h1, .prose h2, .prose h3 { color: var(--clr-text); letter-spacing: .2px; }
.prose h1 { font-size: clamp(28px, 3.8vw, 36px); }
.prose h2 {
  margin-top: 28px;
  position: relative;
  padding-bottom: 10px;
}
.prose h2::after {
  content:""; position:absolute; left:0; bottom:0; height:3px; width:140px;
  background: linear-gradient(90deg, var(--clr-primary), var(--clr-primary-2), var(--clr-accent));
  border-radius: 2px; opacity:.9;
}
.prose a { color: #9cc2ff; text-decoration: underline; text-decoration-color: rgba(156,194,255,.5); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: rgba(156,194,255,.9); }
.prose ul { padding-left: 1.1rem; }
.prose li { margin: .4rem 0; }
.prose ul li::marker { color: var(--clr-primary-2); }

/* Legal layout + fancy TOC */
.legal-layout { display:grid; grid-template-columns: 280px 1fr; gap:24px; align-items:start; }
.toc {
  position: sticky; top: 88px; border-radius: 18px; padding:16px;
  background: linear-gradient(180deg, rgba(59,130,246,.14), rgba(34,211,238,.12) 50%, rgba(139,92,246,.12));
  border:1px solid rgba(255,255,255,.10);
  box-shadow: var(--shadow-sm);
}
.toc h4 { margin: 4px 0 12px; color:#e8eefc; letter-spacing:.3px; }
.toc a {
  display:flex; align-items:center; gap:10px; padding:8px 10px; margin:6px 0;
  border-radius:12px; color:#dce9ff; transition: .2s ease background, .2s ease transform;
  background: rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.06);
}
.toc a::before {
  content: ""; width:8px; height:8px; border-radius:999px;
  background: linear-gradient(180deg, var(--clr-primary), var(--clr-primary-2));
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}
.toc a:hover { background: rgba(59,130,246,.16); transform: translateX(2px); color:#fff; }
.toc a.active { background: linear-gradient(135deg, rgba(59,130,246,.22), rgba(34,211,238,.18)); color:#fff; }
.toc a.active::before { box-shadow: 0 0 0 4px rgba(34,211,238,.3); }

/* Callouts (info boxes) */
.callout {
  margin: 16px 0; padding: 14px 16px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(34,211,238,.14), rgba(59,130,246,.12));
  border: 1px solid rgba(156,194,255,.25);
  color: #eaf2ff;
}

/* Timeline for "Chi siamo" */
.timeline { position: relative; margin: 16px 0; }
.timeline::before {
  content:""; position:absolute; left:10px; top:0; bottom:0; width:2px;
  background: linear-gradient(180deg, var(--clr-primary), var(--clr-accent));
  opacity:.6;
}
.step { position: relative; margin-left: 36px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.06); }
.step + .step { margin-top: 12px; }
.step::before {
  content:""; position:absolute; left:-23px; top:16px; width:12px; height:12px; border-radius:999px;
  background: linear-gradient(180deg, var(--clr-primary), var(--clr-primary-2));
  box-shadow: 0 0 0 4px rgba(59,130,246,.25);
}

/* Footer (compact) */
.footer { border-top: 1px solid rgba(255,255,255,.10); background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)); }
/* Compact footer overrides (shrink global .section padding on footer) */
.footer.section { padding: clamp(16px, 3vw, 28px) 0; }
.footer .wrap { display: grid; align-items:start; gap: 14px; grid-template-columns: 2fr 1fr 1fr; padding: 14px 0 18px; }
.footer a { color:#d6e6ff; opacity:.95; }
.footer a:hover { text-decoration: underline; text-decoration-color: rgba(214,230,255,.7); }
.footer small { color: var(--clr-muted); opacity: 1; font-size: 11px; }
.footer .brand { display:flex; align-items:center; gap:10px; }

.footer .wrap > div:last-child a.btn { width:100%; justify-content:center; padding: 10px 14px; border-radius: 12px; }
/* Ensure vertical spacing between stacked footer buttons */
.footer .wrap > div:last-child { display:flex; flex-direction: column; gap: 10px; }

/* Frame (image box) */
.frame { aspect-ratio: 4 / 3; border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); border: 1px solid rgba(255,255,255,.08); box-shadow: var(--shadow-md); position: relative; overflow: hidden; }
.frame::after{
  content:""; position:absolute; inset:-1px; pointer-events:none;
  background: radial-gradient(50% 60% at 20% 0%, rgba(34,211,238,.18), transparent 55%),
              radial-gradient(60% 50% at 90% 20%, rgba(59,130,246,.22), transparent 55%);
  mix-blend-mode: screen; filter: blur(8px);
}
.frame > img { width:100%; height:100%; object-fit: cover; object-position: center; display:block; }
.frame.logo-card { aspect-ratio: 16 / 10; }

/* Utility: sposta il contenuto dell'immagine verso il basso per mostrare la parte inferiore (es. scritta NEXUS) */
.frame.center-below > img { object-position: center 78%; }
/* Posizione standard (usala su Chi-siamo per tornare al centro) */
.frame.center-default > img { object-position: center 50%; }
/* NUOVE utility opzionali: adatta l'immagine al contenitore o spostala gradualmente */
.frame.fit-contain > img { object-fit: contain; background: rgba(255,255,255,.02); }
.frame.shift-down-sm > img { object-position: center 60%; }
.frame.shift-down-md > img { object-position: center 72%; }
.frame.shift-down-lg > img { object-position: center 84%; }

/* Animations */
@keyframes float { from { transform: translateY(0); } 50% { transform: translateY(-8px); } to { transform: translateY(0); } }
@keyframes pulseGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,.45);} 50% { box-shadow: 0 0 0 8px rgba(59,130,246,0);} }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes fadeUp { from { opacity:0; transform: translateY(14px) scale(.98);} to { opacity:1; transform: translateY(0) scale(1);} }
@keyframes tilt { 0%,100% { transform: rotate(-.4deg);} 50% { transform: rotate(.4deg);} }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.float { animation: float 5s ease-in-out infinite; }
.glow { animation: pulseGlow 2.8s ease-in-out infinite; }
.shimmer { background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.24), rgba(255,255,255,.08)); background-size: 200% 100%; animation: shimmer 2.2s linear infinite; }
.fade-up { animation: fadeUp .7s ease forwards; }
.subtle-tilt:hover { animation: tilt 1.5s ease-in-out infinite; }

/* Responsive */
@media (max-width: 960px){
  .hero { grid-template-columns: 1fr; }
  .card { grid-column: span 6; }
  .footer .wrap { grid-template-columns: 1fr; text-align:center; }
  .footer .wrap > div { margin-top: 8px; }
  .footer .wrap > div:first-child { margin-top: 0; }
  .legal-layout { grid-template-columns: 1fr; }
  .toc { position: relative; top: 0; }
}
@media (max-width: 640px){
  .grid { grid-template-columns: repeat(6,1fr); }
  .card { grid-column: span 6; }
  .nav { height: 64px; }
  .btn-group { flex-direction: column; gap: 10px; }
  .btn-group .btn { width: 100%; }
  .toc a { padding: 7px 10px; margin: 4px 0; }
}

@media (max-width: 480px){
  .section { padding: 40px 0; }
  .btn { padding: 12px 16px; border-radius: 12px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}