/* ============================================================
   La Storia del Mondo per Bambini — official site
   Aesthetic: an explorer's field notebook on aged parchment,
   derived directly from the book's illustrations.
   Tokens:
   --carta       #F5EBD8  parchment base
   --carta-alt   #EFE2C6  darker parchment (alternating sections)
   --inchiostro  #33291E  warm ink
   --seppia      #7A6A52  pencil / secondary text
   --terracotta  #B5502F  spine red (CTA)
   --oro         #B08434  antique gold accents
   --giada       #4E8F86  teal highlight (from subtitle bands)
   Type: Fraunces (display) · Nunito (body) · Caveat (margin notes)
   ============================================================ */

:root {
  --carta: #F5EBD8;
  --carta-alt: #EFE2C6;
  --inchiostro: #33291E;
  --seppia: #6E5F48;
  --terracotta: #B5502F;
  --terracotta-scuro: #94411F;
  --oro: #B08434;
  --giada: #4E8F86;
  --ombra: 0 10px 30px rgba(51, 41, 30, .14);
  --radius: 14px;
  --wrap: 1120px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Nunito", "Segoe UI", sans-serif;
  --font-note: "Caveat", cursive;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.06rem;
  line-height: 1.7;
  color: var(--inchiostro);
  background-color: var(--carta);
  background-image:
    radial-gradient(rgba(51,41,30,.045) 1px, transparent 1.4px),
    linear-gradient(180deg, rgba(176,132,52,.05), transparent 300px);
  background-size: 26px 26px, 100% 100%;
}

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

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2rem); }
.wrap-narrow { max-width: 820px; }
.center { text-align: center; }

/* ---------- typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 560; line-height: 1.15; margin: 0 0 .5em; letter-spacing: .002em; }
h1 { font-size: clamp(2.1rem, 5.4vw, 3.4rem); font-weight: 640; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
h3 { font-size: clamp(1.25rem, 2.4vw, 1.55rem); }
h4 { font-size: 1.12rem; margin-bottom: .3em; }
p { margin: 0 0 1em; }
em { font-style: italic; }
address { font-style: normal; }

.margin-note {
  font-family: var(--font-note);
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  color: var(--seppia);
  margin: 0 0 .2em;
  transform: rotate(-1.2deg);
  transform-origin: left bottom;
}
.eyebrow {
  font-size: .82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .14em; color: var(--giada); margin-bottom: .8em;
}
.lede { font-size: clamp(1.12rem, 2vw, 1.28rem); color: var(--seppia); max-width: 46em; margin-bottom: 1.6em; }
.claim {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  color: var(--terracotta); margin: 1em 0;
  padding-left: .9em; border-left: 3px solid var(--oro);
}

/* ---------- skip link & focus ---------- */
.skip {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--inchiostro); color: var(--carta);
  padding: .6em 1em; border-radius: 0 0 8px 0; text-decoration: none;
}
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--giada); outline-offset: 3px; border-radius: 3px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; text-decoration: none; text-align: center;
  font-weight: 700; font-family: var(--font-body);
  padding: .8em 1.5em; border-radius: 999px;
  border: 2px solid transparent;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--terracotta); color: #FFF7EC;
  box-shadow: 0 6px 18px rgba(181, 80, 47, .35);
}
.btn-primary:hover { background: var(--terracotta-scuro); }
.btn-ghost {
  color: var(--inchiostro); border-color: var(--inchiostro); background: transparent;
}
.btn-ghost:hover { background: rgba(51,41,30,.06); }
.btn-big { font-size: 1.12rem; padding: 1em 2.2em; }
.cta-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.4rem; }
.cta-row.center { justify-content: center; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245, 235, 216, .92);
  backdrop-filter: blur(6px);
  border-bottom: 2px dashed rgba(110, 95, 72, .4);
}
.head-row { display: flex; align-items: center; gap: 1rem; min-height: 68px; }
.wordmark {
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--font-display); font-weight: 640;
  font-size: 1.02rem; line-height: 1.15;
  color: var(--inchiostro); text-decoration: none; max-width: 15em;
}
.wordmark .compass { width: 30px; height: 30px; color: var(--terracotta); flex: none; }
.site-nav { display: flex; align-items: center; gap: 1.1rem; margin-left: auto; }
.nav-list { display: flex; gap: 1.05rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.nav-list a {
  color: var(--inchiostro); text-decoration: none; font-weight: 700; font-size: .95rem;
  border-bottom: 2px solid transparent; padding-bottom: 2px;
}
.nav-list a:hover { border-bottom-color: var(--oro); }
.btn-nav { padding: .55em 1.1em; font-size: .92rem; }

.lang-switch { display: flex; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.lang-switch a {
  display: inline-block; padding: .25em .5em; border-radius: 7px;
  color: var(--seppia); text-decoration: none; font-weight: 800; font-size: .82rem;
  letter-spacing: .05em;
}
.lang-switch a:hover { color: var(--inchiostro); background: rgba(51,41,30,.07); }
.lang-switch a[aria-current="page"] { color: #FFF7EC; background: var(--giada); }

.nav-toggle { display: none; }

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex; flex-direction: column; gap: 5px; margin-left: auto;
    background: none; border: 0; padding: .6rem; cursor: pointer;
  }
  .nav-toggle span { width: 24px; height: 3px; background: var(--inchiostro); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--carta); border-bottom: 2px dashed rgba(110,95,72,.4);
    flex-direction: column; align-items: flex-start; padding: 1.1rem clamp(1.1rem,4vw,2rem) 1.4rem;
    box-shadow: var(--ombra);
  }
  .site-nav.open { display: flex; }
  .nav-list { flex-direction: column; gap: .7rem; }
}

/* ---------- hero ---------- */
.hero { padding: clamp(2.2rem, 6vw, 4.5rem) 0 clamp(1.6rem, 4vw, 3rem); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.hero-sub { font-family: var(--font-display); font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--seppia); }
.hero-p { max-width: 38em; }
.hero-book img {
  border-radius: 6px;
  box-shadow: 14px 18px 0 rgba(176,132,52,.22), var(--ombra);
  transform: rotate(2.2deg);
  transition: transform .3s ease;
}
.hero-book:hover img { transform: rotate(.6deg) scale(1.015); }
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-book { max-width: 380px; margin-inline: auto; }
}

/* ---------- banner strip ---------- */
.banner-strip { margin: clamp(1rem, 3vw, 2rem) 0 0; border-block: 2px dashed rgba(110,95,72,.4); }
.banner-strip img { width: 100%; }

/* ---------- sections ---------- */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-alt { background: var(--carta-alt); border-block: 2px dashed rgba(110,95,72,.35); }
.sub-h { margin-top: 2.2em; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.2rem, 3vw, 2.4rem); }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
  margin: 2rem 0 0; padding: 1.4rem;
  border: 2px dashed var(--oro); border-radius: var(--radius);
  background: rgba(255, 250, 238, .5);
}
.stat { text-align: center; }
.stat-n { display: block; font-family: var(--font-display); font-weight: 640; font-size: clamp(1.5rem, 3vw, 2.1rem); color: var(--terracotta); }
.stat-l { font-size: .88rem; color: var(--seppia); font-weight: 700; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- cards ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.card {
  background: rgba(255, 250, 238, .65);
  border: 1.5px solid rgba(110,95,72,.3);
  border-radius: var(--radius);
  padding: 1.3rem 1.3rem 1rem;
  box-shadow: 3px 4px 0 rgba(176,132,52,.15);
}
.card h4 { color: var(--terracotta); }
.card p { margin-bottom: .3em; color: var(--inchiostro); font-size: .98rem; }
.card-line { border-left: 4px solid var(--giada); }
.card-seal { text-align: center; border-top: 4px solid var(--oro); }
.filiera { margin-top: 1.8rem; }

/* ---------- timeline (the journey) ---------- */
.timeline {
  list-style: none; margin: 1rem 0 0; padding: 0;
  position: relative;
}
.timeline::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  border-left: 3px dashed var(--oro); transform: translateX(-50%);
}
.era {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(1.4rem, 4vw, 3rem);
  align-items: center;
  padding: clamp(1.4rem, 3vw, 2.4rem) 0;
  position: relative;
}
.era-img img {
  border-radius: 10px;
  border: 1.5px solid rgba(110,95,72,.35);
  box-shadow: var(--ombra);
  transform: rotate(-1deg);
}
.era.flip .era-img { order: 2; }
.era.flip .era-img img { transform: rotate(1deg); }
.era-txt { position: relative; padding-left: .4rem; }
.era-dot {
  position: absolute; top: .4rem; width: 16px; height: 16px; border-radius: 50%;
  background: var(--giada); border: 3px solid var(--oro);
  left: calc(-1 * clamp(1.4rem, 4vw, 3rem) / 2 - 8px - .4rem);
}
.era .era-dot { left: auto; right: calc(-1 * clamp(1.4rem, 4vw, 3rem) / 2 - 8px); }
.era.flip .era-dot { right: auto; left: calc(-1 * clamp(1.4rem, 4vw, 3rem) / 2 - 8px); }
.era-epoch { font-family: var(--font-note); font-size: 1.25rem; color: var(--giada); margin-bottom: .1em; }
.era-txt h3 { margin-bottom: .3em; }
.era-txt p:last-child { margin-bottom: 0; color: var(--inchiostro); }
@media (max-width: 820px) {
  .timeline::before { left: 8px; transform: none; }
  .era, .era.flip { grid-template-columns: 1fr; gap: 1rem; padding-left: 2rem; }
  .era.flip .era-img { order: 0; }
  .era .era-dot, .era.flip .era-dot { left: -2rem; right: auto; margin-left: 1px; }
}

/* ---------- author ---------- */
.autore-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(1.6rem, 4vw, 3.4rem); align-items: start; }
.autore-photo img {
  border-radius: var(--radius);
  border: 6px solid #FFF7EC;
  box-shadow: var(--ombra);
  transform: rotate(-1.6deg);
}
.signature { font-family: var(--font-note); font-size: 1.9rem; color: var(--terracotta); transform: rotate(-2deg); margin-top: .6em; }
@media (max-width: 820px) {
  .autore-grid { grid-template-columns: 1fr; }
  .autore-photo { max-width: 340px; }
}

/* ---------- badges & chips ---------- */
.badge {
  display: inline-block; font-size: .8rem; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
  color: #FFF7EC; background: var(--giada);
  padding: .35em .9em; border-radius: 999px; margin-bottom: 1em;
}
.badge-oro { background: var(--oro); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .6rem; padding: 0; margin: 1rem 0 0; justify-content: center; }
.chips li {
  background: rgba(255, 250, 238, .8);
  border: 1.5px dashed rgba(110,95,72,.45);
  border-radius: 999px; padding: .45em 1.1em; font-weight: 700; font-size: .95rem;
}
.chips-merch { justify-content: flex-start; }
.chip-badge {
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--terracotta); display: block; line-height: 1.1;
}

/* ---------- app feature list ---------- */
.feat-list { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: .9rem; }
.feat-list li {
  background: rgba(255, 250, 238, .65);
  border-left: 4px solid var(--oro);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .9rem 1.2rem .5rem;
}
.feat-list h4 { margin-bottom: .15em; }
.feat-list p { font-size: .97rem; color: var(--seppia); }

/* ---------- merch ---------- */
.merch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.6rem, 4vw, 3rem); align-items: center; }
.merch-imgs { position: relative; padding-bottom: 2.5rem; }
.merch-main { border-radius: var(--radius); border: 1.5px solid rgba(110,95,72,.35); box-shadow: var(--ombra); }
.merch-side {
  position: absolute; width: 42%; right: -4%; bottom: 0;
  border-radius: 10px; border: 5px solid #FFF7EC; box-shadow: var(--ombra);
  transform: rotate(3deg);
}
@media (max-width: 820px) {
  .merch-grid { grid-template-columns: 1fr; }
  .merch-side { right: 0; }
}

/* ---------- support ---------- */
.sostieni { padding-bottom: clamp(4rem, 8vw, 6rem); }
.map-cta { display: block; margin: 2rem auto 2rem; max-width: 900px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--ombra); border: 1.5px solid rgba(110,95,72,.35); transition: transform .25s ease, box-shadow .25s ease; }
a.map-cta:hover { transform: translateY(-4px) scale(1.005); box-shadow: 0 16px 40px rgba(51,41,30,.2); }
.map-cta-card { padding: 3rem; display: grid; place-items: center; background: rgba(255,250,238,.6); border-style: dashed; }
.map-cta-card .compass { width: 64px; height: 64px; color: var(--oro); }

/* ---------- footer ---------- */
.site-foot { background: var(--inchiostro); color: #EFE3CC; margin-top: 0; }
.foot-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 2rem; padding-block: 3rem 1.5rem; }
.foot-title { font-family: var(--font-display); font-weight: 640; font-size: 1.2rem; margin-bottom: .3em; }
.foot-tag { color: #C9B893; }
.foot-claim { font-family: var(--font-display); font-style: italic; color: var(--oro); font-size: .95rem; }
.foot-h { font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; color: #C9B893; margin-bottom: .6em; }
.foot-h2 { margin-top: 1.3em; }
.foot-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.foot-list a { color: #EFE3CC; text-decoration: none; }
.foot-list a:hover { color: var(--oro); text-decoration: underline; }
.lang-foot a { color: #C9B893; }
.lang-foot a:hover { color: #EFE3CC; background: rgba(255,255,255,.08); }
.lang-foot a[aria-current="page"] { color: #14211F; background: var(--oro); }
.foot-bottom { border-top: 1px solid rgba(239,227,204,.2); padding-block: 1.1rem; font-size: .88rem; color: #C9B893; }
@media (max-width: 820px) { .foot-grid { grid-template-columns: 1fr; gap: 1.6rem; } }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .hero-book img, a.map-cta { transition: none; }
}

/* ---------- 404 & legal ---------- */
.page-404 { display: grid; min-height: 100vh; place-items: center; text-align: center; }
.wrap-404 { padding: 2rem; max-width: 640px; }
.wrap-404 .compass { width: 70px; height: 70px; color: var(--terracotta); margin-inline: auto; }
.page-legal { padding-block: 0 3rem; }
.page-legal main { padding-block: 2.4rem; }
.page-legal section { margin-bottom: 2.2rem; }
.page-legal section h2 { font-size: 1.25rem; color: var(--terracotta); margin-top: 0; }
.page-legal address {
  background: rgba(255, 250, 238, .6); border: 1.5px dashed rgba(110,95,72,.4);
  border-radius: var(--radius); padding: 1rem 1.2rem; margin: .8em 0 1.2em; line-height: 1.6;
}
.page-legal a { color: var(--terracotta); }
