/* Rodeghiero nel Mondo — foglio di stile
   Direzione: archivio di montagna. Carta calda, inchiostro, verde dello stemma, oro delle ruote. */

/* Font ospitati in locale (nessuna chiamata a Google: più veloce e senza problemi GDPR) */
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-latin-opsz-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-latin-opsz-italic.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --paper: #f6f3ec;
  --paper-2: #efebe1;
  --card: #fbf9f4;
  --ink: #1c1e19;
  --ink-2: #3b3d36;
  --muted: #6c6b62;
  --line: #e0dacb;
  --line-2: #d2cab7;
  --green: #2e5532;
  --green-ink: #24462a;
  --green-soft: #e3eadc;
  --gold: #c9a13b;
  --gold-soft: #f3e8c8;
  --mark: #f1df9e;
  --shadow: 0 1px 2px rgb(40 35 20 / .06), 0 8px 24px -12px rgb(40 35 20 / .18);
  --shadow-lg: 0 2px 4px rgb(40 35 20 / .06), 0 24px 60px -20px rgb(40 35 20 / .35);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --radius: 10px;
  --header-h: 64px;
  --measure: 68ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131512;
    --paper-2: #191c17;
    --card: #1b1e19;
    --ink: #ebe7dc;
    --ink-2: #cfcabd;
    --muted: #9a978b;
    --line: #2b2f28;
    --line-2: #3a3f36;
    --green: #8dbb86;
    --green-ink: #a9d1a2;
    --green-soft: #1f2a1e;
    --gold: #d8b555;
    --gold-soft: #2b2617;
    --mark: #5a4a17;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .6);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / .3), 0 24px 60px -20px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 24px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--gold-soft); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }

.skip {
  position: fixed; left: 12px; top: 12px; z-index: 100;
  padding: 8px 14px; border-radius: 8px; background: var(--ink); color: var(--paper);
  transform: translateY(-160%); transition: transform 160ms var(--ease-out);
}
.skip:focus { transform: none; }

/* ---------- Barra di lettura ---------- */
.progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--gold); transform-origin: 0 50%; transform: scaleX(0); }
.progress[hidden] { display: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
}
.site-header[data-scrolled] { border-bottom-color: var(--line); }
.bar { width: min(1180px, 100% - 40px); margin-inline: auto; height: var(--header-h); display: flex; align-items: center; gap: 24px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font: 600 1.15rem/1 var(--serif); letter-spacing: -.01em; }
.brand-text span { font-size: .72rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }

.nav { display: flex; align-items: center; gap: 2px; font-size: .9rem; }
.nav > a, .menu-trigger {
  position: relative; display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2);
  background: none; border: 0; cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out);
}
.nav > a:active, .menu-trigger:active { transform: scale(0.97); }
.nav > a[aria-current="page"], .menu-trigger[data-active] { color: var(--ink); }
.nav > a[aria-current="page"]::after, .menu-trigger[data-active]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 1.5px; border-radius: 2px; background: var(--gold);
}
.menu-trigger svg { width: 12px; height: 12px; transition: transform 200ms var(--ease-out); }
.menu-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav .nav-cta { margin-left: 8px; background: var(--green); color: var(--paper); font-weight: 500; padding-inline: 16px; }
.nav .nav-cta[aria-current="page"] { color: var(--paper); }
.nav .nav-cta[aria-current="page"]::after { display: none; }

@media (hover: hover) and (pointer: fine) {
  .nav > a:hover, .menu-trigger:hover { background: var(--paper-2); color: var(--ink); }
  .nav .nav-cta:hover { background: var(--green-ink); color: var(--paper); }
}

/* Popover: nasce dal trigger, non dal centro */
.menu { position: relative; }
.popover {
  position: absolute; top: calc(100% + 8px); left: -8px; min-width: 270px;
  padding: 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform-origin: 24px 0;
  opacity: 0; transform: scale(0.96) translateY(-4px); pointer-events: none; visibility: hidden;
  transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out), visibility 0s linear 150ms;
}
.popover[data-open] {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 0s;
}
.popover a { display: grid; gap: 1px; padding: 9px 12px; border-radius: 8px; text-decoration: none; transition: background-color 120ms ease; }
.popover a b { font-weight: 500; font-size: .92rem; }
.popover a small { color: var(--muted); font-size: .8rem; }
.popover a:focus-visible { outline-offset: -2px; }
.popover a[aria-current="page"] b { color: var(--green); }
@media (hover: hover) and (pointer: fine) { .popover a:hover { background: var(--paper-2); } }

/* Menu mobile */
.burger { display: none; width: 40px; height: 40px; border: 0; background: none; border-radius: 10px; position: relative; cursor: pointer; transition: transform 160ms var(--ease-out); }
.burger:active { transform: scale(0.95); }
.burger span { position: absolute; left: 11px; right: 11px; height: 1.5px; background: var(--ink); border-radius: 2px; transition: transform 240ms var(--ease-out); }
.burger span:first-child { top: 16px; }
.burger span:last-child { top: 23px; }
.burger[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

.sheet {
  position: fixed; inset: var(--header-h) 0 0; z-index: 45; overflow-y: auto;
  background: var(--paper); padding: 8px 20px 40px;
  opacity: 1; transform: none;
  transition: opacity 260ms var(--ease-drawer), transform 260ms var(--ease-drawer);
}
.sheet[hidden] { display: block; visibility: hidden; opacity: 0; transform: translateY(-12px); pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 0s linear 180ms; }
.sheet nav { display: flex; flex-direction: column; }
.sheet a { padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; font: 500 1.3rem/1.25 var(--serif); }
.sheet-label { margin: 26px 0 4px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 960px) {
  .nav { display: none; }
  .burger { display: block; }
}
@media (min-width: 961px) { .sheet { display: none !important; } }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1px solid transparent; text-decoration: none; cursor: pointer;
  font: 500 .95rem/1 var(--sans);
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--green); color: var(--paper); }
.btn-ghost { border-color: var(--line-2); color: var(--ink); }
.btn svg { width: 16px; height: 16px; transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--green-ink); }
  .btn-ghost:hover { background: var(--paper-2); border-color: var(--line-2); }
  .btn:hover svg { transform: translateX(2px); }
}

/* ---------- Ingresso della vista ---------- */
.view { animation: view-in 260ms var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Home ---------- */
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(48px, 7vw, 88px); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 6vw, 88px); align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 20px; }
.eyebrow::before { content: ""; width: 22px; height: 1.5px; background: var(--gold); }
.hero h1 {
  font: 500 clamp(2.5rem, 5.6vw, 4.6rem)/1.02 var(--serif); letter-spacing: -.025em; margin: 0 0 24px;
  text-wrap: balance;
}
.hero h1 em { color: var(--green); font-style: italic; }
.hero .lede { font: 400 clamp(1.1rem, 1.6vw, 1.3rem)/1.55 var(--serif); color: var(--ink-2); max-width: 34em; margin: 0 0 32px; text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.greet { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .85rem; color: var(--muted); }
.greet span:not(:last-child)::after { content: "·"; margin-left: 18px; color: var(--line-2); }

.cover { position: relative; justify-self: center; width: min(380px, 100%); }
.cover img { border-radius: 4px 10px 10px 4px; box-shadow: var(--shadow-lg); }
.cover .spine { position: relative; display: block; }
.cover .spine::before {
  content: ""; position: absolute; inset: 0; border-radius: 4px 10px 10px 4px; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgb(0 0 0 / .22) 0, rgb(255 255 255 / .12) 2.5%, transparent 6%);
}
.cover figcaption { margin-top: 14px; font-size: .85rem; color: var(--muted); text-align: center; }

.stats { border-block: 1px solid var(--line); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 28px 24px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat b { display: block; font: 500 clamp(1.8rem, 3vw, 2.4rem)/1 var(--serif); letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; }
.stat span { display: block; margin-top: 8px; font-size: .88rem; color: var(--muted); }

.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 36px; }
.section-head h2 { font: 500 clamp(1.8rem, 3.2vw, 2.6rem)/1.08 var(--serif); letter-spacing: -.02em; margin: 0; max-width: 18em; text-wrap: balance; }
.section-head p { margin: 0; color: var(--muted); max-width: 30em; }

.intro-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.bignum { font: 500 clamp(3rem, 7vw, 5.5rem)/.95 var(--serif); letter-spacing: -.035em; margin: 0; font-variant-numeric: lining-nums; }
.bignum small { display: block; font: 400 1rem/1.4 var(--sans); letter-spacing: 0; color: var(--muted); margin-top: 10px; }
.bignum + .bignum { margin-top: 28px; }
.intro-text { font: 400 1.2rem/1.65 var(--serif); color: var(--ink-2); }
.intro-text p { margin: 0 0 1em; }
.intro-text strong { color: var(--ink); font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.card {
  grid-column: span 4; position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-decoration: none;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), border-color 200ms ease;
}
.card.wide { grid-column: span 6; flex-direction: row; }
.card.wide .card-media { flex: 0 0 46%; aspect-ratio: auto; min-height: 260px; }
.card.text-only.wide { flex-direction: column; }
.card:active { transform: scale(0.99); }
.card-media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--paper-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease-out); }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-kicker { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.card h3 { margin: 0; font: 500 1.45rem/1.15 var(--serif); letter-spacing: -.01em; }
.card p { margin: 0; color: var(--ink-2); font-size: .94rem; }
.card-foot { margin-top: auto; padding-top: 10px; font-size: .85rem; color: var(--green); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.card-foot svg { width: 14px; height: 14px; transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .card:hover { box-shadow: var(--shadow); border-color: var(--line-2); transform: translateY(-2px); }
  .card:hover .card-media img { transform: scale(1.03); }
  .card:hover .card-foot svg { transform: translateX(3px); }
}
.card.text-only { background: var(--green); color: var(--paper); border-color: transparent; justify-content: space-between; }
.card.text-only .card-kicker, .card.text-only p { color: color-mix(in srgb, var(--paper) 78%, transparent); }
.card.text-only .card-foot { color: var(--gold); }
.card.text-only .roman { font: 500 4.4rem/1 var(--serif); letter-spacing: -.02em; color: var(--gold); padding: 22px 22px 0; }

.stagger > * { animation: rise 420ms var(--ease-out) both; }
.stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; }
.stagger > *:nth-child(n+7) { animation-delay: 300ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.books { background: var(--paper-2); border-block: 1px solid var(--line); }
.book-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.book { display: grid; grid-template-columns: 140px 1fr; gap: 24px; align-items: center; padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.book img { border-radius: 3px 6px 6px 3px; box-shadow: var(--shadow); }
.book h3 { margin: 0 0 6px; font: 500 1.35rem/1.2 var(--serif); }
.book p { margin: 0 0 14px; color: var(--ink-2); font-size: .94rem; }

.thanks { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(32px, 6vw, 96px); }
.thanks ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 32px; }
.thanks li { break-inside: avoid; padding: 10px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.thanks li b { display: block; font-weight: 500; }
.thanks li span { color: var(--muted); }

/* ---------- Pagina di lettura ---------- */
.page-head { padding: clamp(40px, 6vw, 80px) 0 clamp(24px, 4vw, 40px); border-bottom: 1px solid var(--line); }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 18px; display: flex; gap: 8px; align-items: center; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.page-head h1 { font: 500 clamp(2.2rem, 5vw, 3.8rem)/1.04 var(--serif); letter-spacing: -.025em; margin: 0; max-width: 16em; text-wrap: balance; }
.page-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 18px; font-size: .86rem; color: var(--muted); }
.page-meta span { display: inline-flex; align-items: center; gap: 6px; }

.reader { display: grid; grid-template-columns: 220px minmax(0, var(--measure)); gap: clamp(32px, 6vw, 88px); justify-content: center; padding: clamp(32px, 5vw, 64px) 0 40px; }
.reader.no-toc { grid-template-columns: minmax(0, var(--measure)); }
.toc { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; max-height: calc(100vh - var(--header-h) - 64px); overflow: auto; font-size: .86rem; }
.toc p { margin: 0 0 10px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 1.5px solid transparent;
  text-decoration: none; color: var(--muted); line-height: 1.35;
  transition: color 150ms ease, border-color 150ms ease;
}
.toc a[data-active] { color: var(--ink); border-left-color: var(--gold); }
@media (hover: hover) and (pointer: fine) { .toc a:hover { color: var(--ink); } }
@media (max-width: 1080px) {
  .reader { grid-template-columns: minmax(0, var(--measure)); }
  .toc { position: static; max-height: none; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
  .toc ol { border: 0; columns: 2; column-gap: 24px; }
  .toc a { padding-left: 0; border: 0; }
}
@media (max-width: 560px) { .toc ol { columns: 1; } }

.prose { font: 400 1.18rem/1.72 var(--serif); color: var(--ink-2); overflow-wrap: break-word; hanging-punctuation: first; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.05em; text-wrap: pretty; }
.prose .lang-switch { font: 500 .85rem/1 var(--sans); color: var(--muted); margin-bottom: 1.6em; display: flex; gap: 8px; }
.prose .lang-switch a { color: var(--green); }
.reader .prose > p:first-of-type:not(.no-drop)::first-letter { float: left; font-size: 3.6em; line-height: .86; padding: .06em .1em 0 0; color: var(--green); font-weight: 500; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose h2 { font: 500 1.75rem/1.2 var(--serif); letter-spacing: -.015em; color: var(--ink); margin: 2.2em 0 .7em; text-wrap: balance; }
.prose h3 { font: 600 1.05rem/1.35 var(--sans); color: var(--ink); margin: 2em 0 .6em; }
.prose .lead-in > strong:first-child { font-variant: small-caps; letter-spacing: .02em; color: var(--green); }
.prose .byline { font: 500 .95rem/1.4 var(--sans); color: var(--muted); margin-top: -.2em; }
.prose .byline strong { color: var(--muted); font-weight: 500; }
.prose sup { font-size: .62em; line-height: 0; color: var(--green); font-family: var(--sans); font-weight: 500; }
.prose ol, .prose ul { padding-left: 1.2em; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }

.prose .notes-start { font: 600 .78rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 2.4em; border-top: 1px solid var(--line); }
.prose .notes-start ~ * { font: 400 .9rem/1.55 var(--sans); color: var(--muted); margin-bottom: .55em; }
.prose .notes-start ~ * strong { color: var(--ink-2); font-weight: 500; }

/* Immagini */
.prose .figure-wrap, .prose .gallery { margin: 2em 0; }
.prose figure { margin: 0; }
.prose .figure-wrap figure { display: flex; justify-content: center; }
.prose figure img {
  border-radius: 8px; box-shadow: 0 0 0 1px var(--line); cursor: zoom-in; background: var(--paper-2);
  transition: transform 160ms var(--ease-out), box-shadow 200ms ease;
}
.prose figure img:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) { .prose figure img:hover { box-shadow: 0 0 0 1px var(--line-2), var(--shadow); } }
.prose .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 14px; align-items: start; }
.prose .gallery img { width: 100%; }

/* Tabelle */
.table-wrap { margin: 1.5em 0 2em; border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 70vh; background: var(--card); }
.prose table { width: 100%; border-collapse: collapse; font: 400 .9rem/1.45 var(--sans); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.prose th { position: sticky; top: 0; background: var(--paper-2); text-align: left; font-weight: 600; color: var(--ink); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.prose td { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.prose tbody tr:last-child td { border-bottom: 0; }
.table-tools { display: flex; align-items: center; gap: 12px; margin: 1.5em 0 -.6em; font: 400 .85rem var(--sans); color: var(--muted); }

/* Navigazione tra pagine */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 24px 0 clamp(56px, 8vw, 96px); max-width: calc(var(--measure) + 308px); margin-inline: auto; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: transform 160ms var(--ease-out), border-color 150ms ease, background-color 150ms ease; }
.pager a:active { transform: scale(0.98); }
.pager a.next { text-align: right; grid-column: 2; }
.pager small { font-size: .78rem; color: var(--muted); }
.pager b { font: 500 1.2rem/1.2 var(--serif); }
@media (hover: hover) and (pointer: fine) { .pager a:hover { border-color: var(--line-2); background: var(--card); } }

/* ---------- Repertorio ---------- */
.rep-tools {
  position: sticky; top: var(--header-h); z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 14px 0;
}
.rep-tools .wrap { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search svg { position: absolute; left: 13px; top: 50%; width: 16px; height: 16px; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search input, .input {
  width: 100%; height: 42px; padding: 0 14px 0 38px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); font: 400 .95rem var(--sans);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.input { padding-left: 14px; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; height: 14px; width: 14px; cursor: pointer;
  background: currentColor; opacity: .45; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.search input:focus, .input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; cursor: pointer;
  font-size: .84rem; color: var(--ink-2); font-variant-numeric: tabular-nums;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, transform 160ms var(--ease-out);
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip small { opacity: .6; margin-left: 4px; }
@media (hover: hover) and (pointer: fine) { .chip:not([aria-pressed="true"]):hover { background: var(--paper-2); } }
.rep-count { margin-left: auto; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.rep { padding: 8px 0 80px; }
.rep-century { display: grid; grid-template-columns: 160px 1fr; gap: 32px; border-bottom: 1px solid var(--line); padding: 28px 0; }
.rep-century > h2 { margin: 0; font: 500 2rem/1 var(--serif); color: var(--green); position: sticky; top: calc(var(--header-h) + 90px); align-self: start; }
.rep-century > h2 small { display: block; font: 400 .8rem/1.4 var(--sans); color: var(--muted); margin-top: 8px; }
.rep-list { list-style: none; margin: 0; padding: 0; }
.rep-item { display: grid; grid-template-columns: 150px 1fr; gap: 6px 24px; padding: 14px 0; border-top: 1px solid var(--line); }
.rep-item:first-child { border-top: 0; padding-top: 0; }
.rep-date { font: 500 .88rem/1.5 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; }
.rep-date span { display: block; color: var(--muted); font-weight: 400; }
.rep-text { font: 400 1.05rem/1.55 var(--serif); color: var(--ink-2); }
.rep-text p { margin: 0; }
.rep-src { margin-top: 4px; font: 400 .82rem/1.5 var(--sans); color: var(--muted); }
.rep mark, .prose mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.rep-empty { padding: 64px 0; text-align: center; color: var(--muted); }
@media (max-width: 760px) {
  .rep-century { grid-template-columns: 1fr; gap: 12px; }
  .rep-century > h2 { position: static; }
  .rep-item { grid-template-columns: 1fr; }
  .rep-count { margin-left: 0; width: 100%; }
}

/* ---------- Contatti ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 80px); padding: clamp(32px, 5vw, 64px) 0 clamp(56px, 8vw, 96px); }
.form { display: grid; gap: 16px; padding: 28px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; align-self: start; }
.field { display: grid; gap: 6px; }
.field label { font-size: .86rem; font-weight: 500; }
.field textarea.input { min-height: 140px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--muted); }
.check input { margin-top: 3px; accent-color: var(--green); }
.form-note { font-size: .82rem; color: var(--muted); margin: 0; }
.form-status { font-size: .9rem; color: var(--green); margin: 0; min-height: 1.4em; }
.socials { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* ---------- Lightbox (modale: resta centrata) ---------- */
.lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(92vw, 1400px); max-height: 92vh; overflow: visible;
  opacity: 0; transform: scale(0.96);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), overlay 180ms allow-discrete, display 180ms allow-discrete;
}
.lightbox[open] { opacity: 1; transform: none; }
@starting-style { .lightbox[open] { opacity: 0; transform: scale(0.96); } }
.lightbox::backdrop { background: rgb(15 16 14 / 0); backdrop-filter: blur(0); transition: background-color 180ms ease, backdrop-filter 180ms ease, overlay 180ms allow-discrete, display 180ms allow-discrete; }
.lightbox[open]::backdrop { background: rgb(15 16 14 / .78); backdrop-filter: blur(4px); }
@starting-style { .lightbox[open]::backdrop { background: rgb(15 16 14 / 0); backdrop-filter: blur(0); } }
.lightbox img { max-width: min(92vw, 1400px); max-height: 88vh; width: auto; border-radius: 8px; box-shadow: var(--shadow-lg); image-rendering: auto; }
.lightbox-close {
  position: absolute; top: -48px; right: 0; width: 36px; height: 36px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgb(255 255 255 / .14); color: #fff; display: grid; place-items: center; transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.lightbox-close svg { width: 16px; height: 16px; }
.lightbox-close:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .lightbox-close:hover { background: rgb(255 255 255 / .24); } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--paper-2); padding: 56px 0 28px; font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
.footer-grid a { display: block; padding: 3px 0; text-decoration: none; color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) { .footer-grid a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; } }
.footer-brand { font: 500 1.3rem var(--serif); margin: 0 0 8px; }
.footer-grid .muted { margin: 0; max-width: 30em; }
.footer-label { margin: 0 0 8px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.footer-credits { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid, .intro-grid, .thanks, .contact-grid { grid-template-columns: 1fr; }
  .cover { width: min(260px, 70%); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .card, .card.wide { grid-column: span 6; flex-direction: row; }
.card.wide .card-media { flex: 0 0 46%; aspect-ratio: auto; min-height: 260px; }
.card.text-only.wide { flex-direction: column; }
  .book-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .section-head { flex-direction: column; align-items: start; }
}
@media (max-width: 620px) {
  body { font-size: 1rem; }
  .card, .card.wide { grid-column: 1 / -1; }
  .card.wide { flex-direction: column; }
  .card.wide .card-media { aspect-ratio: 16 / 10; min-height: 0; }
  .thanks ul { columns: 1; }
  .book { grid-template-columns: 96px 1fr; gap: 16px; padding: 18px; }
  .prose { font-size: 1.1rem; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; }
  .stat { padding: 20px 16px; }
}

/* ---------- Movimento ridotto: niente spostamenti, restano le dissolvenze ---------- */
@media (prefers-reduced-motion: reduce) {
  .view, .stagger > * { animation: fade 200ms ease both; animation-delay: 0ms !important; }
  @keyframes fade { from { opacity: 0; } }
  .popover, .popover[data-open], .sheet, .sheet[hidden], .lightbox, .lightbox[open] { transform: none !important; }
  .card, .card-media img, .btn, .btn svg, .card-foot svg { transition-property: opacity, background-color, border-color, box-shadow, color; }
  @media (hover: hover) { .card:hover, .card:hover .card-media img { transform: none; } }
}

@media print {
  .site-header, .site-footer, .toc, .pager, .progress, .rep-tools { display: none !important; }
  .reader { display: block; }
  body { background: #fff; color: #000; }
}

/* ---------- Aggiunte per la versione multipagina ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main:focus { outline: none; }
.rep-date b { font-weight: 500; }
.rep-century[hidden], .rep-item[hidden] { display: none; }
.rep-list > .rep-item:first-child { border-top: 0; padding-top: 0; }
.card.text-only.alt { background: var(--paper-2); color: var(--ink); border-color: var(--line); }
.card.text-only.alt .card-kicker { color: var(--muted); }
.card.text-only.alt p { color: var(--ink-2); }
.card.text-only.alt .roman, .card.text-only.alt .card-foot { color: var(--green); }
.form-status.err { color: var(--ink); background: var(--gold-soft); padding: 10px 14px; border-radius: 10px; }
.form-status.ok { color: var(--green-ink); background: var(--green-soft); padding: 10px 14px; border-radius: 10px; }
.form-status:empty { display: none; }
.form button[disabled] { opacity: .6; pointer-events: none; }
.nav > a[aria-current="page"]::after { content: ""; }
