/* ============================================================
   MALSCH ITALIA — Stili base e componenti
   Le sezioni si separano solo con lo spazio: niente bordi,
   niente ombre, niente box. Il bianco è l'elemento di design.
   ============================================================ */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 300;
  background: var(--color-text);
  color: #fff;
  padding: 12px 20px;
}
.skip-link:focus {
  left: 0;
  color: #fff;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { font-weight: 400; margin: 0 0 var(--space-3); }
h1 { font-size: var(--text-display); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: var(--text-h2); line-height: 1.15; letter-spacing: -0.01em; }
h3 { font-size: 1.0625rem; }

p { margin: 0 0 var(--space-2); max-width: var(--measure); }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-hover) var(--ease-out);
}
a:hover { color: var(--color-brand-dark); }

:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

/* --- Utility ------------------------------------------------ */

.container {
  padding-inline: var(--page-margin);
  max-width: 1600px;
  margin-inline: auto;
}

.section { margin-block: var(--section-gap); }

.label,
.code {
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-soft);
}

/* Link "Scopri →" — la freccia è uno dei 5 ruoli del colore brand */
.discover {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
  font-size: var(--text-body);
}
.discover::after {
  content: '\2192';
  color: var(--color-brand);
  transition: transform var(--dur-hover) var(--ease-out);
}
.discover:hover::after { transform: translateX(4px); }

/* Pulsanti: primario = brand (ruolo firma), secondario = hairline */
.btn {
  display: inline-block;
  padding: 14px 32px;
  font-size: var(--text-body);
  border: 1px solid var(--color-text);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out), border-color var(--dur-hover) var(--ease-out);
}
.btn:hover { background: var(--color-text); color: var(--color-bg); }
.btn--primary { background: var(--color-brand-dark); border-color: var(--color-brand-dark); color: #fff; }
.btn--primary:hover { background: color-mix(in srgb, var(--color-brand-dark), #000 18%); border-color: color-mix(in srgb, var(--color-brand-dark), #000 18%); color: #fff; }

/* --- Header -------------------------------------------------- */

.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: transparent;
  transition: background 0.18s var(--ease-out), color 0.05s linear;
}
.site-header a,
.site-header .logo-mark {
  transition-duration: 0.05s; /* niente latenza sul cambio colore */
}
.site-header .container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.site-header.is-solid,
body:not(.has-hero) .site-header {
  background: var(--color-bg);
  color: var(--color-text);
}
body.has-hero .site-header:not(.is-solid) { color: #fff; }

.site-logo {
  font-size: 1.375rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.site-logo:hover { color: inherit; }

.site-nav ul {
  display: flex;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  font-size: 0.9375rem;
  padding-block: 6px;
  border-bottom: 1px solid transparent;
}
/* Niente sottolineature nel menu (richiesta utente): la voce attiva
   e l'hover si distinguono solo col colore */
.site-nav .current-menu-item > a { color: var(--color-brand-dark); }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 8px;
}

/* --- Hero --------------------------------------------------- */

.hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: var(--color-text);
}
.hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.6s var(--ease-out);
}
.hero__slide.is-active { opacity: 1; }
.hero__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__slide::after {
  /* velo per leggibilità di caption (basso) e header (alto) su foto chiare */
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0,0,0,0.45), rgba(0,0,0,0) 45%),
    linear-gradient(to bottom, rgba(0,0,0,0.28), rgba(0,0,0,0) 24%);
}
.hero__caption {
  position: absolute;
  z-index: 2;
  left: var(--container-inset);
  bottom: clamp(48px, 8vh, 96px);
  color: #fff;
}
.hero__caption .code { color: rgba(255,255,255,0.88); }
.hero__caption h1 { margin-bottom: var(--space-2); }
.hero__caption .discover { color: #fff; }

.hero__progress {
  position: absolute;
  z-index: 2;
  right: var(--container-inset);
  bottom: clamp(48px, 8vh, 96px);
  display: flex;
  gap: 10px;
}
.hero__progress button {
  width: 32px;
  height: 2px;
  border: 0;
  padding: 0;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
}
/* progress slider: micro-ruolo del colore brand */
.hero__progress button.is-active { background: var(--color-brand); }

/* --- Manifesto ----------------------------------------------- */

.manifesto {
  max-width: var(--measure);
  margin-inline: auto;
  text-align: center;
  font-weight: 600;
  font-size: clamp(1.0625rem, 0.95rem + 0.55vw, 1.3125rem);
  line-height: 1.5;
}

/* --- Griglia collezioni / card prodotto ---------------------- */

.grid {
  display: grid;
  gap: var(--grid-gutter);
  grid-template-columns: repeat(12, 1fr);
}
.grid > * { grid-column: span 12; }

@media (min-width: 700px) {
  .grid--2 > * { grid-column: span 6; }
  .grid--3 > * { grid-column: span 6; }
}
@media (min-width: 1024px) {
  .grid--3 > * { grid-column: span 4; }
}

.card { display: block; }
.card:hover { color: inherit; }
.card__media {
  overflow: hidden;
  background: #ffffff;
  aspect-ratio: 4 / 5;
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5%;
  box-sizing: border-box;
  transition: transform var(--dur-hover) var(--ease-out);
}
.card:hover .card__media img { transform: scale(1.03); }
.card__body {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-2);
}
.card__title { font-size: 1rem; margin: 0; }
.card .discover {
  opacity: 0;
  transition: opacity var(--dur-hover) var(--ease-out);
}
.card:hover .discover { opacity: 1; }

/* Pallino "Novità": micro-ruolo del colore brand */
.badge-new::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-brand);
  margin-right: 8px;
  vertical-align: 2px;
}

/* Riga di link centrata sotto un blocco (es. "Chi siamo" in home) */
.section-link { text-align: center; max-width: none; }
/* Link "tutta la linea" in coda a una griglia */
.grid-more { margin-top: var(--space-4); }
/* Sottotitolo del pilastro, in tono minore */
.pillar__sub { color: var(--color-text-soft); }
/* Le caption delle tabelle tecniche seguono la colonna, non il centro */
.spec-table caption { text-align: left; }

/* Introduzione di archivio: più grande del corpo, allineata a sinistra */
.intro {
  font-size: clamp(1.0625rem, 0.95rem + 0.55vw, 1.3125rem);
  line-height: 1.5;
  max-width: var(--measure);
}

/* --- Pilastri (filosofia) --------------------------------------- */

.pillar h3 {
  font-size: 1.0625rem;
  margin-bottom: var(--space-1);
}
.pillar p { color: var(--color-text-soft); margin: 0; }
.pillar__n {
  display: block;
  font-size: var(--text-label);
  letter-spacing: var(--tracking-label);
  color: var(--color-brand-dark);
  margin-bottom: var(--space-2);
}

/* --- Footer ---------------------------------------------------- */

.site-footer {
  margin-top: var(--section-gap);
  border-top: 1px solid var(--color-line);
  padding-block: var(--space-10) var(--space-6);
  font-size: 0.875rem;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}
.footer-brand { color: var(--color-logo); }
.footer-brand:hover { color: var(--color-logo); }
.footer-brand .logo-mark { height: 96px; }
.footer-claim {
  margin: 0;
  color: var(--color-text-soft);
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.footer-grid { row-gap: var(--space-6); }
.site-footer li { margin-bottom: 10px; }
.site-footer a { color: var(--color-text); }
.site-footer a:hover { color: var(--color-brand-dark); }
.site-footer .grid { row-gap: var(--space-6); }
@media (min-width: 700px) {
  .site-footer .grid > * { grid-column: span 3; }
}
.site-footer h4 {
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-soft);
  margin-bottom: var(--space-2);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer .colophon {
  margin-top: var(--space-8);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-line);
  color: var(--color-text-soft);
  font-size: 0.8125rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  justify-content: space-between;
}
.site-footer .colophon a { color: var(--color-text-soft); }
.site-footer .colophon a:hover { color: var(--color-brand-dark); }

/* --- Tabella tecnica ------------------------------------------- */

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.spec-table th, .spec-table td {
  text-align: left;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-line);
  font-weight: 400;
}
.spec-table th { color: var(--color-text-soft); width: 40%; }
/* su schermi stretti la tabella scorre da sola invece di sfondare il layout */
.spec-table { display: block; overflow-x: auto; }
@media (min-width: 700px) { .spec-table { display: table; } }

/* --- Scheda prodotto --------------------------------------------- */

.product__gallery { grid-column: span 12; }
.product__info { grid-column: span 12; }
@media (min-width: 900px) {
  .product__gallery { grid-column: span 6; }
  .product__info { grid-column: 8 / span 5; }
}
.product__media {
  background: #ffffff;
  max-width: 560px; /* la foto 4:5 non deve dominare la scheda su desktop */
  margin-inline: auto; /* centrata nella sua colonna */
  aspect-ratio: 4 / 5; /* altezza stabile: foto e vista 3D occupano lo stesso box */
}
.product__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4%;
  box-sizing: border-box;
}
.product__info h1 { font-size: var(--text-h2); margin-block: 4px var(--space-2); }
.product__excerpt { margin-bottom: var(--space-4); }
.product__info .spec-table { margin-block: var(--space-4); }
.product__downloads { margin-block: var(--space-4); }
.product__downloads ul { list-style: none; margin: var(--space-1) 0 0; padding: 0; }
.product__downloads li { margin-bottom: 6px; }
.product__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.product__description { margin-top: var(--section-gap); max-width: var(--measure); }

/* --- Listing / filtri categorie ----------------------------------- */

.archive-head { margin-bottom: var(--space-6); }
.archive-filter { margin-bottom: var(--space-6); }
.archive-filter ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}
.archive-filter a {
  font-size: 0.9375rem;
  padding-block: 6px;
  border-bottom: 1px solid transparent;
}
.archive-filter a.is-active,
.archive-filter a:hover {
  color: inherit;
  border-bottom-color: var(--color-brand);
}

/* --- Form contatti / messaggi ------------------------------------- */

.contact-info { grid-column: span 12; }
.contact-form { grid-column: span 12; }
@media (min-width: 900px) {
  .contact-info { grid-column: span 5; }
  .contact-form { grid-column: 7 / span 6; }
}
.contact-form h2 { font-size: 1.25rem; }
.contact-form form { display: flex; flex-direction: column; gap: 6px; }
.contact-form label {
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-soft);
  margin-top: var(--space-2);
}
.contact-form input,
.contact-form select,
.contact-form textarea {
  padding: 12px 14px;
  font: inherit;
  border: 1px solid var(--color-line);
  background: var(--color-bg);
  color: var(--color-text);
}
.contact-form textarea { resize: vertical; }
.contact-form .btn { align-self: flex-start; margin-top: var(--space-2); }

.form-msg { padding: var(--space-2) 0; }
.form-msg--ok { color: var(--color-text); border-top: 2px solid var(--color-brand); }
.form-msg--err { color: #8a2f22; }

/* --- Reveal allo scroll ----------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* --- Mobile ------------------------------------------------------ */

@media (max-width: 860px) {
  .site-nav {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    color: var(--color-text);
    display: none;
    padding: calc(var(--header-h) + var(--space-4)) var(--page-margin);
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: var(--space-3); }
  .site-nav a { font-size: 1.5rem; }
  .nav-toggle { display: block; position: relative; z-index: 101; }
}

/* --- Reduced motion ---------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* --- Logo ---------------------------------------------------------- */

.site-logo { display: inline-flex; align-items: center; }
.logo-mark { height: 50px; width: auto; display: block; }
body:not(.has-hero) .site-logo,
.site-header.is-solid .site-logo { color: var(--color-logo); }
body.has-hero .site-header:not(.is-solid) .site-logo { color: #fff; }

@media (min-width: 861px) {
  .site-nav { display: flex; align-items: baseline; gap: var(--space-4); }
  .site-nav ul { align-items: baseline; }
}

/* --- Consenso privacy nei form ---------------------------------------- */

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.8125rem;
  color: var(--color-text-soft);
  max-width: var(--measure);
  margin-top: var(--space-1);
}
.consent input { margin-top: 3px; accent-color: var(--color-brand-dark); }
.consent a { text-decoration: underline; text-underline-offset: 3px; }

/* --- Prose: pagine di testo (privacy, cookie, azienda…) --------------- */

.prose { max-width: var(--measure); }
.prose h1 { font-size: var(--text-h2); }
.prose h2 {
  font-size: 1.1875rem;
  margin-top: var(--space-6);
}
.prose .label { display: block; margin-bottom: var(--space-4); }
.prose table,
.prose .spec-table { margin-block: var(--space-3); }
.prose table + table { margin-top: var(--space-4); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }

/* --- Marchio (segnaposto testuale finché non arriva il logo) ----------- */

.logo-word {
  font-size: 1.375rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}
.logo-word__it {
  font-weight: 300;
  color: var(--color-brand-dark);
  margin-left: 0.4em;
}
body.has-hero .site-header:not(.is-solid):not(:hover) .logo-word__it { color: rgba(255,255,255,0.75); }
.footer-brand .logo-word { font-size: 1.5rem; }

/* Pagine interne: il <main> non ha bisogno del section-gap pieno in alto —
   il titolo deve stare vicino all'header (richiesta utente) */
main.section {
  margin-top: var(--space-4);
}
.archive-head { margin-top: var(--space-2); }

/* --- Menu: bold + header bianco all'hover ----------------------------- */
/* (in coda al file: deve vincere sulle regole trasparenti dell'hero) */

.site-nav a { font-weight: 600; }

.site-header:hover {
  background: var(--color-bg);
  color: var(--color-text);
}
body.has-hero .site-header:hover:not(.is-solid) { color: var(--color-text); }
body.has-hero .site-header:hover .site-logo { color: var(--color-logo); }

/* --- Card con titolo sopra la foto (griglia homepage) ------------------ */

.card--overlay .card__media { position: relative; }
.card--overlay .card__media::after {
  /* velo per la leggibilità del titolo bianco, come nell'hero */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5), rgba(0,0,0,0) 45%);
}
.card--overlay .card__caption {
  position: absolute;
  z-index: 2;
  left: var(--space-3);
  right: var(--space-3);
  bottom: var(--space-3);
  color: #fff;
}
.card--overlay .card__title {
  font-size: 1.375rem;
  margin: 0 0 2px;
  color: #fff;
}
.card--overlay .discover { color: #fff; }

/* --- Gallery della scheda prodotto ------------------------------------- */

.product__thumbs {
  display: grid;
  /* auto-fill invece di 4 colonne fisse: la scheda "caratteristiche" ha 23
     foto, e sei righe di miniature sotto l'immagine erano ingestibili */
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: var(--space-1);
  margin-top: var(--space-1);
  max-width: 560px;
  margin-inline: auto;
  max-height: 220px;
  overflow-y: auto;
}
.product__thumbs button {
  padding: 0;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  aspect-ratio: 1 / 1;
}
.product__thumbs img { width: 100%; height: 100%; object-fit: contain; }
.product__thumbs button.is-active { border-color: var(--color-brand); }
#product-media img { transition: opacity 0.25s var(--ease-out); }

/* --- Download (PDF certificazioni / schede) ---------------------------- */

.download-list { list-style: none; margin: 0; padding: 0; }
.download-list li { margin-bottom: 10px; }
.download-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
}
.download-list a::before {
  content: 'PDF';
  font-size: 0.6875rem;
  letter-spacing: var(--tracking-label);
  color: var(--color-brand-dark);
  border: 1px solid var(--color-line);
  padding: 2px 5px;
}
