:root {
  --brand-ink: #20211F;
  --brand-white: #FFFFFF;
  --brand-surface: #F5F3EE;
  --brand-muted: #6F706C;
  --brand-line: #D9D9D4;
  --ink: var(--brand-ink);
  --paper: var(--brand-white);
  --muted: var(--brand-muted);
  --rule: var(--brand-line);
  --black: var(--brand-ink);
  --serif: "Source Serif 4", "Iowan Old Style", "Times New Roman", serif;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --fs-body: clamp(1.0625rem, 0.98rem + 0.35vw, 1.1875rem);
  --fs-small: 0.9375rem;
  --fs-h3: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-h2: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  --fs-h1: clamp(2.5rem, 1.6rem + 4vw, 4.5rem);
  --measure: 62ch;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section: clamp(4rem, 8vw, 7.5rem);
  --block: clamp(1.75rem, 3vw, 2.5rem);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  font-feature-settings: "kern", "liga";
}
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-h1); line-height: 1.02; letter-spacing: -0.025em; }
h2 { font-size: var(--fs-h2); line-height: 1.12; }
h3 { font-size: var(--fs-h3); line-height: 1.25; }
p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }
a { color: inherit; text-decoration: underline; text-underline-offset: 0.14em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
img, svg { max-width: 100%; height: auto; display: block; }
picture { display: block; }
.wrap {
  width: min(100% - 2 * var(--gutter), 72rem);
  margin-inline: auto;
}
section { padding-block: var(--section); }
section + section { border-top: 1px solid var(--rule); }
section > .wrap > h2 { margin-bottom: var(--block); }

header.site {
  background: var(--black);
  color: var(--paper);
}
header.site .wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4rem;
  padding-block: 0.75rem;
  padding-right: 8.5rem;
}
header.site .brand {
  display: flex; align-items: center; gap: 0.75rem;
  text-decoration: none;
  font-size: var(--fs-small);
  line-height: 1.2;
}
header.site .brand img { width: auto; height: 2.5rem; }
header.site .brand strong { display: block; font-family: var(--serif); font-size: 2.1rem; font-weight: 500; }
header.site nav {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: var(--fs-small);
}
header.site nav a { text-decoration: none; opacity: 0.85; }
header.site nav a:hover, header.site nav a[aria-current] { opacity: 1; text-decoration: underline; }
.header-lang {
  position: absolute;
  top: 50%;
  right: 0;
  translate: 0 -50%;
  white-space: nowrap;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--brand-line);
}
.header-lang a { text-decoration: none; }
.header-lang a[aria-current] { color: var(--paper); font-weight: 600; }

#ambiti .intro { margin-bottom: var(--block); }
#ambiti .grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--block);
}
.ambito {
  padding-top: 1rem;
  border-top: 1px solid var(--ink);
}
.ambito-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 0.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ambito h3 { margin-bottom: 0.75rem; }
.ambito p { max-width: 42ch; }
.ambito p b { font-weight: 600; }
.ambito .dont { color: var(--muted); }
@media (max-width: 800px) {
  #ambiti .grid { grid-template-columns: 1fr; }
}

#chi p { max-width: 58ch; }
.context-image { padding-bottom: var(--section); }
.context-image img,
.contact-image { width: 100%; border-radius: 0.35rem; object-fit: cover; }
.context-image img { max-height: 34rem; }
@media (max-width: 768px) {
  html,
  body { overflow-x: hidden; }
  .context-image img,
  #scrivimi .contact-image {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    border-radius: 0;
  }
}
#risultati,
#scrivimi { background: var(--black); color: var(--brand-surface); }
#risultati p { max-width: 58ch; margin-bottom: var(--block); }
#risultati img { width: min(100%, 52rem); }
@media (max-width: 768px) {
  #risultati img {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
  }
}
#domande { padding-bottom: 0; }
.faq {
  border-top: 1px solid var(--rule);
  padding: 1.1rem 0;
  max-width: 62ch;
}
.faq:last-of-type { border-bottom: 1px solid var(--rule); }
.faq summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--serif);
  font-size: 1.2em;
  line-height: 1.3;
  display: flex; justify-content: space-between; gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--sans); color: var(--muted); flex: none; }
.faq[open] summary::after { content: "\2013"; }
.faq summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.faq p { margin-top: 0.75rem; }
#scrivimi p { max-width: 48ch; }
#scrivimi { padding-top: 0; border-top: 0; }
#scrivimi .contact-image { max-height: 30rem; margin-bottom: var(--block); }
#scrivimi .mail {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: var(--serif);
  font-size: var(--fs-h3);
}
#scrivimi .links { margin-top: 1.25rem; }
.linkedin { display: inline-block; }
.linkedin svg { width: 28px; }
#scrivimi a:focus-visible { outline-color: var(--brand-surface); }

footer.site {
  background: var(--brand-ink);
  border-top: 1px solid var(--brand-line);
  padding-block: 2.5rem;
  font-size: var(--fs-small);
  color: var(--brand-line);
}
footer.site .wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem var(--gutter);
  align-items: start;
}
footer.site p { margin: 0 0 0.35rem; }
footer.site .disclaimer { color: var(--brand-line); }
footer.site .lang { text-align: right; }
@media (max-width: 600px) {
  header.site .wrap { min-height: 6.75rem; padding: 0.65rem 0 3.25rem; }
  header.site nav { position: absolute; bottom: 0.65rem; left: 0; right: 0; justify-content: space-between; gap: 0.25rem; }
  .header-lang { top: 1.95rem; right: 0; translate: 0 -50%; }
  header.site .brand strong { font-size: 1.7rem; }
  footer.site .wrap { grid-template-columns: 1fr; }
  footer.site .lang { text-align: left; }
}

/* Keep keyboard focus visible on dark brand surfaces. */
header.site a:focus-visible,
footer.site a:focus-visible { outline-color: var(--brand-white); }

/* Desktop layout only: keep the existing mobile and tablet rules intact. */
@media (min-width: 1024px) {
  header.site .wrap,
  main .wrap,
  footer.site .wrap {
    width: min(calc(100% - 2 * var(--gutter)), 100rem);
  }

  #metodo .wrap,
  #domande .wrap {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) minmax(0, 2fr);
    column-gap: clamp(2rem, 5vw, 6rem);
  }
  #metodo h2,
  #domande h2 { grid-column: 1; grid-row: 1 / span 10; }
  #metodo p,
  #domande .faq { grid-column: 2; max-width: none; }
  #metodo p { max-width: 72ch; }

  .context-image img { aspect-ratio: 21 / 9; max-height: 38rem; }

  #ambiti .grid { gap: 3rem clamp(2rem, 4vw, 5rem); }
  #ambiti .ambito p { max-width: 60ch; }

  #risultati .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    column-gap: clamp(2rem, 5vw, 6rem);
    align-items: center;
  }
  #risultati h2 { grid-column: 1; align-self: end; }
  #risultati p { grid-column: 1; align-self: start; margin-bottom: 0; }
  #risultati img { grid-column: 2; grid-row: 1 / span 2; width: 100%; }

  #domande { padding-bottom: var(--section); }
  #domande .faq p { max-width: 72ch; }

  #scrivimi { padding-top: var(--section); }
  #scrivimi .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    column-gap: clamp(2rem, 5vw, 6rem);
    align-items: start;
  }
  #scrivimi .wrap > picture {
    grid-column: 1;
    grid-row: 1 / span 4;
    align-self: stretch;
  }
  #scrivimi .contact-image {
    height: 100%;
    min-height: 24rem;
    max-height: 32rem;
    margin-bottom: 0;
  }
  #scrivimi h2,
  #scrivimi p,
  #scrivimi .mail { grid-column: 2; }
  #scrivimi .mail { overflow-wrap: anywhere; }
}
