/* Optional surface treatment. Removing data-lower-surface restores the base CSS. */
html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti) {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(125deg, rgb(255 255 255 / .64), rgb(255 255 255 / .08) 32%, rgb(255 255 255 / .44) 48%, rgb(255 255 255 / .06) 64%),
    linear-gradient(155deg, rgb(232 232 231 / .65), rgb(212 212 211 / .42) 54%, rgb(244 244 243 / .76));
  border-color: rgb(255 255 255 / .9);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / .72),
    inset 1px 1px 0 rgb(255 255 255 / .96),
    inset -1px -1px 0 rgb(143 143 143 / .13),
    0 16px 35px -23px rgb(25 25 25 / .17),
    0 2px 6px rgb(25 25 25 / .025);
  -webkit-backdrop-filter: blur(20px) saturate(112%);
  backdrop-filter: blur(20px) saturate(112%);
}

/* The optical layers stay behind the content, inside the existing silhouette.
   No overflow clipping: form and link focus rings remain fully visible. */
html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti)::before,
html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
}

html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti)::before {
  background:
    radial-gradient(ellipse at 4% 0%, rgb(255 255 255 / .48), transparent 46%),
    radial-gradient(ellipse at 100% 100%, rgb(255 255 255 / .4), transparent 48%),
    linear-gradient(112deg, transparent 25%, rgb(255 255 255 / .28) 39%, transparent 57%);
  box-shadow:
    inset 0 2px 2px -1px rgb(255 255 255 / .95),
    inset 0 -2px 3px -2px rgb(116 116 116 / .24);
}

html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti)::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.74' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23grain)' d='M0 0h160v160H0z'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  opacity: .028;
}

/* Keep the existing card sizes, spacing, type and rounded corners. */
html[data-lower-surface="glass"] #voci .review-grid figure,
html[data-lower-surface="glass"] #contatti .quote-panel {
  background: linear-gradient(145deg, rgb(255 255 255 / .9), rgb(255 255 255 / .61));
  border-color: rgb(255 255 255 / .98);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / .54),
    inset 0 1px 0 #fff,
    0 7px 21px -15px rgb(25 25 25 / .22),
    0 0 0 1px rgb(25 25 25 / .045);
  -webkit-backdrop-filter: blur(10px) saturate(106%);
  backdrop-filter: blur(10px) saturate(106%);
}

/* Solid-looking controls preserve their boundaries over the translucent panel. */
html[data-lower-surface="glass"] #contatti .quote-panel input:not([type="radio"]),
html[data-lower-surface="glass"] #contatti .quote-panel select,
html[data-lower-surface="glass"] #contatti .quote-panel textarea {
  background: rgb(255 255 255 / .96);
  box-shadow: inset 0 1px 2px rgb(25 25 25 / .025);
}

html[data-lower-surface="glass"] #contatti .radio-options input:not(:checked) + span,
html[data-lower-surface="glass"] #contatti .quote-result dl {
  background: rgb(255 255 255 / .86);
}

/* An opaque neutral surface is the fallback when backdrop filtering is absent. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti) {
    background-color: #f1f1f1;
  }

  html[data-lower-surface="glass"] #voci .review-grid figure,
  html[data-lower-surface="glass"] #contatti .quote-panel {
    background: #fff;
  }
}

@media (prefers-reduced-transparency: reduce) {
  html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti) {
    background: #f1f1f1;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti)::before,
  html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti)::after {
    display: none;
  }

  html[data-lower-surface="glass"] #voci .review-grid figure,
  html[data-lower-surface="glass"] #contatti .quote-panel {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (forced-colors: active) {
  html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti),
  html[data-lower-surface="glass"] #voci .review-grid figure,
  html[data-lower-surface="glass"] #contatti .quote-panel,
  html[data-lower-surface="glass"] #contatti .quote-result dl {
    background: Canvas;
    color: CanvasText;
    border-color: CanvasText;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti)::before,
  html[data-lower-surface="glass"] :is(#come-lavoriamo, #metodo, #voci, #contatti)::after {
    display: none;
  }

  html[data-lower-surface="glass"] #contatti .quote-panel input:not([type="radio"]),
  html[data-lower-surface="glass"] #contatti .quote-panel select,
  html[data-lower-surface="glass"] #contatti .quote-panel textarea,
  html[data-lower-surface="glass"] #contatti .radio-options input:not(:checked) + span {
    background: Field;
    color: FieldText;
    border-color: FieldText;
    box-shadow: none;
  }

  html[data-lower-surface="glass"] #contatti .radio-options input:checked + span {
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }
}
