/* FotoSite - stile pubblico
   Idea: le foto sono le protagoniste, l'interfaccia arretra.
   Un solo gesto forte: il nome del sito, enorme, che "buca" la copertina (mix-blend-mode: difference). */

:root {
  --bg: #101112;
  --fg: #f2f1ee;
  --mute: #8d8f92;
  --line: rgba(255, 255, 255, .15);
  --accent: #ff5a36;
  --accent-rgb: 255, 90, 54;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(16px, 3.2vw, 48px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f1f1ef;
  --fg: #0d0e0f;
  --mute: #66686b;
  --line: rgba(0, 0, 0, .15);
  color-scheme: light;
}

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

html {
  background: var(--bg);
  color: var(--fg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html.lb-open { overflow: hidden; }

body {
  margin: 0;
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: fixed; left: 1rem; top: -4rem; z-index: 200;
  background: var(--fg); color: var(--bg); padding: .6rem 1rem; text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- navigazione ---------- */

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem var(--pad);
  color: #fff; mix-blend-mode: difference; pointer-events: none;
}
.nav a, .nav button { pointer-events: auto; }
.brand {
  font-weight: 700; letter-spacing: -.02em; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50vw;
}
.nav-links { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2rem); }
.nav-links a { text-decoration: none; }
.nav-links a:hover, .theme-btn:hover { text-decoration: underline; text-underline-offset: 4px; }
.theme-btn { background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- hero ---------- */

.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-rows: 1fr auto;
  background: #0b0c0d; color: #fff;
}
.hero-media {
  position: absolute; inset: 0; z-index: -3;
  transform: translate3d(0, var(--py, 0px), 0);
  will-change: transform;
}
.hero-media img {
  position: absolute; left: 0; top: 0; display: block; width: 100%; height: 114%;
  object-fit: cover; object-position: center 40%;
  filter: brightness(.7) saturate(1.05);
  animation: drift 30s ease-in-out infinite alternate;
  pointer-events: none; user-select: none; -webkit-user-drag: none;
}
/* più immagini di copertina: si alternano in dissolvenza */
.hero-media img.slide { opacity: 0; transition: opacity 1.8s ease-in-out; }
.hero-media img.slide.on { opacity: 1; }
.hero-media img.slide:not(.on) { animation-play-state: paused; }
/* video di copertina: sopra l'immagine, appare in dissolvenza quando parte */
.hero-media video {
  position: absolute; left: 0; top: 0; display: block; width: 100%; height: 114%;
  object-fit: cover; object-position: center 40%;
  filter: brightness(.7) saturate(1.05);
  opacity: 0; transition: opacity 1.2s ease;
  pointer-events: none; user-select: none;
}
.hero-media video.on { opacity: 1; }
/* Ken Burns (solo con più immagini e se attivo in admin): zoom e spostamento lento, diverso per ogni immagine */
.hero-media.kb img.slide { animation: none; }
.hero-media.kb img.slide.on, .hero-media.kb img.slide.out { animation-duration: calc(var(--kbs, 6s) + 4s); animation-timing-function: linear; animation-fill-mode: forwards; animation-iteration-count: 1; animation-direction: normal; animation-play-state: running; }
.hero-media.kb img.slide.k0.on, .hero-media.kb img.slide.k0.out { animation-name: kb0; }
.hero-media.kb img.slide.k1.on, .hero-media.kb img.slide.k1.out { animation-name: kb1; }
.hero-media.kb img.slide.k2.on, .hero-media.kb img.slide.k2.out { animation-name: kb2; }
.hero-media.kb img.slide.k3.on, .hero-media.kb img.slide.k3.out { animation-name: kb3; }
.hero-media.kb img.slide.out { opacity: 0; }
@keyframes kb0 { from { transform: scale(1.02) translate3d(-1.5%, 1%, 0); }  to { transform: scale(1.16) translate3d(1.5%, -1.5%, 0); } }
@keyframes kb1 { from { transform: scale(1.16) translate3d(1.5%, -1%, 0); }  to { transform: scale(1.02) translate3d(-1.5%, 1%, 0); } }
@keyframes kb2 { from { transform: scale(1.04) translate3d(1.5%, 1.5%, 0); } to { transform: scale(1.17) translate3d(-1.5%, -1%, 0); } }
@keyframes kb3 { from { transform: scale(1.15) translate3d(-1.5%, -1.5%, 0); } to { transform: scale(1.03) translate3d(1.5%, 1%, 0); } }
@keyframes drift {
  from { transform: scale(1.03) translate3d(-1%, 0, 0); }
  to   { transform: scale(1.13) translate3d(1.2%, -2%, 0); }
}
.hero-media.no-cover {
  background:
    radial-gradient(60% 70% at 78% 18%, rgba(var(--accent-rgb), .55), transparent 70%),
    radial-gradient(50% 60% at 12% 85%, rgba(var(--accent-rgb), .25), transparent 70%),
    #0b0c0d;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: linear-gradient(180deg, rgba(0, 0, 0, .45) 0%, rgba(0, 0, 0, 0) 32%, rgba(0, 0, 0, .55) 100%);
  pointer-events: none;
}
.hero-grain {
  position: absolute; inset: -50%; z-index: -1; opacity: .09; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); } 60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

.hero-title {
  grid-row: 1; align-self: end;
  margin: 0; padding: 0 var(--pad);
  font-weight: 800; line-height: .84; letter-spacing: -.065em;
  font-size: clamp(3rem, min(15.5vw, calc(160vw / var(--len, 8))), 17rem);
  color: #fff; mix-blend-mode: difference;
  overflow-wrap: anywhere;
}
.hero-title .w {
  display: inline-block; vertical-align: top; overflow: hidden;
  padding: .02em .03em .24em 0; margin-bottom: -.24em;
}
.hero-title .w > span {
  display: inline-block; transform: translateY(108%);
  animation: rise 1.15s cubic-bezier(.16, 1, .3, 1) forwards;
  animation-delay: calc(.2s + var(--i, 0) * .1s);
}
@keyframes rise { to { transform: none; } }

.hero-foot {
  grid-row: 2;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap;
  padding: 1.6rem var(--pad) 1.8rem;
}
.hero-tag { margin: 0; max-width: 34ch; font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.35; }

/* ---------- galleria ---------- */

.gallery { padding: clamp(4rem, 9vw, 9rem) var(--pad) clamp(4rem, 8vw, 7rem); }

.g-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.2rem; }
.g-head h2, .g-head h1 {
  margin: 0; font-weight: 800; letter-spacing: -.055em; line-height: .92;
  font-size: clamp(2.4rem, 7vw, 6.5rem);
}
.g-count { margin: 0; color: var(--mute); font-variant-numeric: tabular-nums; }
.page > .gallery-page { padding: 0; }

.cats { display: flex; flex-wrap: wrap; gap: .2rem 1.5rem; margin: 0 0 1rem; }
.cats[hidden] { display: none; }
.cats.subs { margin-top: -.2rem; gap: .1rem 1.2rem; }
.cats.subs .cat-btn, .cats.places .cat-btn { font-size: clamp(.98rem, 1.4vw, 1.15rem); }
.cats.places { gap: .3rem 1.6rem; margin-bottom: 2rem; }
.cat-btn {
  position: relative; background: none; border: 0; padding: .3rem 0; cursor: pointer;
  color: var(--mute); font-weight: 600; letter-spacing: -.02em; line-height: 1.2;
  font-size: clamp(1.1rem, 1.9vw, 1.5rem);
  transition: color .2s;
}
.cat-btn sup { margin-left: .25em; font-size: .55em; font-weight: 500; opacity: .75; font-variant-numeric: tabular-nums; }
.cat-btn::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease);
}
.cat-btn:hover { color: var(--fg); }
.cat-btn[aria-pressed="true"] { color: var(--fg); }
.cat-btn[aria-pressed="true"]::after { transform: scaleX(1); }

.tags { display: flex; flex-wrap: wrap; gap: .4rem .5rem; margin: 0 0 1.4rem; }
.tags:empty { display: none; }
.tag-btn {
  background: none; cursor: pointer; border: 1px solid var(--line); border-radius: 99px;
  padding: .2rem .8rem; color: var(--mute); font-size: .86rem; font-weight: 500;
  transition: color .2s, background-color .2s, border-color .2s;
}
.tag-btn:hover { color: var(--fg); border-color: var(--fg); }
.tag-btn[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.tag-more { border-style: dashed; }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--fg);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent); text-decoration-thickness: 2px;
}
a.link-btn { display: inline-block; }

/* griglia: senza JavaScript è un semplice flusso a colonne; con JS diventa una muratura animata */
.grid { margin-top: 1.2rem; columns: 3 280px; column-gap: 10px; }
.item {
  position: relative; margin: 0 0 10px; break-inside: avoid;
  background: var(--c, #222);
}
.item-link { position: relative; display: block; overflow: hidden; width: 100%; }
.item img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  transition: opacity .7s ease, transform 1.3s var(--ease), filter .5s ease;
  pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none;
}
.shield { position: absolute; inset: 0; z-index: 2; }
.item-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; pointer-events: none;
  padding: 3rem 1rem .9rem; color: #fff; font-weight: 600; letter-spacing: -.01em; line-height: 1.25;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7));
  opacity: 0; transform: translateY(8px); transition: opacity .35s ease, transform .45s var(--ease);
}

.js .grid { columns: auto; position: relative; height: 0; }
.js .item {
  position: absolute; left: 0; top: 0; margin: 0;
  transition: transform .85s var(--ease), opacity .45s ease, visibility 0s;
  will-change: transform;
}
.js .item img { opacity: 0; }
.js .item img.ok { opacity: 1; }
.js .item-link { height: 100%; aspect-ratio: auto !important; }
.js .item.off { opacity: 0; pointer-events: none; visibility: hidden; transition: transform .85s var(--ease), opacity .3s ease, visibility 0s linear .3s; }
.grid.no-anim .item, .grid.no-anim .item.off { transition: none !important; }

@media (hover: hover) {
  .item:hover img, .item-link:focus-visible img { transform: scale(1.045); }
  .item:hover figcaption, .item-link:focus-visible ~ figcaption { opacity: 1; transform: none; }
  .grid:has(.item-link:hover) .item:not(:hover):not(.off) { opacity: .35; }
}

.cat-intro { max-width: 46rem; margin: 0 0 clamp(1.6rem, 3vw, 2.4rem); font-family: var(--font); font-size: clamp(1.05rem, 1.3vw, 1.2rem); line-height: 1.7; white-space: pre-line; overflow-wrap: anywhere; color: var(--fg); }
.cat-intro[hidden] { display: none; }
.empty { padding: 4rem 0; color: var(--mute); text-align: center; }
.empty p { margin: 0 0 .6rem; }

/* cursore "Apri" sulle foto (solo mouse) */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none;
  width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .9rem; letter-spacing: -.01em;
  opacity: 0; scale: .3; transition: opacity .25s ease, scale .35s var(--ease);
}
.cursor.view { opacity: 1; scale: 1; }
html:not(.has-cursor) .cursor { display: none; }
html.has-cursor .item-link { cursor: none; }

/* ---------- footer ---------- */

.foot { padding: clamp(4rem, 9vw, 8rem) var(--pad) 2rem; border-top: 1px solid var(--line); }
.foot-head {
  margin: 0 0 1.2rem; font-weight: 800; letter-spacing: -.055em; line-height: .95;
  font-size: clamp(2.2rem, 7vw, 6.5rem); max-width: 14ch; text-wrap: balance;
}
.foot-mail {
  display: inline-block; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; text-decoration: none;
  font-size: clamp(1.3rem, 3.4vw, 2.8rem); overflow-wrap: anywhere;
  border-bottom: .09em solid var(--accent); transition: color .2s;
}
.foot-mail:hover { color: var(--accent); }
.foot-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2.4rem 3rem; margin-top: clamp(3rem, 6vw, 5rem); }
.foot-col h3 { margin: 0 0 .7rem; font-size: .95rem; font-weight: 600; color: var(--mute); }
.foot-col p { margin: 0 0 .5rem; max-width: 46ch; }
.foot-about p { font-family: var(--font); font-size: 1.1rem; line-height: 1.6; }
.foot-col a { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line); transition: text-decoration-color .2s; }
.foot-col a:hover { text-decoration-color: var(--accent); }
.foot-links { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.foot-bottom {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-top: clamp(3rem, 7vw, 6rem); padding-top: 1.2rem; border-top: 1px solid var(--line);
  color: var(--mute); font-size: .9rem;
}
.foot-bottom p { margin: 0; }
.foot-bottom .link-btn { color: var(--mute); }

/* ---------- visualizzatore ---------- */

.lb {
  position: fixed; inset: 0; z-index: 100; display: none; color: #f2f1ee;
  background: #08090a;
  grid-template-columns: minmax(0, 1fr) 23rem; grid-template-rows: auto minmax(0, 1fr);
  color-scheme: dark;
}
.lb.open { display: grid; animation: lbin .35s ease; }
@keyframes lbin { from { opacity: 0; } to { opacity: 1; } }
.lb.no-side { grid-template-columns: minmax(0, 1fr); }

.lb-bar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: .9rem var(--pad); gap: 1rem; }
.lb-count { font-variant-numeric: tabular-nums; color: #9a9c9f; }
.lb-actions { display: flex; gap: 1.4rem; }
.lb-btn { background: none; border: 0; padding: .3rem 0; cursor: pointer; color: inherit; }
.lb-btn:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent); }
.lb-info-btn { display: none; }

.lb-stage { position: relative; min-height: 0; }
.lb-img {
  position: absolute; left: 1rem; right: 1rem; bottom: 1rem; top: 0;
  width: calc(100% - 2rem); height: calc(100% - 1rem); object-fit: contain;
  transition: opacity .3s ease;
  pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none;
}
.lb-shield { position: absolute; inset: 0; z-index: 2; touch-action: pan-y; cursor: pointer; }
.lb-nav {
  position: absolute; top: 50%; z-index: 3; width: 3.4rem; height: 3.4rem; margin-top: -1.7rem; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; cursor: pointer; transition: background-color .2s, border-color .2s;
}
.lb-nav:hover { background: var(--accent); border-color: var(--accent); }
.lb-prev { left: 1.2rem; } .lb-next { right: 1.2rem; }
.lb-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.lb-side { overflow-y: auto; padding: .4rem 1.8rem 2.2rem; border-left: 1px solid rgba(255, 255, 255, .1); }
.lb.no-side .lb-side { display: none; }
.lb-title { margin: 0 0 1rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-size: clamp(1.7rem, 2.6vw, 2.4rem); overflow-wrap: anywhere; }
.lb-place { margin: -.3rem 0 1rem; font-size: .9rem; letter-spacing: .02em; color: var(--mute, #9a9fa4); overflow-wrap: anywhere; }
.lb-place::before { content: ''; display: inline-block; width: .62em; height: .62em; margin-right: .5em; border: 2px solid currentColor; border-radius: 50% 50% 50% 0; transform: rotate(-45deg) translateY(-.08em); }
.lb-comment { margin: 0 0 1.4rem; font-family: var(--font); font-size: 1.12rem; line-height: 1.65; white-space: pre-line; color: #e6e4df; overflow-wrap: anywhere; }
.lb-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.6rem; }
.lb-chip {
  background: none; cursor: pointer; border: 1px solid rgba(255, 255, 255, .22); border-radius: 99px;
  padding: .2rem .8rem; color: #cfcdc8; font-size: .86rem;
}
.lb-chip:hover { border-color: var(--accent); color: #fff; }
.lb-chip.is-cat { border-color: rgba(255, 255, 255, .5); color: #fff; }
.lb-exif { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .45rem 1.2rem; font-size: .92rem; }
.lb-exif dt { color: #8d8f92; }
.lb-exif dd { margin: 0; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .lb, .lb.no-side { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .lb-side { grid-row: 3; max-height: 42vh; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .12); display: none; }
  .lb.info .lb-side { display: block; }
  .lb.no-side .lb-side { display: none; }
  .lb-info-btn { display: inline-block; }
  .lb.no-side .lb-info-btn { display: none; }
  .lb-nav { display: none; }
}

/* ---------- varie ---------- */

@media (max-width: 560px) {
  .nav-links a:not(.keep) { font-size: .95rem; }
  .brand { max-width: 42vw; }
  .logo-mask { max-width: 40vw; }
  .hero-foot { padding-bottom: 1.4rem; }
}

@media print {
  .hero, .gallery, .lb, .cursor { display: none !important; }
  body::before { content: "Le immagini di questo sito non sono stampabili."; display: block; padding: 2rem; color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-media img, .hero-grain { animation: none; }
  .hero-media img.slide { transition: none; }
  .hero-media.kb img.slide.on, .hero-media.kb img.slide.out { animation: none; }
  .hero-media video { display: none; }
  .hero-title .w > span { animation: none; transform: none; }
  .item, .item img, .cursor, .lb.open { transition: none !important; animation: none !important; }
}

/* ---------- Parole: albero e pagine ---------- */

.page { padding: clamp(6rem, 11vw, 9rem) var(--pad) clamp(4rem, 8vw, 7rem); min-height: 72vh; }
.page-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: clamp(1.6rem, 4vw, 3rem); }
.page-title {
  margin: 0; font-weight: 800; letter-spacing: -.055em; line-height: .92;
  font-size: clamp(2.4rem, 7vw, 6.5rem); overflow-wrap: anywhere; text-wrap: balance;
  animation: title-in .9s var(--ease) both;
}
.page-title.is-article { font-size: clamp(2.2rem, 5.4vw, 4.8rem); margin-bottom: clamp(1.6rem, 3.4vw, 2.8rem); }
@keyframes title-in { from { opacity: 0; transform: translateY(.18em); } }
.notice { margin: 0 0 2rem; color: var(--mute); }

/* albero con "Leggi tutto" */
.tree, .tree ul, .nav-tree, .nav-tree ul { list-style: none; margin: 0; padding: 0; }
.tree { border-bottom: 1px solid var(--line); }
.tree ul { margin-left: clamp(.8rem, 2.4vw, 2.2rem); padding-left: clamp(.8rem, 2vw, 1.6rem); border-left: 1px solid var(--line); }
.tree-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1.2rem; padding: .95rem 0; border-top: 1px solid var(--line); }
.tree-title {
  font-weight: 700; letter-spacing: -.04em; line-height: 1.08; text-decoration: none;
  font-size: clamp(1.5rem, 3.6vw, 2.8rem); overflow-wrap: anywhere;
  transition: color .25s, transform .5s var(--ease);
}
.tree ul .tree-title { font-weight: 600; letter-spacing: -.03em; font-size: clamp(1.2rem, 2.4vw, 1.9rem); }
.tree ul ul .tree-title { font-size: clamp(1.05rem, 1.8vw, 1.4rem); }
.read-more {
  position: relative; flex: none; padding-bottom: 2px; color: var(--mute); font-weight: 600; text-decoration: none;
  transition: color .2s;
}
.read-more::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease);
}
.tree-row:hover .read-more, .read-more:focus-visible { color: var(--fg); }
.tree-row:hover .read-more::after, .read-more:focus-visible::after { transform: scaleX(1); }
@media (hover: hover) { .tree-row:hover .tree-title { color: var(--accent); transform: translateX(.4rem); } }

/* percorso */
.crumbs ol { display: flex; flex-wrap: wrap; gap: .2rem .6rem; list-style: none; margin: 0 0 clamp(1.4rem, 3vw, 2.4rem); padding: 0; color: var(--mute); font-size: .92rem; }
.crumbs li + li::before { content: "/"; margin-right: .6rem; opacity: .6; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent); }
.crumbs [aria-current] { color: var(--fg); overflow-wrap: anywhere; }

/* pagina singola */
.page-grid { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.side-tree { position: sticky; top: 5.5rem; max-height: calc(100vh - 7rem); overflow: auto; padding-right: .5rem; }
.side-tree summary { cursor: pointer; margin-bottom: .6rem; color: var(--mute); font-weight: 600; }
.nav-tree ul { margin-left: .9rem; border-left: 1px solid var(--line); }
.nav-tree a {
  display: block; padding: .3rem 0 .3rem .8rem; color: var(--mute); text-decoration: none; line-height: 1.3; overflow-wrap: anywhere;
  transition: color .2s;
}
.nav-tree a:hover { color: var(--fg); }
.nav-tree a[aria-current="page"] { color: var(--fg); font-weight: 700; box-shadow: inset 2px 0 0 var(--accent); }

.prose {
  max-width: 60rem; font-family: var(--font); font-size: clamp(1.1rem, 1.5vw, 1.26rem); line-height: 1.72; overflow-wrap: anywhere;
}
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1.15em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose h2, .prose h3, .prose h4 { max-width: 68ch; }
.prose h2, .prose h3, .prose h4 { font-family: var(--font); font-weight: 800; letter-spacing: -.04em; line-height: 1.06; }
.prose h2 { margin-top: 2.2em; font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.prose h3 { margin-top: 1.9em; font-size: clamp(1.4rem, 2.4vw, 1.85rem); }
.prose h4 { margin-top: 1.7em; font-size: 1.15rem; letter-spacing: -.02em; }
.prose > :first-child { margin-top: 0; }
.prose a { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.prose a:hover { color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose blockquote { padding-left: 1.2rem; border-left: 3px solid var(--accent); font-style: italic; }
.prose blockquote p + p { margin-top: .8em; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.2em; }
.prose p:has(> img:only-child) { max-width: none; }
.prose img {
  display: block; height: auto; max-width: 100%; margin-block: .4em;
  background: var(--line);
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none;
}
.prose img.img-s { width: min(100%, 22rem); }
.prose img.img-m { width: min(100%, 38rem); }
.prose img.img-l { width: 100%; }

/* pagina a due colonne: immagine a sinistra (larghezza scelta in admin), testo a destra */
.cols { display: grid; grid-template-columns: var(--side, 35%) minmax(0, 1fr); gap: clamp(1.4rem, 3.5vw, 3rem); align-items: start; max-width: 78rem; }
.side-fig { margin: 0; position: sticky; top: 5.5rem; }
.side-fig img {
  display: block; width: 100%; height: auto; background: var(--line);
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none;
}
.cols .prose { max-width: none; }
@media (max-width: 760px) {
  .cols { grid-template-columns: 1fr; }
  .side-fig { position: static; }
}

.subpages { margin-top: clamp(3rem, 6vw, 5rem); }
.subpages h2 { margin: 0 0 1rem; font-size: 1.05rem; font-weight: 600; color: var(--mute); }

.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: clamp(3rem, 6vw, 5rem); border-top: 1px solid var(--line); }
.pn a { display: grid; gap: .3rem; padding: 1.4rem 0; text-decoration: none; align-content: start; }
.pn small { color: var(--mute); font-size: .9rem; }
.pn strong { font-size: clamp(1.1rem, 2.2vw, 1.7rem); letter-spacing: -.03em; line-height: 1.15; font-weight: 700; overflow-wrap: anywhere; transition: color .2s; }
.pn a:hover strong { color: var(--accent); }
.pn .next { text-align: right; grid-column: 2; }

@media (max-width: 900px) {
  .page-grid { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .side-tree { position: static; max-height: none; padding: 0 0 1rem; border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .nav-links { gap: .8rem; }
  .tree-row { flex-direction: column; align-items: flex-start; gap: .25rem; }
  .pn { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pn .next { grid-column: 1; text-align: left; border-top: 1px solid var(--line); }
}
@media print { .prose img { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .page-title { animation: none; }
  .tree-title, .read-more::after { transition: none; }
}

/* ---------- piè di pagina: privacy ---------- */
.foot-end { display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; }
.foot-legal { color: var(--mute); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line); transition: text-decoration-color .2s, color .2s; }
.foot-legal:hover, .foot-legal:focus-visible { color: var(--fg, inherit); text-decoration-color: var(--accent); }

/* ---------- sottotitolo delle pagine: più piccolo del titolo, più grande del testo ---------- */
.page-title.is-article.has-sub { margin-bottom: .55em; }
.page-sub { font-size: clamp(1.3rem, 2.5vw, 1.9rem); line-height: 1.3; font-weight: 500; letter-spacing: -.02em; color: var(--mute); max-width: 32ch; margin: 0 0 clamp(1.6rem, 3.4vw, 2.8rem); text-wrap: balance; }
.tree-text { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.tree-sub { color: var(--mute); font-size: 1rem; line-height: 1.35; max-width: 52ch; }

/* ---------- immagine a sinistra dei link del footer ---------- */
.foot-links a.has-ico { display: inline-flex; align-items: center; gap: .6rem; }
.foot-ico { height: 1.4em; width: auto; max-width: 2.2em; object-fit: contain; flex: none; pointer-events: none; -webkit-user-select: none; user-select: none; }

/* ---------- logo: una sagoma colorata dal tema (chiaro/scuro), sempre leggibile ---------- */
.brand.has-logo { overflow: visible; max-width: none; line-height: 0; }
.logo-mask {
  display: block; height: clamp(1.5rem, 3.4vw, 2rem); aspect-ratio: var(--ar); max-width: 56vw;
  background: currentColor;
  -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: left center; mask-position: left center;
}
