/* =========================================================
   FreeDivinGreen A.S.D. — v3
   Direzione: "Discesa Editoriale"
   Animazioni: CSS scroll-driven native + fallback JS
   ========================================================= */

:root {
  /* Palette */
  --foam: #f7f5ed;
  --shell: #ede8db;
  --mist: #d8e3de;
  --sea-glass: #a9c5ba;
  --kelp: #355f50;
  --reef: #21483f;
  --deep-teal: #0d3a43;
  --abyss: #071f2c;
  --trench: #041822;
  --cobalt: #2855a6;
  --lime: #7fc31c;
  --lime-bright: #8fd62f;
  --sun: #d5a15c;
  --ink: #102c32;
  --muted: #4e625e;

  /* Tipografia */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", "Segoe UI", system-ui, sans-serif;

  /* Ritmo */
  --section-space: clamp(5.5rem, 11vw, 10rem);
  --shell-width: 1240px;
  --header-h: 5.25rem;

  /* Fallback JS (sovrascritte da script se manca il supporto nativo) */
  --intro-p: 0;
}

/* Animazione fluida di <details> dove supportata */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* rende la timeline dell'apertura leggibile anche fuori da .opening (navbar, scala) */
  timeline-scope: --intro;
}

body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background: var(--foam);
  font-family: var(--font-body);
  font-size: 1rem;
  font-optical-sizing: auto;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3 { margin-top: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
}

p { text-wrap: pretty; }

:where(a, button, summary, details):focus-visible {
  outline: 2px solid var(--lime-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { color: var(--abyss); background: var(--lime-bright); }

/* Le ancore non finiscono sotto la navbar fissa */
[id] { scroll-margin-top: calc(var(--header-h) + 1rem); }

.shell {
  width: min(calc(100% - 2.5rem), var(--shell-width));
  margin-inline: auto;
}

.section-pad { padding-block: var(--section-space); }

.skip-link {
  position: fixed;
  z-index: 300;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: var(--abyss);
  background: var(--lime-bright);
  font-weight: 600;
  translate: 0 -160%;
}
.skip-link:focus { translate: 0 0; }

.eyebrow {
  margin-bottom: 1.2rem;
  color: var(--kelp);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.eyebrow-light { color: var(--sea-glass); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.3rem;
  padding: 0.82rem 1.5rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: translate 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
}
.button-lime {
  color: var(--abyss);
  background: var(--lime-bright);
  box-shadow: 0 0.6rem 1.6rem -0.6rem rgb(127 195 28 / 0.65);
}
.button-lime:hover {
  background: #9ce53c;
  translate: 0 -2px;
  box-shadow: 0 0.9rem 2rem -0.6rem rgb(127 195 28 / 0.75);
}

.line-link {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgb(216 227 222 / 0.5);
  color: var(--mist);
  font-size: 0.88rem;
  font-weight: 600;
  transition: color 200ms ease, border-color 200ms ease;
}
.line-link:hover { color: var(--lime-bright); border-color: var(--lime-bright); }

/* ---------- Barra di avanzamento ---------- */
.scroll-progress {
  position: fixed;
  z-index: 150;
  inset: 0 0 auto;
  height: 2px;
  background: rgb(255 255 255 / 0.08);
}
.scroll-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--sea-glass), var(--lime-bright));
  transform-origin: left;
  scale: var(--page-p, 0) 1;
}

/* ---------- Scala di profondità (gesto-firma) ---------- */
.depth-rail {
  position: fixed;
  z-index: 90;
  top: 50%;
  right: 1.1rem;
  display: none;
  width: 3.25rem;
  height: min(46vh, 22rem);
  translate: 0 -50%;
  pointer-events: none;
  /* si inverte da sola: chiara sui fondi scuri, scura sulle sezioni chiare */
  mix-blend-mode: difference;
  transition: opacity 500ms ease;
}

.depth-rail::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0.35rem;
  width: 1px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.5), rgb(255 255 255 / 0.28));
  content: "";
}
.depth-rail ul {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  height: 100%;
  margin: 0;
  padding: 0 0 0 1.1rem;
  color: rgb(255 255 255 / 0.62);
  font-size: 0.56rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  list-style: none;
}
.depth-rail__marker {
  position: absolute;
  top: 0;
  left: 0.1rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  /* monocromatico: con mix-blend-mode: difference un colore pieno virerebbe
     (il verde sul fondo panna diventa viola). Il bianco si inverte pulito. */
  background: #fff;
  box-shadow: 0 0 0 0.28rem rgb(255 255 255 / 0.22);
  translate: 0 calc(var(--page-p, 0) * (min(46vh, 22rem) - 0.55rem));
}

/* ---------- Navigazione ---------- */
/* Di base la navbar e' visibile: se manca sia il CSS scroll-driven sia il JS,
   il sito resta comunque navigabile. Le due varianti sotto la nascondono
   durante l'apertura e la fanno entrare a intro compiuta. */
.site-header {
  position: fixed;
  z-index: 100;
  inset: 0 0 auto;
  padding-block: 0.8rem;
  transition: opacity 400ms ease, translate 400ms ease;
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgb(247 245 237 / 0.16);
  border-radius: 999px;
  background: rgb(7 31 44 / 0.82);
  box-shadow: 0 1rem 2.5rem rgb(7 31 44 / 0.25);
}
@supports (backdrop-filter: blur(1px)) {
  .nav-shell {
    background: rgb(7 31 44 / 0.86);
    backdrop-filter: blur(14px) saturate(1.2);
  }
}

.nav-logo { width: 7.5rem; }
.nav-logo img { width: 100%; height: auto; }

.desktop-nav { display: none; }
.mobile-nav { position: relative; }

.mobile-nav summary {
  padding: 0.62rem 0.95rem;
  border: 1px solid rgb(247 245 237 / 0.24);
  border-radius: 999px;
  color: var(--foam);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  list-style: none;
  text-transform: uppercase;
}
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav[open] summary { color: var(--lime-bright); border-color: rgb(127 195 28 / 0.5); }

.mobile-nav nav {
  position: absolute;
  top: calc(100% + 0.7rem);
  right: 0;
  display: grid;
  width: min(17rem, calc(100vw - 2.5rem));
  padding: 0.9rem;
  border: 1px solid rgb(247 245 237 / 0.12);
  border-radius: 1rem;
  background: rgb(7 31 44 / 0.97);
  box-shadow: 0 1.5rem 3rem rgb(0 0 0 / 0.35);
}
.mobile-nav nav a {
  padding: 0.85rem 0.6rem;
  border-bottom: 1px solid rgb(247 245 237 / 0.1);
  color: var(--mist);
  font-size: 0.9rem;
}
.mobile-nav nav a:last-child { border-bottom: 0; color: var(--lime-bright); font-weight: 600; }

/* ---------- 1 · Apertura ad anello ---------- */
.opening {
  position: relative;
  height: 185vh;
  height: 185svh;
  background: var(--abyss);
  view-timeline: --intro block;
}

.opening-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: clip;
}

.opening-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 190vw;
  max-width: none;
  aspect-ratio: 1672 / 941;
  translate: -50% -50%;
  transform-origin: 50% 50%;
  /* In verticale il 16:9 non copre l'altezza: senza questa sfumatura si vedrebbero
     due tagli netti sopra e sotto l'anello. */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
}

/* Il buio arriva da un overlay in opacità: molto piu' economico di filter: brightness() */
.opening-shade {
  position: absolute;
  inset: 0;
  background: var(--abyss);
  opacity: 0;
}

.opening-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 21%, rgb(7 31 44 / 0.1) 34%, rgb(7 31 44 / 0.46) 80%),
    linear-gradient(180deg, rgb(7 31 44 / 0.18), rgb(7 31 44 / 0.5));
}

.opening-brand {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  width: min(58vw, 25rem);
  text-align: center;
  translate: -50% -50%;
  flex-direction: column;
}
.opening-brand > img { width: 100%; height: auto; }

.micro-label {
  margin-bottom: 1.2rem;
  color: var(--sea-glass);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.opening-tagline {
  margin: 1rem 0 0;
  color: rgb(247 245 237 / 0.86);
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 300;
  font-style: italic;
}

.opening-scroll {
  position: absolute;
  z-index: 3;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  color: rgb(247 245 237 / 0.72);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  translate: -50% 0;
}
.opening-scroll span {
  position: relative;
  display: block;
  width: 1px;
  height: 2.2rem;
  overflow: hidden;
  background: rgb(247 245 237 / 0.3);
}
.opening-scroll span::after {
  position: absolute;
  inset: 0;
  background: var(--lime-bright);
  content: "";
  animation: descend 2.4s ease-in-out infinite;
  translate: 0 -100%;
}
@keyframes descend {
  0%   { translate: 0 -100%; }
  55%  { translate: 0 100%; }
  100% { translate: 0 100%; }
}

/* ---------- Sezioni con media a tutto schermo ---------- */
.motion-section {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: clip;
  color: white;
  background: var(--abyss);
}

.motion-media {
  position: absolute;
  inset: -9%;
}

/* Ogni contenitore [data-motion] ospita un <img> (base) e, quando i file esistono,
   un <video> Higgsfield che ci va in dissolvenza sopra. */
[data-motion] { overflow: clip; }
[data-motion] :is(img, video) {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
[data-motion] video {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1200ms ease;
}
[data-motion] video.is-live { opacity: 1; }

/* ---------- 2 · Hero: la discesa guidata dallo scroll ---------- */
.hero {
  position: relative;
  height: 180vh;
  height: 180svh;
  color: white;
  background: var(--abyss);
}

.hero-sticky {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  height: 100vh;
  height: 100svh;
  overflow: clip;
}

/* Sfondo: il poster del video reale, sfocato e abbassato.
   Tiene insieme la composizione senza un secondo video da decodificare. */
.hero-backdrop {
  position: absolute;
  inset: 0;
  background: url("../img/hero-discesa-reale.webp") center / cover no-repeat;
  /* l'acqua della clip vira al verde: qui va raffreddata, altrimenti
     il lato del testo prende un cast oliva */
  filter: blur(48px) brightness(0.34) saturate(0.55) hue-rotate(-12deg);
  scale: 1.2;
}
/* Ordine di sovrapposizione: sfondo 0 · video 1 · velo 2 · testo 3 */
.hero-backdrop { z-index: 0; }
.hero-sticky::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  /* Base = telefono: si scurisce sopra (navbar) e sotto (testo),
     lasciando respirare la fascia centrale dove scendono. */
  background: linear-gradient(180deg,
    rgb(7 31 44 / 0.66) 0%,
    rgb(7 31 44 / 0.1) 20%,
    rgb(7 31 44 / 0.28) 44%,
    rgb(7 31 44 / 0.88) 74%,
    rgb(7 31 44 / 0.96) 100%);
  content: "";
  pointer-events: none;
}

/* niente z-index qui: creerebbe un contesto di impilamento
   e il velo finirebbe sotto al video */
.hero-inner {
  position: relative;
  display: grid;
  gap: 2.5rem;
  padding-block: 6rem 3rem;
}
.hero-copy { position: relative; z-index: 3; }

/* La colonna verticale: il video è 9:16, ed è giusto così — la discesa è verticale */
.dive-column {
  position: relative;
  z-index: 3;
  overflow: clip;
  margin: 0;
  border: 1px solid rgb(247 245 237 / 0.14);
  border-radius: 1.25rem;
  background: #0a2634;
  box-shadow: 0 2rem 4rem -1rem rgb(0 0 0 / 0.55);
  aspect-ratio: 9 / 16;
}
.dive-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dive-column::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 62%, rgb(7 31 44 / 0.75));
  content: "";
  pointer-events: none;
}

.dive-hint {
  position: absolute;
  z-index: 2;
  bottom: 1rem;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  color: rgb(247 245 237 / 0.8);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  translate: -50% 0;
  transition: opacity 500ms ease;
}
.dive-hint span {
  position: relative;
  display: block;
  width: 1px;
  height: 1.7rem;
  overflow: hidden;
  background: rgb(247 245 237 / 0.3);
}
.dive-hint span::after {
  position: absolute;
  inset: 0;
  background: var(--lime-bright);
  content: "";
  animation: descend 2.4s ease-in-out infinite;
  translate: 0 -100%;
}
/* a discesa avviata l'invito sparisce */
.hero.is-diving .dive-hint { opacity: 0; }

/* Su telefono la colonna diventa lo sfondo: il 9:16 è il formato nativo dello schermo.
   Il testo scende in basso, così la discesa resta visibile nella metà alta. */
@media (max-width: 767px) {
  .hero-sticky { align-items: flex-end; }
  /* static: così la colonna si ancora allo sticky (tutto schermo)
     e non a .hero-inner, che sta in basso */
  .hero-inner { position: static; padding-block: 5rem 3.25rem; }
  .hero-backdrop { display: none; }

  .dive-column {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 50%;
    width: 100vw;
    height: 100svh;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    translate: -50% 0;
  }
  .dive-column::after { background: none; }
  /* i sub stanno poco a destra del centro: il ritaglio segue loro */
  .dive-video { object-position: 56% 50%; }

  .dive-hint {
    top: 5.5rem;
    bottom: auto;
    left: 1.25rem;
    translate: 0 0;
    /* in cima l'acqua è chiara: senza ombra il microtesto sparisce */
    text-shadow: 0 1px 6px rgb(7 31 44 / 0.8);
  }
  .hero h1 { font-size: clamp(3rem, 11.5vw, 4.2rem); }
  .hero-lead { font-size: 0.98rem; }
  .hero-badges { margin-top: 1.8rem; }
}
.hero h1 {
  max-width: 9ch;
  margin-bottom: 1.6rem;
  color: white;
  font-size: clamp(3.4rem, 12.5vw, 7.5rem);
}
.hero h1 em { color: var(--sea-glass); font-weight: 300; }

.hero-lead {
  max-width: 34rem;
  margin-bottom: 2rem;
  color: var(--mist);
  font-size: clamp(1rem, 2vw, 1.2rem);
}
.hero-actions {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 1rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  margin: 2.6rem 0 0;
  padding: 1.1rem 0 0;
  border-top: 1px solid rgb(247 245 237 / 0.15);
  color: rgb(216 227 222 / 0.75);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  list-style: none;
  text-transform: uppercase;
}

/* ---------- 3 · Manifesto ---------- */
.vision { display: flex; align-items: flex-end; }
.surface-media :is(img, video) { object-position: 50% 48%; }

.vision-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgb(7 31 44 / 0.04) 18%, rgb(7 31 44 / 0.84) 84%),
    linear-gradient(90deg, rgb(7 31 44 / 0.4), transparent 55%);
}
.vision-grid {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 2rem;
  padding-block: 7rem 4rem;
}
.vision h2 { max-width: 10ch; margin-bottom: 0; font-size: clamp(3rem, 10vw, 6rem); }
.vision-copy { align-self: end; }
.vision-statement {
  margin-bottom: 1.5rem;
  color: var(--lime-bright);
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3.6rem);
  font-weight: 300;
  line-height: 1.05;
}
.vision-copy > p:last-child { max-width: 31rem; margin-bottom: 0; color: var(--mist); }

/* ---------- 4 · Corsi ---------- */
.courses {
  background:
    radial-gradient(circle at 85% 8%, rgb(127 195 28 / 0.1), transparent 26%),
    var(--shell);
}

.section-intro {
  display: grid;
  gap: 2rem;
  margin-bottom: clamp(3.5rem, 8vw, 6rem);
}
.section-intro h2 {
  max-width: 12ch;
  margin-bottom: 0;
  color: var(--abyss);
  font-size: clamp(2.9rem, 8.5vw, 5.7rem);
}
.intro-copy { max-width: 34rem; margin: 0; color: var(--muted); font-size: 1.05rem; }

.course-list {
  display: grid;
  border-top: 1px solid rgb(7 31 44 / 0.16);
}
.course-item {
  position: relative;
  display: flex;
  padding: 1.6rem 0;
  border-bottom: 1px solid rgb(7 31 44 / 0.16);
  flex-direction: column;
  transition: background-color 300ms ease;
}
.course-item:hover { background: rgb(255 255 255 / 0.45); }
.course-item-accent:hover { background: #1b3c34; }

.course-code {
  color: var(--kelp);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}
.course-item h3 {
  max-width: 12ch;
  margin: 1.4rem 0 0.7rem;
  color: var(--abyss);
  font-size: clamp(2.1rem, 7vw, 3.1rem);
}
.course-item > p { max-width: 26rem; margin-bottom: 1.1rem; color: var(--muted); font-size: 0.92rem; }

.course-more { margin-bottom: 1.4rem; }
.course-more summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--kelp);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  list-style: none;
  text-transform: uppercase;
}
.course-more summary::-webkit-details-marker { display: none; }
.course-more summary::after {
  display: inline-block;
  font-size: 0.9rem;
  content: "+";
  transition: rotate 250ms ease;
}
.course-more[open] summary::after { rotate: 45deg; }
.course-more__body {
  padding-top: 0.9rem;
  color: var(--muted);
  font-size: 0.86rem;
}
.course-more__body ul { margin: 0; padding-left: 1.05rem; }
.course-more__body li { margin-bottom: 0.4rem; }
.course-more__body b { color: var(--reef); font-weight: 600; }
.course-more__body p { margin-bottom: 0; }

.course-link {
  margin-top: auto;
  align-self: flex-start;
  color: var(--reef);
  font-size: 0.84rem;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
}
.course-link span { color: var(--lime); display: inline-block; transition: translate 200ms ease; }
.course-link:hover { border-color: currentColor; }
.course-link:hover span { translate: 2px -2px; }

.course-item-accent {
  margin-top: -1px;
  padding-inline: 1.5rem;
  color: white;
  background: var(--reef);
}
.course-item-accent :is(.course-code, .course-link, .course-more summary) { color: var(--lime-bright); }
.course-item-accent h3 { color: white; }
.course-item-accent :is(p, .course-more__body) { color: var(--mist); }

@supports (interpolate-size: allow-keywords) {
  .course-more::details-content,
  .faq-list details::details-content {
    overflow: clip;
    block-size: 0;
    opacity: 0;
    transition: block-size 350ms ease, opacity 300ms ease, content-visibility 350ms allow-discrete;
  }
  .course-more[open]::details-content,
  .faq-list details[open]::details-content { block-size: auto; opacity: 1; }
}

/* ---------- 5 · Etica ---------- */
.ethics { min-height: 115vh; min-height: 115svh; }
.ethics-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgb(7 31 44 / 0.16), rgb(7 31 44 / 0.85)),
    linear-gradient(90deg, rgb(7 31 44 / 0.48), transparent 70%);
}
.ethics-content {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  min-height: 115vh;
  min-height: 115svh;
  padding-block: 7rem 4rem;
  flex-direction: column;
}
.ethics-heading { margin-bottom: 3rem; }
.ethics h2 { max-width: 12ch; margin-bottom: 0; color: white; font-size: clamp(2.9rem, 8.5vw, 5.7rem); }
.ethics-values { display: grid; gap: 0.75rem; }

.glass-card {
  padding: 1.3rem;
  border: 1px solid rgb(247 245 237 / 0.18);
  border-radius: 1rem;
  background: rgb(7 31 44 / 0.72);
}
.glass-card > span { color: var(--lime-bright); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.14em; }
.glass-card h3 { margin: 1.4rem 0 0.55rem; color: white; font-size: 1.7rem; }
.glass-card p { margin-bottom: 0; color: var(--mist); font-size: 0.88rem; }

/* ---------- 6 · Metodo ---------- */
.method {
  position: relative;
  overflow: clip;
  color: white;
  background:
    radial-gradient(circle at 90% 5%, rgb(127 195 28 / 0.14), transparent 28%),
    var(--deep-teal);
}
.method::after {
  position: absolute;
  right: -15rem;
  bottom: -17rem;
  width: 42rem;
  height: 42rem;
  border: 1px solid rgb(169 197 186 / 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 6rem rgb(169 197 186 / 0.025), 0 0 0 12rem rgb(169 197 186 / 0.018);
  content: "";
}
.method .shell { position: relative; z-index: 1; }
.method-intro h2 { color: white; }
.method-intro .intro-copy { color: var(--mist); }

.method-list { margin: 0; padding: 0; list-style: none; }
.method-list li {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 1rem;
  padding: 1.6rem 0;
  border-top: 1px solid rgb(216 227 222 / 0.18);
}
.method-list li:last-child { border-bottom: 1px solid rgb(216 227 222 / 0.18); }
.method-list li > span { padding-top: 0.35rem; color: var(--lime-bright); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.15em; }
.method-list h3 { margin-bottom: 0.55rem; color: white; font-size: clamp(1.8rem, 6vw, 2.6rem); }
.method-list p { grid-column: 2; max-width: 34rem; margin-bottom: 0; color: var(--mist); font-size: 0.92rem; }

/* ---------- 7 · Team ---------- */
.team { background: var(--foam); }
.team-grid { display: grid; gap: 3.5rem; }
.member { display: grid; align-content: start; gap: 1.3rem; }
/* aspect-ratio sul CONTENITORE, non sull'immagine: in una griglia con righe
   auto lo stretch allungava la cornice oltre la foto e sotto restava una banda */
.member-photo {
  overflow: clip;
  aspect-ratio: 1;
  border-radius: 0.9rem;
  background: var(--abyss);
}
.member-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.82) contrast(1.04);
  transition: scale 600ms cubic-bezier(0.2, 0.65, 0.2, 1), filter 600ms ease;
}
.member:hover .member-photo img { scale: 1.035; filter: saturate(1) contrast(1); }

.member-info { display: grid; grid-template-columns: 2rem 1fr; column-gap: 0.75rem; }
.member-info > span { grid-row: 1 / 5; padding-top: 0.35rem; color: var(--kelp); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.14em; }
.member-info h3 { margin-bottom: 0.6rem; color: var(--abyss); font-size: clamp(1.9rem, 6vw, 2.6rem); }
.member-info p { margin-bottom: 0.8rem; color: var(--muted); font-size: 0.86rem; }
.member-info a {
  justify-self: start;
  border-bottom: 1px solid rgb(40 85 166 / 0.35);
  color: var(--cobalt);
  font-size: 0.78rem;
  font-weight: 600;
}
.member-info a:hover { border-color: currentColor; }

/* ---------- 8 · Domande ---------- */
.faq { background: var(--shell); }
.faq-grid { display: grid; gap: 2.5rem; }
.faq h2 { max-width: 10ch; color: var(--abyss); font-size: clamp(2.6rem, 8vw, 4.4rem); }
.faq-intro { margin-top: 1.5rem; }

.faq-list details { border-top: 1px solid rgb(7 31 44 / 0.16); }
.faq-list details:last-child { border-bottom: 1px solid rgb(7 31 44 / 0.16); }
.faq-list summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.4rem 0;
  color: var(--abyss);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.4vw, 1.45rem);
  letter-spacing: -0.02em;
  list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  color: var(--lime);
  font-family: var(--font-body);
  font-size: 1.2rem;
  content: "+";
  transition: rotate 250ms ease;
}
.faq-list details[open] summary::after { rotate: 45deg; }
.faq-body { padding-bottom: 1.5rem; }
.faq-body p { max-width: 44rem; margin: 0; color: var(--muted); font-size: 0.95rem; }
.faq-body b { color: var(--reef); font-weight: 600; }

/* ---------- 9 · Didattiche ---------- */
.credentials {
  padding-block: clamp(4rem, 8vw, 6.5rem);
  border-top: 1px solid rgb(7 31 44 / 0.1);
  background: white;
}
.credentials-inner { text-align: center; }

/* La barra loghi e' un'unica immagine 15:1: sotto i 700px diventerebbe
   una striscia di 20px illeggibile, quindi la si fa scorrere. */
.teaching-logos-scroll {
  margin-block: 2.4rem 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3rem, #000 calc(100% - 3rem), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 3rem, #000 calc(100% - 3rem), transparent);
}
.teaching-logos-scroll::-webkit-scrollbar { display: none; }
.teaching-logos { width: 100%; min-width: 640px; height: auto; mix-blend-mode: multiply; }

/* Affiliazioni ambientali: sul sito originale sono un blocco a sé
   ("Collaborazioni & Sponsor" → "Affiliati con"), non una ripetizione della barra. */
.affiliations {
  margin-top: 3.5rem;
  padding-top: 2.75rem;
  border-top: 1px solid rgb(7 31 44 / 0.1);
}
.eco-logos {
  display: grid;
  gap: 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.eco-logos li {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 1.1rem;
}
.eco-logos img { width: auto; height: 3.4rem; object-fit: contain; }
.eco-logos li:last-child img { height: 4.6rem; }
.eco-logos p {
  max-width: 26rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

@media (min-width: 768px) {
  .teaching-logos-scroll {
    -webkit-mask-image: none;
            mask-image: none;
  }
}

/* ---------- 10 · Contatto: l'anello del respiro ---------- */
.contact {
  position: relative;
  overflow: clip;
  padding-block: clamp(6rem, 11vw, 10rem);
  color: white;
  background: var(--abyss);
}
.breath {
  position: absolute;
  top: 50%;
  right: -8rem;
  width: 30rem;
  height: 30rem;
  translate: 0 -50%;
  pointer-events: none;
}
.breath-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgb(127 195 28 / 0.4);
  border-radius: 50%;
  box-shadow: 0 0 4rem rgb(127 195 28 / 0.08) inset;
  animation: breathe 12s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}
.breath-ring--echo {
  border-color: rgb(169 197 186 / 0.18);
  animation-delay: -1.4s;
}
@keyframes breathe {
  0%   { scale: 0.78; opacity: 0.45; }
  33%  { scale: 1;    opacity: 1; }   /* inspira ~4s */
  42%  { scale: 1;    opacity: 1; }   /* trattieni ~1s */
  100% { scale: 0.78; opacity: 0.45; } /* espira ~7s */
}

.contact-grid { position: relative; z-index: 1; display: grid; gap: 2.5rem; }
.contact h2 { max-width: 13ch; margin-bottom: 0; color: white; font-size: clamp(2.9rem, 8.5vw, 5.8rem); }
.contact h2 em { color: var(--sea-glass); font-weight: 300; }
.contact-copy { align-self: end; }
.contact-copy > p { max-width: 30rem; margin-bottom: 1.7rem; color: var(--mist); }
.contact-alt { margin: 1.4rem 0 0; font-size: 0.88rem; }
.contact-alt a { border-bottom: 1px solid rgb(216 227 222 / 0.35); color: var(--mist); }
.contact-alt a:hover { color: var(--lime-bright); border-color: var(--lime-bright); }

/* ---------- Footer ---------- */
.site-footer { padding-block: 4.5rem 2rem; color: var(--mist); background: var(--trench); }
.footer-grid { display: grid; gap: 2.5rem; }
.footer-brand img { width: 10rem; height: auto; margin-bottom: 1rem; opacity: 0.92; }
.footer-brand p { color: var(--sea-glass); font-family: var(--font-display); font-size: 1.25rem; font-style: italic; }
.site-footer h2 {
  margin-bottom: 0.9rem;
  color: var(--sea-glass);
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.site-footer a, .site-footer div > p { display: block; margin: 0 0 0.55rem; color: var(--mist); font-size: 0.88rem; }
.site-footer .footer-grid a:hover { color: var(--lime-bright); }

.footer-bottom {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-direction: column;
  gap: 1.75rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgb(216 227 222 / 0.12);
}
.sponsor { display: flex; align-items: center; gap: 1rem; }
.sponsor span { color: #8fa5a2; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.sponsor img { width: 8.5rem; height: auto; opacity: 0.9; transition: opacity 200ms ease; }
.sponsor a:hover img { opacity: 1; }
.footer-bottom > p { margin: 0; color: #8fa5a2; font-size: 0.7rem; }

/* =========================================================
   ANIMAZIONI
   1) percorso nativo: CSS scroll-driven (compositor, zero JS)
   2) fallback: variabili CSS scritte da main.js
   ========================================================= */

@keyframes reveal-in {
  from { opacity: 0; translate: 0 2rem; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes parallax-drift {
  from { translate: 0 -6%; }
  to   { translate: 0 6%; }
}
@keyframes intro-ring-grow { from { scale: 1; }        to { scale: 2.35; } }
@keyframes intro-shade     { from { opacity: 0; }      to { opacity: 0.55; } }
@keyframes intro-brand-out {
  0%   { scale: 1;    opacity: 1; }
  62%  { scale: 0.84; opacity: 0; }
  100% { scale: 0.8;  opacity: 0; }
}
@keyframes intro-hint-out { from { opacity: 1; } 45%, 100% { opacity: 0; } }
@keyframes progress-fill  { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes rail-descend   { from { translate: 0 0; } to { translate: 0 calc(min(46vh, 22rem) - 0.55rem); } }
@keyframes chrome-in {
  0%, 52%   { opacity: 0; translate: 0 -1rem; pointer-events: none; }
  68%, 100% { opacity: 1; translate: 0 0;     pointer-events: auto; }
}

/* ---- 1) Percorso nativo ---- */
@supports (animation-timeline: view()) {
  .reveal {
    animation: reveal-in linear both;
    animation-timeline: view();
    animation-range: entry 6% entry 62%;
  }
  .motion-media {
    animation: parallax-drift linear both;
    animation-timeline: view();
    animation-range: cover 0% cover 100%;
  }
  .opening-ring {
    animation: intro-ring-grow linear both;
    animation-timeline: --intro;
    animation-range: contain 0% contain 100%;
  }
  .opening-shade {
    animation: intro-shade linear both;
    animation-timeline: --intro;
    animation-range: contain 0% contain 100%;
  }
  .opening-brand {
    animation: intro-brand-out linear both;
    animation-timeline: --intro;
    animation-range: contain 0% contain 100%;
  }
  .opening-scroll {
    animation: intro-hint-out linear both;
    animation-timeline: --intro;
    animation-range: contain 0% contain 100%;
  }
  .scroll-progress span {
    scale: 0 1;
    animation: progress-fill linear both;
    animation-timeline: scroll(root block);
  }
  .depth-rail__marker {
    translate: 0 0;
    animation: rail-descend linear both;
    animation-timeline: scroll(root block);
  }
  /* Navbar e scala di profondita' entrano quando l'apertura e' compiuta.
     Legate alla stessa timeline: sono corrette a qualunque posizione di scroll,
     anche arrivando da un link con ancora o ricaricando a meta' pagina. */
  .site-header, .depth-rail {
    animation: chrome-in linear both;
    animation-timeline: --intro;
    animation-range: contain 0% contain 100%;
  }
}

/* ---- 2) Fallback JS (browser senza scroll-driven animations) ---- */
@supports not (animation-timeline: view()) {
  .js .site-header, .js .depth-rail { opacity: 0; pointer-events: none; }
  .js .site-header { translate: 0 -1rem; }
  .js body.has-entered :is(.site-header, .depth-rail) { opacity: 1; pointer-events: auto; }
  .js body.has-entered .site-header { translate: 0 0; }

  .js .reveal {
    opacity: 0;
    translate: 0 2rem;
    transition: opacity 700ms ease, translate 850ms cubic-bezier(0.2, 0.65, 0.2, 1);
  }
  .js .reveal.is-visible { opacity: 1; translate: 0 0; }

  .js .motion-media { translate: 0 calc(var(--par, 0) * 6%); will-change: translate; }
  .js .opening-ring { scale: calc(1 + var(--intro-p) * 1.35); will-change: scale; }
  .js .opening-shade { opacity: calc(var(--intro-p) * 0.55); }
  .js .opening-brand {
    scale: calc(1 - var(--intro-p) * 0.2);
    opacity: calc(1 - var(--intro-p) * 1.6);
    will-change: scale, opacity;
  }
  .js .opening-scroll { opacity: calc(1 - var(--intro-p) * 2.2); }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (min-width: 768px) {
  :root { --header-h: 5.5rem; }

  .shell { width: min(calc(100% - 5rem), var(--shell-width)); }
  .nav-shell { padding: 0.42rem 0.48rem 0.42rem 1rem; }
  .nav-logo { width: 8.5rem; }
  .mobile-nav { display: none; }

  .desktop-nav {
    display: flex;
    align-items: center;
    gap: clamp(1.1rem, 2.2vw, 2.1rem);
    color: var(--mist);
    font-size: 0.78rem;
    font-weight: 600;
  }
  .desktop-nav > a:not(.nav-cta) {
    position: relative;
    padding-block: 0.72rem;
    transition: color 200ms ease;
  }
  .desktop-nav > a:not(.nav-cta)::after {
    position: absolute;
    bottom: 0.42rem;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--lime-bright);
    content: "";
    scale: 0 1;
    transform-origin: left;
    transition: scale 260ms ease;
  }
  .desktop-nav > a:not(.nav-cta):hover { color: var(--lime-bright); }
  .desktop-nav > a:not(.nav-cta):hover::after,
  .desktop-nav > a[aria-current="true"]::after { scale: 1 1; }
  .desktop-nav > a[aria-current="true"] { color: var(--foam); }

  .nav-cta {
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    color: var(--abyss);
    background: var(--lime-bright);
    transition: background-color 200ms ease;
  }
  .nav-cta:hover { background: #9ce53c; }

  .depth-rail { display: block; }

  .opening-brand { width: min(31vw, 27rem); }
  .opening-ring {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    translate: 0 0;
    -webkit-mask-image: none;
            mask-image: none;
  }
  .opening-scroll { bottom: 2rem; }

  .hero-inner {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: clamp(2.5rem, 5vw, 5rem);
    padding-block: 7rem 4rem;
  }
  /* da tablet in su il testo sta a sinistra: il velo si sposta di conseguenza */
  .hero-sticky::after {
    background:
      linear-gradient(90deg, rgb(7 31 44 / 0.8) 0%, rgb(7 31 44 / 0.5) 46%, rgb(7 31 44 / 0.1) 100%),
      linear-gradient(180deg, rgb(7 31 44 / 0.45) 0%, rgb(7 31 44 / 0.15) 45%, rgb(7 31 44 / 0.7) 100%);
  }
  .dive-column { justify-self: end; width: 100%; max-width: 25rem; max-height: 74svh; }
  .hero-actions { align-items: center; flex-direction: row; gap: 1.7rem; }

  .vision-grid { grid-template-columns: 1.2fr 0.8fr; align-items: end; gap: 5rem; padding-block: 9rem 5rem; }

  .section-intro { grid-template-columns: 1.1fr 0.9fr; align-items: end; gap: 4rem; }
  .intro-copy { justify-self: end; }

  .course-list { grid-template-columns: repeat(2, 1fr); }
  .course-item { min-height: 19rem; padding: 2rem; border-right: 1px solid rgb(7 31 44 / 0.16); }
  .course-item:nth-child(even) { border-right: 0; }
  .course-item-accent { padding-inline: 2rem; }

  .ethics-content { padding-block: 9rem 5rem; }
  .ethics-values { grid-template-columns: repeat(3, 1fr); }
  .glass-card { min-height: 13rem; padding: 1.6rem; }

  .method-list li { grid-template-columns: 4rem 0.7fr 1fr; align-items: start; gap: 2rem; padding: 2rem 0; }
  .method-list h3 { margin: 0; }
  .method-list p { grid-column: auto; }

  .team-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
  .member-offset { padding-top: 4rem; }

  .faq-grid { grid-template-columns: 0.8fr 1.2fr; gap: 4rem; align-items: start; }

  .eco-logos { grid-template-columns: repeat(2, 1fr); gap: 4rem; align-items: start; }

  .contact-grid { grid-template-columns: 1.35fr 0.65fr; align-items: end; gap: 5rem; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 0.6fr; gap: 4rem; }
  .footer-bottom { align-items: center; flex-direction: row; }
}

/* Il vetro smerigliato solo dove costa poco: schermi grandi */
@media (min-width: 1024px) {
  @supports (backdrop-filter: blur(1px)) {
    .glass-card {
      background: rgb(7 31 44 / 0.42);
      backdrop-filter: blur(12px) saturate(1.1);
    }
  }
}

@media (min-width: 1200px) {
  body { font-size: 1.0625rem; }
  .opening-brand { width: min(28vw, 29rem); }
  .vision-grid { gap: 8rem; }

  .course-list { grid-template-columns: repeat(3, 1fr); }
  .course-item, .course-item:nth-child(even) {
    min-height: 20rem;
    padding: 2.25rem;
    border-right: 1px solid rgb(7 31 44 / 0.16);
  }
  .course-item:nth-child(3n) { border-right: 0; }
  .course-item-accent { padding-inline: 2.25rem; }

  .ethics-heading { margin-bottom: 4.5rem; }
  .glass-card { min-height: 14rem; padding: 1.8rem; }
  .team-grid { gap: 2rem; }
  .credentials-inner { max-width: 1060px; }
  .faq-grid { gap: 6rem; }
}

/* =========================================================
   MOVIMENTO RIDOTTO
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  /* Si spengono solo le animazioni autonome e i movimenti legati allo scroll.
     La barra di avanzamento resta: segue il gesto dell'utente, non si muove da sola. */
  .opening-scroll span::after,
  .breath-ring,
  .member-photo img,
  .course-link span { animation: none; transition: none; }

  .breath-ring { scale: 0.94; opacity: 0.6; }

  /* L'intro non ha piu' nulla da animare: niente due schermate di scroll a vuoto */
  .opening { height: 100vh; height: 100svh; }
  .opening-ring,
  .opening-shade,
  .opening-brand,
  .opening-scroll,
  .reveal,
  .motion-media { animation: none !important; }

  .opening-ring  { scale: 1; }
  .opening-shade { opacity: 0; }
  .opening-brand { scale: 1; opacity: 1; }
  .opening-scroll { opacity: 1; }

  .motion-media { inset: 0; translate: 0 0; }
  .js .reveal { opacity: 1 !important; translate: 0 0 !important; transition: none; }
  .depth-rail { display: none; }

  /* Senza intro animata la navbar deve esserci sempre, in ogni percorso */
  .js .site-header,
  .site-header {
    animation: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    translate: 0 0 !important;
  }
}
