/* ============================================
   Biblò — stili condivisi del sito
   Reset, layout, nav, footer, back-to-top e
   layer di famiglia (prose / marketing).
   I token sono in tokens.css.
   ============================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }

/* Famiglie di pagina. :where() mantiene la specificità a livello
   elemento, così i componenti (.nav-links a…) e gli stili di pagina
   continuano a vincere come prima del refactor. */
body:where(.page-prose) { line-height: 1.65; }
:where(body.page-prose) a { color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px; }
:where(body.page-prose) a:hover { color: var(--ink); }
:where(body.page-prose) h1 { font-size: clamp(32px, 4.5vw, 52px); line-height: 1.1; }
:where(body.page-prose) h2 { font-size: clamp(20px, 2.6vw, 28px); line-height: 1.2; }

body:where(.page-marketing) { line-height: 1.55; }
:where(body.page-marketing) a { color: inherit; }
:where(body.page-marketing) h1 { font-size: clamp(38px, 5.6vw, 64px); line-height: 1.05; }
:where(body.page-marketing) h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.15; }

/* Background blobs */
.bg-decor {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-decor::before, .bg-decor::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(60px); opacity: 0.55;
}
.bg-decor::before {
  width: 520px; height: 520px;
  background: radial-gradient(circle at 30% 30%, var(--blue) 0%, transparent 60%);
  top: -180px; right: -120px;
}
.bg-decor::after {
  width: 480px; height: 480px;
  background: radial-gradient(circle at 50% 50%, var(--peach) 0%, transparent 60%);
  bottom: -200px; left: -140px;
}

/* Layout */
.shell {
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto; padding: 0 28px;
}
@media (max-width: 600px) {
  .shell { padding: 0 18px; }
}

/* Nav */
.nav {
  position: relative; z-index: 10; padding: 22px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-logo img { height: 38px; width: auto; }
.nav-links {
  display: flex; align-items: center; gap: 6px;
  list-style: none; margin: 0; padding: 0;
}
.nav-links a {
  display: inline-flex; align-items: center;
  padding: 10px 16px; border-radius: var(--radius-pill);
  text-decoration: none; font-weight: 600; font-size: 15px;
  color: var(--ink-soft); transition: background 160ms, color 160ms;
}
.nav-links a:hover { background: rgba(141, 205, 237, 0.18); color: var(--ink); }
.nav-links a.active { background: var(--ink); color: var(--bg-soft); }
@media (max-width: 700px) {
  .nav { flex-wrap: wrap; row-gap: 10px; padding: 16px 0 12px; justify-content: center; }
  .nav-logo img { height: 32px; }
  .nav-links { width: 100%; justify-content: center; flex-wrap: wrap; gap: 4px; }
  .nav-links a { padding: 8px 12px; font-size: 14px; white-space: nowrap; }
}

/* Footer */
.footer {
  border-top: 1px solid var(--line); padding: 36px 0 48px;
  display: flex; justify-content: space-between;
  align-items: center; gap: 18px; flex-wrap: wrap;
}
.footer-meta {
  display: flex; align-items: center; gap: 14px;
  color: var(--ink-soft); font-size: 14px;
}
.footer-meta img { height: 28px; }
.footer-links { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.footer-links a {
  color: var(--ink-soft); text-decoration: none;
  font-size: 14px; font-weight: 600;
}
.footer-links a:hover { color: var(--ink); }

/* Back to top */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--ink); color: var(--bg-soft);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-float), 0 0 0 4px rgba(255,255,255,0.6);
  opacity: 0; transform: translateY(12px) scale(0.9); pointer-events: none;
  transition: opacity 240ms, transform 240ms;
}
body.scrolled .to-top { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
body.scrolled.at-bottom .to-top { opacity: 0; transform: translateY(12px) scale(0.9); pointer-events: none; }
.to-top:hover { transform: translateY(-2px) scale(1); background: #2a1d14; }
.to-top svg { display: block; }
@media (max-width: 560px) { .to-top { right: 16px; bottom: 16px; width: 44px; height: 44px; } }

/* ============================================
   Layout editoriale condiviso (pagine prose)
   ============================================ */
.privacy-header {
  padding: 40px 0 32px;
  text-align: center;
}
.privacy-header h1 { margin-bottom: 12px; }
.privacy-header .updated {
  font-size: 14px; color: var(--ink-faint);
  font-style: italic;
}
.privacy-body {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 0 80px;
}
.privacy-body h2 {
  margin-top: 40px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.privacy-body p {
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.privacy-body ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  gap: 8px;
}
.privacy-body ul li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: var(--ink-soft);
}
.privacy-body ul li::before {
  content: "-";
  flex: none;
  color: var(--ink-faint);
  margin-top: 1px;
}
.privacy-body strong { color: var(--ink); font-weight: 700; }
.privacy-body em { font-style: italic; color: var(--ink-soft); }
.privacy-intro {
  background: var(--sky-bg);
  border-left: 4px solid var(--blue-deep);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 32px;
}
.privacy-intro p { color: var(--ink); margin: 0; font-size: 16.5px; }

/* Animazioni scroll leggere (progressive enhancement) */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0; transform: translateY(18px);
    animation: reveal-in 700ms cubic-bezier(.2,.7,.3,1) forwards;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }
  @keyframes reveal-in {
    to { opacity: 1; transform: none; }
  }
}
