/* Scuola del Lago — elementi comuni ai due temi ("Lago" chiaro e "Acque profonde" scuro):
   impaginazione dell'hero, etichetta delle lezioni, fondale, pergamena del manifesto,
   footer e interruttore del tema. I colori arrivano dai token di landing.css e acque.css. */

:root {
  /* token del tema chiaro per gli elementi di questo file (acque.css li ridefinisce) */
  --tag-bg: var(--blue);
  --tag-ink: #fff;
  --meta-em: var(--teal);
  --meta-strong: var(--blue);
  --rule: var(--cyan);
}

/* titoli bilanciati: niente parola isolata sull'ultima riga */
h1, h2, h3, .hero__sub, .ms-motto, .ms-closing { text-wrap: balance; }

/* elementi presenti in un solo tema (es. logo blu / logo oro) */
[data-theme="acque"] .only-light { display: none !important; }
:root:not([data-theme="acque"]) .only-dark { display: none !important; }

/* ==========================================================================
   Hero: logo al centro in alto, poi i social e il testo
   ========================================================================== */
.hero__split { display: flex; flex-direction: column; align-items: center; }
.hero__inner > :not(.hero__mark) { z-index: auto; }
.hero__visual { order: -1; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.hero__visual .socials__label,
.hero__visual .socials { position: relative; z-index: 2; }
.hero__text { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }

.hero__logo { width: clamp(220px, 30vw, 340px); }
.hero__mark { margin-bottom: clamp(60px, 8vw, 84px); }
.hero h1 { font-size: clamp(2.9rem, 6.2vw, 5.4rem); line-height: 1.02; max-width: 14em; margin: 0 auto 0.9rem; }
.hero__sub { font-family: var(--serif); font-style: italic; font-size: clamp(1.3rem, 2.2vw, 1.75rem); color: var(--ink-soft); margin-bottom: 1.8rem; }

/* etichetta "Lezioni" con il docente, dalla copertina dei quaderni */
.hero__meta { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 0.4rem; text-align: left; }
.hero__meta .tag {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.4em; text-transform: uppercase; font-weight: 500;
  background: var(--tag-bg); color: var(--tag-ink); padding: 12px 18px 12px 24px;
}
.hero__teacher { display: flex; align-items: center; gap: 14px; border-left: 1px solid var(--tag-bg); padding-left: 18px; }
.hero__teacher p { line-height: 1.25; }
.hero__portrait {
  flex: none; width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--tag-bg);
  box-shadow: 0 0 0 4px var(--bg), 0 6px 16px rgba(0, 0, 0, 0.18);
}
.hero__meta span:not(.tag) { display: block; margin-top: 3px; font-family: var(--sans); font-size: 0.78rem; color: var(--ink-soft); }
.hero__meta em { display: block; font-family: var(--serif); font-size: 1.1rem; color: var(--meta-em); }
.hero__meta strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.45rem; color: var(--meta-strong); letter-spacing: 0.02em; }

.hero .lead { margin: 0 auto 2rem; max-width: 36em; padding-top: 1.4rem; position: relative; }
.hero .lead::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 72px; height: 1px; background: var(--rule); }
.hero__actions { justify-content: center; }

/* entrata in sequenza (keyframes "rise" di landing.css) */
.hero__sub, .hero__meta { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero h1 { animation-delay: .3s; }
.hero__sub { animation-delay: .62s; }
.hero .lead { animation-delay: .7s; }
.hero__meta { animation-delay: .78s; }
.hero__actions { animation-delay: .9s; }

/* fondale del tema scuro (nel chiaro c'è l'onda bianca) */
.seabed { display: none; position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: clamp(120px, 17vw, 240px); pointer-events: none; }
.seabed__far { fill: rgba(24, 66, 77, 0.55); }
.seabed__mid { fill: rgba(16, 48, 58, 0.9); }
.seabed__floor { fill: var(--bg); }
.seabed__gold { fill: none; stroke: #c1aa72; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.seabed__thin { fill: none; stroke: rgba(127, 183, 181, 0.35); stroke-width: 1; vector-effect: non-scaling-stroke; }
.seabed__reeds path { fill: none; stroke: rgba(127, 183, 181, 0.45); stroke-width: 1.4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.seabed__pebbles ellipse { fill: rgba(24, 66, 77, 0.8); }

/* titolo subito sotto il logo, poi l'invito a seguire i social */
.hero__visual h1 {
  position: relative; z-index: 2; text-align: center;
  font-size: clamp(2.6rem, 5.8vw, 5rem); line-height: 1.04; max-width: 14em;
  margin: 0 auto clamp(18px, 2.4vw, 28px);
}
.hero .socials__label {
  text-transform: none; letter-spacing: 0; font-weight: 400;
  font-family: var(--text); font-style: italic; font-size: clamp(1rem, 1.5vw, 1.15rem);
  color: var(--ink-soft); margin-bottom: 16px;
}
[data-theme="acque"] .hero .socials__label { color: var(--ink-soft); letter-spacing: 0; font-weight: 400; }
.hero .socials { margin-bottom: clamp(44px, 6vw, 64px); gap: 12px; }

/* pulsanti più grandi */
.hero .social, [data-theme="acque"] .hero .social {
  min-height: 56px; padding: 12px 24px 12px 20px; gap: 11px; font-size: 1.02rem;
}
.hero .social .icon { width: 23px; height: 23px; }
.btn:not(.btn--small) { min-height: 58px; padding: 0.8em 1.9em; font-size: 1.04rem; }
.mobile-cta { min-height: 58px; }
@media (max-width: 420px) {
  .btn:not(.btn--small) { padding: 0.8em 1.1em; font-size: 0.98rem; white-space: nowrap; }
}

/* il pulsante "Prenota" della barra in alto compare solo quando nessun altro è visibile */
.topbar .btn--small { transition: opacity .3s ease, transform .3s ease, visibility .3s, background-color .2s, border-color .2s; }
body:not(.show-cta) .topbar .btn--small { opacity: 0; visibility: hidden; transform: translateY(-6px); }

/* Pulsante "Scopri di più" accanto alla foto, nella pagina principale */
.teacher-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 14px 7px 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-family: var(--sans); font-size: 0.84rem; font-weight: 600; color: var(--blue); text-decoration: none;
  transition: border-color .2s, background-color .2s, color .2s;
}
.teacher-link .icon { width: 16px; height: 16px; transition: transform .2s; }
.teacher-link:hover { border-color: var(--blue); }
.teacher-link:hover .icon { transform: translateX(3px); }
[data-theme="acque"] .teacher-link { color: var(--gold-light); border-color: rgba(193, 170, 114, 0.55); background: rgba(193, 170, 114, 0.1); }
[data-theme="acque"] .teacher-link:hover { border-color: var(--gold); }

/* ==========================================================================
   Sezioni comuni
   ========================================================================== */
/* Le lezioni: la prima scheda (le lezioni del mercoledì) in evidenza, le altre tre in fila */
.offer { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.offer .offer__feature {
  grid-column: 1 / -1;
  padding: clamp(28px, 4vw, 44px);
}
.offer__feature h3 { font-size: clamp(1.8rem, 3vw, 2.3rem); }
.offer__facts {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  font-family: var(--sans); font-size: 0.86rem; font-weight: 500; color: var(--ink);
}
/* sono voci di lista dentro una scheda: niente stile da scheda */
.offer .offer__facts li:nth-child(n),
[data-theme="acque"] .offer .offer__facts li:nth-child(n) {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible;
}
.offer .offer__facts li::before { display: none; }
.offer__facts .icon { width: 18px; height: 18px; color: var(--tone); }

/* fine del manifesto: invito alla prenotazione */
.manifesto__cta { margin-top: clamp(64px, 8vw, 96px); text-align: center; }
.manifesto__cta p { font-family: var(--serif); font-style: italic; font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--ink); margin-bottom: 1.2rem; }

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

.offer__num { font-family: var(--serif); font-size: 2.2rem; font-weight: 400; letter-spacing: 0; line-height: 1; }
.about__quote p { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.3; }
.about__quote footer {
  position: relative; margin-top: 1.4rem;
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.32em; text-transform: uppercase; color: rgba(255, 255, 255, 0.8);
}

.footer { padding: 56px 0 72px; }
.footer__inner { flex-direction: column; text-align: center; gap: 10px; }
.footer__inner img { width: 80px; }
.footer__motto { font-family: var(--serif); font-style: italic; font-size: 1.35rem; color: var(--meta-em); }
.footer__socials { list-style: none; margin: 12px 0 8px; padding: 0; display: flex; justify-content: center; gap: 12px; }
.footer__socials a, .footer__socials span {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--blue); background: var(--surface);
  transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.footer__socials .icon { width: 21px; height: 21px; }
.footer__socials a:hover { background: var(--blue); border-color: var(--blue); color: #fff; transform: translateY(-2px); }
[data-theme="acque"] .footer__socials a { color: var(--gold-light); border-color: rgba(193, 170, 114, 0.6); background: rgba(193, 170, 114, 0.1); }
[data-theme="acque"] .footer__socials a:hover { background: var(--gold); border-color: var(--gold); color: var(--deep-3); }
.footer__socials .is-soon { opacity: 0.45; border-style: dashed; cursor: not-allowed; }
.footer__line { font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--ink-faint); }

/* ==========================================================================
   Manifesto: pergamena che si srotola (uguale nei due temi)
   ========================================================================== */
@property --open { syntax: '<percentage>'; inherits: true; initial-value: 100%; }
/* nome distinto da --ink, che è il colore del testo */
@property --ink-wipe { syntax: '<percentage>'; inherits: false; initial-value: 115%; }

/* il manifesto segue "Chi siamo" (sfondo tinto) e sfuma nel fondo della pagina */
.manifesto { background: linear-gradient(180deg, #e4f1f4, var(--bg) 30%); }
[data-theme="acque"] .manifesto { background: linear-gradient(180deg, #0b2630, var(--bg) 30%); }
.manifesto__head { text-align: center; }

/* Rotolo verticale da appendere, di tradizione cinese: carta montata con bande di
   broccato, asticella in alto col cordino, rullo pesante in basso con terminali in
   palissandro e ottone, sigillo rosso in fondo al testo. */
.scroll {
  --open: 100%;
  --sumi: #2b2722;          /* inchiostro */
  --vermiglio: #8c3a28;     /* titoli dei capitoli */
  --band: clamp(42px, 5.5vw, 58px);   /* parte visibile delle bande di broccato */
  --rod-top: 16px;
  --rod-bottom: 40px;
  position: relative;
  max-width: 820px;
  margin: 70px auto 0;
  padding: 0 60px;
}

/* cordino e chiodo da cui pende il rotolo */
.scroll__hanger {
  position: absolute; left: 50%; top: -62px; z-index: 3;
  width: 220px; height: 64px; transform: translateX(-50%);
  background: url('../img/rotolo-appendino.svg') center / contain no-repeat;
}

/* il foglio: carta antica montata, bordi diritti */
.scroll__sheet { filter: drop-shadow(0 26px 30px rgba(0, 0, 0, 0.35)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25)); }
[data-theme="acque"] .scroll__sheet { filter: drop-shadow(0 26px 30px rgba(0, 0, 0, 0.5)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35)); }
.scroll__paper {
  position: relative;
  color: var(--sumi);
  background:
    linear-gradient(90deg, rgba(110, 76, 30, 0.28), rgba(110, 76, 30, 0.06) 3%, transparent 8%, transparent 92%, rgba(110, 76, 30, 0.06) 97%, rgba(110, 76, 30, 0.28)),
    radial-gradient(120% 70% at 50% 45%, rgba(255, 249, 232, 0.45), transparent 70%),
    radial-gradient(30% 16% at 6% 30%, rgba(130, 88, 34, 0.14), transparent 70%),
    radial-gradient(26% 14% at 94% 72%, rgba(130, 88, 34, 0.14), transparent 70%),
    url('../img/pergamena.webp') 0 0 / 900px 900px,
    #ecdcb6;
  box-shadow: inset 0 0 0 1px rgba(90, 62, 24, 0.3), inset 0 0 40px rgba(110, 76, 30, 0.22);
  clip-path: inset(0 0 calc(100% - var(--open)) 0);
}
/* ombra dell'asticella sulla carta, in alto */
.scroll__paper::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 40px; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, rgba(40, 24, 10, 0.4), transparent);
}
/* curvatura della carta che entra nel rullo in basso: segue lo srotolamento */
.scroll__paper::after {
  content: ''; position: absolute; left: 0; right: 0; top: var(--open); height: 110px; pointer-events: none;
  transform: translateY(-100%);
  background: linear-gradient(180deg, transparent, rgba(120, 82, 32, 0.08) 40%, rgba(80, 52, 18, 0.22) 75%, rgba(60, 38, 12, 0.42));
}

/* bande di broccato con le nuvole di buon auspicio, bordate d'oro.
   Il motivo riempie solo la parte visibile: in alto metà banda è sotto l'asticella,
   in basso metà rullo copre la banda, e quei pezzi vengono aggiunti come margine. */
.scroll__brocade {
  height: var(--band);
  background: url('../img/broccato.svg') 0 0 / auto 100% repeat-x content-box, #2c4f59;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.35);
  position: relative;
}
.scroll__brocade:first-child { height: calc(var(--band) + var(--rod-top) / 2); padding-top: calc(var(--rod-top) / 2); }
.scroll__brocade:last-child { height: calc(var(--band) + var(--rod-bottom) / 2); padding-bottom: calc(var(--rod-bottom) / 2); }
/* filetti d'oro sui due lati visibili della banda */
.scroll__brocade::before {
  content: ''; position: absolute; left: 0; right: 0; pointer-events: none;
  top: calc(var(--pad-top, 0px)); bottom: var(--pad-bottom, 0px);
  border-top: 2px solid #c9ad6c; border-bottom: 2px solid #c9ad6c;
  box-shadow: inset 0 2px 0 rgba(30, 20, 8, 0.35), inset 0 -2px 0 rgba(30, 20, 8, 0.35);
}
.scroll__brocade:first-child::before { --pad-top: calc(var(--rod-top) / 2); }
.scroll__brocade:last-child::before { --pad-bottom: calc(var(--rod-bottom) / 2); }

/* asticella in alto (sottile, in legno) e rullo in basso (carta arrotolata, più pesante) */
.scroll__rod { position: absolute; z-index: 2; transform: translateY(-50%); }
.scroll__rod--top {
  top: 0; left: 44px; right: 44px; height: var(--rod-top); border-radius: 3px;
  background: linear-gradient(180deg, #1e0e08, #6b331d 30%, #b46a45 42%, #7a3a22 55%, #2e140a 100%);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.4);
}
.scroll__rod--bottom {
  top: var(--open); left: 50px; right: 50px; height: var(--rod-bottom); border-radius: 5px;
  background:
    linear-gradient(180deg,
      rgba(60, 38, 12, 0.72) 0%, rgba(90, 60, 20, 0.28) 14%, rgba(255, 250, 232, 0.05) 26%,
      rgba(255, 252, 240, 0.6) 36%, rgba(255, 250, 232, 0.08) 48%, rgba(110, 75, 28, 0.12) 64%,
      rgba(80, 52, 18, 0.45) 84%, rgba(45, 28, 8, 0.8) 100%),
    url('../img/pergamena.webp') 0 0 / 520px 520px,
    #e2cfa4;
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.35), 0 2px 3px rgba(0, 0, 0, 0.3);
}
.scroll__rod::before, .scroll__rod::after {
  content: ''; position: absolute; top: 50%;
  background: url('../img/rotolo-terminale.svg') center / contain no-repeat;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.4));
}
.scroll__rod--top::before, .scroll__rod--top::after { width: 30px; height: 28px; }
.scroll__rod--top::before { left: -27px; transform: translateY(-50%); }
.scroll__rod--top::after { right: -27px; transform: translateY(-50%) scaleX(-1); }
.scroll__rod--bottom::before, .scroll__rod--bottom::after { width: 54px; height: 50px; }
.scroll__rod--bottom::before { left: -50px; transform: translateY(-50%); }
.scroll__rod--bottom::after { right: -50px; transform: translateY(-50%) scaleX(-1); }

/* testo: inchiostro sumi su carta */
.scroll__text {
  position: relative;
  padding: clamp(44px, 6vw, 70px) clamp(30px, 7vw, 84px) clamp(48px, 6vw, 72px);
  font-family: var(--text); font-size: clamp(1.08rem, 1.6vw, 1.22rem); line-height: 1.8;
  text-shadow: 0 0 0.6px rgba(43, 39, 34, 0.45);      /* inchiostro che si allarga appena nella carta */
}
.scroll__text p + p, .scroll__text p + ol, .scroll__text ol + p,
.scroll__text div + p, .scroll__text p + div { margin-top: 1.1em; }
.ms-chapter {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-family: var(--sans); font-weight: 600; font-size: 0.78rem;
  letter-spacing: 0.34em; text-transform: uppercase; color: var(--vermiglio);
  text-shadow: none;
  margin-top: 2.4em !important;
}
.ms-chapter:first-child { margin-top: 0 !important; }
.ms-chapter::before, .ms-chapter::after {
  content: ''; flex: none; width: 56px; height: 10px;
  background: url('../img/pennellata.svg') center / contain no-repeat;
}
.ms-chapter::after { transform: scaleX(-1); }

/* capolettera: una lettera grande, solo inchiostro */
.ms-first::first-letter {
  float: left;
  font-family: var(--serif); font-weight: 400; font-size: 4em; line-height: 0.82;
  color: var(--sumi);
  margin: 0.06em 0.12em 0 0;
}
.ms-motto {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 1.38em; line-height: 1.35; text-align: center; color: #463a2c;
  margin-top: 1.2em !important;
}
/* divisore: un ensō tracciato a pennello */
.ms-ornament {
  height: 50px; max-width: 300px; margin: 1.6em auto 0 !important;
  background: url('../img/enso.svg') center / contain no-repeat;
}
.ms-list { list-style: none; padding: 0; margin: 1.1em 0 0; }
.ms-list li { position: relative; padding-left: 1.6em; }
.ms-list li + li { margin-top: 0.8em; }
.ms-list li::before {
  content: ''; position: absolute; left: 0.2em; top: 0.72em;
  width: 0.42em; height: 0.42em; border-radius: 50%;
  background: var(--vermiglio); opacity: 0.85;
}
.ms-list strong { font-weight: 600; color: #1d1914; }
.ms-closing {
  font-family: var(--serif); font-style: italic; font-size: 1.62em; line-height: 1.3;
  text-align: center; color: var(--sumi); margin-top: 1.2em !important;
}

/* sigillo in ceralacca color petrolio con il logo oro */
.ms-seal {
  position: relative; display: grid; place-items: center;
  width: 128px; height: 128px; margin: 1.8em auto 0 !important;
  filter: drop-shadow(0 4px 5px rgba(60, 35, 10, 0.5));
  transform: rotate(-6deg);
}
.ms-seal::before {
  content: ''; position: absolute; inset: 0;
  clip-path: polygon(96.8% 50.0%, 96.9% 56.7%, 96.0% 63.5%, 93.3% 69.8%, 89.2% 75.2%, 85.1% 80.4%, 81.1% 85.9%, 76.2% 90.8%, 70.1% 94.1%, 63.5% 96.1%, 56.9% 98.0%, 50.0% 98.5%, 43.2% 97.5%, 36.5% 95.9%, 30.3% 93.0%, 24.6% 89.5%, 19.1% 85.6%, 14.4% 80.9%, 9.8% 75.8%, 5.8% 70.2%, 3.5% 63.7%, 2.9% 56.8%, 2.7% 50.0%, 2.3% 43.1%, 3.1% 36.2%, 5.7% 29.8%, 9.4% 23.9%, 13.8% 18.7%, 19.0% 14.3%, 24.7% 10.6%, 30.4% 7.1%, 36.6% 4.3%, 43.2% 2.8%, 50.0% 2.2%, 56.8% 2.8%, 63.5% 4.0%, 70.0% 6.3%, 75.6% 10.1%, 80.8% 14.4%, 85.8% 19.0%, 90.4% 24.0%, 93.5% 30.1%, 95.2% 36.7%, 96.2% 43.4%);
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.28), transparent 32%),
    radial-gradient(circle at 50% 50%, #2c6a77 0%, #184a57 45%, #0e3540 75%, #08232b 100%);
}
.ms-seal::after {
  content: ''; position: absolute; inset: 15%; border-radius: 50%;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.5), inset 0 -2px 3px rgba(255, 255, 255, 0.16), 0 1px 0 rgba(255, 255, 255, 0.12);
}
.ms-seal img { position: relative; z-index: 1; width: 58%; height: auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6)); opacity: 0.92; }

/* inchiostro: il testo si "scrive" da sinistra quando la pergamena lo raggiunge */
.js .scroll.is-rolled .ink {
  opacity: 0;
  filter: blur(3px);
  -webkit-mask-image: linear-gradient(90deg, #000 var(--ink-wipe), transparent calc(var(--ink-wipe) + 14%));
          mask-image: linear-gradient(90deg, #000 var(--ink-wipe), transparent calc(var(--ink-wipe) + 14%));
  --ink-wipe: -14%;
  transition: opacity .9s ease, filter 1.4s ease, --ink-wipe 1.6s cubic-bezier(.45, .05, .3, 1);
}
.js .scroll.is-rolled .ink.is-inked { opacity: 1; filter: none; --ink-wipe: 115%; }
/* il sigillo invece si imprime con un colpo */
.js .scroll.is-rolled .ms-seal.ink {
  -webkit-mask-image: none; mask-image: none;
  filter: drop-shadow(0 4px 5px rgba(60, 35, 10, 0.5));
  transform: scale(1.6) rotate(-20deg); opacity: 0;
  transition: transform .55s cubic-bezier(.2, 1.5, .45, 1) .2s, opacity .25s ease .2s;
}
.js .scroll.is-rolled .ms-seal.ink.is-inked { transform: rotate(-6deg); opacity: 1; }
.js .scroll.is-rolled { --open: 0%; }

/* ==========================================================================
   Interruttore del tema: un sole che, girando, diventa una luna crescente
   ========================================================================== */
.theme-toggle {
  position: relative; flex: none;
  width: 62px; height: 32px; padding: 0;
  border: 1px solid rgba(0, 65, 126, 0.18); border-radius: 999px;
  background: linear-gradient(180deg, #cdebf2, #f1f8f6);
  box-shadow: inset 0 1px 3px rgba(0, 48, 94, 0.14);
  cursor: pointer;
  transition: background .45s ease, border-color .45s ease, box-shadow .45s ease;
}
[data-theme="acque"] .theme-toggle {
  background: linear-gradient(180deg, #061820, #10363f);
  border-color: rgba(193, 170, 114, 0.5);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.55);
}
/* stelline che compaiono di notte */
.theme-toggle__stars {
  position: absolute; inset: 0; border-radius: inherit; opacity: 0; transition: opacity .45s ease .1s;
  background:
    radial-gradient(1.2px 1.2px at 13px 9px, #fff8e0 98%, transparent),
    radial-gradient(1px 1px at 21px 21px, #fff8e0 98%, transparent),
    radial-gradient(1px 1px at 8px 20px, #e2cf9c 98%, transparent),
    radial-gradient(1.3px 1.3px at 27px 13px, #e2cf9c 98%, transparent);
}
[data-theme="acque"] .theme-toggle__stars { opacity: 1; }
.theme-toggle__knob {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffffff, #fff4d8);
  color: #e9a23b;
  box-shadow: 0 2px 6px rgba(0, 48, 94, 0.28), 0 0 0 1px rgba(233, 162, 59, 0.15);
  transition: transform .5s cubic-bezier(.68, -0.35, .27, 1.35), background .45s ease, color .45s ease, box-shadow .45s ease;
}
[data-theme="acque"] .theme-toggle__knob {
  transform: translateX(30px) rotate(360deg);
  background: radial-gradient(circle at 35% 30%, #23535f, #123843);
  color: #ecd9a2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), 0 0 12px rgba(226, 207, 156, 0.3);
}
.theme-toggle svg { width: 18px; height: 18px; overflow: visible; }
.tt-core { fill: currentColor; transform-box: fill-box; transform-origin: center; transform: scale(0.62); transition: transform .45s cubic-bezier(.68, -0.35, .27, 1.35); }
.tt-cut { transition: transform .45s cubic-bezier(.45, 0, .2, 1); }
.tt-rays { stroke: currentColor; stroke-width: 2; fill: none; transform-box: view-box; transform-origin: 12px 12px; transition: transform .45s cubic-bezier(.45, 0, .2, 1), opacity .25s ease; }
[data-theme="acque"] .tt-core { transform: scale(1); }
[data-theme="acque"] .tt-cut { transform: translate(-7px, 5px); }
[data-theme="acque"] .tt-rays { transform: rotate(-120deg) scale(0.3); opacity: 0; }
.theme-toggle:hover .theme-toggle__knob { box-shadow: 0 2px 8px rgba(0, 48, 94, 0.35), 0 0 0 4px rgba(233, 162, 59, 0.18); }
[data-theme="acque"] .theme-toggle:hover .theme-toggle__knob { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(226, 207, 156, 0.2); }
.theme-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* barra in alto: niente a capo; sotto i 1180px il menu lascia spazio all'interruttore */
.topbar__brand span, .topbar__nav a { white-space: nowrap; }
[data-theme="acque"] .topbar__nav { gap: 22px; }
[data-theme="acque"] .topbar__nav a { letter-spacing: 0.1em; }
@media (max-width: 1180px) {
  .topbar__nav { display: none; }
  .topbar__inner { justify-content: space-between; }
  .theme-toggle { margin-left: auto; }
}


/* ==========================================================================
   Passaggio di tema: il nuovo tema si allarga come un'onda dall'interruttore
   (View Transitions; gli anelli viaggiano sul fronte dell'onda)
   ========================================================================== */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-ripples {
  position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden;
  view-transition-name: theme-ripples;
}
::view-transition-group(theme-ripples) { animation: none; z-index: 10; }
::view-transition-old(theme-ripples) { display: none; }
::view-transition-new(theme-ripples) { animation: none; }
.theme-ring {
  position: absolute; border-radius: 50%;
  border: 2px solid var(--ring);
  box-shadow: 0 0 26px var(--ring-glow), inset 0 0 26px var(--ring-glow);
  will-change: transform, opacity;
}
/* il fronte dell'onda: più spesso e luminoso */
.theme-ring--front { border-width: 3px; box-shadow: 0 0 40px var(--ring-glow), 0 0 12px var(--ring), inset 0 0 40px var(--ring-glow); }
/* lampo della scarica e scintille */
.theme-flash {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0%, var(--ring-glow) 28%, transparent 62%);
}
/* al cambio tema il nuovo logo si ridipinge con la pennellata, mentre passa l'onda */
.intro.theme-switched .hero__logo { animation: brush .6s cubic-bezier(.6, 0, .3, 1) .05s both; }
.theme-spark {
  position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 1px var(--ring), 0 0 16px 3px var(--ring-glow);
}

/* il logo si carica: trema sempre più forte mentre sale e si illumina... */
@keyframes logo-charge {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-1px, 0) rotate(-0.6deg); }
  20%  { transform: translate(1.5px, -1px) rotate(0.8deg); }
  30%  { transform: translate(-2px, -3px) rotate(-1deg); }
  40%  { transform: translate(2px, -4px) rotate(1.2deg); }
  50%  { transform: translate(-2.5px, -6px) rotate(-1.3deg) scale(1.01); }
  60%  { transform: translate(3px, -7px) rotate(1.5deg) scale(1.02); }
  70%  { transform: translate(-3px, -9px) rotate(-1.6deg) scale(1.025); }
  80%  { transform: translate(3px, -10px) rotate(1.6deg) scale(1.03); }
  90%  { transform: translate(-2px, -11px) rotate(-1deg) scale(1.035); }
  100% { transform: translate(0, -12px) scale(1.04); }
}
/* ...ricade secco sull'acqua, schiacciandosi appena... */
@keyframes logo-slam {
  from { transform: translate(0, -12px) scale(1.04); }
  to   { transform: translate(0, 4px) scale(1.025, 0.965); }
}
/* ...e, scaricata l'energia, si assesta con un piccolo rimbalzo */
@keyframes logo-settle {
  0%   { transform: translate(0, 4px) scale(1.025, 0.965); }
  45%  { transform: translate(0, -3px) scale(0.995, 1.01); }
  75%  { transform: translate(0, 1px) scale(1.002, 0.998); }
  100% { transform: none; }
}
/* lo schiacciamento ha il punto fermo sull'acqua, sotto il logo */
.hero__mark.is-charging, .hero__mark.is-slamming, .hero__mark.is-discharging { transform-origin: 50% 92%; }
.hero__mark.is-charging { animation: logo-charge .3s cubic-bezier(.4, 0, .7, 1) both; }
.hero__mark.is-slamming { animation: logo-slam .1s cubic-bezier(.55, 0, 1, .45) both; }
.hero__mark.is-discharging { animation: logo-settle .45s cubic-bezier(.3, .7, .3, 1) both; }
.hero__mark .hero__logo { transition: filter .3s ease; }
/* il logo che si carica perde la maschera della pennellata, altrimenti taglierebbe l'alone a rettangolo */
.hero__logo.is-glowing {
  -webkit-mask-image: none !important; mask-image: none !important;
  filter: drop-shadow(0 0 6px var(--charge)) drop-shadow(0 0 22px var(--charge)) brightness(1.12);
}

/* senza View Transitions: i colori sfumano invece di scattare */
.theme-fading, .theme-fading *, .theme-fading *::before, .theme-fading *::after {
  transition: background-color .5s ease, color .5s ease, border-color .5s ease, fill .5s ease, stroke .5s ease !important;
}

/* ==========================================================================
   Mobile e movimento ridotto
   ========================================================================== */
@media (max-width: 760px) {
  .hero__meta { flex-direction: column; gap: 12px; text-align: center; }
  .hero__teacher { flex-direction: column; border-left: 0; padding-left: 0; gap: 10px; }
  .hero__teacher p { text-align: center; }
  .scroll { padding: 0 30px; --rod-top: 13px; --rod-bottom: 30px; }
  .scroll__text { padding-left: 22px; padding-right: 22px; }
  .scroll__rod--top { left: 18px; right: 18px; }
  .scroll__rod--top::before, .scroll__rod--top::after { width: 24px; height: 22px; }
  .scroll__rod--top::before { left: -21px; }
  .scroll__rod--top::after { right: -21px; }
  .scroll__rod--bottom { left: 26px; right: 26px; }
  .scroll__rod--bottom::before, .scroll__rod--bottom::after { width: 40px; height: 37px; }
  .scroll__rod--bottom::before { left: -36px; }
  .scroll__rod--bottom::after { right: -36px; }
  .scroll__hanger { width: 180px; height: 52px; top: -50px; }
  .ms-chapter { gap: 8px; letter-spacing: 0.24em; font-size: 0.72rem; }
  .ms-chapter::before, .ms-chapter::after { width: 32px; }
  .ms-seal { width: 112px; height: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__sub, .hero__meta { animation: none; }
  .scroll { --open: 100%; }
  .js .scroll.is-rolled .ink { opacity: 1; filter: none; -webkit-mask-image: none; mask-image: none; }
  .theme-toggle__knob, .tt-core, .tt-cut, .tt-rays { transition: none; }
}
