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

/* ========= ROOT ========= */
:root {
  --bg-main: #020818;
  --bg-alt: #050b1f;
  --accent: #4fc3ff;
  --accent-strong: #1ea2ff;
  --text-main: #f7f7ff;
  --text-muted: #9fb3c9;
  --card-bg: rgba(8, 13, 32, 0.9);
  --radius-lg: 20px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  --soft-blue-glow: 0 0 25px rgba(80, 180, 255, 0.5);
}

/* ========= GLOBAL ========= */
html,
body {
  height: 100%;
  background: radial-gradient(circle at top, #182646 0%, #020818 55%, #000 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
}

body {
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ========= HEADER (RESPONSIVE + STICKY) ========= */
.site-header {
  position: sticky;
  top: 0;
  width: 100%;
  height: auto;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(
    to right,
    rgba(2, 8, 24, 0.94),
    rgba(2, 8, 24, 0.86)
  );
  border-bottom: 1px solid rgba(79, 195, 255, 0.18);
  z-index: 20;
}

/* Logo sfera cliccabile */
.logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; /* tap target iOS */
  height: 44px;
  border-radius: 12px;
  text-decoration: none;
  outline: none;
  flex: 0 0 auto;
}

.logo-link:focus-visible {
  box-shadow: 0 0 0 3px rgba(127, 217, 255, 0.35);
}

.sphere {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    #aee8ff,
    #3aa0ff 40%,
    #0b3c8a 70%,
    #051430
  );
  box-shadow:
    0 0 12px rgba(120, 220, 255, 0.6),
    inset 0 0 10px rgba(255, 255, 255, 0.25);
}

/* Testo header */
.header-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.header-text .logo-text {
  font-size: 1.05rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-text .logo-sub {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

/* Bottone "Contatti" */
.nav-link {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.45rem 1.3rem;
  border-radius: 999px;
  border: 1px solid rgba(79, 195, 255, 0.6);
  color: var(--text-main);
  background: radial-gradient(circle at top left, rgba(79, 195, 255, 0.18), transparent);
  position: relative;
  overflow: hidden;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.1s ease;
}

.nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(79, 195, 255, 0.4),
    rgba(30, 162, 255, 0.08),
    transparent
  );
  opacity: 0;
  transform: translateX(-20%);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.nav-link:hover {
  border-color: var(--accent-strong);
  background: radial-gradient(circle at top left, rgba(79, 195, 255, 0.28), transparent);
  box-shadow: 0 0 20px rgba(79, 195, 255, 0.55);
  transform: translateY(-1px);
}

.nav-link:hover::before {
  opacity: 1;
  transform: translateX(0);
}

/* ========= HERO (Babylon, attaccata sotto header) ========= */
.hero{
  position: relative;
  height: calc(100svh - var(--header-h, 0px));
  min-height: calc(100svh - var(--header-h, 0px));
  margin-top: 0;
  display: flex;
}


#renderCanvas {
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
  display: block;
  pointer-events: none; /* se vuoi bloccare tocchi sulla scena */
}

/* ========= CONTENT ========= */
main {
  flex: 1 0 auto;
}

.content {
  padding: 3rem 1.4rem 3.4rem;
  background: radial-gradient(circle at top, var(--bg-alt), rgba(2, 8, 24, 0.96));
  max-width: 1120px;
  margin: 0 auto 3rem;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(79, 195, 255, 0.16);
  border-top: none;
}

.content-block {
  background: linear-gradient(
    145deg,
    rgba(8, 13, 32, 0.96),
    rgba(8, 18, 42, 0.96)
  );
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.8rem;
  position: relative;
  box-shadow: var(--shadow);
  border: 1px solid rgba(80, 160, 255, 0.18);
  overflow: hidden;
}

.content-block::before {
  content: "";
  position: absolute;
  inset: -40%;
  opacity: 0.08;
  background: radial-gradient(circle at top left, #4fc3ff, transparent 60%);
  pointer-events: none;
}

.content-block + .content-block {
  margin-top: 2rem;
}

.content-block h2 {
  font-size: 1.5rem;
  margin-bottom: 0.7rem;
}

.content-block p {
  color: var(--text-muted);
  line-height: 1.7;
}

.content-header {
  margin-bottom: 1rem;
}

.content-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ========= PROJECTS GRID ========= */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 1.1rem;
}

.project-item {
  background: linear-gradient(
    150deg,
    rgba(6, 10, 28, 0.9),
    rgba(12, 24, 50, 0.95)
  );
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.3rem;
  position: relative;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(80, 160, 255, 0.2);
  overflow: hidden;
}

.project-item::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(79, 195, 255, 0.22), transparent 60%);
  opacity: 0.4;
  pointer-events: none;
}

.pill {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  border-radius: 999px;
  margin-bottom: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.pill-story {
  color: #ffe2ff;
  border-color: rgba(255, 180, 255, 0.4);
}

.pill-game {
  color: #ffe7c3;
  border-color: rgba(255, 200, 110, 0.5);
}

.pill-dev {
  color: #c1f5ff;
  border-color: rgba(80, 195, 255, 0.5);
}

.project-item h3 {
  margin-bottom: 0.4rem;
  font-size: 1.15rem;
}

.project-item p {
  color: var(--text-muted);
}

.project-tags {
  margin-top: 0.6rem;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.project-tags li {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(2, 8, 24, 0.9);
  color: var(--accent);
}

/* ========= LISTE NELLE SEZIONI DI CONTENUTO ========= */
.content-block ul {
  margin-top: 0.8rem;
  margin-left: 1.2rem;
  list-style: none;
}

.content-block ul li {
  position: relative;
  margin-bottom: 0.55rem;
  padding-left: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

/* bullet luminoso */
.content-block ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(80, 180, 255, 0.9);
}

/* ========= RESPONSIVE ========= */
@media (max-width: 420px) {
  .site-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .sphere {
    width: 32px;
    height: 32px;
  }

  .nav-link {
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
  }
}

@media (min-width: 768px) {
  .content {
    padding: 3.2rem 2.2rem 3.4rem;
  }

  .projects-grid {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .project-item {
    flex: 1 1 260px;
  }
}

/* ========= FOOTER ========= */
.site-footer {
  text-align: center;
  padding: 1.2rem;
  padding-bottom: calc(1.2rem + env(safe-area-inset-bottom));
  background: #020818;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}
/* ========= CTA SOTTO HERO ========= */
/* Pulsante Contatti sovrapposto: alto centro */
.hero-cta{
  position: absolute;
  top: 12px; /* distanza dalla top della hero (sotto header sticky) */
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;

  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;

  padding: 0.5rem 1.35rem;
  border-radius: 999px;
  border: 1px solid rgba(79, 195, 255, 0.65);
  color: var(--text-main);
  background: rgba(2, 8, 24, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  box-shadow: 0 0 18px rgba(79, 195, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.hero-cta:hover{
  background: rgba(2, 8, 24, 0.70);
  box-shadow: 0 0 22px rgba(79, 195, 255, 0.55);
  transform: translateX(-50%) translateY(-1px);
}

/* su mobile: più vicino e più compatto */
@media (max-width: 420px){
  .hero-cta{
    top: 10px;
    padding: 0.45rem 1.1rem;
    font-size: 0.75rem;
  }
}
/* Quando Contatti è sovrapposto alla scena */
.nav-link.is-hero-cta{
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;

  background: rgba(2, 8, 24, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 18px rgba(79, 195, 255, 0.35);
}
@media (max-width: 420px){
  .nav-link.is-hero-cta{
    top: 10px;
    padding: 0.45rem 1.1rem;
    font-size: 0.75rem;
  }
}
