/* ==========================================================
   Avv. Mauro Barresi — foglio di stile principale
   ========================================================== */

:root {
  --ink: #13213a;
  --ink-2: #1b2d4d;
  --ink-3: #0c1628;
  --gold: #b8935a;
  --gold-light: #d8b679;
  --gold-pale: #f3ead9;
  --paper: #fbf9f5;
  --paper-2: #f3efe7;
  --text: #2a2f3a;
  --muted: #5f6675;
  --line: #e4ddd0;
  --white: #fff;
  --ok: #2f7a4d;
  --err: #a33a2b;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(19, 33, 58, .06), 0 8px 24px rgba(19, 33, 58, .08);
  --shadow-lg: 0 2px 6px rgba(19, 33, 58, .08), 0 24px 48px rgba(19, 33, 58, .14);
  --nav-h: 72px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.2; margin: 0 0 .5em; font-weight: 600; }
h2 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); letter-spacing: -.01em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.icon { width: 1.1em; height: 1.1em; flex: none; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: 6px;
}
.skip-link:focus { top: 12px; }

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

.eyebrow {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .9rem;
  display: inline-flex; align-items: center; gap: .75rem;
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.eyebrow--light { color: var(--gold-light); }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 48px; padding: .75rem 1.4rem;
  font: 600 .95rem/1.2 var(--sans); letter-spacing: .01em;
  border-radius: 999px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn--gold { background: var(--gold); color: var(--white); box-shadow: 0 6px 18px rgba(184, 147, 90, .35); }
.btn--gold:hover { background: #a7824a; }
.btn--ghost { border-color: rgba(255, 255, 255, .35); color: var(--white); }
.btn--ghost:hover { border-color: var(--gold-light); color: var(--gold-light); }
.btn--outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn--outline:hover { background: var(--ink); color: var(--white); }
.btn--small { min-height: 40px; padding: .5rem 1.1rem; font-size: .9rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .65; cursor: progress; transform: none; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: -40px; z-index: 50; }

.topbar { background: var(--ink-3); color: rgba(255, 255, 255, .78); font-size: .85rem; }
.topbar__inner { display: flex; align-items: center; gap: 1.75rem; min-height: 40px; }
.topbar__item { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; }
.topbar__item:hover { color: var(--gold-light); }
.topbar__item .icon { color: var(--gold-light); }
.topbar__social { margin-left: auto; display: flex; gap: .9rem; }
.topbar__social a { display: inline-flex; padding: 4px; }
.topbar__social a:hover { color: var(--gold-light); }

.navbar {
  position: relative;
  background: rgba(251, 249, 245, .92);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.navbar.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 20px rgba(19, 33, 58, .06); }
.navbar__inner { display: flex; align-items: center; justify-content: space-between; height: var(--nav-h); }

.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; }
.brand img { width: 44px; height: 44px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--ink); }
.brand__sub { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .35rem; }
.nav a:not(.btn) {
  display: block; padding: .5rem .85rem; border-radius: 6px;
  font-size: .95rem; font-weight: 500; color: var(--ink); text-decoration: none;
  position: relative;
}
.nav a:not(.btn)::after {
  content: ""; position: absolute; left: .85rem; right: .85rem; bottom: .3rem; height: 1px;
  background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform .25s;
}
.nav a:not(.btn):hover::after, .nav a.is-active::after { transform: scaleX(1); }
.nav li:last-child { margin-left: .6rem; }

.nav-toggle {
  display: none; width: 48px; height: 48px; margin-right: -10px;
  background: none; border: 0; cursor: pointer; border-radius: 8px;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(216, 182, 121, .16), transparent 60%),
    linear-gradient(160deg, var(--ink-2) 0%, var(--ink) 55%, var(--ink-3) 100%);
  color: rgba(255, 255, 255, .86);
  padding: clamp(3rem, 2rem + 4vw, 6rem) 0 0;
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(216, 182, 121, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(216, 182, 121, .05) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 85%);
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}
.hero__inner { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 4vw, 4.5rem); align-items: center; }
.hero__title { color: var(--white); font-size: clamp(2.4rem, 1.4rem + 4.2vw, 4.25rem); letter-spacing: -.015em; margin-bottom: .35em; }
.hero__lead { font-family: var(--serif); font-size: clamp(1.2rem, 1rem + .8vw, 1.5rem); line-height: 1.45; color: var(--gold-pale); max-width: 34ch; }
.hero__text { max-width: 56ch; color: rgba(255, 255, 255, .74); }
.hero__text strong { color: var(--white); font-weight: 600; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }

.hero__visual { position: relative; align-self: end; }
.hero__visual img {
  width: 100%; height: auto; aspect-ratio: 5 / 6; object-fit: cover;
  border-radius: 200px 200px 0 0;
  border: 1px solid rgba(216, 182, 121, .35); border-bottom: 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .25);
}
.hero__visual::before {
  content: ""; position: absolute; inset: -14px -14px 0 -14px;
  border: 1px solid rgba(216, 182, 121, .22); border-bottom: 0;
  border-radius: 214px 214px 0 0; pointer-events: none;
}

.facts {
  position: relative; list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--white); color: var(--text);
  border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--shadow-lg);
}
.facts li { padding: 1.5rem 1.6rem; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: .2rem; }
.facts li:first-child { border-left: 0; }
.facts__num { font-family: var(--serif); font-size: 2rem; font-weight: 600; color: var(--gold); line-height: 1.1; }
.facts__label { font-size: .88rem; line-height: 1.45; color: var(--muted); }

/* ---------- Sezioni ---------- */
.section { padding: clamp(4rem, 3rem + 4vw, 7rem) 0; }
.section--tight { padding-bottom: clamp(3rem, 2rem + 3vw, 5rem); }
.section--alt { background: var(--paper-2); }
.section__head { max-width: 760px; margin-bottom: clamp(2rem, 1.5rem + 2vw, 3.5rem); }
.section__intro { color: var(--muted); font-size: 1.075rem; }

/* Card aree */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.card {
  position: relative; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 2rem 2rem 1.6rem;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 64px;
  background: var(--gold); border-radius: var(--radius) 0 0 0;
  transition: width .35s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: transparent; }
.card:hover::before { width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
.card__icon { width: 44px; height: 44px; color: var(--gold); margin-bottom: 1.1rem; }
.card h3 { font-size: 1.35rem; }
.card p { color: var(--muted); margin: 0; }

/* Profilo / timeline */
.profile { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.profile__aside { position: sticky; top: calc(var(--nav-h) + 32px); }
.profile__aside p { color: var(--muted); }
.profile__aside .btn { margin-top: .75rem; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: linear-gradient(var(--gold), var(--line)); }
.timeline__item { position: relative; padding: 0 0 2.2rem 2.5rem; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--paper-2); border: 2px solid var(--gold);
}
.timeline__item:last-child::before { background: var(--gold); }
.timeline__date { display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: .3rem; }
.timeline__item h3 { margin-bottom: .35rem; }
.timeline__item p { color: var(--muted); margin: 0; }

/* Banda pubblicazioni */
.band { background: linear-gradient(120deg, var(--ink) 0%, var(--ink-2) 100%); color: rgba(255, 255, 255, .8); padding: clamp(3rem, 2rem + 3vw, 4.5rem) 0; position: relative; overflow: hidden; }
.band::after { content: "§"; position: absolute; right: -20px; top: 50%; transform: translateY(-50%); font-family: var(--serif); font-size: 22rem; line-height: 1; color: rgba(216, 182, 121, .06); pointer-events: none; }
.band__inner { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.band__title { color: var(--white); font-size: clamp(1.4rem, 1rem + 1.6vw, 2rem); font-style: italic; max-width: 30ch; }
.band__text { margin: 0; max-width: 60ch; }
.band .btn { flex: none; }

/* Contatti */
.contact { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.contact__info > p { color: var(--muted); }
.contact-list { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1.1rem; }
.contact-list li { display: flex; align-items: center; gap: 1rem; }
.contact-list__icon { width: 46px; height: 46px; border-radius: 50%; background: var(--gold-pale); color: var(--gold); display: grid; place-items: center; flex: none; }
.contact-list small { display: block; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.contact-list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.contact-list a:hover { color: var(--gold); }
.contact-list li > span:last-child { color: var(--ink); font-weight: 600; }

.form { background: var(--white); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); padding: clamp(1.4rem, 1rem + 2vw, 2.5rem); box-shadow: var(--shadow); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form__row:first-child { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field span { font-size: .85rem; font-weight: 600; color: var(--ink); }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: .8rem .95rem; min-height: 48px;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--gold); background: var(--white); box-shadow: 0 0 0 4px rgba(184, 147, 90, .18); }
.field.is-invalid input, .field.is-invalid textarea { border-color: var(--err); }
.check { display: flex; gap: .7rem; align-items: flex-start; font-size: .88rem; line-height: 1.5; color: var(--muted); margin: .25rem 0 1.25rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--gold); flex: none; }
.check.is-invalid span { color: var(--err); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__status { margin: 1rem 0 0; font-size: .95rem; min-height: 1.5em; }
.form__status.is-ok { color: var(--ok); }
.form__status.is-err { color: var(--err); }

/* Mappa */
.map { position: relative; border-radius: calc(var(--radius) + 4px); overflow: hidden; border: 1px solid var(--line); background: var(--ink); min-height: 420px; box-shadow: var(--shadow); }
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map__placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 2rem 1.25rem; color: rgba(255, 255, 255, .82);
  background:
    radial-gradient(circle at 50% 40%, rgba(216, 182, 121, .18), transparent 55%),
    repeating-linear-gradient(35deg, rgba(216, 182, 121, .07) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(-55deg, rgba(216, 182, 121, .07) 0 1px, transparent 1px 64px),
    linear-gradient(160deg, var(--ink-2), var(--ink-3));
}
.map__pin { width: 46px; height: 46px; color: var(--gold-light); margin-bottom: .75rem; }
.map__address { font-family: var(--serif); font-size: 1.4rem; color: var(--white); line-height: 1.35; }
.map__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: .5rem; }
.map__actions .btn--outline { border-color: rgba(255, 255, 255, .4); color: var(--white); }
.map__actions .btn--outline:hover { background: var(--white); color: var(--ink); }
.map__note { font-size: .8rem; color: rgba(255, 255, 255, .55); max-width: 46ch; margin: 1.25rem 0 0; }

/* Footer */
.footer { background: var(--ink-3); color: rgba(255, 255, 255, .7); font-size: .95rem; }
.footer__inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr .8fr; gap: 2rem; padding-top: 3.5rem; padding-bottom: 2.5rem; }
.footer__brand { display: flex; gap: 1rem; align-items: flex-start; }
.footer__brand img { width: 48px; height: 48px; }
.footer__brand p { margin: 0; }
.footer__name { font-family: var(--serif); font-size: 1.25rem; color: var(--white); }
.footer__title { font-family: var(--sans); font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-light); margin-bottom: .8rem; font-weight: 600; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--gold-light); }
.footer__social { display: flex; gap: .6rem; }
.footer__social a { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); display: grid; place-items: center; }
.footer__social a:hover { border-color: var(--gold-light); }
.footer__bottom { border-top: 1px solid rgba(255, 255, 255, .08); font-size: .85rem; }
.footer__bottom .container { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: 1.2rem; padding-bottom: 1.2rem; }
.footer__bottom p { margin: 0; }

/* Pulsante chiamata (solo mobile) */
.call-fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40;
  width: 56px; height: 56px; border-radius: 50%; display: none; place-items: center;
  background: var(--gold); color: var(--white); box-shadow: 0 10px 24px rgba(19, 33, 58, .3);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.call-fab .icon { width: 24px; height: 24px; }
.call-fab.is-visible { opacity: 1; transform: none; pointer-events: auto; }

/* Animazione d'ingresso */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1080px) {
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts li:nth-child(3) { border-left: 0; }
  .facts li:nth-child(n+3) { border-top: 1px solid var(--line); }
  .footer__inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 960px) {
  :root { --nav-h: 64px; }
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%; height: var(--menu-h, calc(100vh - var(--nav-h)));
    background: var(--paper); padding: 1rem 20px 2rem;
    overflow-y: auto; overscroll-behavior: contain;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .2s, transform .2s, visibility 0s .2s;
    border-top: 1px solid var(--line);
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .2s, transform .2s; }
  .nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .nav li { border-bottom: 1px solid var(--line); }
  .nav li:last-child { border-bottom: 0; margin: 1.5rem 0 0; }
  .nav a:not(.btn) { font-family: var(--serif); font-size: 1.35rem; padding: 1rem .25rem; }
  .nav a:not(.btn)::after { display: none; }
  .nav .btn { width: 100%; min-height: 52px; font-size: 1rem; }
  body.nav-open { overflow: hidden; }

  .hero__inner { grid-template-columns: 1fr; }
  .hero__visual { max-width: 420px; width: 80%; margin: 0 auto; }
  .profile, .contact { grid-template-columns: 1fr; }
  .profile__aside { position: static; }
  .band__inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 720px) {
  body { font-size: 1rem; }
  .topbar__item:nth-child(2) { display: none; }
  .brand__sub { display: none; }
  .brand__name { font-size: 1.2rem; }
  .brand img { width: 40px; height: 40px; }
  .hero__actions .btn { flex: 1 1 100%; }
  .hero__visual { width: 92%; }
  .facts li { padding: 1.1rem 1.1rem; }
  .facts__num { font-size: 1.6rem; }
  .facts__label { font-size: .82rem; }
  .cards { grid-template-columns: 1fr; gap: 1rem; }
  .card { padding: 1.6rem 1.4rem 1.4rem; }
  .form__row { grid-template-columns: 1fr; gap: 0; }
  .band .btn { width: 100%; }
  .map { min-height: 380px; }
  .map__actions .btn { flex: 1 1 100%; }
  .footer__inner { grid-template-columns: 1fr; gap: 1.6rem; padding-top: 2.5rem; }
  .footer__bottom .container { flex-direction: column; align-items: flex-start; padding-bottom: calc(1.2rem + 72px); }
  .call-fab { display: grid; }
}

@media (max-width: 380px) {
  .container { padding: 0 16px; }
  .facts { grid-template-columns: 1fr; }
  .facts li { border-left: 0 !important; border-top: 1px solid var(--line); }
  .facts li:first-child { border-top: 0; }
  .topbar__inner { gap: 1rem; }
}

@media print {
  .topbar, .nav, .nav-toggle, .call-fab, .map, .form, .hero__visual { display: none !important; }
  .hero, .band, .footer { background: none; color: #000; }
  .hero__title, .band__title, .footer__name { color: #000; }
}
