/* =========================================================================
   CAMERA OSCURA — Il Volume Bianco
   Sito di Martina Gagliardi · pittura, opere uniche
   Un volume bianco caldo che trattiene la luce: le opere levitano nel vuoto,
   la firma è il punto fermo, le ambientazioni le posano nelle stanze reali.
   ========================================================================= */

/* — Wordmark: ITC Avant Garde Gothic Std. local() = usa quella installata sul Mac;
   url() = copia incorporata nel sito così funziona ovunque (licenza web a carico del cliente). — */
@font-face {
  font-family: 'Avant Garde Gothic';
  src: local('ITC Avant Garde Gothic Std'), local('ITCAvantGardeStd-Bk'),
       url('assets/fonts/avantgarde-book.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Avant Garde Gothic';
  src: local('ITC Avant Garde Gothic CE Demi'), local('ITC Avant Garde Gothic Demi'),
       url('assets/fonts/avantgarde-demi.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* — Volume — */
  --bg:        #FBFBF9;   /* plaster bianco caldo, mai #FFF */
  --floor:     #F4F2EC;   /* il pavimento del volume (fascia carosello) */
  --ink:       #1A1A18;   /* near-black caldo, mai #000 */
  --muted:     #8A887F;   /* taupe-grey: sottotitoli, label, metadati */
  --hairline:  rgba(0,0,0,0.08);
  --brass:     #B08A4F;   /* oro antico, usato in 4 punti soltanto */

  /* — Camera oscura (retro card) — */
  --back-bg:    #1C1C1A;
  --back-ink:   #EDEBE4;
  --back-muted: #A9A79E;

  /* — Tipografia — */
  --serif:  'Cormorant Garamond', Georgia, serif;
  --sans:   'Inter', system-ui, -apple-system, sans-serif;
  --wordmark: 'Avant Garde Gothic', 'Futura', 'Avenir Next', sans-serif;

  /* — Geometria — */
  --perspective: 1500px;   /* profondità del carosello Z */

  /* — Texture di iuta (fondale): 0 = assente, ~1 = appena percepibile — */
  --jute: 0.40;   /* sfondo ancora più bianco: trama juta appena accennata */
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  height: 100%;
  overflow: hidden;            /* pagina FISSA a una schermata: lo scroll guida l'asse Z */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* fondale di iuta reale (sfondo_juta.png): fisso dietro a tutto, intensità regolabile via --jute */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url('assets/sfondo_juta.webp');   /* ottimizzata: 1200px, ~432 KB (da 3,9 MB) */
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;       /* riempie lo schermo senza giunte; per ripetere la trama reale -> repeat + size in px */
  opacity: var(--jute);
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.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;
}

/* eyebrow / kicker condiviso */
.eyebrow {
  margin: 0;
  font-family: var(--sans);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: 0.62rem;
  color: var(--muted);
}

/* =========================================================================
   1 · IL VOLUME (hero)
   ========================================================================= */
.stage {
  position: fixed;
  inset: 0;
  height: 100svh;
  max-height: 100svh;
  /* vignettatura calda: il bianco diventa aria, non carta piatta */
  background:
    radial-gradient(130% 110% at 50% 50%,
      rgba(40,38,32,0) 55%,
      rgba(40,38,32,0.04) 100%);
  perspective: var(--perspective);
  perspective-origin: 50% 50%;
  transition: filter .45s ease, transform .45s ease;
}

.scene {
  position: absolute;
  inset: 0;
  z-index: 1;                 /* le opere SEMPRE davanti al wordmark (fondale 2D a z-index 0) */
  transform-style: preserve-3d;
  pointer-events: none;       /* il piano scene NON intercetta i click; le card sì */
}

/* — WORDMARK gigante: fondale 2D dietro le opere, a tutta larghezza — */
.wordmark-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity .45s ease;
}
.wm-line {
  /* centrato in modo robusto anche se più largo della viewport (translate sulle proprie dimensioni) */
  position: absolute;
  top: 50%; left: 50%;
  font-family: var(--wordmark);
  font-weight: 400;
  font-size: 200px;           /* base fissa: il fit a larghezza è UNA scala (regola "scatola unica") */
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink);
  opacity: var(--mark-ink-opacity, 0.12);
  transform: translate(-50%, -50%) scale(var(--mark-scale, 1));
  transform-origin: center center;
  clip-path: inset(0 0 -0.18em 0);
  animation: write 1.6s cubic-bezier(.55,.06,.18,1) 0.2s both;
}
@keyframes write {
  from { clip-path: inset(0 100% -0.18em 0); }
  to   { clip-path: inset(0 0 -0.18em 0); }
}
/* quando una card è aperta o si è nella pagina opera, il wordmark si ritira */
body.card-open .wordmark-bg { opacity: 0.4; }
body.work-open .wordmark-bg { opacity: 0; }

/* — le opere (carosello in profondità) — */
.card {
  position: absolute;
  left: 0; top: 0;
  /* dimensioni (formato reale dell'opera) e posizione/Z le imposta script.js */
  transform-style: preserve-3d;
  will-change: transform;     /* NIENTE opacity qui: appiattirebbe il 3D e romperebbe il flip */
  pointer-events: auto;       /* le opere restano cliccabili anche se scene è trasparente ai click */
  touch-action: manipulation; /* niente delay 300ms né double-tap-zoom sulle opere */
}
.card:focus-visible { outline: none; }
.card:focus-visible .inner {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--brass);
}

.inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.2,.7,.2,1);
  /* la box-shadow viva (levitazione) è scritta dal loop via --sh.
     NIENTE filter qui: appiattirebbe il preserve-3d e romperebbe il flip (il retro non si rivela). */
  box-shadow: var(--sh, 0 42px 50px rgba(40,38,32,0.20));
}
.card.is-flipped .inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  border-radius: 2px;
}

/* fronte = l'opera */
.front {
  background: var(--ph, #ECEAE3);
}
.front .work-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}
/* mat / passe-partout: un'unica regola visiva anche se le foto saranno diverse */
.front::after {
  content: "";
  position: absolute; inset: 0;
  box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.10);
  pointer-events: none;
}
/* velo bianco-juta: l'opera lontana si scioglie nello stesso bianco del fondo (--veil dal loop Z) */
.front::before {
  content: "";
  position: absolute; inset: 0; z-index: 2;
  background: var(--bg);
  opacity: var(--veil, 0);
  pointer-events: none;
}
/* placeholder testuale quando img === null */
.work-ph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: rgba(26,26,24,0.28);
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.6rem;
  letter-spacing: 0.1em;
}

/* retro = la camera oscura */
.back {
  transform: rotateY(180deg);
  background: var(--back-bg);
  color: var(--back-ink);
  padding: clamp(12px, 1.1vw, 18px);
}
.back-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-align: left;
}
.back .eyebrow { color: var(--back-muted); font-size: 0.5rem; letter-spacing: 0.3em; }
.work-title {
  margin: 0.45em 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(17px, 1.5vw, 22px);
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.back-rule {
  border: 0;
  border-top: 0.5px solid rgba(237,235,228,0.18);
  margin: 0.7em 0;
}
.back-meta {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35em 0.6em;
}
.back-meta div { margin: 0; }
.back-meta dt {
  font-size: 0.5rem; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--back-muted);
}
.back-meta dd {
  margin: 0.2em 0 0;
  font-family: var(--sans); font-weight: 400; font-size: 0.72rem;
  color: var(--back-ink);
}
.back-desc {
  margin: 0.8em 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 0.92rem;
  line-height: 1.35;
  color: rgba(237,235,228,0.82);
}
.back-foot {
  margin-top: auto;
  padding-top: 0.8em;
  display: flex;
  flex-direction: column;
  gap: 0.55em;
}
.status {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-family: var(--sans); font-weight: 400;
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--back-ink);
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; flex: 0 0 auto;
}
.status--available .dot { background: var(--brass); }                 /* pieno */
.status--reserved  .dot { background: transparent; box-shadow: inset 0 0 0 1px var(--brass); } /* anello */
.status--sold      .dot { background: var(--back-muted); position: relative; }
.status--sold      .dot::after {                                       /* barrato */
  content: ""; position: absolute; left: -2px; top: 3px; width: 11px; height: 1px;
  background: var(--back-muted); transform: rotate(-20deg);
}
.status--sold { color: var(--back-muted); }

.request {
  align-self: flex-start;
  font-family: var(--sans); font-weight: 400;
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--back-ink);
  padding-bottom: 2px;
  background-image: linear-gradient(var(--brass), var(--brass));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size .4s ease, color .3s ease;
}
.request:hover, .request:focus-visible { color: var(--brass); background-size: 100% 1px; outline: none; }
.status--sold ~ .request { display: none; }   /* opera venduta: nessuna richiesta */

/* — scroll cue — */
.scroll-cue {
  position: absolute;
  left: 50%; bottom: clamp(18px, 4vh, 38px);
  transform: translateX(-50%);
  z-index: 60;
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.7em;
  color: var(--muted);
  font-family: var(--sans); font-weight: 300;
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.4em;
  opacity: 0;
  /* keyframe dedicato che MANTIENE translateX(-50%) (fade-up lo sovrascriveva → fuori centro) */
  animation: cue-in 1.2s ease 1.8s both;
}
.scroll-cue span { padding-left: 0.4em; }   /* compensa lo spazio finale del letter-spacing → testo centrato */
.scroll-cue svg { animation: bob 2.6s ease-in-out infinite; }
@keyframes cue-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(4px);} }

/* =========================================================================
   2 · AMBIENTAZIONI (carosello)
   ========================================================================= */
.staged {
  position: relative;
  background: var(--floor);
  border-top: 0.5px solid var(--hairline);
  padding: clamp(64px, 12vh, 130px) 0 clamp(48px, 8vh, 96px);
}
.staged-label {
  position: absolute;
  left: clamp(10px, 2vw, 34px); top: clamp(64px, 12vh, 130px);
  writing-mode: vertical-rl;
  font-weight: 300; text-transform: uppercase; letter-spacing: 0.3em;
  font-size: 0.6rem; color: var(--muted);
}
.staged-head {
  text-align: center;
  margin: 0 auto clamp(34px, 6vh, 64px);
  padding: 0 24px;
}
.staged-title, .contact-title {
  margin: 0.5em 0 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.7rem, 4.4vw, 3rem);
  line-height: 1.04;
  letter-spacing: 0.005em;
}

.carousel { position: relative; }
.staged-track {
  display: flex;
  gap: clamp(18px, 3vw, 32px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 6px clamp(24px, 8vw, 12vw);
  scrollbar-width: none;
  outline: none;
}
.staged-track::-webkit-scrollbar { display: none; }
.staged-track:focus-visible { box-shadow: inset 0 0 0 1px var(--hairline); }

.staged-slide {
  flex: 0 0 clamp(280px, 42vw, 460px);
  scroll-snap-align: center;
  margin: 0;
}
.staged-frame {
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  background: #e9e4dc;
  box-shadow: 0 20px 40px -16px rgba(40,38,32,0.30);
}
.staged-frame img { width: 100%; height: 100%; object-fit: cover; }
.staged-slide figcaption {
  margin-top: 1em;
  font-weight: 300; text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.6rem; color: var(--muted);
  text-align: center;
}

.chev {
  position: absolute; top: calc(50% - 18px); transform: translateY(-50%);
  z-index: 5;
  font-family: var(--serif); font-size: 2.4rem; line-height: 1;
  color: var(--ink); opacity: 0.4;
  padding: 0.2em 0.4em;
  transition: opacity .3s ease;
}
.chev:hover { opacity: 0.85; }
.chev[disabled] { opacity: 0.12; cursor: default; }
.chev--prev { left: clamp(4px, 1.5vw, 24px); }
.chev--next { right: clamp(4px, 1.5vw, 24px); }

.ticks {
  display: flex; justify-content: center; gap: 9px;
  margin-top: clamp(28px, 5vh, 48px);
}
.tick {
  width: 22px; height: 2px; border-radius: 2px;
  background: rgba(26,26,24,0.16);
  transition: background .35s ease;
}
.tick.is-active { background: var(--brass); }

/* =========================================================================
   3 · CONTATTO / ACQUISTO
   ========================================================================= */
.contact {
  padding: clamp(80px, 16vh, 180px) 24px clamp(60px, 10vh, 120px);
}
.contact-inner { max-width: 620px; margin: 0 auto; }
.contact-lead {
  margin: 1.2em 0 0;
  font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  line-height: 1.5; color: var(--ink); max-width: 46ch;
}

.form {
  margin-top: clamp(40px, 7vh, 72px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(26px, 4vw, 44px) clamp(28px, 5vw, 48px);
}
.field { position: relative; display: flex; flex-direction: column; }
.field--wide { grid-column: 1 / -1; }
.field label {
  font-weight: 300; text-transform: uppercase; letter-spacing: 0.22em;
  font-size: 0.6rem; color: var(--muted); margin-bottom: 0.8em;
}
.field label em { font-style: normal; text-transform: none; letter-spacing: 0.04em; opacity: 0.7; }
.field input, .field textarea {
  font-family: var(--sans); font-weight: 400; font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 0.5px solid #D8D5CB;
  padding: 0.3em 0 0.6em;
  border-radius: 0;
  transition: border-color .4s ease;
  resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: #C4C1B7; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-bottom-color: var(--brass);
}
.field.invalid input, .field.invalid textarea { border-bottom-color: var(--ink); border-bottom-width: 1px; }
.hint {
  min-height: 1em;
  margin-top: 0.7em;
  font-weight: 300; text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 0.56rem; color: var(--ink);
  opacity: 0; transition: opacity .3s ease;
}
.field.invalid .hint { opacity: 0.85; }

.form-foot {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; gap: 1.3em;
  margin-top: 0.4em;
}
.submit {
  align-self: flex-start;
  font-family: var(--sans); font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.3em; font-size: 0.72rem;
  color: var(--ink);
  padding: 0 0 4px;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 100% 0.5px; background-position: 0 100%; background-repeat: no-repeat;
  transition: letter-spacing .4s ease, background-size .4s ease, color .3s ease;
}
.submit:hover { letter-spacing: 0.36em; }
.mail-fallback {
  font-weight: 300; font-size: 0.74rem; letter-spacing: 0.02em;
  color: var(--muted); text-decoration: none;
  border-bottom: 0.5px solid transparent;
  align-self: flex-start;
  transition: color .3s ease, border-color .3s ease;
}
.mail-fallback:hover { color: var(--ink); border-bottom-color: var(--hairline); }

.confirm {
  grid-column: 1 / -1;
  font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(1.1rem, 2.6vw, 1.5rem); line-height: 1.4;
  color: var(--ink);
  animation: fade-up .8s ease both;
}

/* =========================================================================
   4 · FOOTER
   ========================================================================= */
.footer {
  border-top: 0.5px solid var(--hairline);
  padding: clamp(32px, 6vh, 60px) clamp(24px, 6vw, 64px);
  display: flex; flex-wrap: wrap; gap: 0.8em 2em;
  align-items: baseline; justify-content: space-between;
}
.foot-mark { font-family: var(--wordmark); font-weight: 400; font-size: 1.25rem; letter-spacing: 0.02em; color: var(--ink); }
.foot-meta { font-weight: 300; font-size: 0.72rem; letter-spacing: 0.04em; color: var(--muted); }
.foot-meta a { text-decoration: none; border-bottom: 0.5px solid var(--hairline); }
.foot-meta a:hover { color: var(--ink); }

/* =========================================================================
   RESPONSIVE — il wordmark scala come UNICA scatola (nessun font-size per breakpoint)
   ========================================================================= */
@media (max-width: 760px) {
  :root { --perspective: 1000px; }
  .inner { transition-duration: .7s; }
  .wm-line { font-size: 130px; }
}

/* =========================================================================
   REDUCED MOTION — niente respiro/dissolvenza animati, niente blur
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .wm-line { animation: none; clip-path: none; }
  .scroll-cue { animation: none; opacity: 1; }
  .scroll-cue svg { animation: none; }
  .inner { transition-duration: .45s; filter: none; }
  .stage { transition: none; }
  * { scroll-behavior: auto !important; }
}

/* =========================================================================
   3 · PAGINA DEDICATA DELL'OPERA (overlay) + box mail per-opera
   ========================================================================= */
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(4px);} }

body.card-open .scroll-cue,
body.work-open .scroll-cue { opacity: 0 !important; pointer-events: none; }

body.work-open .stage { filter: blur(8px); transform: scale(1.02); }

.overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: clamp(20px, 5vh, 64px) clamp(20px, 6vw, 96px);
  opacity: 0;
  transform: scale(.985);
  transition: opacity .36s ease, transform .36s ease;
}
.overlay.is-on { opacity: 1; transform: scale(1); }
.overlay[hidden] { display: none; }

.ov-back {
  position: sticky; top: 0; left: 0;
  font-family: var(--sans); font-weight: 300;
  text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.7rem;
  color: var(--muted); padding: 6px 0 18px;
  transition: color .3s ease;
}
.ov-back:hover, .ov-back:focus-visible { color: var(--ink); outline: none; }

.wp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  min-height: calc(100svh - 120px);
  max-width: 1500px; margin: 0 auto;
}
.wp-figure { margin: 0; display: flex; align-items: center; justify-content: center; }
.wp-figure img {
  max-width: 100%; max-height: 80svh; width: auto; height: auto;
  object-fit: contain; border-radius: 2px;
  box-shadow: 0 40px 80px -30px rgba(40,38,32,0.45);
}
.wp-info { max-width: 440px; }
.wp-title {
  margin: 0.3em 0 0;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.4rem); line-height: 1.02;
}
.wp-meta { margin: 1.1em 0 0; display: grid; gap: 0.7em; }
.wp-meta div { margin: 0; }
.wp-meta dt { font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }
.wp-meta dd { margin: 0.25em 0 0; font-family: var(--sans); font-weight: 400; font-size: 0.95rem; color: var(--ink); }
.wp-status { margin: 1.3em 0 0; }
.wp-status .status { color: var(--ink); }
.wp-status .status--available .dot { background: var(--brass); }
.wp-status .status--reserved .dot { background: transparent; box-shadow: inset 0 0 0 1px var(--brass); }
.wp-status .status--sold .dot { background: var(--muted); }

.wp-mailbox { margin-top: clamp(28px, 5vh, 48px); padding-top: clamp(20px, 4vh, 32px); border-top: 0.5px solid var(--hairline); }
.wp-mail-lead { margin: 0 0 1em; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 1.15rem; color: var(--ink); }
.wp-mail-btn {
  display: inline-block;
  font-family: var(--sans); font-weight: 400; text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.74rem;
  color: var(--ink); text-decoration: none;
  padding: 0 0 5px;
  background-image: linear-gradient(var(--brass), var(--brass));
  background-size: 100% 1px; background-position: 0 100%; background-repeat: no-repeat;
  transition: letter-spacing .35s ease, color .3s ease;
}
.wp-mail-btn:hover { letter-spacing: 0.26em; color: var(--brass); }
.wp-mail-alt {
  display: block; margin-top: 1.1em;
  font-weight: 300; font-size: 0.8rem; letter-spacing: 0.02em; color: var(--muted);
  text-decoration: none; border-bottom: 0.5px solid transparent;
  width: fit-content; transition: color .3s ease, border-color .3s ease;
}
.wp-mail-alt:hover { color: var(--ink); border-bottom-color: var(--hairline); }

@media (max-width: 820px) {
  .wp-grid { grid-template-columns: 1fr; gap: 24px; align-items: start; min-height: 0; }
  .wp-figure img { max-height: 52svh; }
  .wp-info { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .overlay { transition: opacity .2s ease; transform: none; }
  .overlay.is-on { transform: none; }
  body.work-open .stage { filter: none; transform: none; }
}

/* =========================================================================
   MODALITÀ DEBUG — editor disposizione opere (tasto D)
   ========================================================================= */
.dbg-handle { display: none; }
body.debug .dbg-handle {
  display: block; position: absolute; right: -9px; bottom: -9px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--brass); border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.45); cursor: nwse-resize;
  z-index: 4; touch-action: none;
}
body.debug .card { cursor: grab; touch-action: none; }
body.debug .card .inner { transition: none; box-shadow: none; }
body.debug .card.dbg-sel { outline: 2px solid var(--brass); outline-offset: 3px; }
body.debug .scroll-cue { display: none; }

.dbg-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 99999; display: flex; gap: 12px; align-items: center;
  background: rgba(26,26,24,.94); color: #EDEBE4;
  padding: 10px 14px; border-radius: 12px;
  font: 12px/1 'Inter', sans-serif; letter-spacing: .03em;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.dbg-bar strong { color: var(--brass); letter-spacing: .16em; }
.dbg-bar .dbg-tip { opacity: .6; }
.dbg-bar button {
  font: inherit; text-transform: uppercase; letter-spacing: .08em;
  color: #1A1A18; background: #EDEBE4; border: 0;
  padding: 7px 11px; border-radius: 7px; cursor: pointer;
}
.dbg-bar button:hover { background: var(--brass); }
.dbg-export {
  position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%);
  z-index: 99999; width: min(560px, 90vw);
  background: #1C1C1A; color: #EDEBE4; border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; padding: 12px; font: 12px/1.4 'Inter', sans-serif;
}
.dbg-export textarea {
  width: 100%; height: 110px; margin-top: 8px; resize: vertical;
  background: #111; color: #b9e6b9; border: 0; border-radius: 6px;
  padding: 8px; font: 11px/1.45 ui-monospace, monospace;
}

/* ——— debug su touch/mobile: maniglia più grande e toolbar adatta al pollice ——— */
@media (pointer: coarse) {
  body.debug .dbg-handle { width: 30px; height: 30px; right: -15px; bottom: -15px; border-width: 3px; }
}
@media (max-width: 600px) {
  .dbg-bar {
    bottom: 10px; gap: 8px; padding: 8px 10px;
    flex-wrap: wrap; justify-content: center; max-width: 94vw;
  }
  .dbg-bar .dbg-tip { display: none; }
  .dbg-bar button { padding: 10px 13px; }      /* bersaglio tap comodo */
  .dbg-export { bottom: 96px; }
}

/* =========================================================================
   4 · LIQUID GLASS — controlli card + carrello preferite
   ========================================================================= */
/* Liquid glass Apple: vetro smerigliato vero (backdrop-filter). */
.glass {
  background: rgba(255,255,255,0.13);   /* più trasparente / più liquid */
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255,255,255,0.42);
  box-shadow: 0 12px 32px rgba(40,38,32,0.14), inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(255,255,255,0.1);
}

/* — bolla "+" e bottone "Apri" che spuntano sulla card girata — */
.card-controls {
  position: fixed; inset: 0; z-index: 700;
  pointer-events: none;
  opacity: 0; transition: opacity .28s ease;
}
.card-controls.on { opacity: 1; }

.ctrl-plus {
  pointer-events: auto;
  position: fixed;
  width: 40px; height: 40px; border-radius: 50%;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  font-family: var(--sans); font-weight: 300; font-size: 26px; line-height: 0; color: var(--ink);
  transition: transform .25s cubic-bezier(.2,.9,.3,1.3), background .2s ease;
}
.card-controls.on .ctrl-plus { animation: pop .4s cubic-bezier(.2,.9,.3,1.4) both; }
@keyframes pop { 0% { transform: translate(-50%,-50%) scale(.2); } 60% { transform: translate(-50%,-50%) scale(1.15); } 100% { transform: translate(-50%,-50%) scale(1); } }
.ctrl-plus:hover { background: rgba(176,138,79,0.42); }
.ctrl-plus:active { transform: translate(-50%,-50%) scale(.9); }

.ctrl-open {
  pointer-events: auto;
  position: fixed;
  transform: translate(-50%, 0);
  padding: 10px 18px; border-radius: 999px;
  font-family: var(--sans); font-weight: 400; font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink);
  white-space: nowrap;
  transition: background .2s ease, letter-spacing .3s ease;
}
.card-controls.on .ctrl-open { animation: rise .4s cubic-bezier(.2,.8,.3,1) both; }
@keyframes rise { from { opacity: 0; } to { opacity: 1; } }
.ctrl-open:hover { background: rgba(255,255,255,0.62); letter-spacing: 0.2em; }

/* — carrello delle preferite: opere clonate in prospettiva, a lato, sempre visibili — */
.fav-cart {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: clamp(110px, 15vw, 210px);
  z-index: 600;
  display: flex; align-items: center;
  pointer-events: none;          /* solo le tile catturano i click: le opere dietro restano cliccabili */
}
.fav-rail {
  display: flex; flex-direction: column; gap: clamp(8px, 1.6vh, 20px);
  width: 100%;
  padding: 18px 0 18px clamp(10px, 1.5vw, 22px);
  max-height: 100vh; overflow: visible;
  perspective: 1100px;
}
.fav-tile {
  pointer-events: auto;
  position: relative;
  width: clamp(70px, 9vw, 124px);
  border-radius: 5px;
  transform: rotateY(26deg);
  transform-origin: left center;
  box-shadow: 0 16px 34px -12px rgba(40,38,32,0.5);
  opacity: 0;
  cursor: pointer;
  transition: transform .4s cubic-bezier(.2,.7,.2,1), opacity .4s ease;
}
.fav-tile.in { opacity: 1; }
.fav-tile img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.fav-tile::after {     /* bordo liquid-glass */
  content: ""; position: absolute; inset: 0; border-radius: 5px; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 0 0 1px rgba(255,255,255,0.22);
}
.fav-tile:hover { transform: rotateY(6deg) scale(1.06); z-index: 3; }
.fav-tile.flash { animation: favflash .5s ease; }
@keyframes favflash { 0%,100% { box-shadow: 0 16px 34px -12px rgba(40,38,32,0.5); } 50% { box-shadow: 0 0 0 3px var(--brass), 0 16px 34px -12px rgba(40,38,32,0.5); } }
.fav-tile.out { opacity: 0; transform: rotateY(26deg) translateX(-40px) scale(.7); }

.fav-remove {
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; line-height: 0; color: var(--ink);
  opacity: 0; transform: scale(.7);
  transition: opacity .2s ease, transform .2s ease;
}
.fav-tile:hover .fav-remove { opacity: 1; transform: scale(1); }

@media (prefers-reduced-motion: reduce) {
  .card-controls.on .ctrl-plus, .card-controls.on .ctrl-open { animation: none; }
  .fav-tile { transition: opacity .2s ease; }
}

/* =========================================================================
   5 · MENU PAGINE (destra) · PAGINE info/ambientata/contatti · VISTA SELEZIONE
   ========================================================================= */

/* — menu liquid glass a destra — */
.side-menu {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: clamp(120px, 16vw, 200px);
  z-index: 600;
  display: flex; flex-direction: column; justify-content: center; gap: clamp(8px, 1.4vh, 16px);
  padding: 18px clamp(10px, 1.5vw, 20px) 18px 0;
  pointer-events: none;
  perspective: 1100px;
}
.side-card {
  pointer-events: auto;
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 12px 14px; border-radius: 13px;
  color: var(--ink); cursor: pointer;
  transform: rotateY(-18deg); transform-origin: right center;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), background .2s ease;
}
.side-card:hover, .side-card:focus-visible { transform: rotateY(-4deg) scale(1.05); outline: none; }
.side-label { font-family: var(--sans); font-weight: 500; font-size: 0.82rem; letter-spacing: 0.01em; }
.side-sub { font-weight: 300; font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.13em; color: var(--muted); }

/* — carrello "Le mie opere" (sinistra): titolo + rail + bottone apri-tutte — */
.fav-cart { flex-direction: column; justify-content: center; align-items: flex-start; gap: 12px; }
.fav-rail { flex: 0 1 auto; }
.fav-title { pointer-events: none; font-weight: 300; font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.22em; color: var(--muted); padding-left: 4px; }
.fav-title[hidden], .fav-open-all[hidden] { display: none; }
.fav-open-all {
  pointer-events: auto; margin-left: 4px;
  padding: 9px 15px; border-radius: 999px;
  font-family: var(--sans); font-weight: 400; font-size: 0.6rem;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background .2s ease, letter-spacing .3s ease;
}
.fav-open-all:hover { background: rgba(255,255,255,0.42); letter-spacing: 0.16em; }

/* quando un overlay è aperto, menu/carrello/scroll-cue si ritirano */
body.work-open .side-menu, body.work-open .fav-cart { opacity: 0; pointer-events: none; transition: opacity .3s ease; }

/* — pagine testuali (info/contatti) e ambientata: contenuto centrato — */
.ov-text, .ov-ambiente { min-height: calc(100svh - 100px); display: flex; align-items: center; justify-content: center; }
.ov-wrap { max-width: 600px; width: 100%; }
.ov-body { margin: 1.3em 0 0; font-family: var(--serif); font-weight: 300; font-size: 1.15rem; line-height: 1.6; color: var(--ink); }
.ov-body p { margin: 0 0 1em; }
.ov-lead { margin: 1em 0 0; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 1.1rem; color: var(--ink); }

.amb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 1.2em; max-width: 1100px; width: 100%; }
.amb-figure img { max-width: 100%; max-height: 74svh; object-fit: contain; border-radius: 3px; box-shadow: 0 40px 80px -30px rgba(40,38,32,0.45); }
.amb-figure figcaption { text-align: center; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--ink); line-height: 1.7; }

/* — form contatti — */
.cform { margin: 2em 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 22px 30px; }
.cfield { display: flex; flex-direction: column; }
.cfield--wide { grid-column: 1 / -1; }
.cfield label { font-weight: 300; text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.6rem; color: var(--muted); margin-bottom: 0.6em; }
.cfield input, .cfield textarea { font-family: var(--sans); font-size: 1rem; color: var(--ink); background: transparent; border: 0; border-bottom: 0.5px solid #D8D5CB; padding: 0.3em 0 0.6em; border-radius: 0; resize: vertical; }
.cfield input:focus, .cfield textarea:focus { outline: none; border-bottom-color: var(--brass); }
.cform-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 1em 1.6em; align-items: baseline; }
.cform-hint { grid-column: 1 / -1; min-height: 1em; font-size: 0.72rem; color: var(--ink); margin: 0; }

/* — VISTA SELEZIONE: schermo equamente diviso, tutte le opere selezionate — */
.sel-head { display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: baseline; justify-content: space-between; max-width: 1500px; margin: 0 auto clamp(20px, 4vh, 40px); }
.sel-request { align-self: center; white-space: nowrap; }
.sel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: clamp(16px, 2.5vw, 36px); max-width: 1500px; margin: 0 auto; }
.sel-cell { display: flex; flex-direction: column; }
.sel-img { display: flex; align-items: center; justify-content: center; min-height: 0; }
.sel-img img { max-width: 100%; max-height: 36svh; object-fit: contain; border-radius: 3px; box-shadow: 0 22px 48px -22px rgba(40,38,32,0.4); }
.sel-info { padding: 1em 0.2em 0; }
.sel-title { margin: 0.25em 0 0; font-family: var(--serif); font-weight: 400; font-size: 1.3rem; line-height: 1.05; }
.sel-meta { margin: 0.4em 0 0; font-size: 0.78rem; color: var(--muted); }
.sel-status { margin: 0.5em 0 0; }
.sel-status .status { color: var(--ink); }
.sel-status .status--available .dot { background: var(--brass); }
.sel-status .status--reserved .dot { background: transparent; box-shadow: inset 0 0 0 1px var(--brass); }
.sel-status .status--sold .dot { background: var(--muted); }

/* — responsive — */
@media (max-width: 820px) {
  .cform { grid-template-columns: 1fr; }
  /* menu a destra: card e testo ~30% più piccoli su mobile */
  .side-menu { width: clamp(84px, 11vw, 140px); gap: clamp(6px, 1vh, 11px); }
  .side-card { transform: rotateY(-12deg); padding: 8px 10px; border-radius: 9px; gap: 1px; }
  .side-label { font-size: 0.57rem; }
  .side-sub { font-size: 0.41rem; letter-spacing: 0.1em; }
}
@media (prefers-reduced-motion: reduce) {
  .side-card, .fav-open-all { transition: background .2s ease; }
}

/* =========================================================================
   6 · MENU DESTRA dietro BURGER — solo la card burger è visibile finché non si apre
   ========================================================================= */
.side-menu { align-items: flex-end; }
.side-burger {
  pointer-events: auto;
  position: relative;
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; cursor: pointer;
  transition: background .2s ease;
}
/* area tap ≥44px anche col burger ridotto su mobile (38px), senza cambiarne la resa visiva */
.side-burger::after { content: ""; position: absolute; inset: -6px; border-radius: 18px; }
.side-burger:hover, .side-burger:focus-visible { background: rgba(255,255,255,0.42); outline: none; }
.side-menu.open .side-burger { background: rgba(255,255,255,0.42); }
.burger-icon { display: grid; gap: 4px; }
.burger-icon span { display: block; width: 18px; height: 1.5px; background: var(--ink); border-radius: 2px; transition: transform .3s ease, opacity .3s ease; }
.side-menu.open .burger-icon span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.side-menu.open .burger-icon span:nth-child(2) { opacity: 0; }
.side-menu.open .burger-icon span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.side-list { display: none; flex-direction: column; align-items: flex-end; gap: clamp(8px, 1.4vh, 16px); }
.side-menu.open .side-list { display: flex; }
.side-menu.open .side-card { animation: side-in .38s cubic-bezier(.2,.7,.2,1) backwards; }
@keyframes side-in {
  from { opacity: 0; transform: translateX(26px) rotateY(-34deg) scale(.9); }
  to   { opacity: 1; transform: rotateY(-18deg); }
}

@media (max-width: 820px) {
  .side-burger { width: 38px; height: 38px; border-radius: 11px; }
  .burger-icon span { width: 15px; }
  .side-menu.open .burger-icon span:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
  .side-menu.open .burger-icon span:nth-child(3) { transform: translateY(-4.5px) rotate(-45deg); }
}
@media (prefers-reduced-motion: reduce) {
  .side-menu.open .side-card { animation: none; }
  .burger-icon span { transition: none; }
}

/* — citazione nella pagina Info — */
.ov-quote {
  margin: 1.6em 0 0;
  padding-left: 1.1em;
  border-left: 2px solid var(--brass);
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: 1.2rem; line-height: 1.55; color: var(--ink);
}

/* su touch la × per rimuovere una preferita è sempre visibile (niente hover su mobile) */
@media (pointer: coarse) {
  .fav-tile .fav-remove { opacity: 1; transform: scale(1); }
}

