/* Magie di Rime — grammatica Flying Papers su carta chiara (vedi DESIGN.md) */

:root {
  /* Colori (palette dal logo, su fondo chiaro dal 17/10/2026) */
  --color-paper: #fffaf3;
  --color-cream: #fdf3e6;
  --color-ink: #1a1640;
  --color-ink-soft: #4a4470;
  --color-rhyme-blue: #003b96;
  --color-strawberry: #d6205f;
  --color-teal: #037a8f;
  --color-violet: #7d42a8;
  --color-star: #ffe653;
  --color-butter: #fdc522;
  --color-confetti-pink: #ffd3e3;
  --color-confetti-teal: #c9eef4;
  --color-confetti-violet: #eadcf7;
  --color-confetti-butter: #fff0b8;
  --color-border: rgba(26, 22, 64, .14);

  /* Tipografia */
  --font-display: "Fredoka", "Outfit", system-ui, sans-serif;
  --font-body: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-caption: .875rem;
  --text-body: 1.125rem;
  --text-label: 1rem;
  --text-subheading: clamp(1.5rem, 1.2rem + 1.4vw, 1.875rem);
  --text-heading-sm: clamp(2.375rem, 1rem + 6.8vw, 6.25rem);
  --text-heading: clamp(3.25rem, 1.2rem + 10vw, 9.3rem);
  --text-display: clamp(3rem, .45rem + 12.4vw, 9.5rem);

  /* Spazi e forme */
  --spacing-16: 16px;
  --spacing-20: 20px;
  --spacing-24: 24px;
  --spacing-40: 40px;
  --spacing-60: 60px;
  --spacing-80: 80px;
  --spacing-160: 160px;
  --card-padding: 17px;
  --element-gap: 17px;
  --radius-md: 6px;
  --radius-full: 100px;

  --gutter: clamp(16px, 5vw, 60px);
  --section-pad: clamp(72px, 9vw, 128px);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.5;
  overflow-x: hidden;
}
body.nav-open { overflow: hidden; }

img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }

:focus-visible { outline: 3px solid var(--color-rhyme-blue); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: var(--gutter); }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  padding: 12px 20px; border-radius: var(--radius-full);
  background: var(--color-rhyme-blue); color: var(--color-paper);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* ---------- Stelle: solo dietro la hero ---------- */
.top { position: relative; isolation: isolate; }
.sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  /* stelle dorate a cinque punte come nel logo, chieste dalla cliente il 19/10/2026 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='431' height='431'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23fff4a3'/%3E%3Cstop offset='.55' stop-color='%23ffd23a'/%3E%3Cstop offset='1' stop-color='%23f6a417'/%3E%3C/linearGradient%3E%3CradialGradient id='h'%3E%3Cstop offset='0' stop-color='%23ffe653' stop-opacity='.55'/%3E%3Cstop offset='1' stop-color='%23ffe653' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='64' cy='92' r='29' fill='url(%23h)'/%3E%3Cpath d='M64.0 79.0L67.8 86.7L76.4 88.0L70.2 94.0L71.6 102.5L64.0 98.5L56.4 102.5L57.8 94.0L51.6 88.0L60.2 86.7Z' transform='rotate(-8 64 92)' fill='url(%23g)' stroke='%23f2a20c' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cellipse cx='61.1' cy='88.1' rx='2.1' ry='1.2' fill='%23fff' opacity='.7' transform='rotate(-30 61.1 88.1)'/%3E%3Ccircle cx='318' cy='58' r='20' fill='url(%23h)'/%3E%3Cpath d='M318.0 49.0L320.6 54.4L326.6 55.2L322.3 59.4L323.3 65.3L318.0 62.5L312.7 65.3L313.7 59.4L309.4 55.2L315.4 54.4Z' transform='rotate(12 318 58)' fill='url(%23g)' stroke='%23f2a20c' stroke-width='1.3' stroke-linejoin='round'/%3E%3Cellipse cx='316.0' cy='55.3' rx='1.4' ry='0.8' fill='%23fff' opacity='.7' transform='rotate(-30 316.0 55.3)'/%3E%3Ccircle cx='212' cy='236' r='35' fill='url(%23h)'/%3E%3Cpath d='M212.0 220.0L216.7 229.5L227.2 231.1L219.6 238.5L221.4 248.9L212.0 244.0L202.6 248.9L204.4 238.5L196.8 231.1L207.3 229.5Z' transform='rotate(-4 212 236)' fill='url(%23g)' stroke='%23f2a20c' stroke-width='2.2' stroke-linejoin='round'/%3E%3Cellipse cx='208.5' cy='231.2' rx='2.6' ry='1.4' fill='%23fff' opacity='.7' transform='rotate(-30 208.5 231.2)'/%3E%3Ccircle cx='392' cy='318' r='22' fill='url(%23h)'/%3E%3Cpath d='M392.0 308.0L394.9 314.0L401.5 314.9L396.8 319.5L397.9 326.1L392.0 323.0L386.1 326.1L387.2 319.5L382.5 314.9L389.1 314.0Z' transform='rotate(6 392 318)' fill='url(%23g)' stroke='%23f2a20c' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cellipse cx='389.8' cy='315.0' rx='1.6' ry='0.9' fill='%23fff' opacity='.7' transform='rotate(-30 389.8 315.0)'/%3E%3Ccircle cx='96' cy='368' r='18' fill='url(%23h)'/%3E%3Cpath d='M96.0 360.0L98.4 364.8L103.6 365.5L99.8 369.2L100.7 374.5L96.0 372.0L91.3 374.5L92.2 369.2L88.4 365.5L93.6 364.8Z' transform='rotate(15 96 368)' fill='url(%23g)' stroke='%23f2a20c' stroke-width='1.2' stroke-linejoin='round'/%3E%3Cellipse cx='94.2' cy='365.6' rx='1.3' ry='0.7' fill='%23fff' opacity='.7' transform='rotate(-30 94.2 365.6)'/%3E%3C/svg%3E");
  background-size: 431px 431px;
  background-position: 30px 10px;
}
.sky::before,
.sky::after { content: ""; position: absolute; inset: 0; }
.sky::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='347' height='347'%3E%3Cpath d='M52 50Q52 61 63 61Q52 61 52 72Q52 61 41 61Q52 61 52 50Z' fill='%23fdc522'/%3E%3Cpath d='M233 34Q233 40 239 40Q233 40 233 46Q233 40 227 40Q233 40 233 34Z' fill='%23ff8fb8'/%3E%3Cpath d='M300 240Q300 250 310 250Q300 250 300 260Q300 250 290 250Q300 250 300 240Z' fill='%23fdc522'/%3E%3Cpath d='M120 285Q120 290 125 290Q120 290 120 295Q120 290 115 290Q120 290 120 285Z' fill='%2306b6d4'/%3E%3Cpath d='M180 154Q180 160 186 160Q180 160 180 166Q180 160 174 160Q180 160 180 154Z' fill='%23b388e0'/%3E%3C/svg%3E");
  background-size: 347px 347px;
  opacity: .8;
  animation: twinkle 5s ease-in-out infinite alternate;
}
.sky::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='563' height='563'%3E%3Cpath d='M90 413Q90 420 97 420Q90 420 90 427Q90 420 83 420Q90 420 90 413Z' fill='%23ff8fb8'/%3E%3Cpath d='M410 114Q410 120 416 120Q410 120 410 126Q410 120 404 120Q410 120 410 114Z' fill='%23fdc522'/%3E%3Cpath d='M500 475Q500 480 505 480Q500 480 500 485Q500 480 495 480Q500 480 500 475Z' fill='%2306b6d4'/%3E%3Cpath d='M260 292Q260 300 268 300Q260 300 260 308Q260 300 252 300Q260 300 260 292Z' fill='%23fdc522'/%3E%3C/svg%3E");
  background-size: 563px 563px;
  background-position: 140px 90px;
  opacity: .6;
  animation: twinkle 7s ease-in-out 1.5s infinite alternate-reverse;
}
@keyframes twinkle { from { opacity: .6; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sky::before, .sky::after { animation: none; opacity: .7; }
}

/* ---------- Header e nav ---------- */
.site-header { position: relative; z-index: 50; }
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--spacing-20);
  padding-block: var(--card-padding);
}
.brand { position: relative; z-index: 45; display: inline-flex; min-height: 44px; align-items: center; }
.brand img { width: clamp(170px, 38vw, 230px); }

.nav-toggle {
  position: relative; z-index: 45;
  display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px;
  width: 48px; height: 48px; padding: 0;
  border: 2px solid var(--color-ink); border-radius: var(--radius-full);
  background: var(--color-paper); color: var(--color-ink); cursor: pointer;
}
.nav-toggle__bar { width: 20px; height: 2.5px; border-radius: 2px; background: currentColor; transition: transform .25s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

.site-nav {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center;
  padding: 96px var(--gutter) var(--spacing-40);
  background: var(--color-paper);
  visibility: hidden; opacity: 0;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.site-nav.is-open { visibility: visible; opacity: 1; transition: opacity .25s ease; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--spacing-16); }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 48px;
  font-family: var(--font-display); font-weight: 700; font-stretch: 112%;
  font-size: clamp(2.25rem, 10vw, 3.5rem); line-height: .95; letter-spacing: .02em;
  color: var(--color-strawberry); text-decoration: none;
}
.site-nav li:nth-child(2) a { color: var(--color-teal); }
.site-nav li:nth-child(3) a { color: var(--color-violet); }
.site-nav li:nth-child(4) a { color: var(--color-rhyme-blue); }
@media (prefers-reduced-motion: reduce) {
  .site-nav, .site-nav.is-open, .nav-toggle__bar { transition: none; }
}

@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .site-nav {
    position: static; inset: auto; z-index: auto;
    padding: 0; background: none;
    visibility: visible; opacity: 1; transition: none;
  }
  .site-nav ul { display: flex; gap: var(--spacing-24); }
  .site-nav a,
  .site-nav li:nth-child(n) a {
    font-family: var(--font-body); font-stretch: normal; font-weight: 600;
    font-size: var(--text-label); letter-spacing: 0; line-height: 1;
    color: var(--color-ink);
    min-height: 44px; padding-inline: 4px;
    text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 6px; text-decoration-thickness: 2px;
  }
  .site-nav a:hover { text-decoration-color: var(--color-strawberry); }
}

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px;
  border-radius: var(--radius-full);
  font-family: var(--font-body); font-weight: 700; font-size: var(--text-label);
  letter-spacing: .05em; line-height: 1;
  text-decoration: none; white-space: nowrap;
}
.btn--pill { background: var(--color-rhyme-blue); color: var(--color-paper); border: 2px solid var(--color-rhyme-blue); }
.btn--pill:hover { background: var(--color-ink); border-color: var(--color-ink); }
.btn--outline { background: var(--color-paper); color: var(--color-rhyme-blue); border: 3px solid var(--color-rhyme-blue); }
.btn--outline:hover { background: var(--color-confetti-butter); }
.btn--wa { background: var(--color-strawberry); color: #fff; border: 2px solid var(--color-strawberry); }
.btn--wa:hover { background: var(--color-ink); border-color: var(--color-ink); }
.btn__icon { width: 20px; height: 20px; flex: none; }

/* ---------- Titoli ---------- */
.h2 {
  font-family: var(--font-display); font-weight: 700; font-stretch: 112%;
  font-size: var(--text-heading); line-height: .85; letter-spacing: .02em;
  color: var(--color-strawberry);
  text-wrap: balance;
}
.h2--md { font-size: var(--text-heading-sm); line-height: .9; }
.h2--teal { color: var(--color-teal); }
.h2--violet { color: var(--color-violet); }
.h2--blue { color: var(--color-rhyme-blue); }
.h3 {
  font-family: var(--font-display); font-weight: 600; font-stretch: 105%;
  font-size: var(--text-subheading); line-height: .95; letter-spacing: .02em;
  margin-bottom: 10px;
}

/* ---------- Hero ---------- */
.hero { padding-block: var(--spacing-20) var(--spacing-40); }
.hero__stage { position: relative; }
.hero__title {
  font-family: var(--font-display); font-weight: 700; font-stretch: 112%;
  font-size: var(--text-display); line-height: .82; letter-spacing: .02em;
  position: relative; z-index: 1;
}
.hero__title .ln { display: block; }
.ln--pink { color: var(--color-strawberry); }
.ln--teal { color: var(--color-teal); }
.ln--violet { color: var(--color-violet); }
.ln--blue { color: var(--color-rhyme-blue); }

/* luna illustrata della cliente (19/10/2026): con la nuvola è più larga della
   vecchia falce, quindi scala col titolo e sta sopra la riga "da leggere" */
.hero__moon {
  position: absolute; z-index: 2;
  width: calc(var(--text-display) * 1.9);
  top: calc(var(--text-display) * -0.32);
  right: clamp(-6px, 2vw, 60px);
  transform: rotate(-4deg);
}

.hero__lead {
  max-width: 34ch;
  margin-top: clamp(28px, 4vw, 48px);
  font-size: clamp(1.125rem, 1rem + .6vw, 1.375rem);
  line-height: 1.5;
}
.hero__actions {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--element-gap);
  margin-top: clamp(24px, 3vw, 36px);
}

@media (min-width: 1024px) {
  .hero__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--spacing-60); align-items: end; }
  .hero__stage { grid-column: 1 / -1; }
  .hero__actions { justify-content: flex-end; }
}

/* ---------- Sezioni ---------- */
.section { padding-block: var(--section-pad); }
.section__lead { max-width: 40ch; margin-top: var(--spacing-24); color: var(--color-ink-soft); }

/* ---------- Carte ---------- */
.card { border-radius: var(--radius-md); padding: var(--spacing-24); color: var(--color-ink); }
.card--teal { background: var(--color-confetti-teal); }
.card--pink { background: var(--color-confetti-pink); }
.card--violet { background: var(--color-confetti-violet); }
.card--butter { background: var(--color-confetti-butter); }
.card--cream { background: var(--color-cream); }

/* ---------- Libretti ---------- */
.books {
  display: grid; gap: var(--spacing-40) var(--element-gap);
  margin-top: var(--spacing-40);
}
.book { display: flex; flex-direction: column; }
.book__cover {
  margin: 0 0 var(--spacing-20);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-paper);
  border: 2px solid var(--color-ink);
}
.book__cover img { width: 100%; height: auto; }
.book p { max-width: 36ch; }
.book__buy {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px var(--spacing-16);
  margin-top: auto; padding-top: var(--spacing-20);
}
.price {
  font-family: var(--font-display); font-weight: 700; font-stretch: 105%;
  font-size: 1.75rem; line-height: 1;
}
.price del { font-family: var(--font-body); font-weight: 400; font-size: 1.125rem; color: var(--color-ink-soft); margin-left: 6px; }

@media (min-width: 640px) {
  .books { grid-template-columns: repeat(2, 1fr); }
  .books .book:nth-child(even) { margin-top: var(--spacing-60); }
}
@media (min-width: 1024px) {
  .books { grid-template-columns: repeat(4, 1fr); }
  .books .book:nth-child(even) { margin-top: var(--spacing-80); }
}

.promo {
  display: grid; gap: var(--spacing-24);
  margin-top: var(--spacing-80);
  padding: clamp(24px, 5vw, 56px);
}
.promo__tag {
  justify-self: start;
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 14px;
  border: 2px solid var(--color-ink); border-radius: var(--radius-full);
  font-weight: 700; font-size: var(--text-caption); letter-spacing: .05em;
}
.promo__covers { display: flex; align-items: flex-end; }
.promo__covers .book__cover { width: 50%; margin: 0; }
.promo__covers .book__cover:first-child { transform: rotate(-4deg); }
.promo__covers .book__cover:last-child { transform: rotate(4deg) translateY(-12px); margin-left: -6%; }
.promo .h2 { color: var(--color-strawberry); }
.promo p { max-width: 42ch; }
.promo .book__buy { justify-content: flex-start; padding-top: 0; margin-top: 0; }
@media (min-width: 900px) {
  .promo { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; column-gap: var(--spacing-60); }
  .promo__covers { grid-row: 1 / span 4; grid-column: 2; }
}

.soon { margin-top: var(--spacing-60); max-width: 52ch; color: var(--color-ink-soft); }
.soon strong { color: var(--color-ink); }

/* ---------- Prima di dormire ---------- */
.notes {
  display: grid; gap: var(--element-gap);
  margin-top: var(--spacing-40);
}
.note p { max-width: 30ch; }
@media (min-width: 768px) {
  .notes { grid-template-columns: repeat(12, 1fr); align-items: start; margin-top: var(--spacing-60); }
  .note--wide { grid-column: 1 / span 6; }
  .notes .card--pink { grid-column: 8 / span 5; margin-top: var(--spacing-80); }
}

/* ---------- Su misura ---------- */
.custom {
  background: var(--color-confetti-violet);
  border-radius: var(--radius-md);
  padding: clamp(24px, 5vw, 64px);
}
.custom__lead { max-width: 40ch; margin-top: var(--spacing-24); }
.custom .btn { margin-top: var(--spacing-40); }

/* ---------- Chi sono ---------- */
.about {
  position: relative;
  padding: clamp(28px, 6vw, 80px);
  padding-top: clamp(96px, 14vw, 120px);
}
.about__book {
  position: absolute; top: 20px; right: clamp(16px, 4vw, 48px);
  width: clamp(110px, 28vw, 200px);
}
.about .h2 { font-size: clamp(2.375rem, 1rem + 6vw, 5.25rem); line-height: .9; }
.about__text { display: grid; gap: var(--spacing-16); margin-top: var(--spacing-24); max-width: 46ch; }
@media (min-width: 1024px) {
  .about { padding-top: 196px; }
  .about__book { top: 28px; }
  .about__text { max-width: 60ch; margin-top: var(--spacing-40); }
}

/* ---------- Buonanotte ---------- */
.goodnight { padding-block: var(--spacing-40) 0; text-align: center; }
.goodnight__inner { display: grid; justify-items: center; gap: var(--spacing-20); }
.goodnight__moon { width: clamp(160px, 40vw, 260px); }
.goodnight__title {
  font-family: var(--font-display); font-weight: 700; font-stretch: 112%;
  font-size: var(--text-heading-sm); line-height: .9; letter-spacing: .02em;
  color: var(--color-violet);
}

/* ---------- Footer ---------- */
.site-footer { background: var(--color-rhyme-blue); color: var(--color-paper); margin-top: var(--section-pad); }
.site-footer__inner { display: grid; gap: var(--spacing-20); padding-block: var(--spacing-40); justify-items: start; }
.site-footer__logo { width: 170px; }
.site-footer__nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px var(--spacing-20); }
.site-footer__nav a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-underline-offset: 4px; }
.site-footer__contact a { color: var(--color-star); font-weight: 600; text-underline-offset: 4px; }
.site-footer__copy { font-size: var(--text-caption); }
.footer-credit { font-size: .8125rem; color: var(--color-confetti-pink); }
.footer-credit a { color: var(--color-star); }
@media (min-width: 768px) {
  .site-footer__inner { grid-template-columns: auto 1fr; align-items: center; column-gap: var(--spacing-40); }
  .site-footer__logo { grid-row: span 4; }
}
