/* JUDE Studio — landing
   Palette dal brief: Carta, Grafite, Verde JUDE, Rosso mattone, Blu petrolio */

:root {
  --carta: #EEE9DE;
  --grafite: #393A37;
  --verde: #89A84F;
  --mattone: #B65F49;
  --petrolio: #456B70;
  --rule: rgba(57, 58, 55, 0.35);

  --gutter: clamp(16px, 5.8vw, 116px);
  --maxw: 1680px;
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--carta);
  position: relative;
  color: var(--grafite);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: clamp(16px, 1.05vw + 8px, 20px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Titoli: Archivo esteso, come nel mockup */
.intro__word,
.nav__word, .chapter__title, .cta__title, .footer__word, .word {
  font-family: "Archivo", system-ui, sans-serif;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* Etichette spaziate */
.nav__links a, .tagline, .btn, .chapter__num, .footer__line, .footer__studio {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-weight: 500;
}

/* ---------- NAV ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(14px, 2.4vw, 40px) var(--gutter);
}
.nav__brand { display: flex; align-items: center; gap: 0.6em; text-decoration: none; }
.nav__mark { width: clamp(34px, 3.6vw, 70px); height: clamp(33px, 3.5vw, 68px); }
.nav__word { font-size: clamp(26px, 3vw, 58px); line-height: 1; }
.nav__links { display: flex; gap: clamp(18px, 3.8vw, 76px); }
.nav__links a {
  text-decoration: none; font-size: clamp(11px, 0.85vw, 16px);
  padding: 0.4em 0; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.4s var(--ease-out);
}
.nav__links a:hover, .nav__links a:focus-visible { background-size: 100% 1px; }

/* ---------- INTRO: JUDE al centro ---------- */
.intro {
  height: 100vh; height: 100svh; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 16px;
}
.intro__word {
  display: flex; margin: 0;
  font-size: clamp(84px, 21vw, 360px); line-height: 0.9;
}
.m { display: inline-block; overflow: hidden; padding: 0.05em 0.09em 0.14em; margin: 0 -0.09em; }
.l { display: inline-block; }
.intro__studio {
  margin: 0.6em 0 0; font-size: clamp(12px, 1.2vw, 20px);
  text-transform: uppercase; letter-spacing: 0.9em; padding-left: 0.9em; font-weight: 500;
}

.intro__scroll {
  position: absolute; left: 50%; bottom: 28px; width: 22px; height: 36px;
  border: 1.5px solid var(--grafite); border-radius: 12px; transform: translateX(-50%);
}
.intro__scroll span {
  position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px;
  background: var(--grafite); border-radius: 2px;
  animation: scrollcue 1.8s var(--ease) infinite;
}
@keyframes scrollcue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* Composizione della scritta (solo con JS) */
.js .l { transform: translateY(135%); }
.js .intro__word { letter-spacing: 0.14em; }
.js .intro__studio, .js .intro__scroll { opacity: 0; }
.play .l { animation: rise 1.1s var(--ease-out) forwards; animation-delay: calc(0.15s + var(--i) * 0.1s); }
.play .intro__word { animation: track 1.8s var(--ease-out) 0.15s forwards; }
.play .intro__studio { animation: fade 1s var(--ease-out) 1.1s forwards; }
.play .intro__scroll { animation: fadecue 1s var(--ease-out) 1.6s forwards; }
@keyframes rise { to { transform: none; } }
@keyframes track { to { letter-spacing: -0.01em; } }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadecue { from { opacity: 0; } to { opacity: 1; } }

/* Il menu compare dopo l'intro */
.js .nav { opacity: 0; transform: translateY(-12px); pointer-events: none; transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out); }
.js .nav.is-on { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- MANIFESTO: linee guidate dallo scroll ---------- */
.scrolly { height: 380vh; position: relative; }
.scrolly__stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(110px, 15vh, 170px) var(--gutter) clamp(28px, 5vh, 56px);
}
.hero__art { width: 100%; height: auto; max-height: 66svh; overflow: visible; }
.word { font-size: 124px; fill: currentColor; dominant-baseline: central; }
.word .dot { fill: var(--verde); }
.js .draw { stroke-dasharray: 1 2; stroke-dashoffset: 1.01; }
.js .word { opacity: 0; transform-box: fill-box; }

.hero__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 24px 40px; margin-top: clamp(24px, 4vh, 56px);
  border-top: 1px solid var(--rule); padding-top: clamp(18px, 3vh, 32px);
}
.js .hero__foot { opacity: 0; }
.tagline { margin: 0; font-size: clamp(11px, 1vw, 18px); }

.btn {
  display: inline-block; text-decoration: none;
  background: var(--grafite); color: var(--carta);
  font-size: clamp(12px, 0.9vw, 16px); font-weight: 600;
  padding: 1.25em 2.8em; border-radius: 999px;
  transition: background-color 0.3s, transform 0.3s var(--ease-out);
}
.btn:hover, .btn:focus-visible { background: var(--petrolio); transform: translateY(-2px); }

/* ---------- CAPITOLI ---------- */
.chapters { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

.chapter {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-areas: "head head" "title body" "diagram diagram";
  gap: clamp(20px, 3vw, 40px) clamp(32px, 6vw, 120px);
  padding: clamp(72px, 14vh, 160px) 0;
}
.chapter__head { grid-area: head; display: flex; align-items: center; gap: 24px; }
.chapter__num { font-size: clamp(12px, 0.9vw, 16px); }
.chapter__rule { flex: 1; min-width: 0; width: 0; height: clamp(14px, 1.4vw, 24px); overflow: visible; }
.chapter__rule path {
  fill: none; stroke: var(--c); stroke-linecap: round; vector-effect: non-scaling-stroke;
  stroke-width: clamp(10px, 1.1vw, 18px);
}

.chapter__title {
  grid-area: title; margin: 0;
  font-size: clamp(40px, 6.2vw, 120px); line-height: 0.98; text-transform: uppercase;
  text-wrap: balance;
}
.chapter__title .stack span { display: inline-block; }
#accelera .stack span:first-child { color: var(--petrolio); }

.chapter__body { grid-area: body; align-self: end; max-width: 34em; }
.chapter__body p { margin: 0 0 1em; }
.chapter__body p:last-child { margin-bottom: 0; }
.lead { font-size: 1.3em; line-height: 1.4; font-weight: 500; }

/* Diagramma: motivo a linee + voci collegate */
.diagram {
  grid-area: diagram; position: relative;
  margin-top: clamp(40px, 8vh, 100px);
  color: var(--c);
}
.diagram__lines {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none;
}
.diagram__lines path {
  fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round;
}
.diagram__items {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px clamp(24px, 4vw, 64px);
  text-align: center; color: var(--grafite);
}
.diagram__items li { padding-left: var(--indent, 0px); }
.diagram__items h3 {
  margin-top: 0; margin-bottom: 0.35em;
  font-family: "Archivo", system-ui, sans-serif; font-stretch: 125%; font-variation-settings: "wdth" 125;
  font-weight: 800; text-transform: uppercase; line-height: 1.05;
}
.diagram__items h3 { font-size: clamp(17px, 1.7vw, 30px); }
.diagram__items p { margin: 0 auto; max-width: 22em; }

/* Disegno delle linee e comparsa delle voci */
.js .diagram__lines path, .js .chapter__rule path {
  stroke-dasharray: 1 2; stroke-dashoffset: 1.01;
  transition: stroke-dashoffset 1.2s var(--ease);
}
.js .is-in > .diagram__lines path, .js .is-in .chapter__rule path { stroke-dashoffset: 0; }
.js .diagram__items li {
  opacity: 0; transform: translateX(-14px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.js .is-in > .diagram__items li { opacity: 1; transform: none; }
.js .chapter__rule path { transition-delay: 0.2s; transition-duration: 1.4s; }

/* Rivelazione allo scroll */
.js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- CTA ---------- */
.cta {
  max-width: var(--maxw); margin: 0 auto; padding: clamp(72px, 14vh, 160px) var(--gutter);

}
.cta__title { margin: 0 0 0.4em; font-size: clamp(48px, 8vw, 160px); line-height: 0.95; }
.cta__text { max-width: 30em; margin: 0 0 2em; font-size: 1.15em; }

/* ---------- FOOTER ---------- */
.footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px;
  max-width: var(--maxw); margin: 0 auto; padding: 40px var(--gutter) 56px;
  border-top: 1px solid var(--rule); font-size: 14px;
}
.footer__brand { display: flex; align-items: center; gap: 16px; }
.footer__mark { width: 52px; height: 50px; }
.footer__brand div { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.footer__word { font-size: 30px; }
.footer__studio { font-size: 10px; margin-top: 6px; letter-spacing: 0.5em; padding-left: 0.5em; }
.footer__line, .footer__copy { margin: 0; font-size: 12px; }

/* ---------- PROFONDITÀ ---------- */
/* Sfondo: luce calda al centro, bordi e fondo che scuriscono */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 35%, rgba(255, 252, 245, 0.55) 0%, rgba(255, 252, 245, 0) 55%),
    radial-gradient(140% 120% at 50% 40%, rgba(57, 58, 55, 0) 45%, rgba(57, 58, 55, 0.22) 100%),
    linear-gradient(180deg, rgba(57, 58, 55, 0) 40%, rgba(57, 58, 55, 0.10) 100%),
    var(--carta);
}
.nav { background: rgba(238, 233, 222, 0.72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

/* Chiusura scura: contatti e footer */
.dark {
  color: var(--carta);
  background:
    radial-gradient(90% 70% at 50% 100%, #5E5F5B 0%, rgba(94, 95, 91, 0) 70%),
    linear-gradient(180deg, rgba(58, 59, 56, 0) 0, #3A3B38 clamp(160px, 22vh, 260px), #262725 100%);
  padding-top: clamp(140px, 20vh, 240px);
  --rule: rgba(238, 233, 222, 0.22);
}
.dark .btn { background: var(--carta); color: var(--grafite); }
.dark .btn:hover, .dark .btn:focus-visible { background: var(--verde); color: #262725; }
.footer-wrap { background: #262725; color: var(--carta); --rule: rgba(238, 233, 222, 0.22); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .chapter { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "title" "body" "diagram"; }
}
@media (max-width: 700px) {
  .diagram__items { grid-template-columns: minmax(0, 1fr); gap: 40px; text-align: left; }
  .diagram__items p { margin: 0; }
}
@media (max-width: 600px) {
  .nav__links a:not([href="#contatti"]) { display: none; }
  .nav__links a { letter-spacing: 0.18em; font-size: 10px; }
  .hero__art { max-height: none; }
  .hero__foot { flex-direction: column; align-items: flex-start; }
  .tagline { letter-spacing: 0.2em; line-height: 1.9; }
  .chapter__title { font-size: clamp(28px, 8.6vw, 52px); }
  .diagram__items h3 { font-size: 15px; }
  .diagram__items p { font-size: 15px; }
}

/* ---------- MOVIMENTO RIDOTTO ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .chapter__rule path, .js .diagram__lines path { stroke-dashoffset: 0; transition: none; }
  .js .diagram__items li { opacity: 1; transform: none; transition: none; }
  .js .l, .js .intro__word, .js .intro__studio, .js .intro__scroll, .js [data-reveal] {
    opacity: 1; transform: none; letter-spacing: -0.01em; animation: none; transition: none;
  }
  .intro__scroll span { animation: none; }
}
