/* =========================================================================
   Domus Ars — sistema visivo v1
   Carta chiara, tratto grafite, l'azzurro del logo per evidenziare.
   Un solo elemento memorabile: la forma della casa del logo.
   ========================================================================= */

@font-face {
  font-family: "Jost";
  src: url("../assets/fonts/jost-var.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/plexmono-400.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/plexmono-500.woff") format("woff");
  font-weight: 500;
  font-display: swap;
}

:root {
  --carta: #F2F6F8;
  --bianco: #FFFFFF;
  --inchiostro: #1E2629;
  --testo: #2C373C;
  --petrolio: #355461;
  --petrolio-scuro: #2A4450;
  --grafite: #56656C;
  --cielo: #C4D7DF;
  --cielo-chiaro: #DCE8ED;
  --acciaio: #6DA3BB;
  --acciaio-scuro: #3B6E86;
  --sabbia: #B19C8C;
  --sabbia-chiara: #ECE6E0;
  --sabbia-scura: #7A6555;
  --linea: rgba(30, 38, 41, 0.14);
  --linea-forte: rgba(30, 38, 41, 0.32);

  --sans: "Jost", "Futura PT", "Century Gothic", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1320px;
  --section: clamp(88px, 12vw, 168px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --hdr: 72px;

  /* La casa del logo: la campitura azzurra, normalizzata */
  --house: polygon(0% 56.5%, 48.4% 0%, 100% 51.3%, 100% 100%, 0% 99.4%);
  color-scheme: only light; /* niente scurimento automatico dei browser in modalità scura */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hdr) + 16px); }
body {
  margin: 0;
  background: var(--carta);
  color: var(--testo);
  font: 400 18px/1.6 var(--sans);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; color: var(--inchiostro); font-weight: 400; text-wrap: balance; }
p { margin: 0; }
::selection { background: var(--cielo); color: var(--inchiostro); }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--inchiostro); color: var(--carta); padding: 12px 16px; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--acciaio-scuro); outline-offset: 3px; }

/* ---------- Scala tipografica (rapporto 1,333, base 18) ---------- */
.t-display { font-weight: 300; font-size: clamp(46px, 7.4vw, 112px); line-height: 0.98; letter-spacing: -0.02em; }
.t-1 { font-weight: 300; font-size: clamp(38px, 5vw, 72px); line-height: 1.04; letter-spacing: -0.015em; }
.t-2 { font-weight: 300; font-size: clamp(30px, 3.4vw, 48px); line-height: 1.1; letter-spacing: -0.01em; }
.t-3 { font-weight: 400; font-size: clamp(22px, 2vw, 28px); line-height: 1.25; }
.t-lead { font-size: clamp(19px, 1.55vw, 22px); line-height: 1.55; color: var(--testo); max-width: 34em; }
.t-small { font-size: 15px; line-height: 1.55; color: var(--grafite); }
.t-kicker { font-size: 16px; font-weight: 500; color: var(--acciaio-scuro); }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: 0; }
.measure { max-width: 36em; }

/* ---------- Contenitori ---------- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section); }
.section--tight { padding-block: clamp(64px, 8vw, 112px); }
.on-petrolio { background: var(--petrolio); color: #DCE8ED; }
.on-petrolio h1, .on-petrolio h2, .on-petrolio h3 { color: var(--carta); }
.on-petrolio .t-kicker { color: var(--cielo); }
.on-petrolio .t-small, .on-petrolio .t-lead { color: #C9D9E0; }
.on-sabbia { background: var(--sabbia-chiara); }
.on-sabbia .t-kicker { color: var(--sabbia-scura); }
.on-bianco { background: var(--bianco); }

.head { display: grid; gap: 20px; margin-bottom: clamp(48px, 6vw, 88px); max-width: 52rem; }
.head--split { max-width: none; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: end; column-gap: 64px; }
@media (max-width: 860px) { .head--split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Bottoni e link ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px;
  font-size: 17px; font-weight: 400; letter-spacing: 0.01em;
  text-decoration: none; border-radius: 2px; border: 1px solid transparent; cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.btn--primary { background: var(--petrolio); border-color: var(--petrolio); color: var(--carta); }
.btn--primary:hover { background: var(--inchiostro); border-color: var(--inchiostro); }
.btn--line { border-color: var(--inchiostro); color: var(--inchiostro); background: transparent; }
.btn--line:hover { background: var(--inchiostro); color: var(--carta); }
.btn--light { background: var(--carta); border-color: var(--carta); color: var(--inchiostro); }
.btn--light:hover { background: var(--cielo); border-color: var(--cielo); }
.btn--ghost-light { border-color: rgba(242, 246, 248, 0.7); color: var(--carta); background: transparent; }
.btn--ghost-light:hover { background: var(--carta); color: var(--inchiostro); }
.btn[disabled] { opacity: .6; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.link {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 500; text-decoration: none; color: var(--inchiostro);
  border-bottom: 1px solid currentColor; padding-bottom: 4px;
  transition: color .2s var(--ease), gap .25s var(--ease);
}
.link:hover { color: var(--acciaio-scuro); gap: 14px; }
.link svg { width: 18px; height: 18px; }
.on-petrolio .link { color: var(--carta); }

/* ---------- Barra apertura e header ---------- */
.bar {
  position: relative; z-index: 60;
  background: var(--inchiostro); color: #DCE8ED;
  font-size: 14px; line-height: 1.4; text-align: center;
  padding: 9px var(--gutter);
}
.bar a { color: var(--carta); }

.header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  height: var(--hdr);
  background: rgba(242, 246, 248, 0.94);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--linea);
  transition: background-color .35s var(--ease), border-color .35s var(--ease), color .35s var(--ease);
}
.header__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.header__logo { display: block; flex: none; }
.header__logo img { height: 40px; width: auto; transition: filter .35s var(--ease); }
.nav { display: flex; align-items: center; gap: clamp(16px, 2.2vw, 32px); }
.nav__link { text-decoration: none; font-size: 16px; padding: 10px 0; position: relative; color: var(--inchiostro); }
.nav__link::after { content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.nav__link:hover::after, .nav__link[aria-current="page"]::after { transform: scaleX(1); }
.nav .btn { min-height: 44px; padding: 0 20px; font-size: 16px; }
.nav-toggle { display: none; width: 48px; height: 48px; border: 0; background: transparent; cursor: pointer; padding: 12px; margin-right: -12px; }
.nav-toggle span { display: block; height: 1.5px; background: var(--inchiostro); margin: 6px 0; transition: transform .3s var(--ease), opacity .2s; }
.is-nav-open .nav-toggle span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.is-nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.is-nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* Header sopra il video d'apertura */
.header.is-over-media { background: transparent; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.header.is-over-media .header__logo img { filter: url(#logo-light); }
.header.is-over-media .nav__link { color: var(--carta); }
.header.is-over-media .nav-toggle span { background: var(--carta); }
.header.is-over-media .nav .btn--primary { background: var(--carta); border-color: var(--carta); color: var(--inchiostro); }

@media (max-width: 1080px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed; inset: calc(var(--hdr) + var(--bar-h, 0px)) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--carta); padding: 12px var(--gutter) 28px;
    border-bottom: 1px solid var(--linea);
    transform: translateY(-12px); opacity: 0; visibility: hidden;
    transition: opacity .25s var(--ease), transform .35s var(--ease), visibility 0s linear .3s;
  }
  .is-nav-open .nav { transform: none; opacity: 1; visibility: visible; transition: opacity .25s var(--ease), transform .35s var(--ease); }
  .nav__link { font-size: 22px; font-weight: 300; padding: 14px 0; border-bottom: 1px solid var(--linea); color: var(--inchiostro) !important; }
  .nav__link::after { display: none; }
  .nav .btn { margin-top: 20px; min-height: 52px; }
  .header.is-over-media .nav .btn--primary { background: var(--petrolio); border-color: var(--petrolio); color: var(--carta); }
  .is-nav-open .header { background: var(--carta); border-color: var(--linea); }
  .is-nav-open .header .header__logo img { filter: none; }
  .is-nav-open .header .nav-toggle span { background: var(--inchiostro); }
}
@media (max-width: 680px) {
  :root { --hdr: 64px; }
  .header__logo img { height: 32px; }
  body { font-size: 17px; }
}

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--linea); padding-block: 64px 40px; font-size: 15px; color: var(--grafite); }
.footer__grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 40px; }
.footer__brand img { height: 84px; width: auto; }
.footer__brand p { margin-top: 18px; max-width: 26em; }
.footer h2 { font-size: 15px; font-weight: 500; color: var(--inchiostro); margin-bottom: 14px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--inchiostro); text-decoration: underline; }
.footer__legal { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--linea); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; font-size: 14px; }
@media (max-width: 760px) { .footer__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .footer__brand { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer__grid { grid-template-columns: minmax(0, 1fr); } }
.footer li, .contact__lines a { overflow-wrap: anywhere; }

/* ---------- Banner cookie ---------- */
.cookie {
  position: fixed; z-index: 90; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: 560px; margin-left: auto;
  background: var(--bianco); color: var(--testo);
  border: 1px solid var(--linea); box-shadow: 0 18px 50px rgba(30, 38, 41, 0.14);
  padding: 22px 24px; display: grid; gap: 16px; font-size: 15px;
}
.cookie h2 { font-size: 17px; font-weight: 500; }
.cookie__links { display: flex; gap: 16px; }
.cookie .actions { justify-content: flex-end; }
.cookie .btn { min-height: 44px; padding: 0 18px; font-size: 15px; }

/* ---------- Form ---------- */
.form { display: grid; gap: 18px; }
.form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; font-size: 15px; font-weight: 500; color: var(--inchiostro); }
.field small { font-weight: 400; color: var(--grafite); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 52px; padding: 13px 15px;
  font-size: 17px; font-weight: 400; color: var(--inchiostro);
  background: var(--bianco); border: 1px solid var(--linea-forte); border-radius: 2px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--petrolio); box-shadow: 0 0 0 3px rgba(53, 84, 97, 0.18); }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%231E2629' stroke-width='1.5'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
.choice-group { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.choice-group legend { font-size: 15px; font-weight: 500; color: var(--inchiostro); margin-bottom: 10px; padding: 0; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; min-height: 52px; padding: 12px 16px;
  border: 1px solid var(--linea-forte); background: var(--bianco); border-radius: 2px;
  font-size: 16px; color: var(--inchiostro); cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s;
}
.choice input:checked + span { border-color: var(--petrolio); background: var(--petrolio); color: var(--carta); }
.choice input:focus-visible + span { outline: 2px solid var(--acciaio-scuro); outline-offset: 2px; }
.check { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; font-size: 15px; font-weight: 400; color: var(--testo); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--petrolio); }
.form__step[hidden] { display: none; }
.form__progress { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--grafite); }
.form__progress span { flex: 1; height: 2px; background: var(--linea); position: relative; overflow: hidden; }
.form__progress span::after { content: ""; position: absolute; inset: 0; background: var(--petrolio); transform: scaleX(var(--p, .5)); transform-origin: left; transition: transform .4s var(--ease); }
.form__nav { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.form__status { font-size: 16px; padding: 14px 16px; background: var(--cielo-chiaro); color: var(--inchiostro); }
.form__status.is-error { background: #F6E3DF; color: #7A2A1D; }
.honeypot { position: absolute; left: -9999px; }
@media (max-width: 600px) { .form__row, .choices { grid-template-columns: minmax(0, 1fr); } }

/* Dettagli facoltativi nel modulo */
.form__more { border-top: 1px solid var(--linea); padding-top: 6px; }
.form__more summary { cursor: pointer; font-weight: 500; color: var(--inchiostro); min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; }
.form__more summary::-webkit-details-marker { display: none; }
.form__more summary::before { content: "+"; font-family: var(--mono); width: 18px; color: var(--acciaio-scuro); }
.form__more[open] summary::before { content: "–"; }
.form__progress em { font-style: normal; }
.form__property[hidden] { display: none; }

/* ---------- Comparse una tantum (solo dove servono) ---------- */
.js [data-draw] path, .js [data-draw] line, .js [data-draw] rect, .js [data-draw] circle, .js [data-draw] polyline {
  stroke-dasharray: var(--len, 400); stroke-dashoffset: var(--len, 400);
  transition: stroke-dashoffset 1.6s var(--ease);
}
.js [data-draw].is-drawn path, .js [data-draw].is-drawn line, .js [data-draw].is-drawn rect, .js [data-draw].is-drawn circle, .js [data-draw].is-drawn polyline { stroke-dashoffset: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js [data-draw] path, .js [data-draw] line, .js [data-draw] rect, .js [data-draw] circle, .js [data-draw] polyline { stroke-dashoffset: 0; }
}

/* ---------- Pagine interne: apertura ---------- */
.page-hero { padding-block: clamp(72px, 10vw, 144px) clamp(48px, 6vw, 88px); }
/* Ritratto: la foto scontornata davanti alla casa azzurra del logo, con la casa a tratto alle spalle.
   L'immagine è mostrata intera, senza ritagli, e mai più grande della sua risoluzione. */
.portrait { position: relative; margin: 0; width: 100%; max-width: 440px; aspect-ratio: 1212 / 1402; }
.portrait__house { position: absolute; inset: 0; width: 100%; height: 100%; }
.portrait__fill { fill: var(--cielo); }
.portrait__line { fill: none; stroke: var(--inchiostro); stroke-width: 1.4px; vector-effect: non-scaling-stroke; }
.portrait img { position: absolute; left: 7.426%; top: 0; width: 92.574%; height: 100%; object-fit: contain; }
.page-hero__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 56px; align-items: end; }
.page-hero h1 { margin-top: 18px; }
.page-hero .t-lead { margin-top: 28px; }
@media (max-width: 860px) { .page-hero__grid { grid-template-columns: minmax(0, 1fr); } }

/* Testo lungo (privacy, cookie) */
.prose { max-width: 44rem; }
.prose h2 { font-size: 26px; font-weight: 400; margin: 48px 0 14px; }
.prose p, .prose li { color: var(--testo); }
.prose p + p { margin-top: 14px; }
.prose ul { padding-left: 22px; display: grid; gap: 10px; margin: 14px 0; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--cielo-chiaro); padding: 1px 6px; }
.prose a { color: var(--acciaio-scuro); }

/* ---------- Esclusiva ---------- */
.promise { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 96px); }
.promise__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(122, 101, 85, 0.35); }
.promise__list li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 16px; padding-block: 24px; border-bottom: 1px solid rgba(122, 101, 85, 0.35); font-size: 20px; color: var(--inchiostro); }
.promise__list svg { width: 28px; height: 28px; margin-top: 2px; }
.promise__list .ill { stroke: var(--sabbia-scura); stroke-width: 1.6; }
.promise__sign { margin-top: 40px; display: grid; gap: 4px; }
.promise__sign strong { font-weight: 400; font-size: 26px; color: var(--inchiostro); }
.promise__sign span { color: var(--sabbia-scura); font-size: 16px; }
@media (max-width: 900px) { .promise { grid-template-columns: minmax(0, 1fr); } }


/* ---------- Contatti ---------- */
.contact { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(40px, 6vw, 96px); align-items: start; }
.contact__text { display: grid; gap: 24px; position: sticky; top: calc(var(--hdr) + 40px); }
.contact__lines { display: grid; gap: 6px; margin-top: 12px; font-size: 19px; }
.contact__lines a { color: var(--inchiostro); text-decoration: none; border-bottom: 1px solid var(--linea-forte); justify-self: start; }
.contact__lines a:hover { border-color: var(--inchiostro); }
.contact__form { background: var(--bianco); padding: clamp(24px, 3.4vw, 48px); border: 1px solid var(--linea); }
@media (max-width: 900px) { .contact { grid-template-columns: minmax(0, 1fr); } .contact__text { position: static; } }
