*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --verde:#2D6A4F;--verde-light:#52B788;--crema:#FFF8F0;--crema-dark:#F2E8D9;
  --terra:#BC6C25;--terra-light:#DDA15E;--bianco:#FFFDF9;--testo:#1A1008;
  --testo-muted:#6B5B45;--ombra:rgba(44,24,4,.10);
  --fr-bg:#EBF4FF;--fr-border:#93C5FD;--it-bg:#ECFDF5;--it-border:#6EE7B7;
  --acc:var(--verde);--fs:1.05rem
}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body{font-family:'Nunito',system-ui,sans-serif;background:var(--crema);color:var(--testo);line-height:1.6}
a{color:var(--verde)}
img{max-width:100%;height:auto}

/* ---------- Navigation ---------- */
nav.top{background:var(--verde);display:flex;align-items:center;justify-content:space-between;
  padding:0 1.2rem;height:60px;position:sticky;top:0;z-index:100;box-shadow:0 2px 12px var(--ombra)}
.brand{font-family:'Playfair Display',Georgia,serif;font-size:1.25rem;color:var(--crema);text-decoration:none;white-space:nowrap}
.brand em{color:var(--terra-light)}
.nav-links{display:flex;gap:.15rem;list-style:none}
.nav-links a{color:rgba(255,248,240,.88);text-decoration:none;font-size:.8rem;font-weight:700;
  padding:.45rem .55rem;border-radius:6px;white-space:nowrap;transition:background .2s}
.nav-links a:hover,.nav-links a.active{background:rgba(255,255,255,.18);color:#fff}
.burger{display:none;flex-direction:column;gap:5px;background:none;border:0;padding:8px;cursor:pointer}
.burger span{display:block;width:24px;height:2px;background:var(--crema);border-radius:2px}
.mobile-menu{display:none;flex-direction:column;background:var(--verde);padding:.3rem 1.2rem 1rem;
  position:sticky;top:60px;z-index:99}
.mobile-menu.open{display:flex}
.mobile-menu a{color:rgba(255,248,240,.95);text-decoration:none;font-weight:700;padding:.7rem 0;
  border-bottom:1px solid rgba(255,255,255,.12)}

.breadcrumb{background:var(--crema-dark);padding:.6rem 1.2rem;font-size:.82rem;color:var(--testo-muted);
  display:flex;flex-wrap:wrap;gap:.45rem;border-bottom:1px solid rgba(188,108,37,.15)}
.breadcrumb a{font-weight:700;text-decoration:none}
.breadcrumb a:hover{text-decoration:underline}
.breadcrumb .sep{color:var(--terra-light)}
.breadcrumb .current{color:var(--terra);font-weight:700}

/* ---------- Header ---------- */
.page-header{background:var(--acc);padding:2.2rem 1.2rem 2.4rem;text-align:center;position:relative;overflow:hidden}
.page-header::after{content:'';position:absolute;right:-30px;bottom:-40px;width:180px;height:180px;
  background:radial-gradient(circle,rgba(221,161,94,.28),transparent 70%);border-radius:50%}
.page-header .emoji{font-size:2.4rem;display:block;margin-bottom:.2rem}
.page-header h1{font-family:'Playfair Display',Georgia,serif;font-size:clamp(1.6rem,5vw,2.4rem);color:var(--crema);line-height:1.2}
.page-header h1 em{display:block;color:var(--terra-light);font-size:.72em;font-weight:400;margin-top:.2rem}
.page-header p{color:rgba(255,248,240,.8);font-size:.92rem;margin:.5rem auto 0;max-width:640px;font-style:italic}

.content{max-width:1000px;margin:0 auto;padding:1.8rem 1.2rem 3rem}

/* ---------- Home cards ---------- */
.home-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1.1rem}
.home-card{display:flex;flex-direction:column;gap:.35rem;background:var(--bianco);border:1.5px solid var(--crema-dark);
  border-top:5px solid var(--acc);border-radius:14px;padding:1.1rem 1.2rem;text-decoration:none;color:var(--testo);
  transition:transform .15s,box-shadow .15s,border-color .15s}
.home-card:hover{transform:translateY(-3px);box-shadow:0 8px 22px var(--ombra);border-color:var(--acc)}
.home-card .emoji{font-size:2rem}
.home-card h2{font-family:'Playfair Display',Georgia,serif;font-size:1.2rem;color:var(--acc)}
.home-card h2 em{display:block;font-size:.8em;font-weight:400;color:var(--testo-muted)}
.home-card p{font-size:.88rem;color:var(--testo-muted)}
.home-card .count{margin-top:auto;font-size:.78rem;font-weight:700;color:var(--terra)}

/* ---------- Search ---------- */
.search{display:flex;gap:.5rem;margin-bottom:1.6rem}
.search input{flex:1;font:inherit;padding:.65rem 1rem;border:1.5px solid var(--crema-dark);border-radius:999px;background:var(--bianco);min-width:0}
.search input:focus{outline:none;border-color:var(--acc)}
.no-result{display:none;text-align:center;color:var(--testo-muted);padding:2rem 0;font-style:italic}

/* ---------- Category pages ---------- */
.section-title{display:flex;align-items:center;gap:.75rem;margin:2rem 0 1rem}
.section-title:first-child{margin-top:0}
.section-badge{font-family:'Playfair Display',Georgia,serif;font-weight:700;color:var(--bianco);background:var(--acc);
  padding:4px 14px;border-radius:20px;white-space:nowrap}
.section-line{flex:1;height:1px;background:var(--crema-dark)}
.subsection-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:1rem}
.subsection-card{background:var(--bianco);border:1.5px solid var(--crema-dark);border-radius:14px;overflow:hidden;transition:border-color .2s}
.subsection-card:hover{border-color:var(--terra-light)}
.card-title{font-family:'Playfair Display',Georgia,serif;font-size:1rem;font-weight:700;padding:.85rem 1rem 0;color:var(--testo)}
.card-links{padding:.5rem 1rem .9rem;display:flex;flex-direction:column;gap:.15rem}
.card-link{display:flex;align-items:baseline;gap:.5rem;font-size:.9rem;color:var(--verde);text-decoration:none;line-height:1.4;padding:.3rem 0}
.card-link:hover .t{color:var(--terra);text-decoration:underline}
.langs{display:inline-flex;gap:2px;flex-shrink:0}
.lg{font-size:.62rem;font-weight:800;padding:1px 5px;border-radius:4px;border:1px solid}
.lg.it{background:var(--it-bg);border-color:var(--it-border);color:#065f46}
.lg.fr{background:var(--fr-bg);border-color:var(--fr-border);color:#1e3a8a}
.wip{font-size:.7rem;background:var(--crema-dark);color:var(--terra);border-radius:999px;padding:0 .5rem;white-space:nowrap}

/* ---------- Text pages ---------- */
.toolbar{position:sticky;top:60px;z-index:50;background:var(--bianco);border-bottom:1px solid var(--crema-dark);
  display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;justify-content:center;padding:.5rem 1rem}
.seg{display:inline-flex;border:1.5px solid var(--verde);border-radius:999px;overflow:hidden}
.seg button{font:inherit;font-size:.82rem;font-weight:700;border:0;background:transparent;color:var(--verde);padding:.35rem .9rem;cursor:pointer}
.seg button[aria-pressed="true"]{background:var(--verde);color:#fff}
.tool-btn{font:inherit;font-size:.82rem;font-weight:700;border:1.5px solid var(--crema-dark);background:var(--bianco);color:var(--testo-muted);
  border-radius:999px;padding:.3rem .8rem;cursor:pointer}
.tool-btn:hover{border-color:var(--terra-light)}
.article{max-width:960px;margin:0 auto;padding:1.8rem 1.2rem 3rem;font-size:var(--fs)}
.article h2{font-family:'Playfair Display',Georgia,serif;color:var(--acc);margin:1.8rem 0 .8rem;font-size:1.35rem}
.article h2 em{font-size:.75em;font-weight:400;color:var(--testo-muted)}
.bi{display:grid;grid-template-columns:1fr;gap:.6rem;margin-bottom:1rem}
.bi>div{padding:.1rem 0}
.bi p+p{margin-top:.7rem}
body.mode-it .fr,body.mode-fr .it{display:none}
body.mode-both .bi{grid-template-columns:1fr 1fr;gap:1.2rem}
body.mode-both .bi>.it{border-left:3px solid var(--it-border);background:var(--it-bg);padding:.7rem 1rem;border-radius:0 10px 10px 0}
body.mode-both .bi>.fr{border-left:3px solid var(--fr-border);background:var(--fr-bg);padding:.7rem 1rem;border-radius:0 10px 10px 0}
.bi ul,.bi ol{padding-left:1.3rem}
.bi li{margin:.25rem 0}
.meta{display:flex;flex-wrap:wrap;gap:.6rem;justify-content:center;margin:0 0 1.4rem}
.chip{background:var(--bianco);border:1.5px solid var(--crema-dark);border-radius:999px;padding:.3rem .9rem;font-size:.85rem;font-weight:700}
.chip span{color:var(--terra)}
.figure{margin:1rem 0 1.4rem;text-align:center}
.figure img,.figure .ph{border-radius:12px;box-shadow:0 4px 16px var(--ombra)}
.ph{display:flex;align-items:center;justify-content:center;min-height:200px;background:var(--crema-dark);color:var(--testo-muted);font-style:italic;padding:1rem}
.figure figcaption{font-size:.82rem;color:var(--testo-muted);margin-top:.4rem}
.codebox{position:relative;margin:1rem 0 1.4rem}
.codebox pre{background:#1A1008;color:#FFE9C7;border-radius:12px;padding:1rem 1rem 1rem;overflow-x:auto;font-size:.85rem;line-height:1.5;tab-size:2}
.codebox .copy{position:absolute;top:.5rem;right:.5rem;font:inherit;font-size:.72rem;font-weight:700;border:0;border-radius:6px;
  padding:.25rem .6rem;background:var(--terra-light);color:#1A1008;cursor:pointer}
.note{background:var(--crema-dark);border-left:4px solid var(--terra);border-radius:0 10px 10px 0;padding:.7rem 1rem;margin:1rem 0;font-size:.92rem}
table.parts{width:100%;border-collapse:collapse;margin:.6rem 0 1.2rem;font-size:.92rem;background:var(--bianco)}
table.parts th,table.parts td{border:1px solid var(--crema-dark);padding:.45rem .7rem;text-align:left}
table.parts th{background:var(--crema-dark)}
.story p{text-indent:0;margin-bottom:.9rem}
.story .bi .it p:first-child::first-letter,.story .bi .fr p:first-child::first-letter{}
.pager{display:flex;justify-content:space-between;gap:1rem;margin-top:2.5rem;flex-wrap:wrap}
.pager a{background:var(--bianco);border:1.5px solid var(--crema-dark);border-radius:12px;padding:.6rem 1rem;text-decoration:none;font-weight:700;font-size:.9rem}
.pager a:hover{border-color:var(--terra-light)}

.page-note{margin-top:2.5rem;padding:.75rem 1rem;background:var(--crema-dark);border-radius:10px;font-size:.8rem;color:var(--testo-muted);text-align:center;line-height:1.8}
footer{background:#1A1008;color:rgba(255,248,240,.55);text-align:center;padding:1.2rem;font-size:.8rem}
footer a{color:var(--terra-light);text-decoration:none}

/* ---------- Responsive ---------- */
@media (max-width:1050px){.nav-links{display:none}.burger{display:flex}}
@media (max-width:760px){
  body.mode-both .bi{grid-template-columns:1fr;gap:.5rem}
  .subsection-grid,.home-grid{grid-template-columns:1fr}
  .article{padding:1.2rem 1rem 2.5rem}
}
@media (min-width:761px) and (max-width:1050px){.subsection-grid{grid-template-columns:repeat(2,1fr)}}
@media print{
  nav.top,.mobile-menu,.toolbar,.breadcrumb,.pager,footer,.copy,.search{display:none!important}
  body{background:#fff}
  .page-header{background:none;padding:.5rem 0}
  .page-header h1,.page-header p,.page-header h1 em{color:#000}
  body.mode-both .bi>.it,body.mode-both .bi>.fr{background:none}
}
