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

:root {
  --bg:          #0B0D10;
  --bg-alt:      #12151A;
  --fg:          #E8EAED;
  --fg-muted:    #A9B2C4;
  --accent:      #4DD0E1;
  --accent-rgb:  77,208,225;
  --line:        rgba(255,255,255,0.14);

  --font-heading: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-body:    'Manrope', system-ui, -apple-system, sans-serif;

  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo:   cubic-bezier(0.16, 1, 0.3, 1);
}

html { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: clamp(15px, 1.1vw, 17px);
  font-weight: 400;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ─── SCROLL PROGRESS BAR ────────────────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 200;
  transform-origin: left;
  transition: width 0.05s linear;
}

/* ─── INTRO CURTAIN ─────────────────────────────────────────── */
.intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  pointer-events: none;
}

.intro__panel {
  flex: 1;
  background: var(--bg);
  transform-origin: top;
}

.intro__wordmark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: clamp(48px, 8vw, 96px);
  font-weight: 300;
  letter-spacing: 0.12em;
  color: var(--fg);
  pointer-events: none;
}

/* ─── CURSOR ────────────────────────────────────────────────── */
.cursor,
.cursor-follower {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  will-change: transform;
}

.cursor {
  width: 8px; height: 8px;
  background: var(--accent);
  box-shadow: 0 0 12px 2px rgba(var(--accent-rgb), 0.7);
  transition: transform 0.1s var(--ease-out), opacity 0.2s;
}

.cursor-follower {
  width: 44px; height: 44px;
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.04);
  transition: width 0.4s var(--ease-out),
              height 0.4s var(--ease-out),
              opacity 0.3s,
              background 0.3s,
              border-color 0.3s,
              box-shadow 0.3s;
}

.cursor-follower.cursor-follower--hover {
  width: 58px; height: 58px;
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.5);
}

.cursor-follower.cursor-follower--magnet {
  width: 84px; height: 84px;
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.65);
  box-shadow: 0 0 32px 6px rgba(var(--accent-rgb), 0.3);
}

.cursor.cursor--hover { transform: translate(-50%,-50%) scale(1.6); }

@media (hover: none) { .cursor, .cursor-follower { display: none; } }

/* ─── CONTAINER & LAYOUT ─────────────────────────────────────── */
.container {
  width: min(1280px, 92vw);
  margin-inline: auto;
}

.section {
  padding-block: clamp(96px, 13vw, 176px);
  border-top: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.section__label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-bottom: clamp(48px, 6vw, 88px);
}

/* ─── SECTION BACKGROUND ALTERNATION ─────────────────────────── */
.chi-sono   { background: var(--bg); }
.competenze { background: var(--bg-alt); }
.attivita   { background: var(--bg); }
.contatti   { background: var(--bg-alt); }

/* ─── HEADER ────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 28px 0;
  transition: background 0.5s var(--ease-out),
              padding 0.4s var(--ease-out),
              border-color 0.4s;
  border-bottom: 1px solid transparent;
}

.header.scrolled {
  background: rgba(11,13,16,0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 18px 0;
  border-color: var(--line);
}

.header__inner {
  width: min(1280px, 92vw);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.header__nav { display: flex; gap: 40px; }

.nav-link {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg-muted);
  transition: color 0.2s;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease-out);
}

.nav-link:hover { color: var(--fg); }
.nav-link:hover::after { width: 100%; }

/* ─── MOBILE MENU ────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.menu-toggle span {
  display: block;
  width: 24px; height: 1px;
  background: var(--fg);
  transition: transform 0.3s var(--ease-out), opacity 0.3s;
}

.menu-toggle.open span:first-child { transform: rotate(45deg) translate(3px, 3px); }
.menu-toggle.open span:last-child  { transform: rotate(-45deg) translate(3px, -3px); }

.mobile-nav {
  /* Positioned OUT of the header's normal document flow: the header
     is `position: fixed`, so this absolute panel is placed relative
     to it (top: 100%, i.e. right below the nav bar) without ever
     adding its own height to the header's box. Before this fix the
     panel was laid out in-flow with `display:flex` at all times
     (only hidden via opacity/pointer-events), so its ~180px of link
     rows were silently inflating the fixed header on every mobile
     view — the header looked like it "grew" over the content the
     moment you scrolled past the intro and actually saw it. */
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: none;
  flex-direction: column;
  background: rgba(11,13,16,0.97);
  backdrop-filter: blur(12px);
  padding: 20px min(6vw, 40px) 32px;
  border-top: 1px solid var(--line);
  max-height: calc(100vh - 100%);
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

.mobile-nav.open { opacity: 1; transform: translateY(0); pointer-events: all; }

.mobile-nav__link {
  font-family: var(--font-body);
  font-size: 17px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--fg-muted);
  transition: color 0.2s;
}

.mobile-nav__link:hover { color: var(--fg); }

@media (max-width: 720px) {
  .header__nav { display: none; }
  .menu-toggle { display: flex; }
  .mobile-nav  { display: flex; }
}

/* ─── HERO ──────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(72px, 9vw, 132px);
  overflow: hidden;
  background: var(--bg);
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 2s ease;
}

.hero__canvas.visible { opacity: 0.55; }

.hero__content {
  position: relative;
  z-index: 2;
  width: min(1280px, 92vw);
  margin-inline: auto;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 28px;
  opacity: 0;
}

.hero__title {
  font-family: var(--font-heading);
  font-size: clamp(38px, 5vw, 72px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
  white-space: nowrap;
}

.hero__title-line {
  display: block;
  overflow: hidden;
}

.hero__title-line > span {
  display: block;
}

.hero__desc {
  font-family: var(--font-body);
  font-size: clamp(15px, 1.2vw, 18px);
  color: var(--fg-muted);
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: 36px;
  opacity: 0;
}

.hero__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 3px;
  opacity: 0;
  transition: letter-spacing 0.35s var(--ease-out), opacity 0.25s;
}

.hero__link:hover { letter-spacing: 0.05em; opacity: 0.8; }

.hero__scroll-hint {
  position: absolute;
  bottom: clamp(32px, 4vw, 56px);
  right: min(6vw, 60px);
  z-index: 2;
}

.hero__scroll-line {
  display: block;
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, transparent, var(--fg-muted));
  animation: scrollPulse 2.4s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(1); }
  50%       { opacity: 0.9; transform: scaleY(0.55); }
}

/* ─── CHI SONO ───────────────────────────────────────────────── */
.chi-sono__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 100px);
  align-items: start;
}

.chi-sono__heading {
  font-family: var(--font-heading);
  font-size: clamp(30px, 3.5vw, 52px);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -0.02em;
}

.chi-sono__body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  color: var(--fg-muted);
  font-size: clamp(14px, 1vw, 16px);
  padding-top: 6px;
}

@media (max-width: 800px) {
  .chi-sono__grid { grid-template-columns: 1fr; }
}

/* ─── MARQUEE / TICKER DIVIDER ───────────────────────────────── */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
  padding-block: clamp(16px, 2.4vw, 22px);
}

.marquee__track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: marqueeScroll 26s linear infinite;
  will-change: transform;
}

.marquee:hover .marquee__track { animation-play-state: paused; }

.marquee__item {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg-muted);
  white-space: nowrap;
}

.marquee__sep {
  display: inline-block;
  color: var(--accent);
  font-size: clamp(13px, 1.6vw, 16px);
  margin-inline: clamp(18px, 2.4vw, 32px);
  text-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6);
}

@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track { animation: none; }
}

/* ─── STATS — keyword highlights (scroll-triggered reveal) ──── */
.stats {
  border-top: 1px solid var(--line);
  padding-block: clamp(56px, 8vw, 100px);
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
}

.stat {
  padding: clamp(24px, 3vw, 40px);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.stat + .stat { border-left: 1px solid var(--line); }

.stat__icon {
  display: block;
  width: clamp(26px, 2.8vw, 34px);
  height: clamp(26px, 2.8vw, 34px);
  margin: 0 auto 14px;
  color: var(--accent);
  opacity: 0;
  transform: rotate(-25deg) scale(0.7);
  filter: drop-shadow(0 0 0 rgba(var(--accent-rgb), 0));
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out), filter 0.7s var(--ease-out);
}

.stat__icon svg { width: 100%; height: 100%; }

.stat.stat--lit .stat__icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), 0.65));
}

.stat__word {
  font-family: var(--font-mono);
  font-size: clamp(30px, 4vw, 54px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  display: inline-block;
  color: var(--accent);
  text-shadow: 0 0 0 rgba(var(--accent-rgb), 0);
  transition: text-shadow 0.7s ease;
}

.stat.stat--lit .stat__word {
  text-shadow: 0 0 30px rgba(var(--accent-rgb), 0.55), 0 0 8px rgba(var(--accent-rgb), 0.85);
}

.stat__label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin-top: 12px;
}

@media (max-width: 620px) {
  .stats__grid { grid-template-columns: 1fr; }
  .stat + .stat { border-left: none; border-top: 1px solid var(--line); }
}

/* ─── COMPETENZE ─────────────────────────────────────────────── */
.competenze__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.skill-card {
  background: var(--bg-alt);
  padding: clamp(32px, 4vw, 56px);
  position: relative;
  perspective: 800px;
  transform-style: preserve-3d;
  transition: background 0.35s var(--ease-out),
              transform 0.4s var(--ease-out),
              box-shadow 0.4s var(--ease-out);
  will-change: transform;
}

.skill-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--accent);
  box-shadow: 0 0 16px 1px rgba(var(--accent-rgb), 0.7);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}

.skill-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 0%), rgba(var(--accent-rgb), 0.08), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
}

.skill-card:hover {
  background: #161a21;
  box-shadow: 0 24px 48px -24px rgba(0,0,0,0.6);
}
.skill-card:hover::before { transform: scaleX(1); }
.skill-card:hover::after { opacity: 1; }

.skill-card__number {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 24px;
  transition: text-shadow 0.35s;
}

.skill-card:hover .skill-card__number {
  text-shadow: 0 0 18px rgba(var(--accent-rgb), 0.7);
}

.skill-card__title {
  font-family: var(--font-heading);
  font-size: clamp(16px, 1.4vw, 20px);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.skill-card__desc {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.65;
}

@media (max-width: 640px) { .competenze__grid { grid-template-columns: 1fr; } }

/* ─── ATTIVITÀ ───────────────────────────────────────────────── */
.attivita__heading {
  font-family: var(--font-heading);
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: clamp(48px, 5.5vw, 72px);
}

.attivita__list { display: flex; flex-direction: column; }

.attivita__item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 24px;
  align-items: start;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.attivita__item:first-child { border-top: 1px solid var(--line); }

.attivita__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 8px;
}

.attivita__item strong { font-family: var(--font-heading); display: block; font-weight: 500; font-size: 15px; margin-bottom: 6px; color: var(--fg); }
.attivita__item p { font-size: 14px; color: var(--fg-muted); line-height: 1.6; }

/* ─── CONTATTI ───────────────────────────────────────────────── */
.contatti__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.contatti__heading {
  font-family: var(--font-heading);
  font-size: clamp(40px, 6vw, 96px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}

.contatti__sub { font-size: 14px; color: var(--fg-muted); max-width: 360px; }

/* ─── FORM CONTATTI ──────────────────────────────────────────── */
.contatti__form {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.form-field { display: flex; flex-direction: column; gap: 8px; }

.form-field > label:not(.form-check) {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.form-field input,
.form-field textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  color: var(--fg);
  outline: none;
  resize: none;
  transition: border-color 0.25s;
  width: 100%;
}

.form-field input:focus,
.form-field textarea:focus { border-color: var(--accent); }

.form-submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #06181c;
  border: none;
  padding: 14px 32px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  align-self: flex-start;
  transition: opacity 0.2s, transform 0.3s var(--ease-out);
  animation: ctaGlow 2.6s ease-in-out infinite;
}

.form-submit:hover { opacity: 0.85; transform: translateY(-2px); }
.form-submit:disabled { animation: none; opacity: 0.55; cursor: default; }

@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.45); }
  50%      { box-shadow: 0 0 22px 4px rgba(var(--accent-rgb), 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  .form-submit { animation: none; }
}

.form-submit__arrow { transition: transform 0.3s var(--ease-out); }
.form-submit:hover .form-submit__arrow { transform: translateX(5px); }

.form-feedback { font-size: 13px; color: var(--fg-muted); min-height: 1.4em; }

.form-field--check { margin-top: 4px; }

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-top: 2px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.form-check input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.form-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 1.5px solid #06181c;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.form-check span {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
}

.form-check__link {
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s, color 0.2s;
}

.form-check__link:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ─── FOOTER ─────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 28px;
  background: var(--bg);
  overflow: hidden;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
}

.footer__copy { font-family: var(--font-mono); font-size: 12px; color: var(--fg-muted); letter-spacing: 0.02em; }

.footer__cookies {
  font-size: 11px;
  color: var(--fg-muted);
  opacity: 0.6;
  font-style: italic;
}

/* ─── REVEAL — line-inner ────────────────────────────────────── */
/* All initial states set via GSAP — no hidden defaults in CSS */
.reveal-line-block .line-inner { display: block; will-change: transform; }

/* ─── MAGNETIC ───────────────────────────────────────────────── */
[data-magnetic] { display: inline-block; will-change: transform; }

/* ─── MOBILE HERO ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .hero__desc br { display: none; }
  .hero { align-items: center; padding-top: 120px; }
}
