/* =========================================================
   METROMILANO – header + home a tutto schermo (Center Row)
   Sostituisce completamente il CSS precedente.
   ========================================================= */

:root {
  --mm-gutter: 10vw;          /* margine laterale di logo, menu e testo */
}

body { 
overflow-x: hidden; 
background-color: black;
}  /* evita la barra orizzontale dei 100vw */

/* ---------- HEADER (tutte le pagine) ---------- */

#wrap > header {
  background: black;
position:relative;
margin-top: 30px;
}

#wrap > header h1 {
  margin-top: 0;
  margin-bottom: 10px;
}

#wrap > header #search-container {
  display: none;
}

#wrap > header .site-title {
  margin: 0;
  text-align: left;
}

#wrap > header .site-title img {
  display: block;
  max-height: 55px;
  width: auto;
}

/* annulla bordi e distribuzione del menu di Center Row */
#wrap > header nav .navigation {
  border: 0;
  margin: 0;
  padding: 0;
}

#wrap > header nav li {
  margin: 0;
}

#wrap > header nav .navigation > li > a {
  color: #fff;
  font-family: "Lato", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

#wrap > header nav .navigation > li > a:hover,
#wrap > header nav .navigation > li.active > a {
  border-bottom-color: red;
}

@media screen and (min-width: 641px) {
  /* header a tutta larghezza, fuori dal contenitore di 1100px */
  #wrap > header {
    position: relative;
    left: 50%;
    width: 100vw;
    margin-left: -50vw;
    box-sizing: border-box;
    padding: 10px var(--mm-gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }

  #wrap > header nav {
    margin-left: auto;
  }

  #wrap > header nav .navigation {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
  }
}

@media screen and (max-width: 640px) {
  #wrap > header {
    margin: 0 -24px;
    padding: 15px 0 0;
  }

  #wrap > header h1 {
    margin-bottom: 0;
  }

  #wrap > header .site-title img {
    margin: 0 auto;
    max-height: 44px;
  }

  /* menu su una riga sola, scorrevole in orizzontale */
  #wrap > header nav {
    width: 100%;
    min-width: 0;
  }

  #wrap > header nav .navigation {
    display: flex;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    gap: 24px;
    margin: 8px 0 0 !important;
    padding: 6px 20px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;                 /* nasconde la barra (Firefox) */
    /* sfumatura a destra: fa capire che si può scorrere */
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
            mask-image: linear-gradient(to right, #000 85%, transparent);
  }

  #wrap > header nav .navigation::-webkit-scrollbar {
    display: none;                         /* nasconde la barra (Chrome, Safari) */
  }

  #wrap > header nav .navigation > li {
    flex: 0 0 auto;                        /* le voci non si restringono */
  }
}

/* ---------- REGOLE GENERALI ---------- */
#content {
  background-color: white;
}

.block.block-pageTitle {
  padding-left: 1em;
}

.block.block-html {
  padding: 1em;
}

/* ---------- HOME: apertura a tutto schermo con dissolvenza ---------- */

/* header trasparente sopra le foto (solo desktop) */
@media screen and (min-width: 641px) {
  .site-page-home #wrap > header {
    position: absolute;
    top: 0;
    z-index: 10;
    background: transparent;
  }

  .site-page-home #wrap > header nav .navigation > li > a {
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  }
}

.site-page-home #content {
  margin-top: 0;
  background: transparent;
}

/* il blocco HTML diventa l'apertura a tutto schermo */
.site-page-home .block.block-html {
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  width: 100vw;
  min-height: 100vh;
  margin: 0 0 0 calc(50% - 50vw);
  padding: 160px var(--mm-gutter, 10vw) 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #111;
}

/* foto dietro al testo:
   il primo div del blocco è il contenitore, i div al suo interno sono le foto */
.site-page-home .block.block-html > div:first-child {
  position: absolute;
  inset: 0;
  z-index: 0;
  font-size: 0;            /* nasconde gli   inseriti dall'editor */
}

.site-page-home .block.block-html > div:first-child > div {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  animation: mm-fade 20s infinite;      /* 3 foto x 6 secondi */
}

/* le tre foto: metti qui gli indirizzi degli asset */
.site-page-home .block.block-html > div:first-child > div:nth-child(1) {
  background-image: url("https://iiif.arc.usi.ch/iiif/3/215/full/1920,/0/default.jpg");
}

.site-page-home .block.block-html > div:first-child > div:nth-child(2) {
  background-image: url("https://iiif.arc.usi.ch/iiif/3/135/full/1920,/0/default.jpg");
  animation-delay: 5s;
}

.site-page-home .block.block-html > div:first-child > div:nth-child(3) {
  background-image: url("https://iiif.arc.usi.ch/iiif/3/214/full/1920,/0/default.jpg");
  animation-delay: 10s;
}

.site-page-home .block.block-html > div:first-child > div:nth-child(4) {
  background-image: url("https://iiif.arc.usi.ch/iiif/3/275/full/1920,/0/default.jpg");
  animation-delay: 15s;
}

@keyframes mm-fade {
  0%   { opacity: 0; transform: scale(1); }
  7.5%   { opacity: 1; }
  25%  { opacity: 1; }
  32.5%  { opacity: 0; transform: scale(1.06); }
  100% { opacity: 0; transform: scale(1.06); }
}

/* velatura per leggere il testo */
.site-page-home .block.block-html::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.2) 60%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
}

/* testo di presentazione */
.site-page-home .block.block-html p {
  position: relative;
  z-index: 2;
  max-width: 540px;
  margin: 0;
  color: #fff;
  font-family: "Lato", sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.45;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

/* freccia "scorri giù" */
.site-page-home .block.block-html::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 36px;
  z-index: 2;
  width: 16px;
  height: 16px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translateX(-50%) rotate(45deg);
  pointer-events: none;
}

/* telefono: apertura più bassa, testo in basso */
@media screen and (max-width: 640px) {
  .site-page-home .block.block-html {
    min-height: 75vh;
    padding: 40px 20px 80px;   /* 80px in basso lasciano spazio alla freccia */
    justify-content: flex-end;
  }

  .site-page-home .block.block-html::before {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.75) 100%);
  }

  .site-page-home .block.block-html p {
    font-size: 17px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  }

  .block.block-browsePreview {
    margin-top: 0;
  }
}

/* chi ha chiesto meno animazioni vede solo la prima foto */
@media (prefers-reduced-motion: reduce) {
  .site-page-home .block.block-html > div:first-child > div {
    animation: none;
  }
  .site-page-home .block.block-html > div:first-child > div:first-child {
    opacity: 1;
  }
}

/*--------------------------- BROWSE PREVIEW ------------------------------*/

/* sezione a tutta larghezza su fondo scuro */
.block-browsePreview {
  padding: 80px 40px 96px;
  box-sizing: border-box;
  background: black;
  color: #fff;
}

/* a tutta larghezza solo nella home, dove la colonna è centrata */
.site-page-home .block-browsePreview,
.site-page-lotti-di-costruzione .block-browsePreview {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 80px var(--mm-gutter, 10vw) 96px;
}

.site-page-home .preview-block.browse > a {
display: none;
}

.preview-block.browse h2 {
  color: white;
}
 
/* titolo della sezione */
.block-browsePreview h2 {
  text-align: center;
  font-family: "Crimson Text", Georgia, serif;
  font-size: 44px;
  font-weight: 400;
  line-height: 1.1;
}
 
.block-browsePreview h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin: 20px auto 0;
  background: #e30613;
}
 
/* griglia */
.block-browsePreview .resource-list {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
 
@media screen and (max-width: 1100px) {
.block-browsePreview .resource-list {
    grid-template-columns: repeat(3, 1fr);
  }
}
 
@media screen and (max-width: 800px) {
 .block-browsePreview .resource-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
 
@media screen and (max-width: 480px) {
.block-browsePreview {
    padding: 56px 16px 64px;
  }
.block-browsePreview .resource-list {
    grid-template-columns: 1fr;
  }
}
 
/* piastrella */
.block-browsePreview .resource-list > li {
  position: relative;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  border: 0 !important;
  overflow: hidden;
  background: #222;
}
 
.block-browsePreview .resource-link {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
}
 
/* immagine a riempire la piastrella */
.block-browsePreview .resource-link img.thumbnail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.05);
  transition: transform 0.6s ease, filter 0.6s ease;
}
 
/* sfumatura scura in basso per leggere il testo */
.block-browsePreview .resource-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.25) 45%, rgba(0, 0, 0, 0) 70%);
  transition: background 0.4s ease;
}
 
/* piastrelle senza immagine: fondo a righe */
.block-browsePreview .resource-link:not(:has(img)) {
  background: repeating-linear-gradient(135deg, #1b1b1b 0 12px, #222 12px 24px);
}
 
/* titolo del lotto */
.block-browsePreview .resource-name {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 52px;
  z-index: 2;
  font-family: "Crimson Text", Georgia, serif;
  font-size: 28px;
  line-height: 1.1;
  color: #fff;
}
 
/* descrizione (vie e piazze) */
.block-browsePreview .resource-list > li .description {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  z-index: 2;
  margin: 0;
  font-family: "Lato", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
 
/* linea rossa che compare al passaggio del mouse */
.block-browsePreview .resource-list > li::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  width: 100%;
  height: 4px;
  background: #e30613;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
  pointer-events: none;
}
 
/* hover e focus da tastiera */
.block-browsePreview .resource-list > li:hover img.thumbnail,
.block-browsePreview .resource-list > li:focus-within img.thumbnail {
  transform: scale(1.06);
  filter: grayscale(0%) contrast(1);
}
 
.block-browsePreview .resource-list > li:hover .resource-link::after,
.block-browsePreview .resource-list > li:focus-within .resource-link::after {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0.1) 100%);
}
 
.block-browsePreview .resource-list > li:hover::after,
.block-browsePreview .resource-list > li:focus-within::after {
  transform: scaleX(1);
}
 
.block-browsePreview .resource-link:focus-visible {
  outline: 2px solid #e30613;
  outline-offset: -2px;
}
 
/* link "Browse all" come pulsante */
.block-browsePreview .resource-list + a {
  display: table;
  margin: 48px auto 0;
  padding: 14px 32px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  font-family: "Lato", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.3s, border-color 0.3s;
}
 
.block-browsePreview .resource-list + a:hover,
.block-browsePreview .resource-list + a:focus-visible {
  background: #e30613;
  border-color: #e30613;
}

.block-browsePreview .resource-list {
  border: 0 !important;
}
 
/* chi preferisce meno animazioni */
@media (prefers-reduced-motion: reduce) {
.block-browsePreview * {
    transition: none !important;
  }
}

resource-list preview grid resource-count-12 {
border-color: black;
}

/* =========================================
   PAGINA ITEM: Mirador a tutto schermo
   ========================================= */

/* nasconde il titolo "Lotto 1" e la riga "Contenuto" */
body.item.show #content > h2,
body.item.show #content > h3 {
  display: none;
}

/* niente spazi sopra il viewer */
body.item.show #content {
  margin-top: 0;
  padding-top: 0;
}

body.item.show #wrap {
  padding-bottom: 0;
}

/* viewer a tutta larghezza, fuori dal contenitore di 1100px */
body.item.show .block-mirador {
  width: 100vw;
  margin: 0 0 0 calc(50% - 50vw);
  padding: 0;
}

/* viewer alto quanto lo schermo, meno l'header */
body.item.show .block-mirador .mirador.viewer,
body.item.show .block-mirador .mirador.viewer > .fullscreen {
  height: 85vh !important;
}

/* nasconde Mirador nelle pagine di elenco (sfoglia item e collezioni) */
body.browse .mirador.viewer {
  display: none;
}

@media screen and (max-width: 640px) {
  body.item.show .block-mirador .mirador.viewer {
    height: 80vh !important;
  }
}


/*  MIRADOR */
/* ogni miniatura larga quanto la colonna */
.mirador-companion-area-far-right .mirador-thumbnail-nav-container {
  width: calc(100% - 16px) !important;
}

.mirador-companion-area-far-right .mirador-thumbnail-nav-canvas,
.mirador-companion-area-far-right .mirador-thumbnail-nav-canvas > div {
  width: 100%;
}

/* l'immagine riempie la larghezza: niente spazi vuoti sopra e sotto */
.mirador-companion-area-far-right .mirador-thumbnail-nav-canvas img {
  width: 100% !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  display: block;
}

@media screen and (max-width: 640px) {
  .block-browsePreview .resource-list {
    margin: 0 !important;
  }
  .block-browsePreview .resource-list > li {
    display: block !important;
  }
  .block-browsePreview .resource-link {
    width: 100%;
  }
}

@media screen and (max-width: 640px) {
  .mirador-companion-area-far-right {
    display: none !important;
  }
}


/* -------------------------- IN TRANSITO -------------------*/
body.site-page-in-transito {
  background:
    linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url("https://iiif.arc.usi.ch/iiif/3/112/full/1920,/0/default.jpg")
    center / cover fixed no-repeat #000;
}

body.site-page-in-transito #wrap,
body.site-page-in-transito #wrap > header {
  background: transparent;
}

body.site-page-in-transito #content {
background-color: white;
font-size: 25px;
}

@media screen and (min-width: 641px) {
body.site-page-in-transito #content {
background-color: white;
margin-left: 40%;
margin-right: -200px;
font-size: 25px;
}
}

/* =========================================
   PAGINA VIDEO
   ========================================= */

/* pagina scura come il resto del sito, colonna di lettura centrata */
body.site-page-video #content {
  background: black;
  color: #ddd;
  max-width: 960px;
  margin: 0 auto;
  padding: 64px 48px 80px;
  box-sizing: border-box;
}

/* testo */
body.site-page-video .block-html {
  padding: 0;
}

body.site-page-video .block-html p {
  margin: 0 0 1em;
  font-family: "Crimson Text", Georgia, serif;
  font-size: 21px;
  line-height: 1.6;
  color: #ddd;
}

/* video a tutta larghezza, formato 16:9 */
body.site-page-video #content iframe {
  display: block;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  margin: 40px 0;
  border: 0;
  background: #000;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* l'ultimo testo (nota sul DVD) come nota a margine, con la linea rossa */
body.site-page-video .block-html:last-of-type p {
  padding-left: 20px;
  border-left: 3px solid #e30613;
  font-size: 17px;
  color: #aaa;
}

/* su telefono: margini ridotti */
@media screen and (max-width: 640px) {
  body.site-page-video #content {
    padding: 32px 20px 48px;
  }

  body.site-page-video .block-html p {
    font-size: 18px;
  }

  body.site-page-video #content iframe {
    margin: 24px 0;
  }
}

/* -------------------------- INFO -------------------*/
body.site-page-info {
  background:
    linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url("https://iiif.arc.usi.ch/iiif/3/110/full/1920,/0/default.jpg")
    center / cover fixed no-repeat #000;
}

body.site-page-info #wrap,
body.site-page-info #wrap > header {
  background: transparent;
}

body.site-page-in-transito #content {
background-color: white;
font-size: 25px;
}

footer {
text-align: center;
}