/* =========================================================
   domenicobarricelli.it — stile "Quaderno narrativo"
   Font ospitati in locale (nessuna chiamata a Google: GDPR).
   ========================================================= */

@font-face { font-family: "Lora"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/lora-v35-latin-regular.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/lora-v35-latin-italic.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/lora-v35-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/caveat-v18-latin-500.woff2") format("woff2"); }
@font-face { font-family: "Nunito Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/nunito-sans-v15-latin-regular.woff2") format("woff2"); }
@font-face { font-family: "Nunito Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/nunito-sans-v15-latin-700.woff2") format("woff2"); }

:root {
  --paper: #F5F2EA;
  --paper-2: #EDE6DC;
  --white: #FFFFFF;
  --ink: #333A3D;
  --ink-soft: #5C6467;
  --clay: #8A4E39;      /* terracotta scura: testo e pulsanti (contrasto AA) */
  --clay-soft: #DCCFC2;
  --sage: #4F5E53;      /* salvia scura: testo su chiaro, fondo per testo chiaro */
  --sage-soft: #E3E8E1;
  --line: #D8CFC3;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Nunito Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --radius: 20px;
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 1.125rem; line-height: 1.65; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--clay); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--clay); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; color: var(--ink); margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4.25rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.45rem; }
h1 em, h2 em { color: var(--clay); }
p { margin: 0 0 1em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 2rem; }
.narrow { max-width: 760px; }
.center { text-align: center; }
.section { padding: 5.5rem 2rem; }
.wrap.section { padding-left: 2rem; padding-right: 2rem; }
.band { background: var(--white); }
.band > .wrap { padding-top: 5.5rem; padding-bottom: 5.5rem; }
.band-paper2 { background: var(--paper-2); }
.band-sage { background: var(--sage); color: var(--paper); }
.band-sage h2, .band-sage h3 { color: var(--paper); }
.band-sage a:not(.btn) { color: var(--paper); }
.muted { color: var(--ink-soft); }
.lead { font-size: 1.3rem; }
.hand { font-family: var(--hand); font-size: 1.85rem; line-height: 1.1; color: var(--clay); margin: 0 0 .25rem; }
.hand-sage { color: var(--sage); }
.hand-light { color: var(--sage-soft); }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .75rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- pulsanti ---------- */
.btn { display: inline-block; text-decoration: none; font-weight: 700; padding: .85rem 1.75rem; border-radius: 999px; background: var(--clay); color: var(--white); border: 2px solid var(--clay); line-height: 1.3; cursor: pointer; font: inherit; font-weight: 700; }
.btn:hover { background: #6F3E2D; border-color: #6F3E2D; color: var(--white); }
.btn-soft { background: var(--sage-soft); border-color: var(--sage-soft); color: var(--sage); }
.btn-soft:hover { background: #D3DBD0; border-color: #D3DBD0; color: var(--sage); }
.btn-light { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.btn-light:hover { background: var(--white); border-color: var(--white); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2rem; }

/* ---------- intestazione e menu ---------- */
.site-header { position: relative; z-index: 5; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2.5rem; padding-top: 1.5rem; padding-bottom: 1.5rem; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); text-decoration: none; margin: 0; }
.brand em { color: var(--clay); }
.menu-toggle { display: none; font: inherit; font-weight: 700; background: none; border: 2px solid var(--ink); color: var(--ink); border-radius: 999px; padding: .45rem 1.2rem; min-height: 44px; cursor: pointer; }
.main-nav > ul { display: flex; flex-wrap: wrap; gap: .25rem 1.6rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.main-nav a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1rem; display: inline-block; padding: .5rem 0; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--clay); }
.main-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }
.main-nav .nav-cta { border: 2px solid var(--clay); color: var(--clay); padding: .45rem 1.1rem; border-radius: 999px; }
.has-sub { position: relative; }
.has-sub > ul { display: none; position: absolute; left: -1rem; top: 100%; min-width: 280px; list-style: none; margin: 0; padding: .6rem 0; background: var(--white); border-radius: 14px; box-shadow: 0 12px 32px rgba(51, 58, 61, .12); }
.has-sub > ul a { display: block; padding: .55rem 1.2rem; font-weight: 400; }
.has-sub:hover > ul, .has-sub:focus-within > ul { display: block; }

@media (max-width: 860px) {
  .js .menu-toggle { display: inline-block; }
  .js .main-nav { display: none; width: 100%; }
  .js .main-nav.open { display: block; }
  .main-nav > ul { flex-direction: column; align-items: stretch; gap: 0; border-top: 1px solid var(--line); }
  .main-nav > ul > li { border-bottom: 1px solid var(--line); }
  .main-nav a { padding: .8rem 0; }
  .has-sub > ul { display: block; position: static; box-shadow: none; background: none; padding: 0 0 .6rem 1rem; min-width: 0; }
  .has-sub > ul a { padding: .45rem 0; }
  .main-nav .nav-cta { border: 0; padding: .8rem 0; }
}

/* ---------- hero ---------- */
.hero { display: flex; flex-wrap: wrap-reverse; gap: 3.5rem; align-items: center; padding-top: 3rem; padding-bottom: 5rem; }
.hero-text { flex: 999 1 480px; min-width: 0; }
.hero-figure { flex: 1 1 300px; margin: 0; max-width: 420px; }
.hero-photo { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: center 20%; background: var(--clay-soft); border-radius: 50% 50% 46% 54% / 55% 48% 52% 45%; }
.hero-figure figcaption { font-family: var(--hand); font-size: 1.6rem; color: var(--sage); text-align: center; margin-top: .75rem; }

.page-head { padding-top: 2.5rem; padding-bottom: 3rem; }
.page-head .lead { max-width: 46ch; }

/* ---------- schede percorsi ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.card { background: var(--white); border-radius: var(--radius); padding: 1.75rem; display: flex; flex-direction: column; gap: .5rem; text-decoration: none; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(51, 58, 61, .10); color: var(--ink); }
.card .hand { font-size: 1.5rem; color: var(--sage); }
.card-title { font-family: var(--serif); font-size: 1.5rem; line-height: 1.25; }
.card-text { font-size: 1rem; color: var(--ink-soft); }
.card-dark { background: var(--sage); color: var(--paper); }
.card-dark .hand, .card-dark .card-text { color: var(--sage-soft); }
a.card-dark:hover { color: var(--paper); }

/* ---------- linea del tempo ---------- */
.split { display: flex; flex-wrap: wrap; gap: 3rem; }
.split > * { flex: 1 1 360px; min-width: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.75rem; border-left: 2px dashed #B9A899; display: flex; flex-direction: column; gap: 1.75rem; }
.timeline .hand { font-size: 1.55rem; color: var(--sage); }

/* ---------- testo lungo ---------- */
.prose { max-width: 68ch; }
.prose h2 { font-size: 1.8rem; margin-top: 2.2rem; }
.prose h3 { margin-top: 1.8rem; }
.prose blockquote { margin: 2rem 0; padding: 0 0 0 1.5rem; border-left: 3px solid var(--clay-soft); font-family: var(--serif); font-style: italic; font-size: 1.3rem; color: var(--ink); }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: .4rem; }
.points { list-style: none; padding: 0; margin: 2rem 0; display: grid; gap: 1.25rem; }
.points li { background: var(--white); border-radius: 16px; padding: 1.25rem 1.5rem; }
.points strong { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; display: block; color: var(--ink); }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 2rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.steps li { counter-increment: step; background: var(--white); border-radius: 16px; padding: 1.25rem; }
.steps li::before { content: counter(step); font-family: var(--hand); font-size: 2rem; color: var(--clay); display: block; line-height: 1; margin-bottom: .25rem; }
.note { background: var(--sage-soft); color: var(--sage); border-radius: 16px; padding: 1.25rem 1.5rem; font-size: 1rem; }
.with-aside { display: flex; flex-wrap: wrap; gap: 3rem; align-items: flex-start; }
.with-aside > .prose { flex: 999 1 520px; min-width: 0; }
.aside { flex: 1 1 260px; background: var(--white); border-radius: var(--radius); padding: 1.75rem; position: sticky; top: 1.5rem; }
.aside h2 { font-size: 1.4rem; }

/* ---------- pubblicazioni ---------- */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.book { background: var(--white); border-radius: 16px; padding: 1.25rem; display: flex; gap: 1.25rem; align-items: flex-start; }
.book-cover { flex: 0 0 96px; width: 96px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 8px rgba(51, 58, 61, .18); background: var(--clay-soft); }
.books-4 { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.books-4 .book { flex-direction: column; }
.books-4 .book-cover { width: 150px; flex-basis: auto; }
.band .post { background: var(--paper); }
.book-cover-empty { display: flex; align-items: center; justify-content: center; text-align: center; font-family: var(--serif); font-style: italic; font-size: .85rem; color: var(--ink-soft); padding: .5rem; box-shadow: none; }
.book h3 { font-size: 1.2rem; font-weight: 600; margin: 0 0 .25rem; }
.book-meta { font-size: .95rem; color: var(--ink-soft); margin: 0 0 .5rem; }
.book-desc { font-size: 1rem; margin: 0 0 .5rem; }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--sage-soft); color: var(--sage); border-radius: 999px; padding: .15rem .7rem; margin-bottom: .5rem; }
.tag-clay { background: #F1E2DA; color: var(--clay); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 2rem; padding: 0; list-style: none; }
.filters a { display: inline-block; text-decoration: none; font-weight: 700; font-size: .95rem; padding: .45rem 1rem; border-radius: 999px; border: 2px solid var(--line); color: var(--ink); min-height: 44px; line-height: 1.6; }
.filters a[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- articoli ---------- */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.post { background: var(--white); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.post img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.post-body { padding: 1.5rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.post h3 { font-size: 1.35rem; margin: 0; }
.post h3 a { color: var(--ink); text-decoration: none; }
.post h3 a:hover { color: var(--clay); }
.post-meta { font-size: .9rem; color: var(--ink-soft); margin: 0; }
.post-more { margin-top: auto; font-weight: 700; }
.article-head { padding-top: 2rem; padding-bottom: 2rem; }
.article-cover { border-radius: var(--radius); margin: 0 0 2.5rem; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.empty { background: var(--white); border-radius: var(--radius); padding: 2rem; color: var(--ink-soft); }

/* ---------- modulo ---------- */
.form { display: grid; gap: 1.1rem; }
.form-row { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.form-row > * { flex: 1 1 220px; }
.field { display: flex; flex-direction: column; gap: .35rem; font-weight: 700; font-size: 1rem; }
.field input, .field select, .field textarea { font: inherit; font-weight: 400; padding: .75rem .9rem; border: 2px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); min-height: 48px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--clay); outline: none; }
.field-hint { font-weight: 400; font-size: .9rem; color: var(--ink-soft); }
.check { display: flex; gap: .7rem; align-items: flex-start; font-size: 1rem; }
.check input { width: 22px; height: 22px; margin-top: .2rem; accent-color: var(--clay); flex: 0 0 auto; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { border-radius: 14px; padding: 1rem 1.25rem; font-weight: 700; }
.alert-ok { background: var(--sage-soft); color: var(--sage); }
.alert-err { background: #F6E1DA; color: #7A3622; }

/* ---------- piè di pagina ---------- */
.site-footer { background: var(--ink); color: #E4E1DA; font-size: 1rem; padding-top: 3.5rem; }
.site-footer a { color: #E4E1DA; }
.site-footer a:hover { color: var(--white); }
.site-footer .brand { color: var(--white); }
.site-footer .brand em { color: #E3B8A6; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2rem; padding-bottom: 2.5rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.footer-title { font-weight: 700; color: var(--white); margin-bottom: .6rem; }
.footer-legal { border-top: 1px solid #4A5356; padding-top: 1.5rem; padding-bottom: 2rem; font-size: .9rem; color: #C9C5BC; }

@media (max-width: 600px) {
  body { font-size: 1.0625rem; }
  .wrap, .wrap.section { padding-left: 1.25rem; padding-right: 1.25rem; }
  .section, .band > .wrap { padding-top: 3.5rem; padding-bottom: 3.5rem; }
  .hero { gap: 2rem; padding-top: 1rem; }
  .hero-figure { max-width: 260px; margin: 0 auto; }
  .book { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .card { transition: none; } }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 600px) { .center > p:not(.hand):not(.lead) { text-align: left; } }
