/* ============================================================
   MISSION CONTROL — Awwwards Edition
   AstroX · Emanuele Magno · Aerospace Portfolio
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700;800&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --void:       #030712;
  --void-1:     #070d1f;
  --void-2:     #0a1228;
  --panel:      rgba(10, 18, 40, 0.6);
  --panel-solid:#080e1f;
  --plasma:     #00d4ff;
  --plasma-dim: rgba(0, 212, 255, 0.12);
  --plasma-glow:rgba(0, 212, 255, 0.4);
  --plasma-2:   #00a8cc;
  --white:      #f0f4ff;
  --white-dim:  rgba(240, 244, 255, 0.55);
  --muted:      #7a8aaa;
  --muted-2:    #3d4a65;
  --ok:         #00ffa3;
  --warn:       #ffb23a;
  --danger:     #ff4d6d;
  --border:     rgba(0, 212, 255, 0.1);
  --border-mid: rgba(0, 212, 255, 0.2);
  --border-str: rgba(0, 212, 255, 0.38);
  --radius:     1px;
  --mono:       'JetBrains Mono', 'SFMono-Regular', monospace;
  --display:    'Space Grotesk', 'Inter', sans-serif;
  --sans:       'Space Grotesk', 'Inter', sans-serif;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

html, body {
  color: var(--white);
  font-family: var(--sans);
  min-height: 100%;
  overflow-x: hidden;
}

html {
  background: var(--void);
}
body {
  background: transparent;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

code {
  font-family: var(--mono);
  color: var(--plasma);
  background: var(--plasma-dim);
  padding: 0.15em 0.45em;
  border-radius: 2px;
  font-size: 0.83em;
}

/* ── Cinematic Preloader ────────────────────────────────── */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--void);
  transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1), visibility 0.7s;
}

#preloader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.preloader-badge {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 22px;
  color: var(--plasma);
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-mid);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  animation: preloaderPulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 30px var(--plasma-glow);
}

@keyframes preloaderPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.06); opacity: 0.75; }
}

.preloader-bar {
  width: 220px;
  height: 2px;
  background: rgba(0,212,255,0.1);
  overflow: hidden;
  position: relative;
}

.preloader-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--plasma-2), var(--plasma));
  box-shadow: 0 0 10px var(--plasma-glow);
  transition: width 0.25s ease-out;
}

.preloader-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--muted-2);
}

@media (prefers-reduced-motion: reduce) {
  #preloader { transition: none; }
}

/* ── Custom Cursor ──────────────────────────────────────── */
#cursor-dot {
  position: fixed;
  width: 6px; height: 6px;
  background: var(--plasma);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: background 0.2s;
  mix-blend-mode: screen;
}

#cursor-ring {
  position: fixed;
  width: 32px; height: 32px;
  border: 1px solid var(--plasma);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
  opacity: 0.55;
}

#cursor-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border-top: 1px solid var(--plasma);
  border-right: 1px solid transparent;
  border-bottom: 1px solid transparent;
  border-left: 1px solid transparent;
  animation: orbitSpin 2s linear infinite;
}

@keyframes orbitSpin {
  to { transform: rotate(360deg); }
}

body:has(a:hover) #cursor-ring,
body:has(button:hover) #cursor-ring,
body:has(.card:hover) #cursor-ring {
  width: 52px; height: 52px;
  border-color: var(--plasma-glow);
  opacity: 0.8;
}

/* ── Starship Background ────────────────────────────────── */
.starship-bg {
  position: fixed;
  inset: 0;
  z-index: -6;
  pointer-events: none;
  background: url('https://elemanprojects.com/static/img/bg.jpg') 50% 50% / cover no-repeat;
  filter: saturate(0.7) brightness(0.55);
  animation: subtleDrift 25s ease-in-out infinite alternate;
}

@keyframes subtleDrift {
  0%   { transform: scale(1)    translate(0, 0); }
  50%  { transform: scale(1.03) translate(-0.4%, -0.4%); }
  100% { transform: scale(1.015) translate(0.4%, 0.2%); }
}

/* Deep gradient layer */
.starship-bg::before {
  content: '';
  position: fixed; inset: 0;
  z-index: -5;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(3,7,18,0.72) 0%,
    rgba(3,7,18,0.30) 28%,
    rgba(3,7,18,0.22) 50%,
    rgba(3,7,18,0.58) 75%,
    rgba(3,7,18,0.90) 100%
  );
}

/* Plasma nebula tints */
.starship-bg::after {
  content: '';
  position: fixed; inset: 0;
  z-index: -4;
  pointer-events: none;
  background:
    radial-gradient(ellipse 700px 350px at 70% 20%, rgba(0,212,255,0.035) 0%, transparent 70%),
    radial-gradient(ellipse 500px 600px at 20% 80%, rgba(0,100,200,0.025) 0%, transparent 70%),
    radial-gradient(ellipse 900px 200px at 50% 60%, rgba(0,212,255,0.018) 0%, transparent 80%);
}

/* ── Starship SVG Overlay ───────────────────────────────── */
#starship-overlay {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 3vw 0 0;
  overflow: hidden;
}

#starship-overlay svg {
  width: clamp(260px, 38vw, 560px);
  height: auto;
  opacity: 0.13;
  filter: drop-shadow(0 0 30px rgba(0,212,255,0.25)) drop-shadow(0 0 80px rgba(0,150,255,0.1));
  animation: starshipFloat 8s ease-in-out infinite alternate;
  transform-origin: 50% 100%;
}

@keyframes starshipFloat {
  0%   { transform: translateY(0)    rotate(-0.5deg); }
  100% { transform: translateY(-18px) rotate(0.5deg); }
}

/* ── Particle Canvas ────────────────────────────────────── */
#particle-canvas {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  z-index: -2;
  pointer-events: none;
  opacity: 0.65;
}

/* ── Shooting Stars ─────────────────────────────────────── */
@keyframes shoot {
  0%   { transform: translateX(0) translateY(0) rotate(-42deg);    opacity: 0; }
  4%   { opacity: 0.9; }
  14%  { opacity: 0.35; }
  28%  { opacity: 0; }
  100% { transform: translateX(-700px) translateY(700px) rotate(-42deg); opacity: 0; }
}

.shooting-star {
  position: fixed;
  width: 1px; height: 60px;
  background: linear-gradient(to bottom, rgba(0,212,255,0.8), transparent);
  border-radius: 2px;
  box-shadow: 0 0 4px 1px rgba(0,212,255,0.2);
  animation: shoot 5s ease-out infinite;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
}

.shooting-star::after {
  content: '';
  position: absolute;
  top: 0; left: -1px;
  width: 3px; height: 3px;
  background: var(--plasma);
  border-radius: 50%;
  box-shadow: 0 0 5px 2px rgba(0,212,255,0.6);
}

.shooting-star:nth-of-type(1) { top: 8%;  left: 80%; animation-delay: 0s;   animation-duration: 5.5s; }
.shooting-star:nth-of-type(2) { top: 20%; left: 70%; animation-delay: 4s;   animation-duration: 4.8s; }
.shooting-star:nth-of-type(3) { top: 35%; left: 88%; animation-delay: 9s;   animation-duration: 4.2s; }
.shooting-star:nth-of-type(4) { top: 5%;  left: 64%; animation-delay: 15s;  animation-duration: 6s;   }
.shooting-star:nth-of-type(5) { top: 28%; left: 92%; animation-delay: 21s;  animation-duration: 5.2s; }

/* ── Vignette & Scanlines ───────────────────────────────── */
.vignette {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 38%, transparent 38%, rgba(2,4,12,0.72) 100%);
}

.scanlines {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.018;
  background: repeating-linear-gradient(0deg, #fff 0px, #fff 1px, transparent 1px, transparent 4px);
}

/* ── HUD Grid overlay (hero only) ──────────────────────── */
.hud-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0,212,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.028) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 50%, black 30%, transparent 100%);
  z-index: 0;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 56px);
  height: 64px;
  background: linear-gradient(180deg, rgba(3,7,18,0.95), rgba(3,7,18,0.75));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--plasma), transparent);
  opacity: 0.18;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: none;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 12px;
  color: var(--void);
  background: var(--plasma);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: box-shadow 0.25s;
}

.brand:hover .brand-badge {
  box-shadow: 0 0 20px var(--plasma-glow);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }

.brand-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--white);
}

.brand-sub {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 0.15em;
}

.nav {
  display: flex;
  gap: clamp(8px, 2vw, 28px);
}

.nav-link {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px 4px;
  position: relative;
  cursor: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 100%; bottom: 4px;
  height: 1px;
  background: var(--plasma);
  transition: right 0.3s cubic-bezier(0.4,0,0.2,1);
}

.nav-link:hover { color: var(--white); }
.nav-link.active { color: var(--plasma); }
.nav-link.active::after { right: 0; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 1px solid var(--border-mid);
  padding: 9px 11px;
  cursor: none;
  border-radius: 1px;
}

.nav-toggle span {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--white);
  transition: all 0.25s ease;
}

/* ── Main Layout ────────────────────────────────────────── */
#app {
  flex: 1;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 60px);
  display: block;
  position: relative;
  z-index: 1;
}

.page {
  display: none;
  animation: pageReveal 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.page.active { display: block; }

@keyframes pageReveal {
  from {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    transform: translateY(14px) scale(0.99);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0% 0);
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: clamp(40px, 7vw, 90px) 0 52px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 44px;
  overflow: hidden;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--plasma);
  margin: 0 0 22px;
  opacity: 0;
  animation: fadeSlideUp 0.5s 0.15s ease both;
}

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: blink 2.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

.hero-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0 0 24px;
  max-width: 14ch;
  opacity: 0;
  animation: fadeSlideUp 0.6s 0.25s cubic-bezier(0.4,0,0.2,1) both;
}

.hero-title .accent {
  color: transparent;
  -webkit-text-stroke: 1px var(--plasma);
  position: relative;
}

/* Scramble target class */
.hero-title .accent.reveal {
  color: var(--plasma);
  -webkit-text-stroke: 0px;
  transition: color 0.4s, -webkit-text-stroke 0.4s;
}

.hero-desc {
  max-width: 52ch;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.3vw, 1.05rem);
  line-height: 1.75;
  margin: 0 0 32px;
  font-weight: 400;
  opacity: 0;
  animation: fadeSlideUp 0.6s 0.38s ease both;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 44px;
  opacity: 0;
  animation: fadeSlideUp 0.6s 0.5s ease both;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 13px 24px;
  border-radius: 0;
  cursor: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-mid);
  transition: all 0.22s ease;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.04) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}

.btn:hover::before { transform: translateX(100%); }

.btn-primary {
  background: var(--plasma);
  color: var(--void);
  border-color: transparent;
  font-weight: 700;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.btn-primary:hover {
  box-shadow: 0 0 28px var(--plasma-glow), 0 0 60px rgba(0,212,255,0.15);
  transform: translateY(-2px);
}

.btn-ghost {
  background: rgba(0,212,255,0.04);
  color: var(--white-dim);
}

.btn-ghost:hover {
  border-color: var(--plasma);
  color: var(--plasma);
  background: rgba(0,212,255,0.08);
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 15px;
  font-size: 12px;
}

/* ── Magnetic buttons ───────────────────────────────────── */
.magnetic {
  transition: transform 0.18s cubic-bezier(0.2,0.9,0.3,1), box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  will-change: transform;
}

/* ── Hero polish: soft breathing glow behind title ─────── */
.hero::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -6%;
  width: 46%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(0,212,255,0.07) 0%, transparent 72%);
  pointer-events: none;
  z-index: -1;
  animation: heroBreathe 6s ease-in-out infinite;
}

@keyframes heroBreathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.08); }
}

/* ── Hero Stats ─────────────────────────────────────────── */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
  padding-top: 0;
  opacity: 0;
  animation: fadeSlideUp 0.6s 0.62s ease both;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 0 0;
  position: relative;
}

.hero-stat + .hero-stat {
  padding-left: 28px;
  border-left: 1px solid var(--border);
}

.hero-stat-value {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--plasma);
  line-height: 1;
  text-shadow: 0 0 20px var(--plasma-glow);
}

.hero-stat-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted-2);
}

/* ── Panels ─────────────────────────────────────────────── */
.panel-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 860px) { .panel-row { grid-template-columns: 1fr; } }

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 28px clamp(18px, 3vw, 32px);
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}

/* Corner brackets */
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border-color: var(--plasma);
  opacity: 0.5;
}

.panel::before {
  top: -1px; left: -1px;
  border-top: 1.5px solid var(--plasma);
  border-left: 1.5px solid var(--plasma);
}

.panel::after {
  bottom: -1px; right: -1px;
  border-bottom: 1.5px solid var(--plasma);
  border-right: 1.5px solid var(--plasma);
}

.panel-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  color: var(--white);
}

.panel-title .icon { color: var(--plasma); }

.panel-hint {
  color: var(--muted-2);
  font-size: 11.5px;
  margin: 0 0 20px;
  font-family: var(--mono);
}

.panel-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ── Stat Boxes ─────────────────────────────────────────── */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat-box {
  background: rgba(0,212,255,0.04);
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}

.stat-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--plasma), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-box:hover { border-color: var(--border-mid); background: rgba(0,212,255,0.07); }
.stat-box:hover::before { opacity: 0.6; }

.stat-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--muted-2);
}

.stat-value {
  font-family: var(--mono);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--white);
}

/* ── Chips ──────────────────────────────────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border: 1px solid var(--border-mid);
  color: var(--plasma);
  background: var(--plasma-dim);
  transition: all 0.18s ease;
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
}

.chip:hover {
  background: rgba(0,212,255,0.18);
  border-color: var(--plasma);
}

/* ── Orbit Track (Flight Path, scroll-driven) ──────────── */
.orbit-panel { overflow: visible; }

.orbit-track {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 46px;
  padding: 8px 0 4px;
}

.orbit-line {
  position: absolute;
  top: 5px; left: 0; right: 0;
  height: 2px;
  background: rgba(0,212,255,0.1);
  display: none; /* orizzontale solo da desktop in su */
}

.orbit-line-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--plasma-2), var(--plasma));
  box-shadow: 0 0 10px var(--plasma-glow);
  transition: width 0.15s linear;
}

.orbit-station {
  position: relative;
  padding-left: 26px;
  border-left: 1px solid var(--border);
  opacity: 0.4;
  filter: grayscale(0.6);
  transition: opacity 0.5s ease, filter 0.6s ease, transform 0.5s ease;
}

.orbit-station.lit {
  opacity: 1;
  filter: grayscale(0);
}

.orbit-node {
  position: absolute;
  left: -6px; top: 4px;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--muted-2);
  background: var(--void);
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}

.orbit-station.lit .orbit-node {
  border-color: var(--plasma);
  box-shadow: 0 0 10px var(--plasma-glow);
  transform: scale(1.15);
}

.orbit-card { max-width: 68ch; }

.orbit-date {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--plasma);
  background: var(--plasma-dim);
  padding: 3px 10px;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.orbit-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--display);
}

.orbit-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.92rem;
}

.orbit-station--next .orbit-node {
  border-style: dashed;
  animation: nextStationPulse 1.8s ease-in-out infinite;
}

@keyframes nextStationPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(0,212,255,0); }
  50%      { box-shadow: 0 0 12px var(--plasma-glow); }
}

/* Desktop: orbita orizzontale vera e propria */
@media (min-width: 860px) {
  .orbit-track {
    flex-direction: row;
    gap: 0;
    padding-top: 26px;
  }

  .orbit-line { display: block; }

  .orbit-station {
    flex: 1;
    padding-left: 0;
    padding-top: 24px;
    border-left: none;
  }

  .orbit-node {
    left: 0; top: -25px;
    transform: translateX(-50%);
  }

  .orbit-station.lit .orbit-node { transform: translateX(-50%) scale(1.15); }

  .orbit-station:first-child .orbit-node { left: 0; transform: translateX(0); }
  .orbit-station:first-child.lit .orbit-node { transform: scale(1.15); }
  .orbit-station:last-child .orbit-node { left: 100%; }
  .orbit-station:last-child.lit .orbit-node { transform: translateX(-50%) scale(1.15); }

  .orbit-station + .orbit-station { margin-left: 28px; }
}

/* ── Portfolio Impact statement ─────────────────────────── */
.card-impact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.impact-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--plasma);
}

.impact-text {
  color: var(--muted);
  line-height: 1.6;
}

/* ── Section Headers ────────────────────────────────────── */
.page-head { margin-bottom: 28px; }

.section-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  display: flex;
  align-items: center;
  gap: 16px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.section-title.no-index { margin-top: 4px; }

.tag-index {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--plasma);
  border: 1px solid var(--border-str);
  padding: 4px 10px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.section-desc {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.filter-chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  padding: 8px 16px;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: none;
  background: transparent;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  color: var(--white);
  border-color: var(--border-mid);
}

.filter-chip.active {
  color: var(--void);
  background: var(--plasma);
  border-color: var(--plasma);
  box-shadow: 0 0 14px var(--plasma-glow);
}

/* ── Cards ──────────────────────────────────────────────── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: none;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1),
              border-color 0.3s ease,
              box-shadow 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.card:hover {
  border-color: var(--border-mid);
  box-shadow:
    0 20px 40px rgba(0,0,0,0.5),
    0 0 0 1px rgba(0,212,255,0.12),
    0 0 30px rgba(0,212,255,0.06);
}

/* top plasma line on card hover */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--plasma), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 1;
}

.card:hover::before { opacity: 0.7; }

.card-media {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--void-2);
}

.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.7) brightness(0.75);
  transition: transform 0.5s cubic-bezier(0.4,0,0.2,1), filter 0.5s ease;
}

.card:hover .card-media img {
  transform: scale(1.07);
  filter: saturate(0.9) brightness(0.95);
}

.card-tag {
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  background: rgba(3,7,18,0.8);
  border: 1px solid var(--border-mid);
  color: var(--plasma);
  backdrop-filter: blur(4px);
}

.card-body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: 0.06em;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  font-family: var(--display);
}

.card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  flex: 1;
}

.card-badges { display: flex; flex-wrap: wrap; gap: 5px; }

.card-link {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--plasma);
  letter-spacing: 0.06em;
  margin-top: 4px;
  transition: letter-spacing 0.2s;
}

.card:hover .card-link { letter-spacing: 0.12em; }

/* ── Detail Panel ───────────────────────────────────────── */
.detail-panel {
  border: 1px solid var(--border-mid);
  background: var(--panel-solid);
  padding: 0;
  margin-top: 12px;
  position: relative;
  animation: pageReveal 0.4s ease both;
}

.detail-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  cursor: none;
  font-size: 11px;
  z-index: 2;
  transition: color 0.2s;
}

.detail-close:hover { color: var(--plasma); }

.detail-media {
  width: 100%;
  aspect-ratio: 21/7;
  overflow: hidden;
  position: relative;
}

.detail-media img { width: 100%; height: 100%; object-fit: cover; }

.detail-media::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(3,7,18,0.97), rgba(3,7,18,0.15) 55%);
}

.detail-media-tags {
  position: absolute;
  bottom: 18px; left: 26px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

.detail-media-tags span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  padding: 5px 10px;
  background: rgba(0,212,255,0.8);
  color: var(--void);
  font-weight: 700;
}

.detail-title {
  position: absolute;
  bottom: 40px; left: 26px; right: 26px;
  font-size: clamp(1.3rem, 3.2vw, 2.1rem);
  font-weight: 700;
  margin: 0;
  z-index: 2;
  font-family: var(--display);
}

.detail-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  padding: 28px clamp(18px, 3vw, 36px) 36px;
}

@media (max-width: 800px) { .detail-content { grid-template-columns: 1fr; } }

.detail-section { margin-bottom: 22px; }

.detail-section h4 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--plasma);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.detail-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
  font-size: 0.92rem;
}

.spec-box {
  background: rgba(0,212,255,0.03);
  border: 1px solid var(--border);
  padding: 22px;
}

.spec-row { margin-bottom: 18px; }
.spec-row:last-child { margin-bottom: 0; }

.spec-label {
  display: block;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  margin-bottom: 5px;
}

.spec-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--white);
}

.spec-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.spec-chip {
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  color: var(--muted);
}

/* ── Knowledge Graph ────────────────────────────────────── */
.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

input[type="search"],
input[type="text"],
input[type="email"],
select,
textarea {
  background: rgba(0,212,255,0.03);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px 14px;
  border-radius: 0;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--plasma);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.08);
}

#knowledgeSearch { flex: 1; min-width: 220px; }

.graph-wrap {
  position: relative;
  border: 1px solid var(--border);
  background: var(--panel);
  height: 460px;
  overflow: hidden;
}

#graphCanvas {
  width: 100%; height: 100%;
  display: block;
  cursor: none;
}

.graph-info {
  position: absolute;
  bottom: 14px; left: 14px; right: 14px;
  background: rgba(3,7,18,0.9);
  border: 1px solid var(--border-mid);
  padding: 14px 18px;
  max-width: 400px;
  backdrop-filter: blur(8px);
}

.graph-info h4 { margin: 0 0 6px; font-size: 14px; font-family: var(--display); }
.graph-info p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.muted { color: var(--muted-2); }

.offline-note {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 12px;
}

/* ── Terminal ───────────────────────────────────────────── */
.terminal {
  border: 1px solid var(--border-mid);
  background: #020509;
  box-shadow: 0 0 50px rgba(0,212,255,0.08), inset 0 0 80px rgba(0,212,255,0.02);
  display: flex;
  flex-direction: column;
  height: 540px;
  position: relative;
}

.terminal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--plasma), transparent);
  opacity: 0.3;
}

.terminal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,212,255,0.02);
}

.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot.red    { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green  { background: #27c93f; }

.terminal-path {
  margin-left: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--plasma);
  opacity: 0.7;
}

.terminal-log {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-line { margin: 0; white-space: pre-wrap; }
.log-user { color: var(--white); }
.log-user::before { content: '> '; color: var(--plasma); }
.log-ai { color: var(--plasma); }
.log-system { color: var(--muted-2); font-style: italic; }

.terminal-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.terminal-form .prompt { font-family: var(--mono); color: var(--plasma); }

.terminal-form input {
  flex: 1;
  background: none;
  border: none;
  color: var(--white);
  font-family: var(--mono);
  font-size: 13px;
  padding: 6px 0;
  box-shadow: none;
}

.terminal-form input:focus { border: none; box-shadow: none; }

.terminal-form button {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  background: var(--plasma);
  color: var(--void);
  border: none;
  padding: 9px 18px;
  cursor: none;
  font-weight: 700;
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
  transition: box-shadow 0.2s;
}

.terminal-form button:hover { box-shadow: 0 0 16px var(--plasma-glow); }

/* ── Portfolio ──────────────────────────────────────────── */
.profile-card {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 28px;
  margin-bottom: 28px;
  backdrop-filter: blur(8px);
  position: relative;
}

.profile-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--plasma), transparent);
  opacity: 0.25;
}

.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: conic-gradient(var(--plasma) 0deg, var(--void-2) 120deg, var(--plasma-2) 240deg, var(--plasma) 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 24px;
  flex-shrink: 0;
  color: var(--void);
  animation: avatarSpin 12s linear infinite;
  padding: 2px;
}

@keyframes avatarSpin {
  to { filter: hue-rotate(360deg); }
}

.profile-info h3 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-family: var(--display);
  font-weight: 600;
}

.profile-info p {
  margin: 0 0 12px;
  color: var(--muted);
  max-width: 60ch;
  font-size: 0.9rem;
}

.profile-links { display: flex; gap: 14px; flex-wrap: wrap; }

.profile-links a {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--plasma);
  letter-spacing: 0.06em;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.profile-links a:hover { border-color: var(--plasma); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  overflow-x: auto;
  margin-bottom: 28px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.data-table th {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  background: rgba(0,212,255,0.03);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: rgba(0,212,255,0.03); }

.status-pill {
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 3px 10px;
  display: inline-block;
  letter-spacing: 0.06em;
}

.status-pill.ok   { color: var(--ok);     background: rgba(0,255,163,0.1); }
.status-pill.warn { color: var(--warn);   background: rgba(255,178,58,0.1); }
.status-pill.err  { color: var(--danger); background: rgba(255,77,109,0.1); }

.subhead {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--plasma);
  margin: 0 0 14px;
}

/* ── About ──────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  margin-bottom: 32px;
  align-items: start;
}

@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }

.photo-frame {
  aspect-ratio: 1;
  border: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 3rem;
  font-weight: 800;
  color: var(--plasma);
  background: radial-gradient(circle at 30% 20%, rgba(0,212,255,0.15), transparent 60%), var(--panel-solid);
  position: relative;
}

.photo-frame::before {
  top: 10px; left: 10px;
  border-top: 1.5px solid var(--plasma);
  border-left: 1.5px solid var(--plasma);
}

.photo-frame::after {
  bottom: 10px; right: 10px;
  border-bottom: 1.5px solid var(--plasma);
  border-right: 1.5px solid var(--plasma);
}

.photo-frame::before, .photo-frame::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  opacity: 0.7;
}

.about-meta { display: flex; flex-wrap: wrap; gap: 32px; margin: 20px 0 22px; }

.meta-label {
  display: block;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  color: var(--plasma);
  margin-bottom: 4px;
}

.meta-value { font-size: 14px; }

.about-text { color: var(--muted); line-height: 1.82; max-width: 70ch; margin: 0 0 24px; font-size: 0.93rem; }

.link-row { display: flex; gap: 12px; flex-wrap: wrap; }

.cert-card {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 18px;
  transition: border-color 0.2s;
}

.cert-card:hover { border-color: var(--border-mid); }

.cert-card h4 { margin: 0 0 6px; font-size: 14px; font-family: var(--display); }

.cert-card p {
  margin: 0;
  color: var(--muted-2);
  font-size: 11.5px;
  font-family: var(--mono);
}

/* ── Contact Form ───────────────────────────────────────── */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 640px;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted-2);
}

.contact-form input,
.contact-form textarea { width: 100%; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.form-note {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ok);
  min-height: 16px;
  margin: 0;
}

/* ── Status Bar ─────────────────────────────────────────── */
.statusbar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 0 clamp(16px, 4vw, 40px);
  height: 38px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  background: rgba(3,7,18,0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

.statusbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--plasma), transparent);
  opacity: 0.14;
}

.status-left { display: flex; align-items: center; gap: 8px; color: var(--ok); }
.status-mid  { color: var(--muted-2); }

.status-left .dot {
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}

/* ── Responsive Nav ─────────────────────────────────────── */
@media (max-width: 920px) {
  .nav {
    position: fixed;
    top: 64px; left: 0; right: 0;
    background: rgba(3,7,18,0.98);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px 24px 22px;
    gap: 2px;
    transform: translateY(-120%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  }

  .nav.open { transform: translateY(0); }

  .nav-link {
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-toggle { display: flex; }
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--void-2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--plasma-2); }

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Scroll reveal ──────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.4,0,0.2,1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── PDF Download card fix ──────────────────────────────── */
.pdf-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--plasma);
  border: 1px solid var(--border-mid);
  padding: 8px 14px;
  transition: all 0.2s;
  background: var(--plasma-dim);
  letter-spacing: 0.06em;
  margin-top: auto;
}

.pdf-download-btn:hover {
  background: rgba(0,212,255,0.15);
  border-color: var(--plasma);
  box-shadow: 0 0 12px var(--plasma-glow);
}
