/* Tuttle Edizioni - riquadri della home (usato anche dall'anteprima del pannello) */
.tiles {
  --t-gap: 1px;
  --t-default: #ecebe7;
  --t-ink: #000000;
  --t-focus: #b3261e;
  --t-serif: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", "P052", Georgia, serif;
  container-type: inline-size;
  container-name: tiles;
  font-family: var(--t-serif);
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tiles { --t-default: #2a2a28; --t-ink: #f2f2f0; --t-focus: #ef6b62; }
}
:root[data-theme="dark"] .tiles { --t-default: #2a2a28; --t-ink: #f2f2f0; --t-focus: #ef6b62; }
.tiles *, .tiles *::before, .tiles *::after { box-sizing: border-box; }
.tiles .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tiles__rows { display: flex; flex-direction: column; gap: var(--t-gap); }
/* una riga: da 1 a 4 riquadri larghi uguali e alti uguali; sul computer l'altezza è fissa (HomeTiles::DESK_HEIGHTS) */
.tiles__row { display: flex; gap: var(--t-gap); height: var(--row-h); }
.tiles__row.h-thin   { --row-h: 90px; --row-h-m: 90px; }  /* Sottile: 90 px fissi, anche sul telefono */
.tiles__row.h-low    { --row-h: 194px; --row-h-m: 48cqw; }
.tiles__row.h-medium { --row-h: 285px; --row-h-m: 70cqw; }
.tiles__row.h-high   { --row-h: 389px; --row-h-m: 95cqw; }
.tiles__row > .tile { flex: 1 1 0; min-width: 0; }
/* schermi piccoli: uno sotto l'altro */
@container (max-width: 640px) {
  .tiles__row { flex-direction: column; height: auto; }
  .tiles__row > .tile { flex: none; height: var(--row-h-m); }
}

.tile { position: relative; overflow: hidden; container-type: inline-size; background: var(--tile-bg, var(--t-default)); color: var(--tile-fg, var(--t-ink)); min-width: 0; }

/* il link copre tutto il riquadro; i link nel testo restano cliccabili sopra */
.tile { cursor: default; }
.tile.has-link { cursor: pointer; }
.tile__link { position: absolute; inset: 0; z-index: 2; }
.tile__body a { position: relative; z-index: 3; color: inherit; cursor: pointer; }
.tile:has(.tile__link:focus-visible) { outline: 2px solid var(--t-focus); outline-offset: 3px; }
.tile__link:focus-visible { outline: none; }

.tile { display: flex; flex-direction: column; }
.tile__media { position: relative; overflow: hidden; }
.tile__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* l'immagine occupa sempre tutta la larghezza del suo spazio, senza deformarsi:
   se ha proporzioni diverse viene rifilata (le copertine dall'alto, così la testata resta visibile) */
.tile__media img { object-fit: cover; object-position: center; }
.is-product .tile__media img { object-position: center top; }
/* la foto ha sempre la misura che ha con la pagina larga (1296 px di contenuto):
   stringendo la pagina non si rimpicciolisce, resta centrata e viene tagliata ai lati */
.tiles__row[data-count="1"] { --tile-wmax: 1296px; }
.tiles__row[data-count="2"] { --tile-wmax: calc((1296px - 1px) / 2); }
.tiles__row[data-count="3"] { --tile-wmax: calc((1296px - 2px) / 3); }
.tiles__row[data-count="4"] { --tile-wmax: calc((1296px - 3px) / 4); }
.tile__media img { position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  height: 100%; width: max(100%, var(--tile-wmax, 100%)); max-width: none; }
/* sul telefono i riquadri sono a tutta larghezza: la foto occupa il riquadro */
@container tiles (max-width: 640px) { .tile__media img { width: 100%; } }

/* testo */
.tile__text { position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: min(3cqi, 14px); }
.tile__headline { margin: 0; font-weight: normal; font-size: clamp(1.05rem, 6.2cqi, 2.4rem); line-height: 1.06; letter-spacing: -.01em; text-wrap: balance; }
.tile__sub { margin: .15em 0 0; font-size: clamp(.82rem, 3.8cqi, 1.15rem); line-height: 1.3; font-style: italic; opacity: .82; }
.tile__body { margin-top: .35em; font-size: clamp(.82rem, 3.6cqi, 1.05rem); line-height: 1.42; max-width: 62ch; overflow: hidden; }
.tile__body > :first-child { margin-top: 0; }
.tile__body > :last-child { margin-bottom: 0; }
.tile__body p { margin: 0 0 .5em; }
.tile__body h2, .tile__body h3, .tile__body h4 { margin: .35em 0 .15em; font-weight: normal; line-height: 1.15; color: inherit; }
.tile__body h2 { font-size: 1.4em; } .tile__body h3 { font-size: 1.2em; } .tile__body h4 { font-size: 1em; font-weight: bold; margin-bottom: 0; line-height: 1.4; }
.tile__body ul, .tile__body ol { margin: 0 0 .5em; padding-left: 1.2em; }
.tile__body li { margin: 0; }
.tile__body blockquote { margin: .2em 0 .5em; padding-left: .7em; border-left: 2px solid currentColor; }
.tile__price { margin: .35em 0 0; font-size: clamp(.82rem, 3.6cqi, 1.05rem); font-variant-numeric: lining-nums tabular-nums; }
.tile__more { margin: 0; padding-top: .35em; font-size: clamp(.82rem, 3.6cqi, 1.05rem); font-style: italic; }
.tile__more span, .tile__more a { text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }

/* immagine sopra o sotto, alta metà riquadro */
.l-image-top .tile__media, .l-image-bottom .tile__media { flex: 0 0 50%; }
.l-image-top .tile__text, .l-image-bottom .tile__text { flex: 1 1 50%; padding: min(1.2cqi, 6px) min(2.2cqi, 10px); }
.l-image-top .tile__media:only-child, .l-image-bottom .tile__media:only-child { flex-basis: 100%; }

/* immagine a tutto riquadro, testo sopra l'immagine */
.l-image-full .tile__media { position: absolute; inset: 0; }
.l-image-full .tile__text { margin-top: auto; z-index: 1; padding-top: min(10cqi, 56px);
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,.62)); text-shadow: 0 1px 2px rgba(0,0,0,.35); }

/* solo testo: il titolo è più grande */
.l-text .tile__text { flex: 1 1 auto; padding: min(3.5cqi, 18px); }
.l-text .tile__headline { font-size: clamp(1.25rem, 8.5cqi, 3.6rem); line-height: 1.02; letter-spacing: -.015em; }
.l-text .tile__body { margin-top: .5em; }
.l-text .tile__more { margin-top: 0; }
/* il testo parte sempre dall'alto del suo spazio */
.tile__text { justify-content: flex-start; }
/* dove si vede il riquadro (pannello → riquadro → "Mostra su": Telefono, Computer, Full screen);
   una riga rimasta senza riquadri sparisce del tutto */
@container tiles (max-width: 640px) {
  .tile.hide-mobile { display: none; }
  .tiles__row:not(:has(> .tile:not(.hide-mobile))) { display: none; }
}
@container tiles (min-width: 641px) and (max-width: 1295px) {
  .tile.hide-desktop { display: none; }
  .tiles__row:not(:has(> .tile:not(.hide-desktop))) { display: none; }
}
@container tiles (min-width: 1296px) {
  .tile.hide-wide { display: none; }
  .tiles__row:not(:has(> .tile:not(.hide-wide))) { display: none; }
}
/* se il testo è più lungo dello spazio, viene tagliato in fondo (si vede nell'anteprima del pannello) */
.tile__text > * { flex-shrink: 0; }
