/* ─────────────────────────────────────────────────────────
   FotoFlavio — "l'album di famiglia"
   Carta      #F1E8E2  carta baritata, appena rosata
   Seppia     #2F2420  testo
   Seppia 2   #6E5E55  testo secondario
   Inchiostro #2D5B57  verde stilografica: date scritte a mano, link
   Ocra       #C38A2E  angolini delle foto
   Stampa     #FBF8F3  bordo bianco delle stampe
   ───────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Literata';
  src: url('../fonts/literata.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Literata';
  src: url('../fonts/literata-italic.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Kalam';
  src: url('../fonts/kalam.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f1e8e2;
  --paper-2: #e8ddd5;
  --sepia: #2f2420;
  --sepia-2: #6e5e55;
  --ink: #2d5b57;
  --ochre: #c38a2e;
  --print: #fbf8f3;
  --line: #d9cbc1;

  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --hand: 'Kalam', 'Comic Sans MS', cursive;

  --gutter: clamp(1.1rem, 4vw, 3rem);
  --max: 1180px;
  --measure: 64ch;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--sepia);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
p { margin: 0 0 1em; text-wrap: pretty; }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: calc(44rem + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--sepia); color: var(--print); padding: .6rem 1rem; z-index: 99; }
.skip:focus { top: 1rem; }

/* scrittura a mano: date e didascalie, come sotto le foto di un album */
.hand { font-family: var(--hand); color: var(--ink); font-size: 1.15em; line-height: 1.3; }
.muted { color: var(--sepia-2); }
.small { font-size: .9rem; }

/* ───────── Intestazione ───────── */
.site-head { border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.4rem; }
.logo { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--sepia); }
.logo b { font-weight: 650; font-size: 1.35rem; letter-spacing: -0.015em; line-height: 1; }
.logo .tlr { width: 1.75rem; height: auto; flex: none; transform: rotate(-4deg); transition: transform .3s ease; }
.logo:hover .tlr { transform: rotate(0); }
.nav ul { display: flex; gap: .2rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.nav a { display: block; padding: .45rem .75rem; text-decoration: none; color: var(--sepia); font-size: 1rem; border-radius: 999px; }
.nav a:hover { background: var(--paper-2); }
.nav a[aria-current="page"] { background: var(--sepia); color: var(--print); }
.nav svg { width: 1.05rem; height: 1.05rem; display: block; }
.menu-btn { display: none; }
.nav-sub, .nav-search { display: none; }
@media (max-width: 760px) {
  .menu-btn {
    display: inline-flex; align-items: center; gap: .45rem; position: relative; z-index: 31;
    font: inherit; font-size: .95rem; background: none; border: 1.5px solid var(--sepia); color: var(--sepia);
    border-radius: 999px; padding: .35rem .95rem; cursor: pointer;
  }
  .menu-btn .burger { width: 14px; height: 10px; position: relative; }
  .menu-btn .burger::before, .menu-btn .burger::after { content: ""; position: absolute; left: 0; right: 0; height: 1.6px; background: currentColor; transition: transform .25s ease, top .25s ease; }
  .menu-btn .burger::before { top: 1px; }
  .menu-btn .burger::after { top: 7px; }
  .menu-btn[aria-expanded="true"] .burger::before { top: 4px; transform: rotate(45deg); }
  .menu-btn[aria-expanded="true"] .burger::after { top: 4px; transform: rotate(-45deg); }
  .site-head { position: sticky; top: 0; z-index: 30; background: var(--paper); }
  .nav {
    position: fixed; inset: 4.4rem 0 0 0; z-index: 30;
    background: var(--paper);
    padding: 1.2rem var(--gutter) 2rem;
    overflow-y: auto;
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
  }
  .nav.open { visibility: visible; opacity: 1; transform: none; transition: opacity .25s ease, transform .25s ease; }
  .nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .nav li { border-bottom: 1px solid var(--line); }
  .nav li.search-li { display: none; }
  .nav a { display: block; padding: 1rem .2rem; border-radius: 0; font-size: 1.75rem; line-height: 1.15; }
  .nav a:hover { background: none; }
  .nav a[aria-current="page"] { background: none; color: var(--ink); }
  .nav-sub { display: block; font-family: var(--hand); font-size: 1.05rem; color: var(--ink); margin-top: .15rem; }
  .nav.open li { animation: menu-in .35s ease both; }
  .nav.open li:nth-child(2) { animation-delay: .04s; }
  .nav.open li:nth-child(3) { animation-delay: .08s; }
  .nav.open li:nth-child(4) { animation-delay: .12s; }
  .nav.open li:nth-child(5) { animation-delay: .16s; }
  .nav-search { display: flex; gap: .5rem; margin-top: 1.6rem; }
  .nav-search input { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: .7rem 1rem; border: 1.5px solid var(--sepia); border-radius: 999px; background: var(--print); color: var(--sepia); }
  .nav-search button { font: inherit; border: 0; border-radius: 999px; padding: 0 1.1rem; background: var(--ink); color: var(--print); cursor: pointer; }
  body.menu-open { overflow: hidden; }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ───────── Stampe con bordo dentellato ───────── */
.print-wrap { filter: drop-shadow(0 1px 1px rgba(47, 36, 32, .18)) drop-shadow(0 8px 16px rgba(47, 36, 32, .12)); }
.print {
  --s: 9px;
  background: var(--print);
  padding: calc(var(--s) + 6px);
  -webkit-mask:
    linear-gradient(#000 0 0) center / calc(100% - var(--s)) calc(100% - var(--s)) no-repeat,
    radial-gradient(circle closest-side, #000 97%, #0000) 0 0 / var(--s) var(--s) round;
  mask:
    linear-gradient(#000 0 0) center / calc(100% - var(--s)) calc(100% - var(--s)) no-repeat,
    radial-gradient(circle closest-side, #000 97%, #0000) 0 0 / var(--s) var(--s) round;
}
.print img { width: 100%; height: 100%; object-fit: cover; background: var(--paper-2); }
.tilt-l { transform: rotate(-1.6deg); }
.tilt-r { transform: rotate(1.3deg); }
.tilt-l, .tilt-r { transition: transform .35s ease; }
a:hover > .tilt-l, a:hover > .tilt-r, a:focus-visible > .tilt-l, a:focus-visible > .tilt-r { transform: rotate(0); }

/* angolini di carta come negli album: attaccati alla foto, ruotano con lei */
.corners .print-wrap { position: relative; }
.corners .print-wrap::before, .corners .print-wrap::after {
  content: ""; position: absolute; width: 30px; height: 30px; z-index: 2; pointer-events: none;
  background: linear-gradient(135deg, var(--sepia) 0 50%, transparent 50%);
  opacity: .85;
}
.corners .print-wrap::before { left: 0; top: 0; }
.corners .print-wrap::after { right: 0; bottom: 0; transform: rotate(180deg); }

/* ───────── Bottoni ───────── */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font: inherit; font-size: 1rem; font-weight: 550;
  padding: .7em 1.25em; border-radius: 999px;
  border: 1.5px solid var(--sepia); color: var(--sepia); background: transparent;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--sepia); color: var(--print); }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--print); }
.btn-ink:hover { background: #22494a; border-color: #22494a; }

/* ───────── Home ───────── */
.hello { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; padding-block: clamp(2.5rem, 7vw, 5.5rem); }
.hello h1 { font-size: clamp(2.4rem, 5.6vw, 4.2rem); font-weight: 500; letter-spacing: -0.02em; margin-bottom: .35em; }
.hello .lede { font-size: 1.25rem; line-height: 1.6; max-width: 36ch; }
.hello .actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }
.hello figure { margin: 0; justify-self: center; width: min(100%, 380px); }
.hello figure .print { aspect-ratio: 4 / 5; }
.hello figcaption { margin-top: 1rem; text-align: center; }
@media (max-width: 800px) { .hello { grid-template-columns: 1fr; } .hello figure { width: min(82%, 320px); order: -1; } }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.4rem; }
.section-title h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); font-weight: 500; margin: 0; }

/* Voci del diario: foto e racconto alternati */
.diary { display: grid; gap: clamp(3.5rem, 8vw, 6rem); }
.entry { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(1.8rem, 5vw, 4rem); align-items: center; }
.entry:nth-child(even) .entry-photo { order: 2; }
.entry-photo { display: block; text-decoration: none; }
.entry-photo .print { aspect-ratio: 3 / 2; }
.entry-date { display: block; margin-bottom: .35rem; }
.entry h3 { font-size: clamp(1.55rem, 3vw, 2.1rem); font-weight: 550; margin-bottom: .5rem; }
.entry h3 a { color: var(--sepia); text-decoration: none; }
.entry h3 a:hover { text-decoration: underline; text-decoration-color: var(--ink); }
.entry p { color: var(--sepia-2); }
.entry .more { font-weight: 550; }
@media (max-width: 760px) { .entry { grid-template-columns: 1fr; } .entry:nth-child(even) .entry-photo { order: 0; } }

.quote-band { background: var(--paper-2); margin-top: clamp(4rem, 9vw, 7rem); padding-block: clamp(3rem, 7vw, 5rem); }
.quote-band blockquote { margin: 0; }
.quote-band blockquote p { font-size: clamp(1.6rem, 3.4vw, 2.5rem); font-style: italic; font-weight: 400; line-height: 1.3; max-width: 30ch; margin-bottom: .6rem; }
.quote-band .about-short { max-width: 52ch; margin-top: 1.6rem; }

.videos-home { padding-top: clamp(4rem, 8vw, 6rem); }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 2rem 1.6rem; }
.vgrid h3 { font-size: 1.2rem; margin: .8rem 0 .1rem; }
.vgrid h3 a { color: var(--sepia); text-decoration: none; }

.cta { padding-top: clamp(4rem, 8vw, 6rem); }
.cta h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); font-weight: 500; }

/* ───────── Elenchi ───────── */
.page-head { padding-block: clamp(2.2rem, 6vw, 4.5rem) 2.2rem; }
.page-head h1 { font-size: clamp(2.3rem, 5.5vw, 3.8rem); font-weight: 500; letter-spacing: -0.02em; }
.page-head .intro { font-size: 1.2rem; max-width: 50ch; color: var(--sepia-2); }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.5rem; }
.chips a { text-decoration: none; color: var(--sepia); border: 1.5px solid var(--line); border-radius: 999px; padding: .3rem .95rem; font-size: .95rem; }
.chips a:hover { border-color: var(--sepia); }
.chips a[aria-current="page"] { background: var(--sepia); border-color: var(--sepia); color: var(--print); }
.chips .n { opacity: .65; margin-left: .2rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 3rem 2rem; }
.card a.card-photo { display: block; text-decoration: none; }
.card .print { aspect-ratio: 3 / 2; }
.card .entry-date { margin-top: 1.1rem; }
.card h2, .card h3 { font-size: 1.3rem; font-weight: 550; margin: 0 0 .2rem; }
.card h2 a, .card h3 a { color: var(--sepia); text-decoration: none; }
.card h2 a:hover, .card h3 a:hover { text-decoration: underline; }
.card .meta { font-size: .92rem; color: var(--sepia-2); margin: 0; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 4rem; border-top: 1px solid var(--line); padding-top: 1.3rem; }
.pager ol { display: flex; gap: .3rem; list-style: none; margin: 0; padding: 0; }
.pager ol a, .pager ol span { display: grid; place-items: center; min-width: 2.3rem; height: 2.3rem; border-radius: 999px; text-decoration: none; color: var(--sepia); }
.pager ol a:hover { background: var(--paper-2); }
.pager [aria-current="page"] { background: var(--sepia); color: var(--print); }

/* ───────── Reportage ───────── */
.post-head { padding-block: clamp(2.2rem, 6vw, 4.5rem) 1.5rem; }
.crumbs { font-size: .95rem; color: var(--sepia-2); margin-bottom: 1.2rem; }
.crumbs a { color: var(--sepia-2); }
.post-head h1 { font-size: clamp(2.2rem, 5.6vw, 3.9rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.06; margin-bottom: .6rem; }
.post-head .hand { font-size: 1.35rem; }
.prose { font-size: 1.2rem; line-height: 1.75; }
.prose h2 { font-size: 1.55rem; margin-top: 1.8em; }
.prose blockquote { margin: 1.6em 0; padding-left: 1.2em; border-left: 3px solid var(--ochre); font-style: italic; }
.prose strong { font-weight: 650; }
.draft-note { display: inline-block; background: var(--ochre); color: var(--print); padding: .25rem .8rem; border-radius: 999px; font-size: .9rem; margin-bottom: 1rem; }
.edit-link { display: inline-block; margin-top: .8rem; font-size: .95rem; }

.post-videos { display: grid; gap: .6rem; margin-block: 3.5rem 0; }
.yt-link { margin: 0 0 1.2rem; color: var(--sepia-2); }
/* Galleria a scorrimento */
.viewer { max-width: 1240px; margin: 3rem auto 0; padding-inline: clamp(0rem, 2vw, 1.5rem); }
.stage { position: relative; }
.track {
  display: flex; list-style: none; margin: 0; padding: 0;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.track::-webkit-scrollbar { display: none; }
.track:focus-visible { outline-offset: 4px; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; }
.slide a { display: flex; justify-content: center; align-items: center; width: 100%; height: min(76vh, 780px); background: var(--paper-2); cursor: zoom-in; }
.slide img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.slide-cap { margin: .7rem 1rem 0; text-align: center; }
.v-nav {
  position: absolute; top: calc(min(76vh, 780px) / 2); transform: translateY(-50%);
  width: 3.2rem; height: 3.2rem; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(251, 248, 243, .92); color: var(--sepia);
  display: grid; place-items: center; box-shadow: 0 2px 10px rgba(47, 36, 32, .2);
}
.v-nav svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.v-nav:hover { background: var(--print); }
.v-nav[disabled] { opacity: 0; pointer-events: none; }
.v-prev { left: .8rem; }
.v-next { right: .8rem; }
.v-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem clamp(1rem, 2vw, 0rem) .4rem; }
.v-count { font-size: 1.25rem; }
.v-full { font: inherit; font-size: .95rem; background: none; border: 1.5px solid var(--sepia); color: var(--sepia); border-radius: 999px; padding: .35rem 1rem; cursor: pointer; }
.v-full:hover { background: var(--sepia); color: var(--print); }
.thumbs { display: flex; gap: 6px; list-style: none; margin: .4rem 0 0; padding: 4px clamp(1rem, 2vw, 0rem) 10px; overflow-x: auto; scrollbar-width: thin; }
.thumbs button { display: block; padding: 0; border: 0; background: none; cursor: pointer; height: 68px; border-radius: 3px; overflow: hidden; opacity: .55; outline-offset: 2px; transition: opacity .15s; }
.thumbs button:hover { opacity: .9; }
.thumbs button[aria-current] { opacity: 1; outline: 2px solid var(--ink); }
.thumbs img { height: 68px; width: auto; max-width: none; }
@media (max-width: 700px) {
  .slide a { height: min(62vh, 560px); }
  .v-nav { display: none; }
  .thumbs button, .thumbs img { height: 54px; }
}

.adjacent { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 4.5rem; border-top: 1px solid var(--line); padding-top: 1.6rem; }
.adjacent a { text-decoration: none; color: var(--sepia); display: grid; gap: .1rem; }
.adjacent strong { font-size: 1.2rem; font-weight: 550; }
.adjacent a:hover strong { text-decoration: underline; }
.adjacent .next { text-align: right; }
@media (max-width: 600px) { .adjacent { grid-template-columns: 1fr; } .adjacent .next { text-align: left; } }

/* ───────── Libro da sfogliare (corso) ───────── */
.book-head { text-align: center; }
.book-head .book-intro { text-align: left; margin-top: 1.6rem; }
.book { --maxh: min(calc(100vh - 7.5rem), 1400px); --sheet-ratio: 0.75; max-width: 1700px; margin: 2rem auto 0; padding-inline: var(--gutter); }
.book-src { list-style: none; padding: 0; margin: 0 auto; max-width: 900px; display: grid; gap: 2rem; }
.book-src img { width: 100%; }
.book-src p { text-align: center; margin-top: .5rem; }
.book.is-ready .book-src { display: none; }
.book:not(.is-ready) .book-stage, .book:not(.is-ready) .book-controls, .book:not(.is-ready) .book-tools { display: none; }

.book-stage { display: flex; justify-content: center; }
.book-sheet {
  position: relative;
  width: min(100%, calc(var(--maxh) * var(--sheet-ratio)));
  aspect-ratio: var(--sheet-ratio);
  perspective: 2600px;
  cursor: pointer;
  user-select: none;
  touch-action: pan-y;
  /* bordo delle pagine sotto, come lo spessore di un libro */
  filter: drop-shadow(0 18px 28px rgba(47, 36, 32, .18)) drop-shadow(0 2px 3px rgba(47, 36, 32, .15));
}
.pg {
  position: absolute; top: 0; bottom: 0;
  background: var(--print);
  display: flex; flex-direction: column;
  padding: 1.6% 2% 0;
  overflow: hidden;
}
.pg-single { left: 0; right: 0; border-radius: 3px 6px 6px 3px; box-shadow: 3px 3px 0 -1px #efe8df, 6px 6px 0 -2px #e6ddd2; }
.pg-left { left: 0; width: 50%; border-radius: 6px 0 0 6px; box-shadow: -3px 3px 0 -1px #efe8df, -6px 6px 0 -2px #e6ddd2; }
.pg-right { left: 50%; width: 50%; border-radius: 0 6px 6px 0; box-shadow: 3px 3px 0 -1px #efe8df, 6px 6px 0 -2px #e6ddd2; }
/* ombra della rilegatura */
.pg-left::after, .pg-right::after { content: ""; position: absolute; top: 0; bottom: 0; width: 9%; pointer-events: none; }
.pg-left::after { right: 0; background: linear-gradient(to left, rgba(47, 36, 32, .16), transparent); }
.pg-right::after { left: 0; background: linear-gradient(to right, rgba(47, 36, 32, .14), transparent); }
.pg-blank { background: var(--print); }
.pg-in { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.pg-in img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.pg-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; min-height: 2rem; padding: .3rem .4rem .5rem; }
.pg-cap { font-family: var(--hand); color: var(--ink); font-size: 1.05rem; line-height: 1.25; }
.pg-num { font-size: .85rem; color: var(--sepia-2); margin-left: auto; font-variant-numeric: oldstyle-nums; }

.leaf { position: absolute; top: 0; bottom: 0; transform-style: preserve-3d; z-index: 5; will-change: transform; }
.leaf-right { left: 50%; width: 50%; transform-origin: left center; }
.leaf-left { left: 0; width: 50%; transform-origin: right center; }
.leaf-single { left: 0; right: 0; transform-origin: left center; }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face .pg { left: 0; right: 0; width: auto; }
.face-back { transform: rotateY(180deg); }
.face::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(to right, rgba(47,36,32,.10), transparent 30%, transparent 70%, rgba(47,36,32,.10)); }

.book-controls { display: flex; justify-content: center; align-items: center; gap: 1.2rem; margin-top: 1.6rem; }
.bk-btn { width: 3rem; height: 3rem; border-radius: 50%; border: 1.5px solid var(--sepia); background: transparent; color: var(--sepia); cursor: pointer; display: grid; place-items: center; }
.bk-btn:hover { background: var(--sepia); color: var(--print); }
.bk-btn[disabled] { opacity: .3; pointer-events: none; }
.bk-btn svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bk-where { font-size: 1.3rem; min-width: 9ch; text-align: center; }
.book-tools { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.bk-tool { font: inherit; font-size: .95rem; background: none; border: 1.5px solid var(--line); color: var(--sepia); border-radius: 999px; padding: .4rem 1rem; cursor: pointer; }
.bk-tool:hover { border-color: var(--sepia); }

.bk-dialog { border: 0; border-radius: 10px; padding: 0; width: min(92vw, 980px); max-height: 86vh; background: var(--paper); color: var(--sepia); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.bk-dialog::backdrop { background: rgba(47, 36, 32, .55); }
.bk-dialog-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.4rem; background: var(--paper); border-bottom: 1px solid var(--line); z-index: 1; }
.bk-dialog-head h2 { margin: 0; font-size: 1.4rem; font-weight: 550; }
.bk-grid { list-style: none; margin: 0; padding: 1.2rem 1.4rem 1.6rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; }
.bk-grid button { display: grid; gap: .35rem; width: 100%; padding: .5rem; border: 0; border-radius: 6px; background: var(--print); cursor: pointer; text-align: left; font: inherit; color: var(--sepia); }
.bk-grid button:hover { outline: 2px solid var(--ink); }
.bk-grid img { width: 100%; height: 110px; object-fit: contain; background: var(--paper-2); }
.bk-grid span { font-size: .85rem; line-height: 1.3; }

@media (max-width: 700px) {
  .book { --maxh: 70vh; padding-inline: .8rem; }
  .pg { padding: 4% 4% 0; }
}

/* ───────── Libro dei ricordi (album con più foto per pagina) ───────── */
.memories .book-sheet { transition: transform .7s cubic-bezier(.45,.05,.35,1); }
/* libro chiuso: solo la copertina, al centro */
.memories .book-sheet.is-closed { transform: translateX(-25%); }
.pg-void { background: transparent !important; box-shadow: none !important; }
.pg-void::after { display: none; }
/* la copertina */
.pg-cover .rc-page {
  background:
    linear-gradient(to right, rgba(47, 36, 32, .10), transparent 7%),
    radial-gradient(ellipse at 50% 40%, #fdfaf5 0%, var(--print) 60%, #f3ece2 100%);
}
.pg.rc-pg { padding: 0; }
.rc-page {
  position: relative; width: 100%; height: 100%;
  container-type: inline-size;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(195, 138, 46, .07) 100%),
    var(--print);
}
.rc-photo {
  position: absolute; margin: 0;
  background: #fff;
  transform: rotate(var(--rot));
  box-shadow: 0 1px 2px rgba(47, 36, 32, .22), 0 6px 14px -4px rgba(47, 36, 32, .28);
  cursor: zoom-in;
}
.rc-photo img { display: block; width: 100%; height: auto; object-fit: cover; background: var(--paper-2); }
/* nastro adesivo */
.rc-photo::before {
  content: ""; position: absolute; z-index: 1;
  left: 50%; top: 0; width: 34%; aspect-ratio: 3.4;
  transform: translate(-50%, -55%) rotate(var(--tape));
  background: linear-gradient(to bottom, rgba(244, 233, 206, .78), rgba(232, 219, 188, .72));
  box-shadow: 0 1px 2px rgba(47, 36, 32, .12);
  -webkit-mask: linear-gradient(90deg, transparent 0 2%, #000 2% 98%, transparent 98%);
          mask: linear-gradient(90deg, transparent 0 2%, #000 2% 98%, transparent 98%);
}
.rc-photo figcaption {
  position: absolute; left: 3%; right: 3%; bottom: 0;
  height: calc(var(--fw) * .09cqw);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hand); color: var(--ink);
  font-size: calc(var(--fw) * .045cqw); line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rc-num {
  position: absolute; bottom: 1.6%; left: 0; right: 0; text-align: center;
  font-size: 2.6cqw; color: var(--sepia-2); font-variant-numeric: oldstyle-nums;
}
.rc-cover-title {
  position: absolute; left: 10%; right: 10%; top: 7%; margin: 0;
  text-align: center; font-weight: 550; line-height: 1.12;
  font-size: 5.6cqw; color: var(--sepia); text-wrap: balance;
}
.rc-cover.no-photo .rc-cover-title { top: 50%; transform: translateY(-50%); font-size: 7cqw; }
/* l'ultima pagina: la dedica */
.rc-end { display: flex; align-items: center; justify-content: center; }
.rc-dedica {
  width: 76%; font-family: var(--hand); color: var(--ink);
  font-size: 4.3cqw; line-height: 1.45; transform: rotate(-1deg);
}
.rc-dedica p { margin: 0 0 .9em; }
.rc-dedica p:last-child { margin-bottom: 0; text-align: right; }
.memories .rc-dedica-src { max-width: 640px; margin: 2rem auto 0; font-family: var(--hand); color: var(--ink); font-size: 1.3rem; }
.memories.is-ready .rc-dedica-src { display: none; }
.rc-logout { text-align: center; margin: 2.5rem 0 1rem; }
.rc-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.memories-page .book-head { padding-top: 0; margin-bottom: 0; }
.memories-page .book-head:not(:has(a, p)) { display: none; }
.memories-page .book-head + .memories { margin-top: 1.2rem; }
.memories .book-src { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-width: 1100px; }
@media (prefers-reduced-motion: reduce) { .memories .book-sheet { transition: none; } }

/* ───────── Condividi ───────── */
.share { margin: 3.5rem auto 0; padding: 1.4rem 1.5rem 1.5rem; background: var(--paper-2); border-radius: 10px; }
.share-title { font-weight: 600; font-size: 1.15rem; margin: 0 0 .8rem; }
.share-buttons { display: flex; flex-wrap: wrap; gap: .55rem; }
.share-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; font-size: 1.02rem; font-weight: 550;
  padding: .65rem 1.1rem; min-height: 3rem; border-radius: 999px;
  border: 1.5px solid var(--sepia); background: var(--print); color: var(--sepia);
  text-decoration: none; cursor: pointer;
}
.share-btn:hover { background: var(--sepia); color: var(--print); }
.share-btn svg { width: 1.25rem; height: 1.25rem; flex: none; }
.share-native { background: var(--ink); border-color: var(--ink); color: var(--print); }
@media (max-width: 600px) { .share-btn { flex: 1 1 calc(50% - .3rem); justify-content: center; } }

/* ───────── Video leggero ───────── */
.yt { position: relative; aspect-ratio: 16 / 9; background: var(--sepia); border-radius: 4px; overflow: hidden; }
.yt button, .yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; background: none; cursor: pointer; }
.yt img { width: 100%; height: 100%; object-fit: cover; }
.yt .play { position: absolute; inset: 0; display: grid; place-items: center; }
.yt .play span { width: 72px; height: 72px; border-radius: 50%; background: rgba(251, 248, 243, .92); display: grid; place-items: center; box-shadow: 0 4px 18px rgba(0,0,0,.25); }
.yt .play svg { width: 26px; height: 26px; margin-left: 4px; fill: var(--sepia); }
.yt button:hover .play span { background: var(--print); transform: scale(1.05); }

/* ───────── Presentazione e contatti ───────── */
.about { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; padding-top: clamp(2.2rem, 6vw, 4.5rem); }
.about h1 { font-size: clamp(2.3rem, 5.5vw, 3.8rem); font-weight: 500; }
.about .quote { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-style: italic; line-height: 1.35; margin: 0 0 2.4rem; }
.about .quote p { margin-bottom: .4rem; }
.about figure { margin: 0; position: sticky; top: 2rem; }
.about figure .print { aspect-ratio: 4 / 5; }
.about figcaption { text-align: center; margin-top: 1rem; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } .about figure { position: static; order: -1; width: min(80%, 320px); justify-self: center; } }

.social { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.social a { display: inline-flex; gap: .55rem; align-items: center; }
.social svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }

.contact-list { margin: 2.5rem 0 0; border-top: 1px solid var(--sepia); max-width: 44rem; }
.contact-list div { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.contact-list dt { color: var(--sepia-2); }
.contact-list dd { margin: 0; font-size: 1.25rem; }
.contact-list dd .muted { display: block; font-size: .92rem; }
@media (max-width: 560px) { .contact-list div { grid-template-columns: 1fr; gap: .1rem; } }

.search-form { display: flex; gap: .6rem; max-width: 40rem; }
.search-form input { flex: 1; min-width: 0; font: inherit; padding: .7rem 1.1rem; border: 1.5px solid var(--sepia); border-radius: 999px; background: var(--print); color: var(--sepia); }

/* ───────── Piè di pagina ───────── */
.site-foot { margin-top: 7rem; border-top: 1px solid var(--line); background: var(--paper-2); }
.site-foot .cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2rem; padding-block: 3rem 2rem; }
.site-foot .name { font-size: 1.4rem; font-weight: 600; margin-bottom: .2rem; }
.site-foot h2 { font-size: 1rem; font-weight: 600; margin-bottom: .6rem; }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.site-foot .legal { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; font-size: .88rem; color: var(--sepia-2); border-top: 1px solid var(--line); padding-block: 1.2rem 1.8rem; }
.site-foot .legal a { color: inherit; }
@media (max-width: 760px) { .site-foot .cols { grid-template-columns: 1fr; } }

/* ───────── 404 ───────── */
.lost { padding-top: clamp(3rem, 8vw, 6rem); max-width: 46rem; }
.lost h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 500; }

/* ───────── Apertura delle pagine ───────── */
/* ogni pagina entra con una leggera dissolvenza */
main { animation: page-in .5s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* home: il testo compare riga per riga e il ritratto "si appoggia" sul tavolo come una stampa */
.home main { animation: none; }
.hello h1, .hello .lede, .hello .actions { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
.hello .lede { animation-delay: .12s; }
.hello .actions { animation-delay: .24s; }
.hello figure { animation: drop 1s cubic-bezier(.2,.8,.25,1) .15s both; }
.hello figcaption { animation: rise .6s ease .9s both; }
.hello .corners .print-wrap::before, .hello .corners .print-wrap::after { animation: corner-in .4s ease 1s both; }
.home .diary { animation: rise .8s ease .45s both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes drop {
  from { opacity: 0; transform: translate(30px, -40px) rotate(9deg) scale(1.06); }
  60% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
@keyframes corner-in { from { opacity: 0; } to { opacity: .85; } }

/* Chi ha disattivato le animazioni (es. Windows: Accessibilità > Effetti visivi):
   niente movimenti, ma le dissolvenze restano, così la pagina non compare "di colpo" */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  main, .hello h1, .hello .lede, .hello .actions, .hello figure, .hello figcaption, .home .diary,
  .nav.open li { animation-name: fade !important; }
  .picked .pencil-mark path { animation: none !important; }
}
