
/* Megacard: pannello con linguetta (bg-surface + handle) riutilizzato su piu' pagine
   (homepage, portfolio, ...). Stato iniziale nascosto sotto il viewport: ogni pagina
   lo rivela con uno slide da sotto verso sopra tramite il proprio script GSAP. */
#megacard { opacity: 0; transform: translateY(100%); }

@media (min-width: 768px) {
  .md\:text-5xl {
    font-size: clamp(1.75rem, 1.09rem + 1.39vw, 3rem);
  }

  .md\:text-6xl {
    font-size: clamp(2.2rem, 1.36rem + 1.74vw, 3.75rem);
  }

  .md\:text-7xl {
    font-size: clamp(2.6rem, 1.63rem + 2.08vw, 4.5rem);
  }

  .md\:text-8xl {
    font-size: clamp(3.5rem, 2.18rem + 2.78vw, 6rem);
  }

  .md\:text-9xl {
    font-size: clamp(4.65rem, 2.91rem + 3.71vw, 8rem);
  }
}
/* Specificita' di una classe (batte il reset di Tailwind su p, h*, ecc.);
   esclusi gli elementi che hanno gia' un margine inferiore via utility (mb-*, my-*). */
.leading-relaxed:where(:not([class*="mb-"], [class*="my-"])) {
  margin-bottom: 10px;
}

/* Titoli dentro i testi RTE (bodytext dei content element).
   Il preflight di Tailwind azzera h2-h4 (dimensione e peso ereditati): qui li ripristiniamo.
   Il contenitore nel template ha la classe .rte-content (+ .rte-content--dark su fondo scuro).
   :where() tiene la specificita' al livello del solo tag, cosi' eventuali classi
   assegnate dall'RTE ai titoli restano prioritarie. */
:where(.rte-content) h2,
:where(.rte-content) h3,
:where(.rte-content) h4 {
  font-family: "Exo 2", sans-serif;
  font-weight: 700;
  color: #111111;
  letter-spacing: -0.01em;
}

:where(.rte-content) h2 {
  font-size: clamp(1.75rem, 1.4rem + 1vw, 2.5rem);
  line-height: 1.15;
  margin: 2.5rem 0 1rem;
}

:where(.rte-content) h3 {
  font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.875rem);
  line-height: 1.25;
  margin: 2rem 0 0.5rem;
}

:where(.rte-content) h4 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 1.5rem 0 0.5rem;
}

:where(.rte-content) > :where(h2, h3, h4):first-child {
  margin-top: 0;
}

:where(.rte-content--dark) h2,
:where(.rte-content--dark) h3,
:where(.rte-content--dark) h4 {
  color: #ffffff;
}

/* Sezione a box del template Default (colPos 2): immagine opzionale del box,
   adattata senza ritaglio (adatta a loghi e icone). */
.nv-box__image {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 8rem;
  object-fit: contain;
  object-position: left center;
  align-self: flex-start;
  margin-bottom: 2.5rem;
}

/* Template Default – "In breve" (colPos 4): griglia compatta dentro la sezione scura */
.nv-caps {
  margin-top: 8rem;
  padding-top: 4rem;
  border-top: 1px solid rgb(255 255 255 / 0.1);
}
.nv-caps--solo {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.nv-caps__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: rgb(255 255 255 / 0.1);
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 2rem;
  overflow: hidden;
}
@media (min-width: 768px) {
  .nv-caps__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .nv-caps__grid { grid-template-columns: repeat(3, 1fr); }
}
.nv-caps__item {
  background: #111111;
  padding: 2.5rem 2rem;
  transition: background-color 0.5s;
}
.nv-caps__item:hover {
  background: #1a1a1a;
}
.nv-caps__title {
  font-family: "Exo 2", sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  color: #ffffff;
  margin-bottom: 0.75rem;
}
.nv-caps__text {
  color: #9ca3af;
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* Template Default – intestazione della sezione a box e sottotitolo del box */
.nv-section-head {
  max-width: 48rem;
  margin-bottom: 5rem;
}
.nv-box__meta {
  margin-top: -1.25rem;
  margin-bottom: 2rem;
}

/* Link in modalita' pulsante, selezionabili dall'RTE (Classe CSS del link) */
.nv-btn,
.nv-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 2.5rem;
  margin: 0.5rem 0;
  border-radius: 9999px;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.3s;
}
.nv-btn {
  background-color: #111111;
  color: #ffffff;
  border: 1px solid #111111;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}
.nv-btn-outline {
  background-color: transparent;
  color: #111111;
  border: 1px solid #111111;
}
.nv-btn:hover,
.nv-btn-outline:hover {
  background-color: #8eb353;
  border-color: #8eb353;
  color: #ffffff;
  transform: scale(1.05);
}
/* Su fondo scuro */
.rte-content--dark .nv-btn {
  background-color: #ffffff;
  border-color: #ffffff;
  color: #111111;
}
.rte-content--dark .nv-btn-outline {
  border-color: rgb(255 255 255 / 0.4);
  color: #ffffff;
}
.rte-content--dark .nv-btn:hover,
.rte-content--dark .nv-btn-outline:hover {
  background-color: #8eb353;
  border-color: #8eb353;
  color: #ffffff;
}

/* Template Service – griglia dei servizi (colPos 1): 1 colonna, 2 da desktop, con linee divisorie */
.nv-service-grid {
  display: grid;
  grid-template-columns: 1fr;
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}
.nv-service + .nv-service {
  border-top: 1px solid rgb(255 255 255 / 0.1);
}
@media (min-width: 1024px) {
  .nv-service-grid { grid-template-columns: repeat(2, 1fr); }
  .nv-service + .nv-service { border-top: 0; }
  .nv-service:nth-child(n + 3) { border-top: 1px solid rgb(255 255 255 / 0.1); }
  .nv-service:nth-child(odd) { border-right: 1px solid rgb(255 255 255 / 0.1); }
}

/* Home – loghi clienti (colPos 5): griglia di riquadri uguali con linee sottili,
   loghi in scala di grigi che prendono colore al passaggio del mouse */
.nv-logos {
  padding: 6rem 0 2rem;
}
.nv-logos__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: #d4d4d0;
  border: 1px solid #d4d4d0;
  border-radius: 1.5rem;
  overflow: hidden;
}
@media (min-width: 768px) {
  .nv-logos__grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1280px) {
  .nv-logos__grid { grid-template-columns: repeat(6, 1fr); }
}
.nv-logo-item {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 2;
  padding: 0.75rem 1rem;
  background: #f5f5f3;
  transition: background-color 0.4s;
}
.nv-logo-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.6;
  transition: filter 0.4s, opacity 0.4s;
}
.nv-logo-item__name {
  font-family: "Exo 2", sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.25;
  text-align: center;
  color: #9ca3af;
  transition: color 0.4s;
}
.nv-logo-item:hover {
  background: #ffffff;
}
.nv-logo-item:hover img {
  filter: none;
  opacity: 1;
}
.nv-logo-item:hover .nv-logo-item__name {
  color: #111111;
}

/* About – introduzione del team (colPos 4): testo sopra le card, su due colonne
   allineate alla griglia delle card (md:grid-cols-2, gap 4rem) */
.nv-team-intro {
  margin-bottom: 6rem;
}
@media (min-width: 768px) {
  .nv-team-intro {
    columns: 2;
    column-gap: 4rem;
  }
}
.nv-team-intro p {
  font-size: 1.125rem;
  line-height: 1.7;
  font-weight: 300;
  color: #4b5563;
  margin-bottom: 1.5rem;
}
.nv-team-intro strong {
  font-weight: 700;
  color: #111111;
}
.nv-team-intro .nv-team-intro__note {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: #9ca3af;
  margin: 2.5rem 0 0;
}

/* Stile RTE "Evidenza": testo in verde e monospace (es. numeri, dettagli "da terminale") */
.nv-highlight {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #8eb353;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Link nei testi RTE (.rte-content): il reset di Tailwind li rende identici al testo.
   Sottolineati e con hover verde; su fondo scuro in bianco. I pulsanti (nv-btn) sono esclusi.
   Dentro "Evidenza" (.nv-highlight) il link resta verde monospace, sottolineato. */
.rte-content a:where(:not(.nv-btn):not(.nv-btn-outline)) {
  color: #111111;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.3s;
}
.rte-content--dark a:where(:not(.nv-btn):not(.nv-btn-outline)) {
  color: #ffffff;
}
.rte-content a:where(:not(.nv-btn):not(.nv-btn-outline)):hover {
  color: #8eb353;
}
.rte-content .nv-highlight a,
.rte-content a:has(.nv-highlight),
.rte-content a .nv-highlight {
  color: #8eb353;
}
.rte-content .nv-highlight a:hover,
.rte-content a:has(.nv-highlight):hover,
.rte-content a:hover .nv-highlight {
  color: #111111;
}
.rte-content--dark .nv-highlight a:hover,
.rte-content--dark a:has(.nv-highlight):hover,
.rte-content--dark a:hover .nv-highlight {
  color: #ffffff;
}

/* Template Default – Contenuto libero (colPos 5): elementi TYPO3 resi con il rendering standard.
   Il reset di Tailwind azzera margini, elenchi e dimensioni: qui li ripristiniamo solo in questa sezione
   (:where = specificita' minima, le classi assegnate dall'RTE restano prioritarie). */
:where(.nv-free-content) :where(.frame, .ce-textpic, .ce-bodytext, .ce-uploads) + :where(.frame) {
  margin-top: 4rem;
}
:where(.nv-free-content) p {
  margin-bottom: 1rem;
  line-height: 1.7;
  color: #4b5563;
}
:where(.nv-free-content) h1 {
  font-family: "Exo 2", sans-serif;
  font-weight: 900;
  font-size: clamp(2.25rem, 1.8rem + 1.5vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #111111;
  margin: 0 0 1.5rem;
}
:where(.nv-free-content) ul,
:where(.nv-free-content) ol {
  margin: 0 0 1rem 1.5rem;
  color: #4b5563;
  line-height: 1.7;
}
:where(.nv-free-content) ul { list-style: disc; }
:where(.nv-free-content) ol { list-style: decimal; }
:where(.nv-free-content) li { margin-bottom: 0.25rem; }
:where(.nv-free-content) img {
  max-width: 100%;
  height: auto;
}
:where(.nv-free-content) figure { margin: 0 0 1.5rem; }
:where(.nv-free-content) figcaption {
  font-size: 0.875rem;
  color: #9ca3af;
  margin-top: 0.5rem;
}
:where(.nv-free-content) table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}
:where(.nv-free-content) th,
:where(.nv-free-content) td {
  border-bottom: 1px solid #d4d4d0;
  padding: 0.75rem 0.5rem;
  text-align: left;
}

/* Menu a schermo intero su mobile: il contenuto e' piu' alto dello schermo e, centrato
   in verticale, saliva sotto il logo. Sotto md parte dall'alto, sotto logo e hamburger,
   e il pannello scorre. Da md in su resta centrato come prima. */
@media (max-width: 767px) {
  #fullscreen-menu {
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-top: 8rem;
    padding-bottom: 3rem;
  }
}

/* Pagina del singolo progetto (/portfolio/nome-progetto, Partials/Project/Detail.html) */
.nv-project-back {
  display: inline-block;
  align-self: flex-start;
}
.nv-project-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 2;
  padding: 1.5rem;
  background: #ffffff;
  border: 1px solid #d4d4d0;
  border-radius: 1.5rem;
}
.nv-project-logo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.nv-project-gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}
@media (min-width: 768px) {
  .nv-project-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Screenshot dei siti: riquadro 16:10 con l'inizio della pagina, al click l'immagine intera */
.nv-project-shot {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid #d4d4d0;
  border-radius: 2rem;
  background: #111111;
  isolation: isolate;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  transition: box-shadow 0.5s;
}
.nv-project-shot:hover {
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}
.nv-project-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* ==========================================================================
   Safari / WebKit: griglie card di home e Portfolio (colonne CSS)
   Solo con html.is-webkit (classe aggiunta da page.typoscript, headerData.101):
   gli altri browser non sono toccati. Su WebKit webkit-masonry.js sostituisce le colonne
   CSS con colonne flex (.nv-wk-col): le animazioni in hover restano quelle originali.
   ========================================================================== */
html.is-webkit .nv-wk-masonry {
  -webkit-columns: auto;
  columns: auto;
  display: flex;
  align-items: flex-start;
}
html.is-webkit .nv-wk-masonry > .nv-wk-col {
  margin: 0; /* annulla space-y-* del contenitore sulle colonne */
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
/* Ogni card larga quanto la colonna: con aspect-ratio (es. aspect-square) WebKit
   altrimenti ricava la larghezza dall'altezza e la card invade la colonna vicina. */
html.is-webkit .nv-wk-masonry > .nv-wk-col > * {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
/* Angoli arrotondati: ritaglio corretto dello screenshot animato dentro la card */
html.is-webkit #megacard .story-card {
  isolation: isolate;
}
/* Safari / WebKit: griglia loghi "Collaborazioni". Con 1fr WebKit allarga le colonne alla
   larghezza naturale delle immagini (griglia fuori dal riquadro, loghi enormi) e non risolve
   height:100% dell'immagine nel riquadro con aspect-ratio. Colonne minmax(0,1fr) e logo
   posizionato dentro il padding del riquadro. */
html.is-webkit .nv-logos__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) {
  html.is-webkit .nv-logos__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  html.is-webkit .nv-logos__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
html.is-webkit .nv-logo-item {
  position: relative;
  min-width: 0;
}
html.is-webkit .nv-logo-item img {
  position: absolute;
  top: 0.75rem;
  bottom: 0.75rem;
  left: 1rem;
  right: 1rem;
  width: calc(100% - 2rem);
  height: calc(100% - 1.5rem);
}
