/* ---------- Fonts (self-hosted) ----------
   Clash Display + Satoshi: Fontshare, ITF Free Font License (commercial use OK).
   Instrument Serif: Google Fonts, SIL OFL. */
@font-face { font-family: 'Clash Display'; src: url('../public/fonts/clash-display-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Clash Display'; src: url('../public/fonts/clash-display-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('../public/fonts/satoshi-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('../public/fonts/satoshi-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('../public/fonts/satoshi-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('../public/fonts/instrument-serif-italic.woff2') format('woff2'); font-style: italic; font-weight: 400; font-display: swap; }

:root {
  --bg: #0a0a0f;
  --violet: #7c3aed;
  --indigo: #4f46e5;
  --cyan: #22d3ee;
  --ink: #ecebf5;
  --ink-dim: rgba(236, 235, 245, 0.66);
  --line: rgba(236, 235, 245, 0.14);
  --display: 'Clash Display', 'Satoshi', system-ui, sans-serif;
  --sans: 'Satoshi', system-ui, -apple-system, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --gutter: clamp(16px, 4vw, 48px);
  --header-h: 72px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg); color: var(--ink);
  scrollbar-gutter: stable;          /* unlocking scroll never shifts the layout */
}
body {
  margin: 0; background: var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html.is-locked, html.is-locked body { overflow: hidden; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: var(--gutter); top: 12px; z-index: 100;
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font: 500 14px/1 var(--sans); text-decoration: none;
  transform: translateY(-160%); transition: transform .3s var(--ease-out);
}
.skip-link:focus { transform: none; }

/* ---------- Preloader ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  background: var(--bg);
}
.preloader__word { font: 500 12px/1 var(--sans); letter-spacing: 0.5em; padding-left: 0.5em; text-transform: uppercase; color: var(--ink-dim); }
.preloader__bar { width: 120px; height: 1px; background: var(--line); overflow: hidden; }
.preloader__bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transform-origin: left; transform: scaleX(0);
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 40;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) 0;
  display: flex; align-items: center; justify-content: space-between;
  opacity: 0;
}
.brand { display: inline-flex; padding: 6px; margin-left: -6px; border-radius: 8px; }
.site-header__actions { display: flex; align-items: center; gap: 10px; }
.header-cta, .menu-btn {
  height: 40px; padding: 0 16px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 14px/1 var(--sans); text-decoration: none; color: var(--ink); cursor: pointer;
  border: 1px solid var(--line); background: rgba(10, 10, 15, .4); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .3s, background-color .3s;
}
.header-cta:hover, .menu-btn:hover { border-color: rgba(236, 235, 245, .35); }
.menu-btn__icon { width: 14px; height: 8px; position: relative; }
.menu-btn__icon i { position: absolute; left: 0; width: 100%; height: 1.5px; border-radius: 1px; background: currentColor; transition: transform .5s var(--ease-out), top .5s var(--ease-out); }
.menu-btn__icon i:first-child { top: 0; }
.menu-btn__icon i:last-child { top: 6.5px; }
.menu-btn[aria-expanded="true"] .menu-btn__icon i:first-child { top: 3.25px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn__icon i:last-child { top: 3.25px; transform: rotate(-45deg); }

/* audio toggle lives in the header */
.audio-toggle {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; cursor: pointer;
  color: var(--ink-dim); background: rgba(10, 10, 15, .4); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: color .3s, border-color .3s, box-shadow .4s;
}
.audio-toggle[hidden] { display: none; }
.audio-toggle:hover { color: var(--ink); }
.audio-toggle .audio-toggle__on { display: none; }
.audio-toggle[aria-pressed="true"] { color: var(--ink); border-color: rgba(34, 211, 238, .5); box-shadow: 0 0 22px -6px rgba(34, 211, 238, .6); }
.audio-toggle[aria-pressed="true"] .audio-toggle__on { display: inline; }
.audio-toggle[aria-pressed="true"] .audio-toggle__off { display: none; }

/* ---------- Full-screen menu ---------- */
.menu {
  position: fixed; inset: 0; z-index: 35;
  padding: calc(var(--header-h) + 6vh) var(--gutter) calc(40px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  background: radial-gradient(120% 80% at 80% 0%, rgba(124, 58, 237, .18), transparent 60%), var(--bg);
  clip-path: inset(0 0 100% 0);
}
.menu[hidden] { display: none; }
.menu__list { list-style: none; margin: 0; padding: 0; }
.menu__list li { overflow: hidden; border-bottom: 1px solid var(--line); }
.menu__list a {
  display: flex; align-items: baseline; gap: 18px; padding: 2.2vh 0;
  font: 500 clamp(2.6rem, 8vw, 6.5rem)/1 var(--display); letter-spacing: -0.02em; text-decoration: none;
  transition: color .3s, padding-left .5s var(--ease-out);
}
/* five entries must fit short laptop screens too: the size also follows the viewport height */
.menu__list a { font-size: min(clamp(2.6rem, 8vw, 6.5rem), 8.5vh); }
.menu { overflow-y: auto; overscroll-behavior: contain; }
.menu__list a:hover { color: #c9bcff; padding-left: 12px; }
.menu__num { font: 500 12px/1 var(--sans); letter-spacing: .14em; color: var(--ink-dim); transform: translateY(-1.2em); }
.menu__cta { align-self: flex-start; }

/* ---------- Hero ---------- */
.hero { position: relative; height: 100vh; height: 100svh; }
.hero__stage { position: relative; height: 100vh; height: 100svh; overflow: hidden; }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* split text */
.sw { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.si { display: inline-block; will-change: transform; }

/* 45% / 70% captions */
.caption {
  position: absolute; left: 0; right: 0; bottom: clamp(64px, 14vh, 150px);
  margin: 0 auto; padding: 0 var(--gutter); max-width: 20ch;
  text-align: center;
  font: 500 clamp(1.8rem, 4.2vw, 3.7rem)/1.04 var(--display); letter-spacing: -0.02em;
  visibility: hidden; pointer-events: none;
}
/* gradient on the words themselves: background-clip on the parent breaks once words are transformed */
.caption em, .hero__title em,
.caption em .si, .hero__title em .si {
  background: linear-gradient(100deg, #b79cff 0%, var(--cyan) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.caption em .si, .hero__title em .si { padding-right: 0.06em; }
.caption em:has(.si), .hero__title em:has(.si) { background: none; }
.caption em, .hero__title em { font-size: 1.08em; }

/* 100% */
.hero__final {
  position: absolute; left: 0; right: 0; bottom: clamp(36px, 8vh, 88px);
  padding: 0 var(--gutter);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  visibility: hidden;
}
.hero__wordmark {
  margin: 0 0 18px;
  font: 500 12px/1 var(--sans); letter-spacing: 0.6em; padding-left: 0.6em; text-transform: uppercase;
  color: #c9bcff;
}
.hero__title {
  margin: 0; max-width: 15ch;
  font: 500 clamp(2.4rem, 5.6vw, 5.4rem)/0.98 var(--display); letter-spacing: -0.025em;
}
.hero__subtitle {
  margin: 20px 0 0; max-width: 44ch;
  font-size: clamp(1rem, 1.2vw, 1.12rem); line-height: 1.55; color: var(--ink-dim);
}
.hero__ctas { margin-top: 30px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px; border-radius: 999px;
  font: 500 15px/1.2 var(--sans); text-decoration: none; color: var(--ink);
  transition: box-shadow .4s var(--ease-out), border-color .3s, background-color .3s, transform .4s var(--ease-out);
}
/* white on violet -> indigo: >= 4.9:1 everywhere (WCAG AA); cyan only in the glow */
.btn--primary {
  color: #fff;
  background: linear-gradient(100deg, var(--violet), var(--indigo));
  box-shadow: 0 0 26px -6px rgba(124, 58, 237, .85), 0 0 56px -14px rgba(34, 211, 238, .65), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 36px -4px rgba(124, 58, 237, .95), 0 0 72px -12px rgba(34, 211, 238, .85), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn--ghost { border: 1px solid var(--line); background: rgba(10, 10, 15, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn--ghost:hover { border-color: rgba(34, 211, 238, .55); }

/* discreet skip, only during the automatic phase */
.skip {
  position: absolute; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5;
  background: none; border: 0; padding: 8px 2px; cursor: pointer;
  font: 500 11px/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-dim);
  opacity: 0; visibility: hidden;
}
.skip::after {
  content: ''; display: block; height: 1px; margin-top: 6px; background: currentColor;
  transform: scaleX(.3); transition: transform .5s var(--ease-out);
}
.skip:hover { color: var(--ink); }
.skip:hover::after { transform: scaleX(1); }

/* ---------- Servizi (start) ---------- */
.servizi {
  position: relative; min-height: 100vh;
  padding: 22vh var(--gutter) 12vh;
  background: var(--bg);
}
.servizi:focus { outline: none; }
.eyebrow { margin: 0 0 24px; font: 500 12px/1 var(--sans); letter-spacing: 0.24em; text-transform: uppercase; color: var(--cyan); }
.servizi__title { margin: 0; font: 500 clamp(2.6rem, 7vw, 6.8rem)/1 var(--display); letter-spacing: -0.03em; }

/* ---------- Reduced motion: formed Y + texts, static ---------- */
.reduced .hero__final { visibility: visible; }
.reduced .site-header { opacity: 1; }

/* ---------- Phone: its own layout, not the desktop one shrunk ----------
   Editorial, left-aligned type anchored to the thumb zone; the Y owns the top half. */
@media (max-width: 600px) {
  :root { --header-h: 64px; }
  .header-cta { display: none; }               /* the CTA is in the hero and in the menu */
  .menu-btn { padding: 0 14px; }

  .caption {
    text-align: left; max-width: none; margin: 0;
    bottom: calc(96px + env(safe-area-inset-bottom));
    font-size: clamp(2.2rem, 10.5vw, 2.9rem); line-height: 1;
  }
  .hero__final {
    align-items: flex-start; text-align: left;
    bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .hero__wordmark { margin-bottom: 14px; padding-left: 0; }
  .hero__title { font-size: clamp(2.3rem, 10.8vw, 3rem); max-width: 12ch; }
  .hero__subtitle { margin-top: 14px; font-size: 1rem; max-width: 34ch; }
  .hero__ctas { width: 100%; flex-direction: column; margin-top: 22px; gap: 10px; }
  .btn { width: 100%; }

  .menu__list a { padding: 2.6vh 0; }
  .menu__cta { align-self: stretch; }
}

/* header past the hero: soft backdrop so content never reads through it */
.site-header::before {
  content: ''; position: absolute; inset: 0 0 -24px; z-index: -1; pointer-events: none;
  background: linear-gradient(var(--bg) 55%, transparent);
  opacity: 0; transition: opacity .5s var(--ease-out);
}
.site-header.is-solid::before { opacity: 1; }
