/* Variante B "Fascicolo": editoriale e tipografica.
   Caslon (carattere storico della stampa ufficiale) + colonna di note a margine come in un atto annotato. */
:root {
  --carta: #FFFFFF;
  --margine: #F4F2ED;
  --inchiostro: #10243A;
  --profondo: #172F4B;
  --testo: #3F4A56;
  --oro: #B18A54;
  --oro-testo: #8A6636;
  --oro-chiaro: #D8C4A0;
  --filetto: #DAD4C8;
  --display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --text: "Libre Caslon Text", Georgia, serif;
  --ui: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --aside: 190px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--carta); color: var(--testo); font: 400 1.0625rem/1.75 var(--text); overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--inchiostro); }
:focus-visible { outline: 2px solid var(--oro); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--display); color: var(--inchiostro); font-weight: 400; margin: 0 0 .45em; line-height: 1.08; }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); }
h3 { font-size: 1.35rem; font-family: var(--text); line-height: 1.3; }
p { margin: 0 0 1em; max-width: 64ch; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 0; background: var(--inchiostro); color: #fff; padding: .6em 1em; z-index: 20; }
.skip:focus { left: 8px; top: 8px; }
.demo-bar { background: var(--inchiostro); color: var(--oro-chiaro); font: 400 .82rem/1.45 var(--ui); text-align: center; padding: .55em var(--gutter); }
.demo-bar a { color: #fff; margin-left: .4em; }
.pending { color: var(--oro-testo); font-style: italic; }

/* Header */
.site-header { position: relative; z-index: 10; background: var(--carta); border-bottom: 1px solid var(--filetto); view-transition-name: vl-header; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 92px; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--oro); }
.mono { width: 60px; height: 44px; flex: none; }
.brand-name { font-family: var(--text); font-size: 1.3rem; color: var(--inchiostro); line-height: 1.1; }
.brand-name small { display: block; font: 400 .82rem/1.4 var(--ui); color: var(--testo); margin-top: 4px; letter-spacing: .02em; }
.nav ul { list-style: none; display: flex; gap: clamp(20px, 2.6vw, 40px); margin: 0; padding: 0; }
.nav a { position: relative; display: inline-block; text-decoration: none; font: 500 .98rem/1 var(--ui); color: var(--testo); padding: 10px 0; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px; background: var(--oro); transform: scaleX(0); transform-origin: right; transition: transform .45s var(--ease); }
.nav a:hover::after, .nav a:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.nav a[aria-current="page"] { color: var(--inchiostro); }
.nav a[aria-current="page"]::after { transform: scaleX(1); height: 2px; }
.menu-btn { display: none; align-items: center; gap: 12px; background: none; border: 0; color: var(--inchiostro); font: 500 .95rem var(--ui); padding: 10px 0 10px 12px; min-height: 44px; cursor: pointer; }
.menu-lines { position: relative; width: 22px; height: 9px; }
.menu-lines::before, .menu-lines::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: currentColor; transition: transform .35s var(--ease); }
.menu-lines::before { top: 0; } .menu-lines::after { bottom: 0; }
.menu-btn[aria-expanded="true"] .menu-lines::before { transform: translateY(4px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-lines::after { transform: translateY(-4px) rotate(-45deg); }

/* Pulsanti e link */
.btn { position: relative; display: inline-flex; align-items: center; min-height: 56px; padding: 0 28px; background: var(--inchiostro); color: #fff; font: 500 1rem/1.2 var(--ui); letter-spacing: .01em; text-decoration: none; border: 1px solid var(--inchiostro); overflow: hidden; isolation: isolate; }
.btn::before { content: ""; position: absolute; inset: 0; background: var(--profondo); transform: scaleX(0); transform-origin: right; transition: transform .5s var(--ease); z-index: -1; }
.btn:hover::before, .btn:focus-visible::before { transform: scaleX(1); transform-origin: left; }
.btn-ghost { background: transparent; color: var(--inchiostro); }
.btn-ghost::before { background: var(--inchiostro); }
.btn-ghost:hover, .btn-ghost:focus-visible { color: #fff; }
.btn span { transition: transform .5s var(--ease); }
.btn:hover span { transform: translateX(4px); }
.link { position: relative; display: inline-block; font: 500 1rem/1.4 var(--ui); color: var(--inchiostro); text-decoration: none; padding-bottom: 3px; background: linear-gradient(var(--filetto), var(--filetto)) left bottom / 100% 1px no-repeat; }
.link::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--oro-testo); transform: scaleX(0); transform-origin: right; transition: transform .5s var(--ease); }
.link:hover::after, .link:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 32px; margin-top: 36px; }

/* Griglia con note a margine */
.row { display: grid; grid-template-columns: var(--aside) minmax(0, 1fr); column-gap: clamp(28px, 5vw, 80px); }
.aside { margin: .55em 0 0; text-align: right; font-style: italic; font-size: .98rem; line-height: 1.4; color: var(--oro-testo); }
.aside-inline { font-style: italic; color: var(--oro-testo); margin: 1.6em 0 .4em; }
.section { padding: clamp(64px, 8vw, 120px) 0; }
.section + .section { padding-top: 0; }
.section-tint { background: var(--margine); }
.section-tint + .section, .section + .section-tint, .statement + .section { padding-top: clamp(64px, 8vw, 120px); }

/* Hero */
.hero { padding: clamp(40px, 6vw, 88px) 0 clamp(56px, 7vw, 104px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.kicker { font-style: italic; color: var(--oro-testo); font-size: 1.05rem; margin-bottom: 1.4em; }
.name, .title { font-weight: 400; letter-spacing: -.012em; margin-bottom: .32em; }
.name { font-size: clamp(3rem, 6.4vw, 6rem); line-height: .98; }
.title { font-size: clamp(2.5rem, 4.8vw, 4.3rem); line-height: 1.02; }
.line { display: block; overflow: hidden; padding-bottom: .06em; }
.line > span { display: block; }
.sub { font-family: var(--display); font-size: clamp(1.4rem, 2.3vw, 2rem); color: var(--oro-testo); line-height: 1.2; margin-bottom: 1em; }
.lead { font-size: 1.15rem; }
.hero-fig { position: relative; margin: 0; overflow: hidden; background: #C9C3B8; aspect-ratio: 4 / 3; }
.hero-fig-tall { aspect-ratio: auto; height: clamp(440px, 64vh, 660px); }
.hero-fig img { width: 100%; height: 100%; object-fit: cover; }
.hero-fig-tall::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(to bottom, rgba(16,36,58,0), rgba(16,36,58,.72)); pointer-events: none; }
.hero-phrase { position: absolute; left: 28px; bottom: 54px; z-index: 1; margin: 0; max-width: 15ch; color: #fff; font: italic 400 1.45rem/1.3 var(--text); }
.hero-phrase::before { content: ""; display: block; width: 40px; height: 1px; background: var(--oro-chiaro); margin-bottom: 14px; }
.photo-note { position: absolute; right: 12px; top: 12px; z-index: 2; max-width: 300px; font: 400 .72rem/1.3 var(--ui); color: var(--inchiostro); background: rgba(255,255,255,.9); padding: 5px 9px; }

/* Indice delle aree (home) */
.index { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--filetto); }
.index li { position: relative; border-top: 1px solid var(--filetto); }
.index li::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--oro); transform: scaleX(0); transform-origin: left; transition: transform .7s var(--ease); }
.index li:hover::before, .index li:focus-within::before { transform: scaleX(1); }
.index a { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: baseline; padding: 30px 0 26px; text-decoration: none; color: inherit; }
.index h2 { font-size: clamp(1.7rem, 2.8vw, 2.4rem); margin: 0; transition: transform .6s var(--ease), color .3s; }
.index a:hover h2, .index a:focus-visible h2 { transform: translateX(10px); color: var(--profondo); }
.index p { margin: 0; }

/* Fascia con dichiarazione */
.statement { background: var(--margine); padding: clamp(56px, 7vw, 104px) 0; }
.statement-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.statement-fig { position: relative; margin: 0; aspect-ratio: 4 / 5; max-height: 560px; overflow: hidden; background: #D9D1C2; }
.statement-fig img { width: 100%; height: 100%; object-fit: cover; }
.statement-big { font: italic 400 clamp(2rem, 4.2vw, 3.6rem)/1.12 var(--display); color: var(--inchiostro); max-width: 18ch; margin-bottom: .7em; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 10px 0; border-top: 1px solid var(--filetto); }

/* Passaggi numerati (sequenza reale) */
.steps { list-style: none; margin: 48px 0 0; padding: 0; counter-reset: s; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 48px; }
.steps li { counter-increment: s; position: relative; padding: 26px 0 8px; }
.steps li::before { content: counter(s, upper-roman); display: block; font: 400 1.6rem/1 var(--display); color: var(--oro-testo); margin-bottom: 14px; }
.steps li::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--filetto); transform-origin: left; }
.steps h3 { margin-bottom: .3em; }
.steps p { margin: 0; }

.note-block { border-left: 2px solid var(--oro); padding-left: clamp(20px, 3vw, 40px); }
.note-block .btn { margin-top: 12px; }
.note { font-size: .98rem; font-style: italic; color: var(--testo); }
.head-line { display: flex; justify-content: space-between; align-items: baseline; gap: 16px 32px; flex-wrap: wrap; margin-bottom: 28px; }
.head-line h2 { margin: 0; }

.toc { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--filetto); }
.toc li { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 24px; align-items: baseline; padding: 22px 0; border-top: 1px solid var(--filetto); }
.toc-cat { font-style: italic; color: var(--oro-testo); font-size: .98rem; }
.toc-title { font-size: 1.25rem; color: var(--inchiostro); line-height: 1.35; }
.tag { display: inline-block; font: 500 .74rem/1.3 var(--ui); color: var(--testo); border: 1px solid var(--filetto); padding: 4px 9px; white-space: nowrap; }

.closing { padding: 0 0 clamp(72px, 9vw, 128px); }
.closing-body { display: flex; justify-content: space-between; align-items: center; gap: 24px 40px; flex-wrap: wrap; border-top: 1px solid var(--inchiostro); padding-top: 48px; }
.closing h2 { margin: 0; font-size: clamp(2.4rem, 5vw, 4.2rem); }
.statement + .closing, .section-tint + .closing { padding-top: clamp(64px, 8vw, 120px); }

/* Pagine interne */
.facts { margin: 0; border-bottom: 1px solid var(--filetto); }
.facts > div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; padding: 22px 0; border-top: 1px solid var(--filetto); }
.facts dt { font-family: var(--display); font-size: 1.35rem; color: var(--inchiostro); line-height: 1.3; }
.facts dd { margin: 0; }
.facts .link { margin-left: .4em; }
.todo { border: 1px dashed var(--oro); padding: 20px 24px; margin-top: 16px; background: var(--margine); }
.todo h3 { margin-bottom: .2em; }
.todo p { margin: 0; }
.areas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 56px; }
.areas li { padding: 30px 0; border-top: 1px solid var(--filetto); }
.areas h2 { font-size: clamp(1.6rem, 2.4vw, 2rem); }
.areas .is-pending h2 { color: var(--testo); }
.areas .tag { margin-right: 8px; }
.cats { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; padding: 0; margin: 0 0 40px; }
.cats li { font-style: italic; color: var(--inchiostro); padding-bottom: 2px; border-bottom: 1px solid var(--filetto); }
.featured { padding: 0 0 40px; margin-bottom: 8px; }
.featured .tag { margin-bottom: 18px; }
.featured .toc-cat { margin: 0 0 .4em; }
.featured h2 { font-size: clamp(2rem, 3.8vw, 3.2rem); max-width: 22ch; }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); }

/* Footer */
.site-footer { background: var(--inchiostro); color: rgba(255,255,255,.74); font-size: .98rem; padding: 64px 0 32px; }
.foot { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.site-footer .brand-name { color: #fff; }
.site-footer .brand-name small { color: var(--oro-chiaro); }
.site-footer a { color: #fff; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer .pending { color: var(--oro-chiaro); }
.foot-id p { margin-top: 18px; }
.foot-base { grid-column: 1 / -1; max-width: none; border-top: 1px solid rgba(216,196,160,.25); padding-top: 22px; margin: 0; font: 400 .85rem var(--ui); }

/* Movimento: un'unica sequenza d'apertura, poi rivelazioni misurate */
@media (prefers-reduced-motion: no-preference) {
  .line > span { animation: b-rise 1s var(--ease) both; }
  .line + .line > span { animation-delay: .12s; }
  .hero .kicker, .hero .sub, .hero .lead, .hero .actions { animation: b-fade .9s var(--ease) both; }
  .hero .kicker { animation-delay: .05s; }
  .hero .sub { animation-delay: .35s; }
  .hero .lead { animation-delay: .45s; }
  .hero .actions { animation-delay: .55s; }
  .hero-fig { animation: b-open 1.4s var(--ease) .1s both; }
  .hero-fig img { animation: b-settle 2.2s var(--ease) both; }
  .hero-phrase { animation: b-fade 1s var(--ease) 1.1s both; }

  .reveal-on .reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
  .reveal-on .reveal.in { opacity: 1; transform: none; }
  .reveal-on .steps li::after { transform: scaleX(0); transition: transform 1.1s var(--ease) .1s; }
  .reveal-on .steps li.in::after { transform: scaleX(1); }

  @supports (animation-timeline: view()) {
    .statement-fig img { animation: b-drift linear both; animation-timeline: view(); scale: 1.14; }
  }

  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: b-out .3s ease both; }
  ::view-transition-new(root) { animation: b-in .55s var(--ease) .05s both; }
  ::view-transition-group(vl-header) { animation: none; }
}
@keyframes b-rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes b-fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes b-open { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }
@keyframes b-settle { from { transform: scale(1.08); } to { transform: none; } }
@keyframes b-drift { from { translate: 0 -6%; } to { translate: 0 6%; } }
@keyframes b-out { to { opacity: 0; } }
@keyframes b-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Responsive */
@media (max-width: 1023px) {
  .hero-grid, .statement-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-fig-tall { height: 380px; }
  .statement-fig { max-height: 360px; aspect-ratio: 16 / 10; }
  .foot { grid-template-columns: 1fr 1fr; }
  .areas { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .js .nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--carta); border-bottom: 1px solid var(--filetto); clip-path: inset(0 0 100% 0); visibility: hidden; transition: clip-path .5s var(--ease), visibility 0s .5s; }
  .js .nav.open { clip-path: inset(0); visibility: visible; transition: clip-path .5s var(--ease); }
  .nav ul { flex-direction: column; gap: 0; padding: 8px var(--gutter) 24px; }
  .nav li { border-bottom: 1px solid var(--filetto); }
  .nav a { display: block; font: 400 1.9rem/1.2 var(--display); color: var(--inchiostro); padding: 16px 0; }
  .nav a::after { display: none; }
  .nav a[aria-current="page"] { color: var(--oro-testo); }
  html:not(.js) .head { flex-wrap: wrap; }
  html:not(.js) .menu-btn { display: none; }
  html:not(.js) .nav { width: 100%; }
  .row { grid-template-columns: 1fr; }
  .aside { text-align: left; margin: 0 0 18px; }
  .aside::before { content: ""; display: inline-block; vertical-align: middle; width: 28px; height: 1px; background: var(--oro); margin-right: 12px; }
  .index a { grid-template-columns: 1fr; gap: 8px; }
  .steps { grid-template-columns: 1fr; }
  .toc li { grid-template-columns: 1fr; gap: 4px; }
  .toc .tag { justify-self: start; margin-top: 6px; }
  .facts > div { grid-template-columns: 1fr; gap: 4px; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 900px) {
  .js .nav li { opacity: 0; transform: translateY(10px); transition: opacity .4s, transform .5s var(--ease); }
  .js .nav.open li { opacity: 1; transform: none; }
  .js .nav.open li:nth-child(2) { transition-delay: .05s; }
  .js .nav.open li:nth-child(3) { transition-delay: .1s; }
  .js .nav.open li:nth-child(4) { transition-delay: .15s; }
  .js .nav.open li:nth-child(5) { transition-delay: .2s; }
}
@media (max-width: 600px) {
  .head { min-height: 76px; }
  .mono { width: 46px; height: 34px; }
  .brand { gap: 10px; }
  .brand-name { font-size: 1.1rem; }
  .hero-fig-tall { height: 320px; }
  .hero-phrase { font-size: 1.2rem; left: 18px; bottom: 60px; }
  .actions .btn { width: 100%; justify-content: center; }
  .foot { grid-template-columns: 1fr; }
  .closing h2 { font-size: 2.4rem; }
}
