/* ============================================================
   DOMUS MARINA — Base: reset, tipografia, layout primitives
   ============================================================ */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Blocca lo scroll quando menu/lightbox sono aperti, senza jump */
body.is-locked {
  overflow: hidden;
  touch-action: none;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

/* Ogni immagine riserva il suo spazio: CLS = 0 */
img { height: auto; background-color: var(--sand-200); }

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

button { background: none; border: none; cursor: pointer; }

p, h1, h2, h3, h4, li { overflow-wrap: break-word; }

/* ---------- Tipografia ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: var(--lh-snug);
  letter-spacing: var(--track-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-4xl); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-3xl); line-height: var(--lh-tight); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

/* L'italico del Cormorant è il vero lusso di questo font: usalo. */
.em {
  font-style: italic;
  font-weight: 300;
}

p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }

/* Label maiuscoletto spaziato — la firma editoriale */
.label {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--fg-subtle);
  line-height: 1;
}
.label--accent { color: var(--accent); }
.label--on-deep { color: var(--fg-on-deep-muted); }

/* Numerazione sezioni: 01 — Le Dimore */
.label__num {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-loose);
  color: var(--fg-muted);
  font-weight: 300;
}

/* Cifre tabulari per prezzi e distanze — niente sfarfallio */
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.shell {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell--wide { max-width: 100rem; }
.shell--text { max-width: var(--maxw-text); }

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

.section--deep {
  background: var(--bg-deep);
  color: var(--fg-on-deep);
}
.section--deep .label { color: var(--fg-on-deep-muted); }
.section--deep .lead { color: var(--fg-on-deep-muted); }

.section--alt { background: var(--bg-alt); }

/* Intestazione di sezione ricorrente */
.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}
.section-head__title { max-width: 18ch; }

@media (min-width: 62rem) {
  .section-head {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-7);
  }
  .section-head__aside { max-width: 30rem; padding-bottom: var(--sp-2); }
}

/* Filetto orizzontale sottile */
.rule {
  height: 1px;
  background: var(--border);
  border: 0;
  width: 100%;
}
.section--deep .rule { background: var(--border-on-deep); }

/* ---------- Accessibilità ---------- */

/* Skip link — primo elemento focusabile */
.skip {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: var(--z-loader);
  padding: var(--sp-3) var(--sp-5);
  background: var(--primary);
  color: var(--white);
  border-radius: var(--r-md);
  transform: translateY(-160%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip:focus-visible { transform: translateY(0); }

/* Un solo anello di focus, coerente ovunque */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
.section--deep :focus-visible { outline-color: var(--terra-300); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

::selection {
  background: var(--sea-900);
  color: var(--sand-50);
}
