/* =========================================================
   Il Castello della Buonanotte — tema condiviso
   Palette ispirata alla copertina: lavanda, rosa, blu notte, oro.
   Mobile-first, responsive, pulito.
   ========================================================= */

:root {
  /* Colori */
  --notte:        #3b3168;   /* blu notte - testi e titoli */
  --notte-soft:   #5a4d86;
  --lavanda:      #b9a8db;
  --lavanda-chiara:#e8e0f5;
  --rosa:         #f3d9e4;
  --rosa-caldo:   #e9b9cd;
  --crema:        #fbf7f1;   /* sfondo */
  --crema-card:   #ffffff;
  --oro:          #d8b25e;   /* accenti */
  --oro-scuro:    #b7913f;
  --testo:        #463c63;
  --testo-soft:   #6f6690;
  --ombra:        0 10px 30px rgba(59, 49, 104, .10);
  --ombra-soft:   0 4px 14px rgba(59, 49, 104, .08);

  /* Tipografia */
  --font-titolo:  "Georgia", "Times New Roman", serif;
  --font-testo:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --raggio:       18px;
  --raggio-sm:    12px;
  --max:          1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-testo);
  color: var(--testo);
  line-height: 1.65;
  font-size: 17px;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--lavanda-chiara), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, var(--rosa), transparent 55%),
    var(--crema);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--notte-soft); }

h1, h2, h3 {
  font-family: var(--font-titolo);
  color: var(--notte);
  line-height: 1.2;
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 6vw, 3.2rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 0 0 .6em; }
h3 { font-size: 1.2rem; margin: 0 0 .4em; }

p { margin: 0 0 1em; }

.contenitore {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

.stretto { max-width: 760px; }

/* ---------- Header / brand ---------- */
.intestazione {
  text-align: center;
  padding: 26px 20px 8px;
  position: relative;
  z-index: 2;
}
.intestazione .logo-castello { margin: 0 auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--notte);
}
.brand img { width: 34px; height: 34px; }
.brand .nome {
  font-family: var(--font-titolo);
  font-size: 1.05rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--notte);
}
.brand .nome b { color: var(--oro-scuro); font-weight: 700; }

/* ---------- Sezioni ---------- */
section { padding: 36px 0; }

.hero {
  text-align: center;
  padding-top: 12px;
}
.hero .sottotitolo {
  color: var(--testo-soft);
  font-size: 1.1rem;
  max-width: 620px;
  margin: 0 auto 1.4em;
}

/* Copertina libro */
.copertina-wrap { display: flex; justify-content: center; margin: 0 0 28px; }
.copertina {
  border-radius: var(--raggio);
  box-shadow: var(--ombra);
  max-width: 340px;
  width: 100%;
}

/* ---------- Bottoni ---------- */
.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  font-family: var(--font-testo);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 15px 30px;
  border-radius: 999px;
  text-decoration: none;
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primario {
  background: linear-gradient(135deg, var(--oro), var(--oro-scuro));
  color: #fff;
  box-shadow: 0 8px 20px rgba(184, 145, 63, .35);
}
.btn-primario:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(184, 145, 63, .45); }
.btn-secondario {
  background: var(--notte);
  color: #fff;
}
.btn-secondario:hover { transform: translateY(-2px); background: var(--notte-soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-amazon::before { content: "🛒  "; }

/* ---------- Card / blocchi ---------- */
.card {
  background: var(--crema-card);
  border-radius: var(--raggio);
  box-shadow: var(--ombra-soft);
  padding: 28px;
  border: 1px solid rgba(185, 168, 219, .25);
}

.lista-pregi {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 600px;
  text-align: left;
}
.lista-pregi li {
  position: relative;
  padding: 8px 0 8px 34px;
}
.lista-pregi li::before {
  content: "✦";
  position: absolute;
  left: 6px;
  top: 8px;
  color: var(--oro-scuro);
}

/* Richiamo al mondo del Castello */
.mondo {
  text-align: center;
  background: linear-gradient(135deg, rgba(185,168,219,.18), rgba(233,185,205,.18));
  border-radius: var(--raggio);
  padding: 34px 24px;
  border: 1px solid rgba(185, 168, 219, .3);
}

/* ---------- Pagina regalo ---------- */
.regalo-grid {
  display: grid;
  gap: 32px;
  align-items: start;
}
@media (min-width: 820px) {
  .regalo-grid { grid-template-columns: 0.9fr 1.1fr; }
}
.regalo-pdf img {
  border-radius: var(--raggio);
  box-shadow: var(--ombra);
  margin: 0 auto;
  max-width: 320px;
}

/* ---------- Form ---------- */
.campo { margin-bottom: 18px; }
.campo label {
  display: block;
  font-weight: 600;
  color: var(--notte);
  margin-bottom: 6px;
  font-size: .98rem;
}
.campo input[type="text"],
.campo input[type="email"] {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid var(--lavanda);
  border-radius: var(--raggio-sm);
  font-size: 1rem;
  font-family: var(--font-testo);
  background: #fff;
  color: var(--testo);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.campo input:focus {
  outline: none;
  border-color: var(--notte-soft);
  box-shadow: 0 0 0 3px rgba(90, 77, 134, .15);
}

.consenso {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  font-size: .92rem;
  color: var(--testo-soft);
  line-height: 1.5;
}
.consenso input[type="checkbox"] {
  margin-top: 3px;
  width: 20px;
  height: 20px;
  accent-color: var(--oro-scuro);
  flex: 0 0 auto;
}
.consenso a { color: var(--notte); font-weight: 600; }
.facolt { font-style: italic; }
.facolt-tag {
  font-size: .75rem;
  background: var(--lavanda-chiara);
  color: var(--notte-soft);
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 4px;
}

.msg {
  border-radius: var(--raggio-sm);
  padding: 14px 16px;
  margin: 12px 0;
  font-size: .95rem;
  display: none;
}
.msg.errore { background: #fbe6e6; color: #8a2b2b; display: block; }
.msg.attesa { background: var(--lavanda-chiara); color: var(--notte); display: block; }

.download-box { display: none; text-align: center; }
.download-box.mostra { display: block; animation: fadein .5s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.spunta-ok {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 8px;
}

/* ---------- Privacy ---------- */
.legale { max-width: 760px; }
.legale h2 { margin-top: 1.6em; }
.legale p, .legale li { color: var(--testo); }
.legale ul { padding-left: 22px; }
.legale .aggiornato { color: var(--testo-soft); font-size: .9rem; }

/* ---------- Footer ---------- */
.pie {
  text-align: center;
  padding: 40px 20px 50px;
  margin-top: 30px;
  color: var(--testo-soft);
  font-size: .9rem;
  border-top: 1px solid rgba(185, 168, 219, .3);
}
.pie a { color: var(--notte-soft); }
.pie .brand-mini { font-family: var(--font-titolo); color: var(--notte); }

/* =========================================================
   HOME — schermata unica "cielo della buonanotte" (premium)
   ========================================================= */
.pagina-home {
  color: #efe9f7;
  background:
    radial-gradient(1100px 800px at 78% -15%, #6a5a9e 0%, transparent 55%),
    radial-gradient(900px 700px at 8% 115%, #6d4f7d 0%, transparent 50%),
    linear-gradient(165deg, #211c43 0%, #352c63 55%, #4a3c70 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.hero-libro {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sfondo-decor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.sfondo-decor .stelle { position: absolute; inset: 0; width: 100%; height: 100%; }

.decor { position: absolute; }
.decor.luna { top: 6%; right: 6%; width: 122px; filter: drop-shadow(0 0 22px rgba(246,224,120,.35)); }
.decor.nuvola { opacity: .55; }
.n1 { top: 13%; left: 16%; width: 210px; opacity: .50; }
.n2 { top: 33%; right: 12%; width: 165px; opacity: .40; }
.n3 { bottom: 6%;  left: 3%;  width: 250px; opacity: .58; }
.n4 { bottom: 9%;  right: 7%; width: 215px; opacity: .48; }
.n5 { top: 24%; left: 1%;  width: 135px; opacity: .38; }
@media (max-width: 760px) {
  .n2, .n5 { display: none; }
  .decor.luna { top: 3%; width: 86px; }
  .n1 { top: 8%; width: 150px; opacity: .42; }
  .n3 { width: 170px; }
  .n4 { width: 150px; bottom: 3%; }
}

.brand-flott {
  position: relative;
  z-index: 2;
  padding: 20px 26px 4px;
}
.brand .logo-castello { width: 420px; max-width: 86vw; height: auto; display: block; }
@media (max-width: 760px) { .brand .logo-castello { width: 300px; } }

.hero-cover { position: relative; }

/* =========================================================
   PAGINE INTERNE su sfondo notturno (regalo, privacy, 404)
   ========================================================= */
.pagina-notte {
  color: #efe9f7;
  background:
    radial-gradient(1100px 800px at 78% -15%, #6a5a9e 0%, transparent 55%),
    radial-gradient(900px 700px at 8% 115%, #6d4f7d 0%, transparent 50%),
    linear-gradient(165deg, #211c43 0%, #352c63 55%, #4a3c70 100%);
  background-attachment: fixed;
  min-height: 100vh;
}
.pagina-notte .hero h1 { color: #ffffff; }
.pagina-notte .hero .sottotitolo { color: #d9cdef; }
.pagina-notte .torna-libro a { color: #d8cdf0; }
.pagina-notte .pie {
  color: #b6a9d6;
  border-top-color: rgba(255, 255, 255, .14);
}
.pagina-notte .pie a, .pagina-notte .pie .brand-mini { color: #d8cdf0; }

/* testo dentro i riquadri bianchi: scuro e leggibile (correzione) */
.pagina-notte .card { color: var(--testo); }

/* contenuto sopra le nuvole di sfondo */
.pagina-notte > header,
.pagina-notte > main,
.pagina-notte > .pie { position: relative; z-index: 1; }

/* nuvole di sfondo fisse (pagina regalo) */
.sfondo-decor-fisso {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.sfondo-decor-fisso .decor { position: absolute; }
.rc1 { top: 9%;  left: 2%;  width: 180px; opacity: .42; }
.rc2 { top: 42%; right: 3%; width: 150px; opacity: .32; }
.rc3 { bottom: 6%; left: 4%; width: 200px; opacity: .40; }
.rc4 { bottom: 12%; right: 6%; width: 160px; opacity: .34; }
@media (max-width: 760px) {
  .rc2 { display: none; }
  .rc1 { width: 120px; top: 5%; }
  .rc3 { width: 130px; }
  .rc4 { width: 120px; }
}

/* foglio chiaro per il testo legale, leggibile sul fondo scuro */
.pagina-notte .legale {
  background: #fffdf9;
  color: var(--testo);
  border-radius: var(--raggio);
  box-shadow: var(--ombra);
  padding: 34px 36px;
  margin: 12px auto 36px;
}
@media (max-width: 600px) { .pagina-notte .legale { padding: 24px 20px; } }

.hero-griglia {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 8px 26px 6px;
  display: grid;
  gap: 30px;
  place-content: center;
  place-items: center;
  text-align: center;
}
@media (min-width: 860px) {
  .hero-griglia {
    grid-template-columns: minmax(240px, 380px) 1fr;
    align-items: center;
    text-align: left;
    gap: 56px;
  }
}

.hero-cover img {
  width: 100%;
  max-width: 330px;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, .45),
    0 0 0 1px rgba(216, 178, 94, .45);
  animation: salita .8s ease both;
}
@media (min-width: 860px) { .hero-cover img { max-width: 380px; } }

.hero-testo { animation: salita .8s ease .1s both; }
.kicker {
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .78rem;
  font-weight: 700;
  color: var(--oro);
  margin: 0 0 .7em;
}
.pagina-home h1 {
  color: #ffffff;
  font-size: clamp(2.1rem, 5.2vw, 3.4rem);
  margin: 0 0 .25em;
}
.pagina-home .sottotitolo {
  color: #ddd2f2;
  font-size: 1.12rem;
  margin: 0 0 1em;
}
.hero-desc {
  color: #cabfe3;
  max-width: 48ch;
  margin: 0 auto 1.3em;
  font-size: 1.02rem;
}
@media (min-width: 860px) { .hero-desc { margin-left: 0; } }

.divisore-oro {
  width: 64px;
  height: 2px;
  border: none;
  margin: 0 auto 1.3em;
  background: linear-gradient(90deg, transparent, var(--oro), transparent);
}
@media (min-width: 860px) { .divisore-oro { margin-left: 0; } }

.pregi-inline {
  list-style: none;
  padding: 0;
  margin: 0 0 1.7em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
}
@media (min-width: 860px) { .pregi-inline { justify-content: flex-start; } }
.pregi-inline li { font-size: .92rem; color: #e7dff5; }
.pregi-inline li::before { content: "✦"; color: var(--oro); margin-right: 8px; }

.hero-pie {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 14px 20px 20px;
  font-size: .82rem;
  color: #b6a9d6;
}
.hero-pie a { color: #d8cdf0; }

@keyframes salita {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* stelline che brillano leggermente */
.sfondo-decor .twinkle { animation: brilla 4s ease-in-out infinite; }
.sfondo-decor .twinkle.b { animation-delay: 1.3s; }
.sfondo-decor .twinkle.c { animation-delay: 2.6s; }
@keyframes brilla { 0%,100% { opacity: .25; } 50% { opacity: .9; } }
@media (prefers-reduced-motion: reduce) {
  .hero-cover img, .hero-testo { animation: none; }
  .sfondo-decor .twinkle { animation: none; }
}

/* utilità */
.centro { text-align: center; }
.mt-2 { margin-top: 18px; }
.mt-3 { margin-top: 28px; }
.nascosto { display: none; }
