/* =========================
   VARIABILI COLORI
========================= */

:root {
  --color-white: #ffffff;
  --color-cream: #f7f3ea;
  --color-cream-light: #fffaf2;
  --color-black: #111111;
  --color-gray-dark: #2d2d2d;
  --color-gray: #666666;
  --color-gray-light: #d8d2c7;

  --signature-offset: 46px;

  --page-bg: #f7f3ea;
  --page-text: #111111;
  --muted-text: #666666;
  --soft-panel: rgba(255, 250, 242, 0.62);
  --border-soft: rgba(17, 17, 17, 0.12);

  /*
    Sistema di movimento: tre curve cubic-bezier custom, mai lineare.
    Riutilizzate ovunque al posto di "ease" / "ease-in-out" generici.
  */
  --ease-glass: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-inertia: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.65, 0, 0.35, 1);

  --dur-slow: 1.6s;
  --dur-medium: 0.85s;
  --dur-fast: 0.4s;

  /*
    Scala tipografica modulare (rapporto ~1.25).
    Non ancora applicata ai contenuti: pronta per le fasi successive.
  */
  --step--1: clamp(0.78rem, 0.75rem + 0.15vw, 0.86rem);
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.56rem, 1.4rem + 0.8vw, 1.9rem);
  --step-3: clamp(1.95rem, 1.7rem + 1.25vw, 2.5rem);
  --step-4: clamp(2.44rem, 2.05rem + 1.9vw, 3.3rem);
  --step-5: clamp(3.05rem, 2.45rem + 3vw, 4.5rem);
  --step-6: clamp(3.8rem, 2.9rem + 4.6vw, 6.4rem);

  /* Grana e vignettatura: intensità di giorno, volutamente minime */
  --grain-opacity: 0.025;
  --vignette-opacity: 0.10;
}

html.theme-dark {
  --page-bg: #171717;
  --page-text: #f5f0e8;
  --muted-text: rgba(255, 255, 255, 0.62);
  --soft-panel: rgba(255, 255, 255, 0.045);
  --border-soft: rgba(255, 255, 255, 0.10);

  /* Di notte grana e vignettatura sono un po' più presenti: cambia l'atmosfera, non solo il colore */
  --grain-opacity: 0.045;
  --vignette-opacity: 0.30;
}

/* =========================
   RESET BASE
========================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;

  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;

  background: var(--page-bg);
  color: var(--page-text);

  font-family: Georgia, "Times New Roman", serif;

  -webkit-user-select: none;
  user-select: none;

  overflow-x: hidden;

  transition:
    background 0.45s ease,
    color 0.45s ease;
}

img {
  max-width: 100%;
  height: auto;
  display: block;

  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

input,
textarea,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

.visually-hidden {
  position: absolute;

  width: 1px;
  height: 1px;

  padding: 0;
  margin: -1px;

  overflow: hidden;

  clip: rect(0, 0, 0, 0);
  white-space: nowrap;

  border: 0;
}

html.preloader-skip #preloader {
  display: none;
}

/* =========================
   SFONDO ANIMATO
========================= */

#bg-canvas {
  position: fixed;
  inset: 0;

  z-index: 0;

  width: 100%;
  height: 100%;

  pointer-events: none;

  opacity: 0;
  transition: opacity 1.2s ease;
}

body.loaded #bg-canvas {
  opacity: 0.78;
}

html.theme-dark body.loaded #bg-canvas {
  opacity: 1;
}

/* =========================
   GRANA E VIGNETTATURA
========================= */

.grain-layer,
.vignette-layer {
  position: fixed;
  inset: 0;

  /*
    Sopra la navbar (z-index 1000), come un velo unico su tutta
    l'inquadratura; sotto il lightbox (2000) e il cursore (3000) per
    non intaccare mai la lettura ravvicinata delle opere.
  */
  z-index: 1500;

  pointer-events: none;

  opacity: 0;

  transition: opacity 1.4s ease;
}

body.loaded .vignette-layer {
  opacity: 1;
}

/*
  La grana non arriva a opacità piena: si ferma al livello definito
  da --grain-opacity, già molto basso di suo.
*/
body.loaded .grain-layer {
  opacity: var(--grain-opacity);
}

.grain-layer {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;

  mix-blend-mode: overlay;

  transition: opacity 0.7s ease;
}

.vignette-layer {
  background: radial-gradient(
    circle at 50% 42%,
    transparent 48%,
    rgba(0, 0, 0, var(--vignette-opacity)) 132%
  );

  transition: background 0.7s ease, opacity 1.4s ease;
}

/* Velo chiaro sopra lo sfondo */
body::before {
  content: "";

  position: fixed;
  inset: 0;

  z-index: 0;

  pointer-events: none;

  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.16), transparent 34%),
    radial-gradient(circle at 80% 35%, rgba(255, 255, 255, 0.10), transparent 34%),
    linear-gradient(180deg, rgba(247, 243, 234, 0.10), rgba(247, 243, 234, 0.24));

  transition: background 0.45s ease;
}

/* Velo scuro quando premi la luna */
html.theme-dark body::before {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.055), transparent 28%),
    radial-gradient(circle at 82% 70%, rgba(255, 255, 255, 0.040), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(0, 0, 0, 0.10));
}

/* =========================
   PRELOADER
========================= */

#preloader {
  position: fixed;
  inset: 0;

  z-index: 9999;

  display: flex;
  justify-content: center;
  align-items: flex-start;

  overflow: hidden;

  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.97), rgba(247, 243, 234, 0.97) 58%, rgba(239, 234, 224, 0.99) 100%);

  transition:
    opacity 1.05s ease,
    visibility 1.05s ease;
}

html.theme-dark #preloader {
  background:
    radial-gradient(circle at 50% 44%, rgba(42, 42, 42, 0.98), rgba(23, 23, 23, 0.98) 58%, rgba(10, 10, 10, 0.99) 100%);
}

#preloader::before {
  content: "";

  position: absolute;
  inset: 0;

  background:
    radial-gradient(circle at 22% 28%, rgba(255, 255, 255, 0.72), transparent 26%),
    radial-gradient(circle at 76% 66%, rgba(255, 255, 255, 0.42), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(247, 243, 234, 0.10));

  pointer-events: none;
}

html.theme-dark #preloader::before {
  background:
    radial-gradient(circle at 22% 28%, rgba(255, 255, 255, 0.08), transparent 26%),
    radial-gradient(circle at 76% 66%, rgba(255, 255, 255, 0.05), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(0, 0, 0, 0.10));
}

.preloader-scene {
  position: relative;

  width: min(1120px, 100%);
  min-height: calc(100svh - 110px);

  margin-top: 92px;
  padding: 0 24px;

  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;

  isolation: isolate;
}

.preloader-shapes {
  position: absolute;

  top: -44px;
  left: 0;
  right: 0;

  height: 390px;

  z-index: 1;

  opacity: 0;

  animation: preloaderShapesAppear 0.9s ease forwards;
  animation-delay: 0.2s;

  pointer-events: none;
}

.preloader-shape {
  position: absolute;

  display: block;

  opacity: 0;

  border-color: rgba(17, 17, 17, 0.28);

  animation:
    preloaderShapeFade 3.6s ease-in-out forwards,
    preloaderFloat 4.8s ease-in-out infinite;

  will-change: transform, opacity;
}

html.theme-dark .preloader-shape {
  border-color: rgba(255, 255, 255, 0.26);
}

.preloader-dot {
  width: 8px;
  height: 8px;

  border-radius: 50%;

  background: rgba(17, 17, 17, 0.42);
}

html.theme-dark .preloader-dot {
  background: rgba(255, 255, 255, 0.52);
}

.preloader-circle {
  width: 82px;
  height: 82px;

  border: 1.4px solid rgba(17, 17, 17, 0.26);
  border-radius: 50%;
}

.preloader-line {
  width: 150px;
  height: 1px;

  background: rgba(17, 17, 17, 0.30);
}

html.theme-dark .preloader-line {
  background: rgba(255, 255, 255, 0.30);
}

.preloader-arc {
  width: 112px;
  height: 112px;

  border: 1.3px solid rgba(17, 17, 17, 0.26);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
}

.preloader-square {
  width: 76px;
  height: 76px;

  border: 1.2px solid rgba(17, 17, 17, 0.24);
}

.preloader-diamond {
  width: 66px;
  height: 66px;

  border: 1.2px solid rgba(17, 17, 17, 0.26);

  transform: rotate(45deg);
}

.shape-1 {
  left: 8%;
  top: 46%;
  animation-delay: 0.25s, 0s;
}

.shape-2 {
  left: 15%;
  top: 12%;
  animation-delay: 0.35s, 0.2s;
}

.shape-3 {
  left: 2%;
  top: 66%;
  transform: rotate(-12deg);
  animation-delay: 0.45s, 0.4s;
}

.shape-4 {
  left: 23%;
  top: 72%;
  animation-delay: 0.55s, 0.6s;
}

.shape-5 {
  left: 42%;
  top: 0%;
  transform: rotate(9deg);
  animation-delay: 0.65s, 0.8s;
}

.shape-6 {
  left: 48%;
  top: 78%;
  animation-delay: 0.75s, 1s;
}

.shape-7 {
  right: 9%;
  top: 48%;
  animation-delay: 0.3s, 0.1s;
}

.shape-8 {
  right: 14%;
  top: 10%;
  animation-delay: 0.4s, 0.3s;
}

.shape-9 {
  right: 2%;
  top: 68%;
  transform: rotate(13deg);
  animation-delay: 0.5s, 0.5s;
}

.shape-10 {
  right: 23%;
  top: 72%;
  transform: rotate(28deg);
  animation-delay: 0.6s, 0.7s;
}

.shape-11 {
  right: 38%;
  top: 8%;
  transform: rotate(-10deg);
  animation-delay: 0.7s, 0.9s;
}

.shape-12 {
  right: 44%;
  top: 82%;
  animation-delay: 0.8s, 1.1s;
}

.preloader-signature-frame {
  position: relative;
  z-index: 2;

  height: clamp(78px, 10vw, 108px);
  overflow: hidden;

  display: flex;
  justify-content: center;
  align-items: center;

  transform: translateX(var(--signature-offset));
}

.preloader-signature {
  width: min(790px, 88vw);
  max-width: none;

  opacity: 0;

  filter:
    brightness(0)
    contrast(220%);

  animation: preloaderSignatureReveal 2.2s ease forwards;
  animation-delay: 0.45s;
}

html.theme-dark .preloader-signature {
  filter:
    brightness(0)
    invert(1)
    contrast(150%);
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* =========================
   HEADER LIQUID GLASS
========================= */

.site-header {
  position: fixed;

  top: 18px;
  left: 0;
  right: 0;

  width: 100%;
  max-width: 100vw;

  z-index: 1000;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 0 26px;

  pointer-events: none;
}

.glass-navbar {
  width: min(1180px, calc(100vw - 52px));
  min-height: 54px;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;

  padding: 7px 10px;

  border-radius: 999px;

  position: relative;
  overflow: hidden;

  pointer-events: auto;

  background: rgba(255, 255, 255, 0.055);

  border: 1px solid rgba(255, 255, 255, 0.42);

  backdrop-filter:
    blur(20px)
    saturate(260%)
    contrast(138%)
    brightness(112%);
  -webkit-backdrop-filter:
    blur(20px)
    saturate(260%)
    contrast(138%)
    brightness(112%);

  box-shadow:
    0 18px 55px rgba(17, 17, 17, 0.14),
    inset 0 1px 1px rgba(255, 255, 255, 0.78),
    inset 0 -1px 2px rgba(17, 17, 17, 0.14),
    inset 12px 0 22px rgba(255, 255, 255, 0.08),
    inset -12px 0 22px rgba(255, 255, 255, 0.07);

  transition:
    background 0.45s ease,
    border-color 0.45s ease,
    box-shadow 0.45s ease;
}

/*
  Modalità notte:
  stessa forma e stesso effetto vetro,
  ma più fumé, più scuro, con bordi meno bianchi.
*/
html.theme-dark .glass-navbar {
  background:
    linear-gradient(
      180deg,
      rgba(42, 42, 42, 0.46),
      rgba(18, 18, 18, 0.34)
    );

  border-color: rgba(0, 0, 0, 0.58);

  backdrop-filter:
    blur(24px)
    saturate(210%)
    contrast(150%)
    brightness(92%);
  -webkit-backdrop-filter:
    blur(24px)
    saturate(210%)
    contrast(150%)
    brightness(92%);

  box-shadow:
    0 22px 72px rgba(0, 0, 0, 0.58),
    inset 0 1px 1px rgba(255, 255, 255, 0.14),
    inset 0 -1px 2px rgba(0, 0, 0, 0.72),
    inset 18px 0 34px rgba(255, 255, 255, 0.025),
    inset -18px 0 34px rgba(0, 0, 0, 0.22);
}

.glass-navbar::before {
  content: "";

  position: absolute;
  inset: 0;

  border-radius: inherit;

  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.30),
      rgba(255, 255, 255, 0.06) 36%,
      rgba(255, 255, 255, 0.00) 64%,
      rgba(255, 255, 255, 0.10)
    ),
    radial-gradient(
      circle at 14% 18%,
      rgba(255, 255, 255, 0.36),
      transparent 24%
    ),
    radial-gradient(
      circle at 86% 72%,
      rgba(255, 255, 255, 0.14),
      transparent 30%
    );

  /*
    La superficie è più grande della barra: spostando lentamente la
    posizione, i due riflessi radiali scivolano come luce reale su un
    materiale, in autonomia e senza mai fermarsi.
  */
  background-size: 240% 240%;
  background-position: 10% 15%;

  opacity: 0.72;

  mix-blend-mode: screen;

  pointer-events: none;

  animation: navbarSheen 34s var(--ease-soft) infinite alternate;
}

/*
  In modalità notte il riflesso resta,
  ma è molto più controllato e meno “bordo bianco”.
*/
html.theme-dark .glass-navbar::before {
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.12),
      rgba(255, 255, 255, 0.035) 34%,
      rgba(255, 255, 255, 0.00) 68%,
      rgba(0, 0, 0, 0.18)
    ),
    radial-gradient(
      circle at 14% 18%,
      rgba(255, 255, 255, 0.16),
      transparent 26%
    ),
    radial-gradient(
      circle at 88% 78%,
      rgba(0, 0, 0, 0.24),
      transparent 32%
    );

  opacity: 0.64;
}

.glass-navbar::after {
  content: "";

  position: absolute;
  inset: 1px;

  border-radius: inherit;

  border: 1px solid rgba(255, 255, 255, 0.24);

  box-shadow:
    inset 0 0 18px rgba(255, 255, 255, 0.22),
    inset 0 0 45px rgba(255, 255, 255, 0.05);

  pointer-events: none;
}

/* Bordo interno più scuro in modalità notte */
html.theme-dark .glass-navbar::after {
  border-color: rgba(255, 255, 255, 0.08);

  box-shadow:
    inset 0 0 18px rgba(255, 255, 255, 0.055),
    inset 0 0 48px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.62);
}

.nav-group {
  position: relative;
  z-index: 2;

  display: flex;
  align-items: center;

  gap: 34px;
}

.nav-left {
  justify-content: flex-start;
  padding-left: 24px;
}

.nav-right {
  justify-content: flex-end;
  padding-right: 4px;
  gap: 12px;
}

.nav-logo {
  position: relative;
  z-index: 2;

  justify-self: center;

  display: flex;
  justify-content: center;
  align-items: center;

  color: inherit;
  text-decoration: none;
}

.logo-mark {
  width: 40px;
  height: 40px;

  display: flex;
  justify-content: center;
  align-items: center;

  border-radius: 50%;

  border: 1px solid rgba(255, 255, 255, 0.46);

  background: rgba(255, 255, 255, 0.045);

  backdrop-filter:
    blur(14px)
    saturate(220%)
    contrast(130%)
    brightness(110%);
  -webkit-backdrop-filter:
    blur(14px)
    saturate(220%)
    contrast(130%)
    brightness(110%);

  color: var(--page-text);

  font-size: 13px;
  letter-spacing: 0.08em;

  box-shadow:
    0 10px 24px rgba(17, 17, 17, 0.12),
    inset 0 1px 1px rgba(255, 255, 255, 0.72),
    inset 0 -1px 2px rgba(17, 17, 17, 0.12);

  transition:
    color 0.45s ease,
    background 0.45s ease,
    border-color 0.45s ease,
    box-shadow 0.45s ease;
}

html.theme-dark .logo-mark {
  background:
    linear-gradient(
      180deg,
      rgba(70, 70, 70, 0.34),
      rgba(18, 18, 18, 0.30)
    );

  border-color: rgba(255, 255, 255, 0.14);

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.42),
    inset 0 1px 1px rgba(255, 255, 255, 0.14),
    inset 0 -1px 2px rgba(0, 0, 0, 0.52);
}

.nav-link {
  position: relative;
  z-index: 2;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 9px 0;

  color: var(--page-text);
  text-decoration: none;

  font-size: 13px;
  letter-spacing: 0.09em;
  text-transform: uppercase;

  opacity: 0.98;

  text-shadow:
    0 1px 1px rgba(255, 255, 255, 0.42),
    0 0 8px rgba(255, 255, 255, 0.14);

  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    color 0.45s ease,
    text-shadow 0.45s ease;
}

html.theme-dark .nav-link {
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.62),
    0 0 12px rgba(255, 255, 255, 0.08);
}

.nav-link:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.nav-link::after {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  bottom: 4px;

  height: 1px;

  background: currentColor;

  transform: scaleX(0);
  transform-origin: center;

  transition: transform 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

.nav-contact {
  padding: 10px 18px;

  border-radius: 999px;

  background: rgba(17, 17, 17, 0.88);
  color: var(--color-cream-light);

  text-shadow: none;

  box-shadow:
    0 10px 24px rgba(17, 17, 17, 0.24),
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    inset 0 -1px 1px rgba(0, 0, 0, 0.35);

  transition:
    background 0.35s ease,
    color 0.35s ease,
    transform 0.3s ease,
    box-shadow 0.35s ease;
}

html.theme-dark .nav-contact {
  background:
    linear-gradient(
      180deg,
      rgba(245, 245, 245, 0.90),
      rgba(218, 218, 218, 0.86)
    );

  color: #111111;

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.42),
    inset 0 1px 1px rgba(255, 255, 255, 0.48),
    inset 0 -1px 1px rgba(0, 0, 0, 0.24);
}

.nav-contact::after {
  display: none;
}

.nav-contact:hover {
  background: rgba(17, 17, 17, 1);
}

html.theme-dark .nav-contact:hover {
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.96),
      rgba(230, 230, 230, 0.92)
    );
}

/* =========================
   BOTTONE TEMA LUNA / SOLE
========================= */

.theme-toggle {
  position: relative;
  z-index: 2;

  width: 40px;
  height: 40px;

  display: inline-flex;
  justify-content: center;
  align-items: center;

  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.06);
  color: var(--page-text);

  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1;

  cursor: pointer;

  backdrop-filter:
    blur(14px)
    saturate(220%)
    contrast(130%)
    brightness(110%);
  -webkit-backdrop-filter:
    blur(14px)
    saturate(220%)
    contrast(130%)
    brightness(110%);

  box-shadow:
    0 10px 24px rgba(17, 17, 17, 0.12),
    inset 0 1px 1px rgba(255, 255, 255, 0.62),
    inset 0 -1px 2px rgba(17, 17, 17, 0.10);

  transition:
    color 0.35s ease,
    background 0.35s ease,
    transform 0.3s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

html.theme-dark .theme-toggle {
  background:
    linear-gradient(
      180deg,
      rgba(70, 70, 70, 0.38),
      rgba(20, 20, 20, 0.34)
    );

  color: #ffffff;

  border-color: rgba(255, 255, 255, 0.14);

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.44),
    inset 0 1px 1px rgba(255, 255, 255, 0.14),
    inset 0 -1px 2px rgba(0, 0, 0, 0.55);
}

.theme-icon {
  display: block;
}

.theme-icon-sun {
  display: none;
}

html.theme-dark .theme-icon-moon {
  display: none;
}

html.theme-dark .theme-icon-sun {
  display: block;
}

/* =========================
   HOME
========================= */

.site-content {
  position: relative;
  z-index: 1;

  width: 100%;
  overflow-x: clip;

  min-height: 100vh;
  min-height: 100svh;

  display: flex;
  flex-direction: column;

  justify-content: flex-start;
  align-items: center;

  padding: 92px 24px 10px;

  text-align: center;
}

@supports not (overflow: clip) {
  .site-content {
    overflow-x: hidden;
  }
}

.hero {
  position: relative;

  width: min(1120px, 100%);

  min-height: calc(100svh - 110px);

  padding-top: 0;
}

.signature-frame {
  width: calc(100% - (var(--signature-offset) * 2));

  margin-inline: auto;

  height: clamp(78px, 10vw, 108px);
  overflow: hidden;

  display: flex;
  justify-content: center;
  align-items: center;

  opacity: 0;

  transform: translateX(var(--signature-offset)) translateY(-10px) scale(0.96);

  transition:
    opacity 1s ease,
    transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

body.loaded .signature-frame {
  opacity: 1;
  transform: translateX(var(--signature-offset)) translateY(0) scale(1);
}

.hero-signature {
  width: min(790px, 88vw);

  max-width: none;

  display: block;
}

html.theme-dark .hero-signature {
  filter:
    brightness(0)
    invert(1)
    contrast(150%);
}

.hero-note {
  position: absolute;

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 14px;

  border: 1px solid var(--border-soft);
  background: var(--soft-panel);

  color: var(--page-text);

  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  opacity: 0;
  transform: translateY(12px);

  transition:
    opacity 0.9s ease,
    transform 0.9s ease,
    background 0.45s ease,
    color 0.45s ease,
    border-color 0.45s ease;

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.note-number {
  color: var(--page-text);
  font-size: 12px;
}

.note-text {
  white-space: nowrap;
}

.hero-note-left {
  left: 36px;
  top: 142px;
}

.hero-note-right {
  right: 36px;
  top: 142px;
}

body.loaded .hero-note {
  opacity: 1;
  transform: translateY(0);
}

body.loaded .hero-note-left {
  transition-delay: 0.25s;
}

body.loaded .hero-note-right {
  transition-delay: 0.42s;
}

.home-artworks {
  margin-top: 6px;

  display: flex;
  justify-content: center;
  align-items: flex-start;

  gap: clamp(72px, 9vw, 118px);

  min-height: 250px;

  perspective: 1200px;
}

.home-artwork {
  width: 210px;
  height: 252px;

  object-fit: cover;

  background: var(--color-white);

  border: 9px solid var(--color-cream-light);

  box-shadow:
    0 22px 52px rgba(17, 17, 17, 0.18),
    0 0 0 1px rgba(17, 17, 17, 0.08);

  opacity: 0;

  transform-origin: center center;

  will-change: transform, opacity;
}

html.theme-dark .home-artwork {
  border-color: rgba(255, 255, 255, 0.88);

  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.home-artwork-left {
  transform: translateX(-115vw) rotateY(180deg) rotateZ(-8deg) scale(0.72);
}

.home-artwork-right {
  transform: translateX(115vw) rotateY(-180deg) rotateZ(8deg) scale(0.72);
}

body.loaded .home-artwork-left {
  animation-name: entraGirandoSinistra;
  animation-duration: 3.2s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  animation-fill-mode: forwards;
  animation-delay: 0.25s;
}

body.loaded .home-artwork-right {
  animation-name: entraGirandoDestra;
  animation-duration: 3.2s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  animation-fill-mode: forwards;
  animation-delay: 0.25s;
}

.home-actions {
  margin-top: 12px;

  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;

  opacity: 0;
  transform: translateY(12px);

  transition:
    opacity 0.9s ease,
    transform 0.9s ease;
}

body.loaded .home-actions {
  opacity: 1;
  transform: translateY(0);

  transition-delay: 0.8s;
}

.home-button {
  min-width: 145px;

  padding: 11px 18px;

  border: 1px solid var(--page-text);

  background: var(--page-text);
  color: var(--page-bg);

  text-decoration: none;

  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  transition:
    background 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    transform 0.3s ease;
}

.home-button:hover {
  transform: translateY(-2px);

  background: transparent;
  color: var(--page-text);
}

.home-button-secondary {
  background: transparent;
  color: var(--page-text);
}

.home-button-secondary:hover {
  background: var(--page-text);
  color: var(--page-bg);
}

/* =========================
   PAGINA OPERE
========================= */

.page-content {
  position: relative;
  z-index: 1;

  width: 100%;

  min-height: 100vh;
  min-height: 100svh;

  padding: 118px 24px 100px;
}

.works-cover {
  position: relative;

  width: min(1180px, 100%);

  min-height: 78vh;

  margin: 0 auto 90px;

  display: flex;
  align-items: center;

  overflow: hidden;
}

.works-small-label {
  position: absolute;

  top: 80px;
  left: 0;

  margin: 0;

  color: var(--muted-text);

  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;

  opacity: 0;
  transform: translateY(12px);

  transition:
    opacity 1s ease,
    transform 1s ease,
    color 0.45s ease;
}

body.loaded .works-small-label {
  opacity: 1;
  transform: translateY(0);
}

.works-vertical-title {
  display: flex;
  align-items: flex-start;
  gap: clamp(28px, 5vw, 70px);

  padding-left: clamp(10px, 4vw, 54px);
}

.works-vertical-title span {
  display: block;

  writing-mode: vertical-rl;
  text-orientation: mixed;

  color: var(--page-text);

  font-size: clamp(44px, 5.6vw, 92px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0.02em;

  text-shadow:
    0 18px 70px rgba(17, 17, 17, 0.12);

  opacity: 0;
  transform: translateY(-42px);

  animation: worksTitleDrop 1.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;

  transition:
    color 0.45s ease,
    text-shadow 0.45s ease;
}

html.theme-dark .works-vertical-title span {
  text-shadow:
    0 0 22px rgba(255, 255, 255, 0.06),
    0 18px 70px rgba(0, 0, 0, 0.40);
}

body.loaded .works-vertical-title span:nth-child(1) {
  animation-delay: 0.12s;
}

body.loaded .works-vertical-title span:nth-child(2) {
  animation-delay: 0.24s;
}

body.loaded .works-vertical-title span:nth-child(3) {
  animation-delay: 0.36s;
}

body.loaded .works-vertical-title span:nth-child(4) {
  animation-delay: 0.48s;
}

body.loaded .works-vertical-title span:nth-child(5) {
  animation-delay: 0.60s;
}

.works-cover-text {
  position: absolute;

  right: 0;
  bottom: 88px;

  width: min(360px, 42vw);

  margin: 0;

  color: var(--muted-text);

  font-size: 16px;
  line-height: 1.7;

  text-align: left;

  opacity: 0;
  transform: translateY(18px);

  transition:
    opacity 1s ease,
    transform 1s ease,
    color 0.45s ease;
}

body.loaded .works-cover-text {
  opacity: 1;
  transform: translateY(0);

  transition-delay: 0.75s;
}

.works-section {
  width: min(1180px, 100%);

  margin: 0 auto;
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 34px;
}

.work-card {
  position: relative;

  min-height: 420px;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;

  padding: 14px;

  border: 1px solid var(--border-soft);

  background: var(--soft-panel);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  opacity: 0;
  transform: translateY(28px);

  transition:
    opacity 0.9s ease,
    transform 0.9s ease,
    box-shadow 0.35s ease,
    background 0.45s ease,
    border-color 0.45s ease;
}

body.loaded .work-card {
  opacity: 1;
  transform: translateY(0);
}

body.loaded .work-card:nth-child(1) {
  transition-delay: 0.10s;
}

body.loaded .work-card:nth-child(2) {
  transition-delay: 0.18s;
}

body.loaded .work-card:nth-child(3) {
  transition-delay: 0.26s;
}

body.loaded .work-card:nth-child(4) {
  transition-delay: 0.34s;
}

body.loaded .work-card:nth-child(5) {
  transition-delay: 0.42s;
}

body.loaded .work-card:nth-child(6) {
  transition-delay: 0.50s;
}

.work-card:hover {
  transform: translateY(-6px);

  box-shadow:
    0 24px 80px rgba(17, 17, 17, 0.14);
}

html.theme-dark .work-card:hover {
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.34);
}

/*
  Immagine dell'opera dentro la card.
  L'aspect-ratio fissa la forma della cornice; object-fit la riempie
  senza deformarla, qualunque sia il formato originale della foto.
*/
.work-image {
  width: 100%;
  aspect-ratio: 4 / 5;

  object-fit: cover;

  background:
    linear-gradient(135deg, #030303, #161616 54%, #070707);

  border: 1px solid rgba(255, 255, 255, 0.12);

  box-shadow:
    inset 0 0 42px rgba(255, 255, 255, 0.025),
    0 18px 55px rgba(0, 0, 0, 0.24);
}

html.theme-dark .work-image {
  box-shadow:
    inset 0 0 42px rgba(255, 255, 255, 0.025),
    0 18px 55px rgba(0, 0, 0, 0.38);
}

.work-image-tall {
  aspect-ratio: 3 / 5;
}

.work-image-wide {
  aspect-ratio: 5 / 4;
}

/*
  Pulsante che avvolge l'immagine e apre il lightbox.
  Riprende l'aspetto della card: nessuno stile "da bottone".
*/
.work-trigger {
  position: relative;

  display: block;

  width: 100%;

  padding: 0;
  border: none;

  overflow: hidden;

  background: none;
  color: inherit;

  font: inherit;
  text-align: left;

  cursor: pointer;
}

.work-trigger:focus-visible {
  outline: 2px solid var(--page-text);
  outline-offset: 4px;
}

.work-trigger .work-image {
  transition:
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.45s ease;
}

.work-trigger:hover .work-image,
.work-trigger:focus-visible .work-image {
  transform: scale(1.035);
  filter: brightness(0.94);
}

/* Lente disegnata con due forme semplici, come le forme del preloader */
.work-zoom {
  position: absolute;

  right: 14px;
  bottom: 14px;

  width: 38px;
  height: 38px;

  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.42);

  background: rgba(17, 17, 17, 0.55);
  color: var(--color-cream-light);

  opacity: 0;
  transform: translateY(6px) scale(0.9);

  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);

  transition:
    opacity 0.3s ease,
    transform 0.3s ease;

  pointer-events: none;
}

.work-trigger:hover .work-zoom,
.work-trigger:focus-visible .work-zoom {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.work-zoom-glass {
  position: absolute;

  top: 10px;
  left: 9px;

  width: 13px;
  height: 13px;

  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.work-zoom-handle {
  position: absolute;

  bottom: 10px;
  right: 8px;

  width: 8px;
  height: 1.5px;

  background: currentColor;

  transform: rotate(45deg);
  transform-origin: right center;
}

.work-info {
  padding: 18px 2px 4px;

  text-align: left;
}

.work-number {
  margin: 0 0 10px;

  color: var(--muted-text);

  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.work-info h2 {
  margin: 0;

  color: var(--page-text);

  font-size: 24px;
  font-weight: 400;
}

.work-technique {
  margin: 8px 0 0;

  color: var(--muted-text);

  font-size: 14px;
  line-height: 1.5;
}

.work-info .work-description {
  margin: 14px 0 0;

  color: var(--page-text);

  font-size: 14px;
  line-height: 1.65;
}

.works-note {
  width: min(1180px, 100%);

  margin: 44px auto 0;

  color: var(--muted-text);

  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.02em;

  opacity: 0;
  transform: translateY(10px);

  transition:
    opacity 0.9s ease,
    transform 0.9s ease,
    color 0.45s ease;

  transition-delay: 0.55s;
}

body.loaded .works-note {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   PAGINA BIOGRAFIA
========================= */

.bio-section {
  width: min(980px, 100%);

  margin: 0 auto;
}

.bio-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 60px;

  text-align: left;
}

.bio-text {
  opacity: 0;
  transform: translateY(24px);

  transition:
    opacity 0.9s ease,
    transform 0.9s ease;

  transition-delay: 0.15s;
}

body.loaded .bio-text {
  opacity: 1;
  transform: translateY(0);
}

.bio-lead {
  margin: 0 0 22px;

  color: var(--page-text);

  font-size: 22px;
  line-height: 1.55;
}

.bio-text p {
  margin: 0 0 20px;

  color: var(--muted-text);

  font-size: 16px;
  line-height: 1.75;
}

.bio-text p:last-child {
  margin-bottom: 0;
}

.bio-panel {
  height: fit-content;

  padding: 30px 28px;

  border: 1px solid var(--border-soft);
  background: var(--soft-panel);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  opacity: 0;
  transform: translateY(24px);

  transition:
    opacity 0.9s ease,
    transform 0.9s ease,
    background 0.45s ease,
    border-color 0.45s ease;

  transition-delay: 0.32s;
}

body.loaded .bio-panel {
  opacity: 1;
  transform: translateY(0);
}

.bio-panel h2 {
  margin: 0 0 18px;

  color: var(--page-text);

  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bio-panel ul {
  margin: 0;
  padding: 0;

  list-style: none;
}

.bio-panel li {
  padding: 12px 0;

  border-top: 1px solid var(--border-soft);

  color: var(--muted-text);

  font-size: 15px;
}

.bio-panel li:first-child {
  border-top: none;
}

/* =========================
   PAGINA CONTATTI
========================= */

.contact-section {
  width: min(1080px, 100%);

  margin: 0 auto;
}

.contact-panel {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 50px;

  padding: 48px;

  position: relative;
  overflow: hidden;

  border-radius: 40px;

  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.42);

  backdrop-filter:
    blur(22px)
    saturate(300%)
    contrast(145%)
    brightness(112%);
  -webkit-backdrop-filter:
    blur(22px)
    saturate(300%)
    contrast(145%)
    brightness(112%);

  box-shadow:
    0 28px 90px rgba(17, 17, 17, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 0.82),
    inset 0 -1px 2px rgba(17, 17, 17, 0.18);

  text-align: left;

  opacity: 0;
  transform: translateY(24px);

  transition:
    opacity 0.9s ease,
    transform 0.9s ease,
    border-color 0.45s ease,
    box-shadow 0.45s ease;

  transition-delay: 0.15s;
}

body.loaded .contact-panel {
  opacity: 1;
  transform: translateY(0);
}

html.theme-dark .contact-panel {
  border-color: rgba(255, 255, 255, 0.16);

  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.36),
    inset 0 1px 1px rgba(255, 255, 255, 0.20),
    inset 0 -1px 2px rgba(0, 0, 0, 0.42);
}

.contact-info,
.contact-form {
  position: relative;
  z-index: 2;
}

.contact-info h2 {
  margin: 14px 0 0;

  font-size: clamp(30px, 4vw, 44px);
  font-weight: 400;
  line-height: 1.1;

  color: var(--page-text);
}

.contact-info p {
  margin: 18px 0 0;

  max-width: 380px;

  color: var(--muted-text);

  font-size: 16px;
  line-height: 1.65;
}

.contact-email-link {
  display: inline-flex;

  margin-top: 26px;

  letter-spacing: 0.04em;
  text-transform: none;
}

.instagram-contact {
  width: min(100%, 380px);
  margin-top: 18px;
}

.instagram-profile-link {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;

  min-height: 72px;
  padding: 12px 14px;

  color: var(--page-text);
  text-decoration: none;

  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.20), transparent 62%),
    var(--soft-panel);

  box-shadow:
    0 14px 38px rgba(17, 17, 17, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);

  transition:
    transform 0.35s var(--ease-inertia),
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

.instagram-profile-link:hover {
  transform: translateY(-3px);
  border-color: rgba(17, 17, 17, 0.30);
  box-shadow:
    0 18px 46px rgba(17, 17, 17, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

html.theme-dark .instagram-profile-link:hover {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.instagram-icon {
  width: 46px;
  height: 46px;

  display: grid;
  place-items: center;

  border-radius: 15px;
  color: #ffffff;
  background:
    radial-gradient(circle at 31% 104%, #ffd600 0 18%, #ff7a00 31%, #ff0169 54%, #d300c5 72%, #7638fa 100%);

  box-shadow: 0 9px 20px rgba(211, 0, 197, 0.20);
}

.instagram-icon svg {
  width: 25px;
  height: 25px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.instagram-icon .instagram-icon-dot {
  fill: currentColor;
  stroke: none;
}

.instagram-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.instagram-copy span {
  color: var(--muted-text);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.instagram-copy strong {
  overflow-wrap: anywhere;

  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.025em;
}

.instagram-arrow {
  color: var(--muted-text);
  font-size: 20px;

  transition:
    color 0.3s ease,
    transform 0.3s var(--ease-inertia);
}

.instagram-profile-link:hover .instagram-arrow {
  color: var(--page-text);
  transform: translate(2px, -2px);
}

.instagram-app-link {
  display: none;
  align-items: center;
  gap: 8px;

  width: fit-content;
  margin: 10px 4px 0;

  color: var(--page-text);
  text-decoration: none;

  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.instagram-app-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (hover: none), (pointer: coarse) {
  .instagram-app-link {
    display: inline-flex;
  }
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;

  color: var(--muted-text);

  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;

  border: 1px solid rgba(17, 17, 17, 0.30);
  border-radius: 10px;

  background: rgba(255, 255, 255, 0.72);
  color: var(--page-text);

  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.4;

  -webkit-appearance: none;
  appearance: none;

  box-shadow:
    inset 0 1px 3px rgba(17, 17, 17, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.65);

  transition:
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.contact-form input[type="text"],
.contact-form input[type="email"] {
  min-height: 46px;
}

.contact-form textarea {
  min-height: 142px;
  resize: vertical;
}

html.theme-dark .contact-form input[type="text"],
html.theme-dark .contact-form input[type="email"],
html.theme-dark .contact-form textarea {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.055);

  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.04);
}

.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form textarea:focus {
  outline: 2px solid transparent;
  border-color: var(--page-text);

  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.09);
}

html.theme-dark .contact-form input[type="text"]:focus,
html.theme-dark .contact-form input[type="email"]:focus,
html.theme-dark .contact-form textarea:focus {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.09);
}

.contact-form button {
  align-self: flex-start;

  margin-top: 4px;

  cursor: pointer;
}

.contact-form .privacy-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 10px;

  margin-top: 2px;

  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-transform: none;
}

.contact-form .privacy-check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  padding: 0;

  accent-color: var(--page-text);
}

.privacy-check a,
.contact-privacy a {
  color: currentColor;
  text-underline-offset: 3px;
}

.form-success {
  margin: 0;
  padding: 14px 16px;

  border: 1px solid rgba(50, 120, 72, 0.35);
  border-radius: 6px;

  background: rgba(50, 120, 72, 0.10);
  color: var(--page-text);

  font-size: 14px;
  line-height: 1.5;
}

.contact-privacy {
  width: min(1080px, 100%);
  margin: 24px auto 0;
}

.contact-privacy details {
  padding: 18px 22px;

  border: 1px solid var(--border-soft);
  border-radius: 16px;

  background: var(--soft-panel);
}

.contact-privacy summary {
  cursor: pointer;

  color: var(--page-text);

  font-size: 14px;
  letter-spacing: 0.05em;
}

.contact-privacy-text {
  max-width: 850px;
  margin-top: 14px;

  color: var(--muted-text);

  font-size: 14px;
  line-height: 1.65;
}

.contact-privacy-text p {
  margin: 10px 0 0;
}

/* =========================
   FOOTER
========================= */

.site-footer {
  width: min(1180px, calc(100% - 48px));
  margin: 70px auto 0;
  padding: 24px 0 30px;

  display: flex;
  justify-content: space-between;
  gap: 20px;

  border-top: 1px solid var(--border-soft);

  color: var(--muted-text);

  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.06em;
}

.site-footer p {
  margin: 0;
}

.site-footer strong {
  color: var(--page-text);
  font-weight: 400;
}

@media (max-width: 700px) {
  .site-footer {
    width: min(100% - 28px, 1180px);
    margin-top: 42px;
    padding-bottom: 22px;

    flex-direction: column;
    gap: 6px;
  }
}

/* =========================
   LIGHTBOX OPERE
========================= */

/* Blocca lo scorrimento della pagina mentre il lightbox è aperto */
body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;

  z-index: 2000;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 32px;

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(10, 10, 10, 0.72);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

html.theme-dark .lightbox-backdrop {
  background: rgba(0, 0, 0, 0.86);
}

.lightbox-dialog {
  position: relative;
  z-index: 1;

  width: min(1100px, 100%);
  height: min(880px, 92vh);

  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);

  overflow: hidden;

  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.5);

  background: rgba(247, 243, 234, 0.96);

  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.45);

  transform: scale(0.96) translateY(14px);
  opacity: 0;

  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease,
    background 0.45s ease,
    border-color 0.45s ease;
}

.lightbox.is-open .lightbox-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

html.theme-dark .lightbox-dialog {
  border-color: rgba(255, 255, 255, 0.12);

  background: rgba(23, 23, 23, 0.97);
}

.lightbox-media {
  position: relative;

  min-height: 0;

  touch-action: pan-y;

  background: #0a0a0a;

  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-image {
  width: 100%;
  height: 100%;

  object-fit: contain;
}

.lightbox-info {
  padding: 40px 38px;

  min-height: 0;
  overflow-y: auto;

  display: flex;
  flex-direction: column;
  justify-content: center;

  text-align: left;
}

.lightbox-number {
  margin: 0 0 10px;

  color: var(--muted-text);

  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lightbox-title {
  margin: 0;

  color: var(--page-text);

  font-size: clamp(26px, 3vw, 34px);
  font-weight: 400;
  line-height: 1.15;
}

.lightbox-technique {
  margin: 10px 0 26px;

  color: var(--muted-text);

  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lightbox-description {
  margin: 0;

  color: var(--muted-text);

  font-size: 16px;
  line-height: 1.75;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 2;

  display: flex;
  justify-content: center;
  align-items: center;

  width: 42px;
  height: 42px;

  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.42);

  background: rgba(17, 17, 17, 0.55);
  color: var(--color-cream-light);

  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1;

  cursor: pointer;

  backdrop-filter: blur(14px) saturate(200%);
  -webkit-backdrop-filter: blur(14px) saturate(200%);

  transition:
    background 0.3s ease,
    transform 0.3s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(17, 17, 17, 0.8);
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
  outline: 2px solid var(--color-cream-light);
  outline-offset: 2px;
}

.lightbox-close {
  top: 18px;
  right: 18px;
}

.lightbox-prev {
  left: 16px;
  top: 50%;

  transform: translateY(-50%);
}

.lightbox-next {
  right: 16px;
  top: 50%;

  transform: translateY(-50%);
}

.lightbox-prev:hover {
  transform: translateY(-50%) translateX(-2px);
}

.lightbox-next:hover {
  transform: translateY(-50%) translateX(2px);
}

.lightbox-view-counter {
  position: absolute;
  left: 50%;
  bottom: 16px;

  margin: 0;
  padding: 7px 11px;

  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;

  background: rgba(17, 17, 17, 0.62);
  color: var(--color-cream-light);

  font-size: 11px;
  letter-spacing: 0.12em;

  transform: translateX(-50%);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lightbox-nav[hidden],
.lightbox-view-counter[hidden] {
  display: none;
}

/* =========================
   SEZIONE TEST LIQUID GLASS
========================= */

.glass-test-section {
  position: relative;

  width: min(1180px, 100%);

  min-height: 76vh;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 110px 24px 140px;

  overflow: hidden;
}

.glass-test-background-text {
  position: absolute;

  top: 18%;
  left: 50%;

  transform: translateX(-50%);

  width: 120vw;

  font-size: clamp(72px, 13vw, 190px);
  line-height: 0.9;
  font-weight: 400;
  letter-spacing: -0.06em;

  color: rgba(17, 17, 17, 0.08);

  white-space: nowrap;

  pointer-events: none;

  transition: color 0.45s ease;
}

html.theme-dark .glass-test-background-text {
  color: rgba(255, 255, 255, 0.055);
}

.glass-test-section::before {
  content: "";

  position: absolute;

  width: 380px;
  height: 380px;

  left: 4%;
  bottom: 8%;

  border-radius: 50%;

  border: 1px solid var(--border-soft);

  pointer-events: none;
}

.glass-test-section::after {
  content: "";

  position: absolute;

  width: 260px;
  height: 260px;

  right: 5%;
  top: 22%;

  border-radius: 46px;

  transform: rotate(18deg);

  border: 1px solid var(--border-soft);

  pointer-events: none;
}

.glass-info-bar {
  width: 100%;

  min-height: 230px;

  padding: 46px 56px;

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 42px;

  position: relative;
  overflow: hidden;

  border-radius: 46px;

  background: rgba(255, 255, 255, 0.025);

  border: 1px solid rgba(255, 255, 255, 0.42);

  backdrop-filter:
    blur(22px)
    saturate(300%)
    contrast(145%)
    brightness(112%);
  -webkit-backdrop-filter:
    blur(22px)
    saturate(300%)
    contrast(145%)
    brightness(112%);

  box-shadow:
    0 28px 90px rgba(17, 17, 17, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 0.82),
    inset 0 -1px 2px rgba(17, 17, 17, 0.18),
    inset 18px 0 34px rgba(255, 255, 255, 0.10),
    inset -18px 0 34px rgba(255, 255, 255, 0.08);

  transition:
    border-color 0.45s ease,
    box-shadow 0.45s ease;
}

html.theme-dark .glass-info-bar {
  border-color: rgba(255, 255, 255, 0.16);

  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.36),
    inset 0 1px 1px rgba(255, 255, 255, 0.20),
    inset 0 -1px 2px rgba(0, 0, 0, 0.42);
}

.glass-info-bar::before {
  content: "";

  position: absolute;
  inset: 0;

  border-radius: inherit;

  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.34),
      rgba(255, 255, 255, 0.06) 36%,
      rgba(255, 255, 255, 0.00) 64%,
      rgba(255, 255, 255, 0.12)
    ),
    radial-gradient(
      circle at 10% 18%,
      rgba(255, 255, 255, 0.42),
      transparent 26%
    ),
    radial-gradient(
      circle at 88% 78%,
      rgba(255, 255, 255, 0.18),
      transparent 30%
    );

  opacity: 0.74;

  mix-blend-mode: screen;

  pointer-events: none;
}

.glass-info-bar::after {
  content: "";

  position: absolute;
  inset: 1px;

  border-radius: inherit;

  border: 1px solid rgba(255, 255, 255, 0.28);

  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.28),
    inset 0 0 66px rgba(255, 255, 255, 0.06);

  pointer-events: none;
}

.glass-info-text,
.glass-info-data {
  position: relative;
  z-index: 2;
}

.glass-info-text {
  max-width: 560px;
  text-align: left;
}

.glass-info-label {
  margin: 0 0 14px;

  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;

  color: var(--muted-text);
}

.glass-info-text h2 {
  margin: 0;

  font-size: clamp(34px, 5vw, 64px);
  font-weight: 400;
  line-height: 1;

  color: var(--page-text);

  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.32);
}

html.theme-dark .glass-info-text h2 {
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.62);
}

.glass-info-text p:last-child {
  margin: 22px 0 0;

  max-width: 500px;

  font-size: 17px;
  line-height: 1.6;

  color: var(--muted-text);
}

.glass-info-data {
  display: flex;
  flex-direction: column;
  gap: 12px;

  min-width: 230px;
}

.glass-info-data span {
  padding: 12px 16px;

  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.035);

  backdrop-filter:
    blur(14px)
    saturate(240%)
    contrast(130%)
    brightness(112%);
  -webkit-backdrop-filter:
    blur(14px)
    saturate(240%)
    contrast(130%)
    brightness(112%);

  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  color: var(--page-text);

  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.58),
    0 8px 20px rgba(17, 17, 17, 0.08);
}

/* =========================
   ANIMAZIONI
========================= */

@keyframes preloaderShapesAppear {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes preloaderShapeFade {
  0% {
    opacity: 0;
  }

  25% {
    opacity: 1;
  }

  72% {
    opacity: 0.88;
  }

  100% {
    opacity: 0;
  }
}

@keyframes preloaderFloat {
  0% {
    translate: 0 0;
  }

  50% {
    translate: 0 -18px;
  }

  100% {
    translate: 0 0;
  }
}

@keyframes preloaderSignatureReveal {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes entraGirandoSinistra {
  0% {
    opacity: 0;
    transform: translateX(-115vw) rotateY(180deg) rotateZ(-8deg) scale(0.72);
  }

  36% {
    opacity: 1;
    transform: translateX(-38vw) rotateY(120deg) rotateZ(-5deg) scale(0.88);
  }

  62% {
    opacity: 1;
    transform: translateX(28px) rotateY(-22deg) rotateZ(2deg) scale(1.04);
  }

  82% {
    opacity: 1;
    transform: translateX(-8px) rotateY(8deg) rotateZ(-1deg) scale(1.01);
  }

  100% {
    opacity: 1;
    transform: translateX(0) rotateY(0deg) rotateZ(0deg) scale(1);
  }
}

@keyframes entraGirandoDestra {
  0% {
    opacity: 0;
    transform: translateX(115vw) rotateY(-180deg) rotateZ(8deg) scale(0.72);
  }

  36% {
    opacity: 1;
    transform: translateX(38vw) rotateY(-120deg) rotateZ(5deg) scale(0.88);
  }

  62% {
    opacity: 1;
    transform: translateX(-28px) rotateY(22deg) rotateZ(-2deg) scale(1.04);
  }

  82% {
    opacity: 1;
    transform: translateX(8px) rotateY(-8deg) rotateZ(1deg) scale(1.01);
  }

  100% {
    opacity: 1;
    transform: translateX(0) rotateY(0deg) rotateZ(0deg) scale(1);
  }
}

@keyframes navbarSheen {
  0% {
    background-position: 6% 10%;
  }

  100% {
    background-position: 92% 70%;
  }
}

@keyframes worksTitleDrop {
  from {
    opacity: 0;
    transform: translateY(-42px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   ACCESSIBILITÀ
========================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .preloader-shapes,
  .preloader-shape,
  .preloader-signature,
  .works-vertical-title span {
    opacity: 1;
    animation: none;
    transform: none;
    translate: none;
  }

  #preloader {
    transition: none;
  }

  #bg-canvas {
    opacity: 0.45;
  }

  .signature-frame,
  .home-artwork,
  .hero-note,
  .home-actions,
  .works-small-label,
  .works-cover-text,
  .work-card,
  .works-note,
  .bio-text,
  .bio-panel,
  .contact-panel {
    opacity: 1;
    transition: none;
    animation: none;
    transform: none;
  }

  .signature-frame {
    transform: translateX(var(--signature-offset));
  }

  .work-trigger .work-image,
  .work-trigger:hover .work-image,
  .work-trigger:focus-visible .work-image {
    transition: none;
    transform: none;
    filter: none;
  }

  .lightbox,
  .lightbox-dialog {
    transition: none;
  }

  .lightbox-dialog {
    transform: none;
  }

  .glass-navbar::before {
    animation: none;
    background-position: 10% 15%;
  }
}

/* =========================
   TABLET
========================= */

@media (max-width: 1200px) {
  .hero {
    min-height: auto;
    padding-bottom: 44px;
  }

  .glass-test-section {
    min-height: 0;
    padding: 48px 20px 72px;
  }

  .glass-info-bar {
    padding: 40px;
    gap: 32px;
  }

  .page-content {
    padding: 106px 22px 78px;
  }

  .works-cover {
    min-height: min(620px, 64svh);
    margin-bottom: 64px;
  }

  .bio-page .works-cover {
    min-height: min(650px, 76svh);
  }
}

@media (max-width: 950px) {
  .hero-note {
    display: none;
  }

  .works-grid {
    grid-template-columns: repeat(2, 1fr);
  }

}

@media (max-width: 850px) {
  :root {
    --signature-offset: 34px;
  }

  .site-header {
    top: 12px;
    padding: 0 16px;
  }

  .glass-navbar {
    width: calc(100vw - 32px);

    min-height: 52px;

    padding: 7px 8px;
  }

  .nav-group {
    gap: 18px;
  }

  .nav-right {
    gap: 10px;
  }

  .nav-left {
    padding-left: 10px;
  }

  .nav-right {
    padding-right: 0;
  }

  .nav-link {
    font-size: 12px;
    letter-spacing: 0.07em;
  }

  .nav-contact {
    padding: 9px 13px;
  }

  .logo-mark,
  .theme-toggle {
    width: 38px;
    height: 38px;
  }

  .site-content {
    padding-top: 92px;
  }

  .preloader-scene {
    margin-top: 92px;
  }

  .signature-frame,
  .preloader-signature-frame {
    height: clamp(70px, 12vw, 94px);
  }

  .hero-signature,
  .preloader-signature {
    width: min(680px, 90vw);
  }

  .home-artworks {
    gap: 52px;
  }

  .bio-grid {
    gap: 42px;
  }

  .contact-panel {
    gap: 34px;
    padding: 38px;
  }
}

/* =========================
   MOBILE
========================= */

@media (max-width: 700px) {
  :root {
    --signature-offset: 14px;
  }

  .site-header {
    top: 10px;
    padding: 0 10px;
  }

  .glass-navbar {
    width: calc(100vw - 20px);

    min-height: 50px;

    padding: 6px;
  }

  .nav-group {
    gap: 10px;
  }

  .nav-right {
    gap: 8px;
  }

  .nav-left {
    padding-left: 6px;
  }

  .nav-right {
    padding-right: 0;
  }

  .nav-link {
    font-size: 10px;
    letter-spacing: 0.05em;
  }

  .nav-contact {
    padding: 8px 10px;
  }

  .logo-mark,
  .theme-toggle {
    width: 36px;
    height: 36px;

    font-size: 12px;
  }

  .theme-toggle {
    font-size: 17px;
  }

  .preloader-scene {
    margin-top: 86px;
    padding: 0 18px;
  }

  .preloader-shapes {
    top: -30px;
    height: 300px;
  }

  .preloader-circle {
    width: 58px;
    height: 58px;
  }

  .preloader-line {
    width: 96px;
  }

  .preloader-arc {
    width: 74px;
    height: 74px;
  }

  .preloader-square {
    width: 52px;
    height: 52px;
  }

  .preloader-diamond {
    width: 46px;
    height: 46px;
  }

  .site-content {
    padding: 86px 18px 0;
  }

  .hero {
    min-height: auto;
    padding-bottom: 34px;
  }

  .signature-frame,
  .preloader-signature-frame {
    height: 68px;
  }

  .signature-frame {
    width: 100%;
    transform: translateY(-10px) scale(0.96);
  }

  .preloader-signature-frame {
    transform: none;
  }

  body.loaded .signature-frame {
    transform: translateY(0) scale(1);
  }

  .hero-signature,
  .preloader-signature {
    width: 92vw;
  }

  .home-artworks {
    margin-top: 8px;

    gap: 24px;

    min-height: 188px;
  }

  .home-artwork {
    width: 128px;
    height: 166px;

    border-width: 6px;
  }

  .home-artwork-left {
    transform: translateX(-115vw) rotateY(180deg) rotateZ(-7deg) scale(0.72);
  }

  .home-artwork-right {
    transform: translateX(115vw) rotateY(-180deg) rotateZ(7deg) scale(0.72);
  }

  .home-actions {
    margin-top: 10px;
    gap: 10px;
  }

  .home-button {
    min-width: auto;

    padding: 10px 12px;

    font-size: 11px;
  }

  .page-content {
    padding: 98px 18px 58px;
  }

  .works-cover {
    min-height: 0;

    margin-bottom: 48px;

    display: block;

    padding-top: 54px;

    overflow: visible;
  }

  .works-small-label {
    top: 0;
  }

  .works-vertical-title {
    gap: 18px;

    padding-left: 0;
  }

  .works-vertical-title span {
    font-size: clamp(34px, 11vw, 56px);
  }

  .works-cover-text {
    position: static;

    width: min(100%, 420px);

    margin-top: 28px;

    font-size: 15px;
  }

  .works-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .work-card {
    min-height: auto;
  }

  .bio-grid {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .bio-lead {
    font-size: 19px;
  }

  .contact-panel {
    grid-template-columns: 1fr;
    gap: 36px;

    padding: 30px 22px;

    border-radius: 26px;
  }

  .contact-email-link {
    max-width: 100%;

    white-space: normal;
    overflow-wrap: anywhere;

    text-align: center;
  }

  .lightbox {
    padding: 0;
  }

  .lightbox-dialog {
    width: 100%;
    max-height: 100%;
    height: 100%;

    grid-template-columns: 1fr;
    grid-template-rows: minmax(240px, 46vh) 1fr;

    border-radius: 0;
  }

  .lightbox-info {
    padding: 26px 22px 32px;
  }

  .lightbox-title {
    font-size: 26px;
  }

  .lightbox-description {
    font-size: 15px;
  }

  .lightbox-close,
  .lightbox-nav {
    width: 38px;
    height: 38px;

    font-size: 17px;
  }

  .glass-test-section {
    min-height: 0;

    padding: 34px 0 58px;
  }

  .glass-test-background-text {
    top: 4%;

    font-size: 76px;

    white-space: normal;
  }

  .glass-info-bar {
    min-height: 0;

    padding: 30px 22px;

    flex-direction: column;
    align-items: flex-start;

    gap: 26px;

    border-radius: 28px;
  }

  .glass-info-text h2 {
    font-size: clamp(32px, 10vw, 38px);
  }

  .glass-info-text p:last-child {
    font-size: 15px;
  }

  .glass-info-data {
    width: 100%;
    min-width: 0;
  }

  @keyframes entraGirandoSinistra {
    0% {
      opacity: 0;
      transform: translateX(-115vw) rotateY(180deg) rotateZ(-7deg) scale(0.72);
    }

    56% {
      opacity: 1;
      transform: translateX(16px) rotateY(-20deg) rotateZ(2deg) scale(1.03);
    }

    100% {
      opacity: 1;
      transform: translateX(0) rotateY(0deg) rotateZ(0deg) scale(1);
    }
  }

  @keyframes entraGirandoDestra {
    0% {
      opacity: 0;
      transform: translateX(115vw) rotateY(-180deg) rotateZ(7deg) scale(0.72);
    }

    56% {
      opacity: 1;
      transform: translateX(-16px) rotateY(20deg) rotateZ(-2deg) scale(1.03);
    }

    100% {
      opacity: 1;
      transform: translateX(0) rotateY(0deg) rotateZ(0deg) scale(1);
    }
  }
}

/* Telefoni molto piccoli */
@media (max-width: 420px) {
  :root {
    --signature-offset: 8px;
  }

  .site-header {
    top: 8px;
    padding: 0 8px;
  }

  .glass-navbar {
    width: calc(100vw - 16px);
  }

  .nav-group {
    gap: 8px;
  }

  .nav-right {
    gap: 6px;
  }

  .nav-left {
    padding-left: 4px;
  }

  .nav-link {
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .nav-contact {
    padding: 8px 9px;
  }

  .logo-mark,
  .theme-toggle {
    width: 34px;
    height: 34px;
  }

  .site-content {
    padding-top: 82px;
  }

  .preloader-scene {
    margin-top: 82px;
  }

  .signature-frame,
  .preloader-signature-frame {
    height: 60px;
  }

  .home-artworks {
    gap: 16px;
  }

  .home-artwork {
    width: 118px;
    height: 152px;
  }

  .home-actions {
    flex-wrap: wrap;
  }

  .contact-panel {
    padding: 26px 18px;
  }

  .contact-email-link {
    font-size: 11px;
  }

  .glass-info-bar {
    padding: 26px 18px;
    border-radius: 24px;
  }

  .works-vertical-title {
    gap: 12px;
  }

  .works-vertical-title span {
    font-size: 32px;
  }
}

/* Larghezze molto strette, incluse le anteprime da circa 240 px. */
@media (max-width: 360px) {
  .site-header {
    top: 6px;
    padding: 0 6px;
  }

  .glass-navbar {
    width: calc(100vw - 12px);
    min-height: 44px;

    grid-template-columns: auto auto auto;
    column-gap: 4px;

    justify-content: space-between;

    padding: 5px 6px;
  }

  .nav-group,
  .nav-left,
  .nav-right {
    min-width: 0;
    gap: 4px;
    padding: 0;
  }

  .nav-link {
    font-size: 8px;
    letter-spacing: 0.02em;
  }

  .nav-contact {
    padding: 5px 4px;
  }

  .logo-mark,
  .theme-toggle {
    width: 30px;
    height: 30px;
  }

  .theme-toggle {
    font-size: 14px;
  }

  .site-content {
    padding: 72px 14px 0;
  }

  .page-content {
    padding: 84px 14px 48px;
  }

  .signature-frame {
    height: 54px;
  }

  .home-artworks {
    gap: 10px;
  }

  .home-artwork {
    width: clamp(76px, 34vw, 110px);
    height: auto;
    aspect-ratio: 7 / 9;
  }

  .home-actions {
    gap: 8px;
  }

  .home-button {
    padding: 8px 9px;
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .works-cover {
    margin-bottom: 38px;
    padding-top: 46px;
  }

  .works-vertical-title {
    gap: 9px;
  }

  .works-vertical-title span {
    font-size: 27px;
  }

  .works-cover-text {
    margin-top: 22px;
    font-size: 14px;
  }

  .contact-panel {
    gap: 28px;
    padding: 22px 14px;
  }

  .glass-test-section {
    padding: 26px 0 42px;
  }

  .glass-info-bar {
    padding: 24px 16px;
  }

  .glass-info-text h2 {
    font-size: 28px;
  }

  .glass-info-data span {
    padding: 10px 12px;
    font-size: 10px;
  }
}

/* Le regole mobile sono successive al blocco accessibilità principale:
   questa conferma finale impedisce che riattivino le trasformazioni 3D. */
@media (prefers-reduced-motion: reduce) {
  .home-artwork-left,
  .home-artwork-right,
  body.loaded .home-artwork-left,
  body.loaded .home-artwork-right {
    opacity: 1;
    animation: none;
    transform: none;
  }
}
