/* ============================================================
   Marta — Base: reset, tipografia, griglia cartamodello, a11y
   ============================================================ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
  font-family: var(--type-body);
  font-size: var(--fs-400);
  line-height: var(--lh-prose);
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern', 'liga', 'calt';
  letter-spacing: var(--tracking-normal);
  min-height: 100vh;
  overflow-x: hidden;
}

img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  max-width: 100%;
  height: auto;
}

img, svg {
  vertical-align: middle;
}

svg {
  fill: currentColor;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
  color: inherit;
}

a {
  color: var(--marta-red);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--marta-red-deep);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--marta-red);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: var(--marta-red);
  color: var(--white);
}

/* ---- Tipografia -------------------------------------------------
   Archivo variabile impostata stretta: i titoli hanno la compattezza
   di un'etichetta su un disegno tecnico, non la larghezza di un font
   di sistema. Il corpo e' Fira Sans, umanista e caldo. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--type-display);
  font-stretch: var(--stretch-display);
  font-weight: var(--weight-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  word-spacing: normal;
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: var(--fs-900); }
h2 { font-size: var(--fs-800); }
h3 { font-size: var(--fs-700); font-weight: var(--weight-semibold); }
h4 { font-size: var(--fs-600); font-weight: var(--weight-semibold); }
h5 { font-size: var(--fs-500); font-weight: var(--weight-semibold); }

h6 {
  font-family: var(--type-mono);
  font-size: var(--fs-100);
  font-weight: var(--weight-regular);
  font-stretch: normal;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--mute);
}

p {
  text-wrap: pretty;
}

p + p {
  margin-top: var(--space-4);
}

ul, ol {
  list-style: none;
}

hr {
  border: 0;
  border-top: 1px dashed var(--dash);
  margin: var(--space-6) 0;
}

/* ---- Etichette: la voce del disegno tecnico ---------------------
   L'eyebrow non e' un trattino decorativo: e' la quota che apre la
   sezione, e la sua linea corre fino al bordo del corpo. */
.eyebrow {
  font-family: var(--type-mono);
  font-size: var(--fs-100);
  font-weight: var(--weight-regular);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--marta-red-ink);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.eyebrow::before {
  content: '';
  width: clamp(1rem, 2vw, 2.5rem);
  height: 0;
  border-top: 1px solid currentColor;
  flex: none;
}

.eyebrow::after {
  content: '';
  height: 0;
  border-top: 1px dashed var(--dash);
  flex: 1 1 auto;
}

.eyebrow--center {
  justify-content: center;
}

.eyebrow--center::after {
  flex: 0 1 clamp(1rem, 2vw, 2.5rem);
  border-top-style: solid;
  border-top-color: currentColor;
}

.lead {
  font-size: var(--fs-500);
  line-height: var(--lh-normal);
  color: var(--mute);
}

.mute { color: var(--mute); }
.mono { font-family: var(--type-mono); font-stretch: normal; }
.center { text-align: center; }
.italic { font-style: italic; }

mark, .highlight {
  background: var(--marta-red-soft);
  color: var(--marta-red-deep);
  padding: 0 0.18em;
  border-radius: 2px;
}

/* Skip-link */
.skip-link {
  position: absolute;
  top: -6.25rem;
  left: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-5);
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus-visible {
  top: var(--space-4);
  outline-color: var(--white);
  color: var(--white);
}

/* ---- Layout: 90% ovunque, nessun max-width di pagina ------------ */
.container {
  width: var(--page-width);
  max-width: none;
  margin-inline: auto;
  padding-inline: 0;
}

.container--wide,
.container--narrow {
  width: var(--page-width);
  max-width: none;
}

section {
  padding-block: var(--section-py);
  position: relative;
}

section.tight {
  padding-block: var(--section-py-tight);
}

/* ---- La griglia cartamodello ------------------------------------
   binario (quota + linea di costruzione) | corpo | annotazioni.
   E' lo stesso impianto in ogni sezione del sito: e' questo che
   sostituisce i max-width sparsi di prima. */
.sheet {
  display: grid;
  grid-template-columns:
    [rail] var(--rail-w)
    [body] minmax(0, 1fr)
    [note] var(--margin-w);
  column-gap: var(--space-5);
  align-items: start;
}

.sheet--no-note {
  grid-template-columns: [rail] var(--rail-w) [body] minmax(0, 1fr);
}

.sheet__rail {
  grid-column: rail;
  align-self: stretch;
  position: relative;
  border-right: 1px dashed var(--dash);
  min-height: 100%;
  padding-top: var(--space-1);
}

.sheet__rail-label {
  font-family: var(--type-mono);
  font-size: var(--fs-100);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--mute-2);
  writing-mode: vertical-rl;
  position: sticky;
  top: calc(var(--header-h) + var(--space-5));
}

.sheet__body {
  grid-column: body;
  min-width: 0;
}

/* Le annotazioni a margine: quello che prima era spazio vuoto */
.sheet__note {
  grid-column: note;
  position: relative;
  padding-left: var(--space-5);
  border-left: 1px dashed var(--dash);
  display: grid;
  gap: var(--space-5);
  align-content: start;
  position: sticky;
  top: calc(var(--header-h) + var(--space-6));
}

.note {
  display: grid;
  gap: var(--space-2);
}

.note__label {
  font-family: var(--type-mono);
  font-size: var(--fs-100);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--marta-red);
}

.note__value {
  font-family: var(--type-display);
  font-stretch: var(--stretch-display);
  font-weight: var(--weight-bold);
  font-size: var(--fs-600);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
}

.note p {
  font-size: var(--fs-200);
  line-height: var(--lh-normal);
  color: var(--mute);
}

.section-dark .note__value { color: var(--white); }
.section-dark .note p { color: rgba(255, 253, 250, 0.66); }
.section-dark .sheet__rail,
.section-dark .sheet__note { border-color: var(--dash-dark); }
.section-dark .sheet__rail-label { color: rgba(255, 253, 250, 0.45); }

/* Sotto i 1000px il margine di annotazione scende sotto il corpo;
   sotto i 700px sparisce anche il binario. */
@media (max-width: 1000px) {
  .sheet {
    grid-template-columns: [rail] var(--rail-w) [body] minmax(0, 1fr);
  }

  .sheet__note {
    grid-column: body;
    position: static;
    border-left: 0;
    border-top: 1px dashed var(--dash);
    padding-left: 0;
    padding-top: var(--space-5);
    margin-top: var(--space-6);
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
  }

  .section-dark .sheet__note { border-color: var(--dash-dark); }
}

@media (max-width: 700px) {
  .sheet,
  .sheet--no-note {
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet__rail {
    display: none;
  }

  .sheet__body,
  .sheet__note {
    grid-column: 1;
  }

  .sheet__note {
    grid-auto-flow: row;
  }
}

/* ---- Superfici --------------------------------------------------- */
.section-dark {
  background: var(--ink);
  color: var(--paper);
  position: relative;
  overflow: clip;
}

.section-dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  pointer-events: none;
  z-index: 0;
}

.section-dark > * {
  position: relative;
  z-index: 1;
}

.section-paper-grid {
  position: relative;
}

.section-paper-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line-light) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line-light) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  pointer-events: none;
  z-index: 0;
}

.section-paper-grid > * {
  position: relative;
  z-index: 1;
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4,
.section-dark h5,
.section-dark h6 {
  color: var(--white);
}

.section-dark .lead,
.section-dark .mute {
  color: rgba(255, 253, 250, 0.72);
}

.section-paper-2 {
  background: var(--paper-2);
}

/* ---- Giunzioni: dove finisce un pezzo e ne comincia un altro ----
   L'onda M e' il punto di cucitura fra due sezioni. Un solo segno,
   sempre lo stesso, sempre sulla linea di taglio. */
.seam {
  position: relative;
  height: 0;
  border-top: 1px dashed var(--dash);
  width: var(--page-width);
  margin-inline: auto;
}

.seam::after {
  content: '';
  position: absolute;
  left: var(--rail-w);
  top: 50%;
  width: clamp(1.75rem, 3vw, 2.75rem);
  height: clamp(0.75rem, 1.3vw, 1.25rem);
  transform: translate(-50%, -50%);
  background-color: var(--marta-red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 80' fill='none'%3E%3Cpath d='M0,40 C150,80 250,0 400,40 C550,80 650,0 800,40 C950,80 1050,0 1200,40' stroke='black' stroke-width='8' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 80' fill='none'%3E%3Cpath d='M0,40 C150,80 250,0 400,40 C550,80 650,0 800,40 C950,80 1050,0 1200,40' stroke='black' stroke-width='8' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

.seam--center::after {
  left: 50%;
}

.section-divider {
  height: 0;
  border-top: 1px dashed var(--dash);
  width: 100%;
}

.section-divider--brand {
  height: 0;
  border-top: 2px solid var(--marta-red);
  width: 100%;
}

.section-divider--xl {
  height: 0;
  border-top: 2px solid var(--marta-red);
  width: clamp(3rem, 6vw, 6rem);
}

/* ---- Griglie ----------------------------------------------------- */
.grid {
  display: grid;
  gap: var(--space-5);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

.section-dark .eyebrow {
  color: var(--marta-red);
}

.section-dark .eyebrow::after {
  border-top-color: var(--dash-dark);
}

.section-dark hr,
.section-dark .section-divider,
.section-dark .seam {
  border-top-color: var(--dash-dark);
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  margin: -0.0625rem;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Print */
@media print {
  .skip-link,
  nav,
  header,
  footer,
  .form-contatti,
  .cta-section form {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }
}
