/* The scale comes from the printed window. Editable copy only affects the
   space a row needs, never the type or cover size assigned to its position. */
.window-heading { display:contents }
.window-heading,.label,.footbrand,.buy a {overflow-wrap:anywhere}
.blurb {white-space:pre-line}
.empty-cover {display:grid;place-items:center;aspect-ratio:2/3;text-align:center;padding:12%;background:#5f1721;color:#fff1d7;font:italic clamp(20px,2.1cqw,42px)/1.1 var(--serif)}
.opening:is(.carta,.congedo) .mast {border-color:#65453170}
.opening:is(.carta,.congedo) :is(.brand,.season) {color:var(--ink);text-shadow:none}
.opening:is(.carta,.congedo) .season b {color:#7a381c}
.brand,.season {min-width:0;white-space:normal;overflow-wrap:anywhere}
.season {text-align:right}
footer {overflow-wrap:anywhere}

@media (min-width:921px) and (min-height:541px), (min-width:1025px) {
  .scene {container-type:inline-size}
  /* Five bands reproduce the original offsets. Their minimum heights leave
     the poster intact; longer copy can increase the relevant band. */
  .scene .stage {
    --u:min(1cqw,17.8px);
    --intro:4.65; --one:7.5; --two:21; --three:38.5; --end:65;
    --x1:49; --w1:15.5; --c1:25.5; --t1:6deg;
    --x2:7; --w2:16.8; --c2:21; --t2:-5deg;
    --x3:50.7; --w3:13.2; --c3:24.5; --t3:-7deg;
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    grid-template-rows:
      minmax(calc(var(--intro)*var(--u)),auto)
      minmax(calc((var(--one) - var(--intro))*var(--u)),auto)
      minmax(calc((var(--two) - var(--one))*var(--u)),auto)
      minmax(calc((var(--three) - var(--two))*var(--u)),auto)
      minmax(calc((var(--end) - var(--three))*var(--u)),auto);
    aspect-ratio:auto;align-items:start;
  }
  .bosco .stage {
    --one:8.8; --two:24.3; --three:42.5; --end:66;
    --x1:48.7; --w1:16.5; --c1:24.7;
    --x2:5.5; --w2:14.7;
    --x3:50.2; --w3:13.7; --c3:23; --t3:-5deg;
  }
  .tavolo .stage {
    --one:8.8; --two:22.8; --three:40.8;
    --x1:49.8; --w1:15.8; --c1:24.6;
    --x2:6.3; --w2:15.4; --c2:21.6; --t2:-7deg;
    --x3:49.2; --w3:15; --c3:23.9; --t3:-6deg;
  }
  .congedo .stage {
    --one:9.7; --two:25; --three:40.8; --end:54;
    --x1:51.5; --w1:15.8; --c1:22.5;
    --x2:6.8; --w2:15.5; --c2:23.6; --t2:-6deg;
    --x3:50.5; --w3:14; --c3:24; --t3:5deg;
  }
  .congedo .stage:has(>.book:nth-of-type(3)) {--end:66}
  .opening .stage {
    --intro:9.2; --one:17.3; --two:35.2; --three:41.4; --end:66;
    --x1:37.9; --w1:17.5; --c1:25.6; --t1:4deg;
    --x2:5.5; --w2:13.8; --c2:15.6; --t2:-6deg;
    --x3:59.3; --w3:12.5; --c3:21.8; --t3:6deg;
  }
  .stage>.mast {position:static;grid-column:1/-1;grid-row:1;margin-inline:4.2%;height:auto;min-height:max(58px,6.5cqw);gap:1rem}
  .window-heading {display:block;grid-column:1;grid-row:2/4;min-width:0;margin-left:5.4cqw;width:38cqw;margin-bottom:2cqw}
  .opening .window-heading {margin-left:4.5cqw;width:32cqw}
  .window-heading .lead,.window-heading .chapter {position:static;width:auto}
  .window-heading .lead+.chapter {margin-top:.5em}
  .stage>.book {position:relative;inset:auto;grid-column:1/-1;justify-self:start;align-self:start;width:max-content;max-width:100%;min-width:0;margin-left:calc(var(--x)*1cqw);margin-bottom:1.1cqw}
  .book:nth-of-type(1) {--x:var(--x1);--w:var(--w1);--caption:var(--c1);--tilt:var(--t1);grid-row:3/5}
  .book:nth-of-type(2) {--x:var(--x2);--w:var(--w2);--caption:var(--c2);--tilt:var(--t2);grid-row:4/6}
  .book:nth-of-type(3) {--x:var(--x3);--w:var(--w3);--caption:var(--c3);--tilt:var(--t3);grid-row:5}
  .stage>.book:nth-of-type(n+4) {grid-row:var(--extra-row);grid-column:1;--x:5.5;--w:14.7;--caption:22;--tilt:-5deg;margin-block:2.2cqw 3.5cqw}
  .stage>.book:nth-of-type(n+4):nth-of-type(odd) {grid-column:2;--x:1;--w:15;--caption:24;--tilt:5deg}
  .binding img {max-height:calc(var(--w)*1.8cqw);object-fit:contain}
  .empty-scene .stage {display:block;padding-block:2cqw}
  .empty-scene .window-heading {padding-block:2cqw}
}

@media (max-width:920px), (max-width:1024px) and (max-height:540px) {
  /* Preserve the original mobile cut, including alternating covers and
     heading sizes, regardless of the saved order or section length. */
  .opening .stage {padding-top:0}
  .stage>.book {--tilt:4deg}
  .stage>.book:nth-of-type(even) {--tilt:-5deg}
  .binding img {max-height:calc(var(--art)*1.8);object-fit:contain}
}

@media (max-width:920px), (max-width:1024px) and (max-height:540px) {
  .book .blurb {font-size:1rem;line-height:1.5}
  .book .author {font-size:.9375rem;line-height:1.4}
  .buy {display:flex;align-items:center;flex-wrap:wrap;gap:4px 14px}
  .buy a, footer a {
    display:inline-flex;align-items:center;min-height:46px;min-width:46px;
    max-width:100%;margin:0;padding-block:5px;font-size:1rem;line-height:1.3;
  }
  .buy a {
    background:none;text-decoration:underline;text-decoration-thickness:1px;
    text-underline-offset:.2em;overflow-wrap:anywhere;
  }
}
@media (max-width:520px) {
  .book, .vetrina .book:first-of-type {
    --art:clamp(102px,31vw,154px);
    display:grid;grid-template-columns:var(--art) minmax(0,1fr);
    grid-template-areas:"cover info" "description description" "purchase purchase";
    gap:0 clamp(18px,5vw,26px);width:100%;
  }
  .book:nth-of-type(even) {
    grid-template-columns:minmax(0,1fr) var(--art);
    grid-template-areas:"info cover" "description description" "purchase purchase";
  }
  .book .binding {grid-area:cover;align-self:center}
  .book .label {display:contents}
  .label::before {display:none}
  .book-meta {grid-area:info;min-width:0;align-self:center}
  .book .kind {line-height:1.1;margin-bottom:.32em}
  .book h2 {line-height:1.07}
  .book .blurb {grid-area:description;max-width:42ch;margin:.95rem 0 0}
  .book .buy {grid-area:purchase;margin:.6rem 0 0}
  .buy .main-buy {
    padding:8px 14px;border-radius:4px;background:#ffebc7;color:#421319;
    text-decoration:none;text-align:left;
  }
  .carta .buy .main-buy, .congedo .buy .main-buy {background:#592131;color:#fff5dc}
  .buy .alt-buy {padding-inline:2px}
  .vetrina {
    --shade:linear-gradient(180deg,#35080947 0%,#4208083d 30%,#51090b 55%,transparent 78%),
      linear-gradient(22deg,#68171b 4%,#31080730 55%);
  }
  .bosco {--shade:linear-gradient(90deg,#10251cce,#10251c9c)}
  .tavolo {--shade:linear-gradient(90deg,#241007df,#2e130cba)}
  .carta,.congedo {--shade:linear-gradient(100deg,#faefd5d6,#faefd5aa)}
}
@media (max-width:355px) {
  .vetrina .stage {gap:1.75rem}
}
@media (min-width:540px) and (max-width:1024px) and (max-height:540px) and (orientation:landscape) {
  .opening .stage {gap:1.25rem}
  .opening .stage .mast {min-height:54px}
  .opening .mast .bv-dog {width:48px}
  .opening .mast .bv-name {width:170px}
  .opening .lead {font-size:clamp(44px,6vw,54px);line-height:.96}
  .opening .chapter {font-size:clamp(37px,5vw,45px)}
  .book, .vetrina .book:first-of-type {--art:clamp(118px,17vw,154px)}
}
