/*
 * EXIR, sito in rifacimento.
 * Palette e regole: EXIR_Direzione_Artistica_v2, sezioni 03 e 04. Carattere unico: Roboto.
 *
 * Contrasti (WCAG) usati qui:
 *   Statuario su Portoro 13,9 · Oro su Portoro 6,4 (titoli, filetti, testo di servizio)
 *   Bardiglio su Portoro 4,5 (solo filetti e bordi) · Statuario su Pino 11,9
 *   Inchiostro su Statuario 11,5 · #5E676A su Statuario 4,7 · Bardiglio su Statuario 3,1 (solo filetti)
 * L'oro non è mai un pulsante né un gradiente, e mai testo su Statuario.
 */

@font-face {
  font-family: 'Roboto';
  src: url('../fonts/roboto-latin-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --portoro: #1B1C1A;
  --pino: #1E2B25;
  --statuario: #EBE7DF;
  --bardiglio: #7C8588;
  --bardiglio-testo: #5E676A;
  --oro: #B49A70;
  --inchiostro: #2A2B28;

  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --gutter: clamp(1.25rem, 4.6vw, 5rem);
  --cols: repeat(12, minmax(0, 1fr));
  --col-gap: clamp(1rem, 2vw, 2rem);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --slow: cubic-bezier(.45, .05, .25, 1);

  color-scheme: dark;
}

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

html {
  background: var(--portoro);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--portoro);
  color: var(--statuario);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, p, ol, ul, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
[hidden] { display: none !important; }
p, li { text-wrap: pretty; }
a[href^="tel:"] { white-space: nowrap; }

::selection { background: var(--oro); color: var(--portoro); }

:focus-visible {
  outline: 1px solid var(--oro);
  outline-offset: 4px;
}

.skip {
  position: absolute;
  top: .75rem;
  left: var(--gutter);
  z-index: 10;
  padding: .75rem 1rem;
  background: var(--statuario);
  color: var(--portoro);
  font-size: .8125rem;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Testo di servizio */
.label {
  font-size: .6875rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--oro);
}

/* ---------- Struttura: tutto in una schermata ---------- */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: clamp(1.5rem, 3.4vw, 3rem) var(--gutter) 0;
}

.logo {
  display: block;
  width: clamp(5rem, 3.9rem + 3.4vw, 7.25rem);
  height: auto;
  color: var(--oro);
}

.langs {
  display: flex;
  gap: .25rem;
  margin: -.75rem -.625rem 0 0;
}
.langs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 .625rem;
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-decoration: none;
  color: var(--statuario);
}
.langs a::after {
  content: '';
  position: absolute;
  left: .625rem;
  right: calc(.625rem + .18em);
  bottom: .8rem;
  height: 1px;
  background: var(--oro);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s var(--ease);
}
.langs a[aria-current]::after,
.langs a:hover::after { transform: scaleX(1); }

/* ---------- Apertura ---------- */

.opening {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(3rem, 9vh, 7rem) var(--gutter) clamp(1.5rem, 3.5vh, 2.75rem);
}

.opening__body {
  flex: 1;
  display: grid;
  grid-template-columns: var(--cols);
  column-gap: var(--col-gap);
  align-items: end;
  padding-bottom: clamp(2.25rem, 6vh, 5rem);
}
.opening__lead, .opening__aside { grid-column: 1 / -1; }

.status {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 1.6vw, 1.5rem);
  margin-bottom: clamp(1.75rem, 4vh, 3rem);
  font-size: clamp(1rem, .82rem + .75vw, 1.625rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--oro);
}
.status__rule {
  flex: none;
  width: clamp(2.5rem, 4vw, 4.5rem);
  height: 1px;
  background: var(--oro);
  transform-origin: left;
}

.claim {
  font-size: clamp(2.6rem, 1.05rem + 5.9vw, 7.5rem);
  font-weight: 300;
  line-height: .98;
  letter-spacing: -.045em;
  color: var(--statuario);
}

.opening__aside {
  margin-top: clamp(2.25rem, 5vh, 3rem);
  max-width: 24rem;
}
.opening__aside > p:first-child {
  font-size: 1rem;
  line-height: 1.65;
}
.opening__aside .label { margin-top: 1.75rem; }

.contacts {
  display: grid;
  gap: .125rem;
  margin-top: .625rem;
  font-size: 1rem;
  line-height: 1.6;
}
.contacts a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--bardiglio);
  text-underline-offset: .32em;
  transition: text-decoration-color .25s var(--ease);
}
.contacts a:hover { text-decoration-color: var(--statuario); }

/* ---------- Pulsanti: Statuario su Portoro, o Portoro su Statuario, con un filetto ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 1.125rem;
  min-height: 3.25rem;
  margin-top: 2rem;
  padding: 0 1.5rem;
  border: 1px solid var(--bardiglio);
  border-radius: 0;
  background: var(--portoro);
  color: var(--statuario);
  font: 500 .6875rem/1 var(--font);
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.btn::after {
  content: '';
  width: 1.5rem;
  height: 1px;
  background: currentColor;
  transition: width .4s var(--ease);
}
.btn:hover {
  background: var(--statuario);
  border-color: var(--statuario);
  color: var(--portoro);
}
.btn:hover::after { width: 2.25rem; }

.btn--light {
  margin-top: 0;
  background: var(--statuario);
  color: var(--inchiostro);
}
.btn--light:hover {
  background: var(--portoro);
  border-color: var(--portoro);
  color: var(--statuario);
}
.btn[disabled] { cursor: progress; }

/* ---------- Orizzonte: la linea fra Apuane e costa ---------- */

.horizon { margin: 0 calc(var(--gutter) * -1); }
.horizon__ridge {
  display: block;
  width: 100%;
  /* Il disegno è 16:1: l'altezza segue la larghezza, così le cime non vengono mai tagliate.
     Sotto i 52px di altezza il disegno si ritaglia ai lati e resta il gruppo centrale delle Apuane. */
  height: max(3.25rem, 6.25vw);
  overflow: hidden;
}
.horizon__ridge path {
  fill: none;
  stroke: var(--bardiglio);
  stroke-width: 1;
  stroke-linejoin: miter;
  stroke-miterlimit: 2;
  vector-effect: non-scaling-stroke;
}
.horizon__sea {
  display: block;
  height: 1px;
  margin-top: clamp(.875rem, 1.6vw, 1.5rem);
  background: var(--oro);
  transform-origin: left;
}

/* ---------- Residenze ---------- */

.residences {
  display: grid;
  gap: 1rem;
  padding-top: clamp(1.25rem, 2.4vw, 2rem);
}
.residences ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem var(--col-gap);
}
.residences li {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  font-size: clamp(1rem, .92rem + .3vw, 1.25rem);
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: -.01em;
}
.residences__n {
  flex: none;
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
  color: var(--oro);
}

/* ---------- Piede: Pino ---------- */

.foot {
  display: grid;
  gap: .25rem;
  padding: 1.25rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom, 0px));
  background: var(--pino);
  color: var(--statuario);
  font-size: .75rem;
  line-height: 1.6;
  letter-spacing: .02em;
}
.foot a {
  display: inline-block;
  padding: .625rem 0;
  margin: -.625rem 0;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - .5rem) / 0 1px no-repeat;
  transition: background-size .4s var(--ease);
}
.foot a:hover { background-size: 100% 1px; }

/* ---------- Richiesta riservata: pannello chiaro ---------- */

.panel {
  color-scheme: light;
  position: fixed;
  inset: 0 0 0 auto;
  width: min(42rem, 100%);
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--statuario);
  color: var(--inchiostro);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Senza JavaScript il pannello si apre con l'ancora #richiesta. */
.panel:target { display: block; }
.panel::backdrop { background: rgb(27 28 26 / .72); }

.panel :focus-visible { outline-color: var(--inchiostro); }
.panel ::selection { background: var(--inchiostro); color: var(--statuario); }

.panel__inner {
  display: grid;
  align-content: start;
  gap: 2.5rem;
  min-height: 100%;
  padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1.25rem, 4vw, 3.5rem) clamp(2.5rem, 5vw, 4rem);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: .25rem;
}
.panel__title {
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -.04em;
}
.panel__close {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  margin: -.375rem -.625rem 0 0;
}
.panel__close span::before,
.panel__close span::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.25rem;
  height: 1px;
  background: var(--inchiostro);
  transition: transform .4s var(--ease);
}
.panel__close span::before { transform: translate(-50%, -50%) rotate(45deg); }
.panel__close span::after { transform: translate(-50%, -50%) rotate(-45deg); }
.panel__close:hover span::before { transform: translate(-50%, -50%) rotate(135deg); }
.panel__close:hover span::after { transform: translate(-50%, -50%) rotate(45deg); }

/* Modulo */

.form { display: grid; gap: 2rem; }

.form__status:empty { display: none; }
.form__status {
  padding-left: 1rem;
  border-left: 1px solid var(--inchiostro);
  font-size: .9375rem;
  line-height: 1.55;
}
.form__status a,
.form__note a,
.privacy a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--bardiglio);
  text-underline-offset: .3em;
  transition: text-decoration-color .25s var(--ease);
}
.form__status a:hover,
.form__note a:hover,
.privacy a:hover { text-decoration-color: currentColor; }

.field { display: grid; gap: .5rem; }
.field label {
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.field__hint {
  margin-left: .5rem;
  font-size: .8125rem;
  font-weight: 400;
  letter-spacing: .01em;
  text-transform: none;
  color: var(--bardiglio-testo);
}
.field input,
.field textarea {
  width: 100%;
  margin: 0;
  padding: .625rem 0 .75rem;
  border: 0;
  border-bottom: 1px solid var(--bardiglio);
  border-radius: 0;
  background: transparent;
  color: var(--inchiostro);
  font: 400 1.0625rem/1.5 var(--font);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.field textarea { resize: vertical; min-height: 8.5rem; }
.field input:focus,
.field textarea:focus,
.field.is-invalid input,
.field.is-invalid textarea {
  outline: none;
  border-bottom-color: var(--inchiostro);
  box-shadow: 0 1px 0 var(--inchiostro);
}
.field__error:empty { display: none; }
.field__error {
  font-size: .875rem;
  line-height: 1.5;
}
.field__error::before { content: '— '; }

.trap {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form__end {
  display: grid;
  gap: 1.5rem;
  padding-top: .5rem;
}
.form__note {
  font-size: .875rem;
  line-height: 1.6;
  color: var(--bardiglio-testo);
}
.form__note a { color: var(--inchiostro); }
.form__end .btn { justify-self: start; }

.thanks { outline: none; }
.thanks__title {
  margin-bottom: .75rem;
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -.035em;
}
.thanks p:last-child { max-width: 30rem; }

/* Informativa */

.privacy { border-top: 1px solid var(--bardiglio); }
.privacy summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  padding: 1rem 0;
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}
.privacy summary::-webkit-details-marker { display: none; }
.privacy summary::after {
  content: '';
  flex: none;
  width: .75rem;
  height: .75rem;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat;
  transition: transform .3s var(--ease);
}
.privacy[open] summary::after { transform: rotate(45deg); }
.privacy__body {
  display: grid;
  gap: .875rem;
  padding: .25rem 0 1rem;
  font-size: .875rem;
  line-height: 1.65;
}

/* ---------- Schermi larghi ---------- */

@media (min-width: 48em) {
  .residences {
    grid-template-columns: var(--cols);
    column-gap: var(--col-gap);
    align-items: baseline;
  }
  .residences .label { grid-column: 1 / span 2; }
  .residences ol {
    grid-column: 3 / -1;
    grid-template-columns: 1.1fr 1.25fr 1.2fr 1fr;
  }

  .foot {
    grid-template-columns: auto 1fr auto;
    column-gap: 2.5rem;
    align-items: baseline;
  }

  .form { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; }
  .form__status, .field:has(textarea), .form__end { grid-column: 1 / -1; }
  .form__end { grid-template-columns: 1fr auto; align-items: center; gap: 2rem; }
  .form__end .btn { justify-self: end; }
}

@media (min-width: 64em) {
  .opening__lead { grid-column: 1 / span 8; }
  .opening__aside {
    grid-column: 9 / -1;
    justify-self: end;
    margin-top: 0;
    padding-bottom: .5rem;
  }
}

/* ---------- Movimento: dissolvenze brevi, spostamenti minimi, una sola linea lenta ---------- */

@media (prefers-reduced-motion: no-preference) {
  .logo, .langs { animation: fade .9s var(--ease) .1s both; }
  .status { animation: fade 1s var(--ease) .25s both; }
  .status__rule { animation: draw-x 1.2s var(--ease) .35s both; }
  .claim { animation: rise 1.2s var(--ease) .45s both; }
  .opening__aside { animation: rise 1s var(--ease) .9s both; }
  .horizon__ridge { animation: reveal 3.2s var(--slow) .6s both; }
  .horizon__sea { animation: draw-x 2.4s var(--slow) 1.7s both; }
  .residences, .foot { animation: fade 1.2s var(--ease) 2.4s both; }

  .panel[open] { animation: panel-in .45s var(--ease) both; }
  .panel[open]::backdrop { animation: fade .45s var(--ease) both; }
  .is-entering { animation: fade .6s var(--ease) both; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: none; } }
@keyframes draw-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes panel-in { from { opacity: 0; transform: translateX(1rem); } to { opacity: 1; transform: none; } }

@media (forced-colors: active) {
  .horizon__sea, .status__rule { background: CanvasText; }
  .btn { border-color: ButtonText; }
  .panel { border-left: 1px solid CanvasText; }
}
