/* theme/iocero.css: il muro di Io c'ero e il modulo per firmare. Biglietti sul banco, disposti per anno. */
.wall, .bf, .bm-preview { --bg-ombra: rgba(23, 22, 58, .2); }
@media screen and (prefers-color-scheme: dark) { .wall, .bf, .bm-preview { --bg-ombra: rgba(0, 0, 0, .5); } }

.wall-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muro-apertura { max-width: 700px; margin: 0 0 20px; font-size: clamp(19px, 2vw, 21px); line-height: 1.5; }
.muro-apertura p { margin: 0 0 12px; }
.muro-apertura p:last-child { font-family: var(--cond); font-size: 17px; font-weight: 500; line-height: 1.3; color: var(--muted); }

/* Il contatore: tre numeri, senza arrotondare niente */
.wall-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 28px; padding: 12px 0 14px; border-top: 1px solid var(--ink); }
.wall-count { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); gap: 8px 22px; margin: 0; }
.wall-count > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.wall-count dd { margin: 0; font-family: var(--font); font-size: clamp(36px, 5vw, 50px); font-weight: 800; line-height: 1; font-feature-settings: "lnum"; }
.wall-count dt { max-width: 13ch; font-family: var(--cond); font-size: 15px; font-weight: 500; line-height: 1.15; color: var(--muted); }
.wall-write { margin: 0; }
.wall-write .button { display: inline-flex; align-items: center; min-height: 48px; font-size: 19px; }

.wall-places { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--cond); font-size: 17px; font-weight: 500; }
.wall-places a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 12px; border: 1px solid var(--ink); color: inherit; text-decoration: none; }
.wall-places a:hover { background: var(--paper-2); }
.wall-places a[aria-current] { background: var(--ink); color: var(--paper); }
.wall-places small { font-family: var(--mono); font-size: 13px; }

/* La striscia degli anni resta sotto il pollice */
.wall-years { position: sticky; top: var(--muro-sopra, 0); z-index: 20; margin: 14px 0 0; background: var(--paper); border-block: 1px solid var(--ink); }
.wall-years div { position: relative; display: flex; overflow-x: auto; scrollbar-width: none; }
.wall-years div::-webkit-scrollbar { display: none; }
.wall-years a { flex: none; display: flex; align-items: center; min-height: 44px; padding: 0 11px; font-family: var(--mono); font-size: 16px; font-weight: 600; color: inherit; text-decoration: none; }
.wall-years a.empty { font-weight: 400; color: var(--muted); }
.wall-years a[aria-current] { box-shadow: inset 0 -4px 0 var(--red); }
/* chi torna indietro col Tab non deve finire sotto la striscia (WCAG 2.4.11): 46 px di striscia e un po' d'aria.
   Il margine degli anni scende di altrettanto, così i salti agli anni arrivano dove arrivavano */
html:has(.wall-years) { scroll-padding-top: 56px; }

.wall-year { display: grid; gap: 6px 28px; padding: 24px 0 26px; border-bottom: 1px solid var(--line); scroll-margin-top: 2px; }
.wall-year h3 { margin: 0; padding: 0; border: 0; font-family: var(--font); font-size: clamp(48px, 5.4vw, 74px); font-weight: 800; line-height: 1; letter-spacing: -.02em; font-feature-settings: "lnum"; }
.wall-year-empty { align-items: center; padding-block: 12px; }
.wall-year-empty h3 { font-size: 30px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.wall-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 22px 20px; margin: 10px 0 0; padding: 0; list-style: none; }
.wall-row > li { margin: 0; min-width: 0; }
@media (min-width: 900px) {
  .wall-year { grid-template-columns: 176px minmax(0, 1fr); }
  .wall-year h3 { position: sticky; top: 56px; align-self: start; }
  .wall-year-empty h3 { position: static; }
  .wall-row { margin-top: 0; }
}

/* Il biglietto. Firmato: carta chiara e filo d'inchiostro. Dalla stampa: ritaglio, più sottile, col timbro */
.bg { display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 210px; padding: 13px 16px 11px; background: var(--field); color: var(--ink); border: 1px solid var(--ink); box-shadow: 3px 4px 0 var(--bg-ombra); }
.wall-row > li:nth-child(4n + 1) .bg { rotate: -.7deg; }
.wall-row > li:nth-child(4n + 2) .bg { rotate: .5deg; }
.wall-row > li:nth-child(4n + 3) .bg { rotate: -.3deg; }
.wall-row > li:nth-child(4n) .bg { rotate: .8deg; }
.bg-press { background: var(--paper); border-color: var(--line); box-shadow: 2px 2px 0 var(--bg-ombra); }
.bg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.bg-place { margin: 0; font-family: var(--cond); font-size: 15px; font-weight: 700; letter-spacing: .07em; line-height: 1.2; text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
.bg-stamp { flex: none; margin: 0; padding: 1px 7px; border: 2px solid var(--red); color: var(--red); font-family: var(--cond); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; rotate: -2.5deg; }
.bg-text { margin: 0; padding: 0; border: 0; background: none; font-family: var(--font); font-size: 21px; font-style: normal; line-height: 1.32; }
.bg-text p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.bg-press .bg-text { font-size: 20px; font-style: italic; }
.bg-foot { margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); font-family: var(--cond); font-size: 15px; line-height: 1.25; }
.bg-foot p { margin: 0; }
.bg-name { font-family: var(--font); font-size: 18px; font-style: italic; font-weight: 600; overflow-wrap: anywhere; }
.bg-name span { display: block; font-family: var(--cond); font-size: 15px; font-style: normal; font-weight: 500; color: var(--muted); }
.bg-note { margin-top: 4px !important; color: var(--muted); }
.bg-source a { display: inline-block; padding: 7px 0 3px; color: inherit; font-weight: 500; text-underline-offset: 2px; }
.bg-source a:visited { color: var(--visited); }
.bg-key { display: flex; align-items: center; gap: 8px; margin-top: 4px !important; color: var(--muted); }
.bg-key code { font-family: var(--mono); font-size: 14px; color: var(--ink); background: none; white-space: nowrap; }
.bg-print { flex: none; color: var(--ink); }
.bg-print circle { fill: none; stroke: currentColor; stroke-width: 1.15; stroke-linecap: round; }

/* Il posto vuoto: non finge, chiede */
.wall-missing { margin: 0; }
.wall-missing a { display: flex; align-items: center; justify-content: center; min-height: 48px; height: 100%; padding: 8px 14px; border: 1px dashed var(--muted); color: var(--muted); font-family: var(--cond); font-size: 17px; font-weight: 500; text-align: center; text-decoration: none; }
.wall-missing a:hover { border-color: var(--ink); background: var(--field); color: var(--ink); }
.wall a:focus-visible, .bf a:focus-visible, .bf button:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .wall-row .bg { transition: rotate .18s ease-out, box-shadow .18s ease-out; }
  .wall-row > li:hover .bg, .wall-row .bg:focus-within { rotate: 0deg; box-shadow: 5px 6px 0 var(--bg-ombra); }
}

/* Il modulo è il biglietto: si scrive sulla carta */
.bf { max-width: 640px; }
.bf-card { height: auto; min-height: 0; gap: 14px; padding: 16px 16px 14px; }
.bf-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 14px; }
.bf-field { margin: 0; min-width: 0; }
.bf-field label { display: block; font-family: var(--cond); font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bf-field input, .bf-field select, .bf-field textarea { display: block; width: 100%; min-height: 44px; padding: 7px 0; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink); font-family: var(--font); font-size: 20px; }
.bf-text textarea { min-height: 230px; padding: 8px 10px; border: 1px solid var(--ink); font-size: 21px; line-height: 1.34; resize: vertical; }
.bf-name input { font-style: italic; font-weight: 600; }
.bf-field small { display: block; margin-top: 5px; font-family: var(--cond); font-size: 15px; font-weight: 500; line-height: 1.25; color: var(--muted); }
.bf-field small.short { color: var(--red); font-weight: 700; }
.bf-field input:focus, .bf-field select:focus, .bf-field textarea:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.bf-sign { margin: 20px 0 0; padding: 0; border: 0; }
.bf-sign legend { padding: 0; font-family: var(--font); font-size: 22px; font-weight: 700; }
.bf-choice { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; padding: 11px 12px; border: 1px solid var(--line); font-size: 17px; line-height: 1.3; cursor: pointer; }
.bf-choice input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--red); }
.bf-choice b { display: block; font-size: 19px; }
.bf-choice:has(input:checked) { border-color: var(--ink); background: var(--field); }
.bf-choice:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 2px; }
.bf-email { margin-top: 12px; }
.bf-sign:has(input[value="wallet"]:checked) .bf-email { display: none; }
.bf-send { margin: 18px 0 8px; }
.bf-send .button { min-width: 180px; min-height: 50px; font-size: 20px; }
.bf-note { max-width: 640px; margin: 8px 0; font-family: var(--cond); font-size: 16px; font-weight: 500; line-height: 1.3; color: var(--muted); }
.bf-note a { color: inherit; }

/* Dopo la firma */
.bm-sign { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 460px; margin: 0 0 26px; }
.bm-sign p { margin: 0; }
.bm-sign .button { display: inline-flex; align-items: center; min-height: 48px; }
.bm-preview { max-width: 520px; margin: 0 0 26px; }
.bm-preview .bg { min-height: 0; height: auto; }
.bm-tuo { max-width: 620px; padding-top: 10px; border-top: 1px solid var(--ink); }
.bm-tuo h2 { margin: 0 0 6px; padding: 0; border: 0; font-size: 24px; }
.bm-tuo p { margin: 0 0 12px; font-size: 18px; line-height: 1.4; }
.bm-tuo small { display: block; margin-top: 6px; font-family: var(--cond); font-size: 15px; color: var(--muted); }
.bm-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; max-width: 760px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.bm-row .bm-preview { flex: 1 1 280px; margin: 0; }
.bm-state { margin: 0 0 4px; font-family: var(--cond); font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--red); }
.bm-text { margin: 0; font-size: 18px; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; }

@media print {
  .wall-places, .wall-years, .wall-missing, .wall-write, .wall-year-empty, .bm-tuo { display: none !important; }
  .wall-year { display: block; padding: 8px 0; }
  .wall-year h3 { position: static; font-size: 28px; break-after: avoid; }
  .wall-row { display: block; margin: 4px 0 0; }
  .wall-row > li { margin-bottom: 8px; break-inside: avoid; }
  .wall-row .bg, .bg { height: auto; min-height: 0; padding: 6px 8px; border: 1px solid #000; box-shadow: none; rotate: 0deg !important; background: none; }
  .bg-stamp { border-width: 1px; rotate: 0deg; }
  .bg-text, .bg-press .bg-text { font-size: 13pt; }
  .bg-source a::after { content: " " attr(href); font-size: 9pt; overflow-wrap: anywhere; }
}
