/* ==========================================================
   IN ARCHITETTURA VERITAS — countdown al 15 ottobre 2026
   ========================================================== */

:root {
  --paper:      #f5efe6;
  --paper-deep: #ece3d5;
  --wine-900:   #2c0616;
  --wine-700:   #4a1129;
  --wine-500:   #6e1f44;
  --wine-300:   #a04a72;
  --ivory:      #f9f2ea;
  --ivory-dim:  rgba(249, 242, 234, .72);
  --orb-size:   min(78vw, 38vh, 430px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

/* body inchiodato: nessuno scroll, nessun panning, nessun rimbalzo,
   su qualunque browser mobile (Samsung Internet compreso) */
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;                 /* fallback per WebView datate */
  height: 100svh;
  height: var(--app-h, 100svh);  /* altezza reale misurata da JS */
  background:
    radial-gradient(120% 90% at 50% 8%, var(--paper) 0%, var(--paper-deep) 100%);
  font-family: "Cormorant Garamond", Georgia, serif;
  color: var(--ivory);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;            /* niente gesti di scorrimento/zoom */
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ---------- macchia di vino (immagine fornita) ---------- */

.stain-wrap {
  position: fixed;
  inset: -2.5%;
  z-index: 0;
  pointer-events: none;
  background: url("../img/sfondo-vino.png") center / cover no-repeat;
  animation: stain-breathe 16s ease-in-out infinite;
}

@keyframes stain-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}

/* ---------- grana carta ---------- */

.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: multiply;
}

/* ---------- struttura pagina ---------- */

.page {
  position: relative;
  z-index: 2;
  height: 100vh; /* fallback per WebView datate */
  height: 100svh;
  height: var(--app-h, 100svh);
  /* --fit: impostato da JS se il contenuto supera lo schermo */
  transform: scale(var(--fit, 1));
  transform-origin: 50% 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  gap: clamp(.4rem, 1.4vh, 1.6rem);
  padding: clamp(.8rem, 2.4vh, 3rem) 1.2rem;
  text-align: center;
}

/* ---------- intestazione ---------- */

/* alone scuro dietro i blocchi di testo: le scritte restano
   leggibili anche sulle zone chiare della macchia */
.masthead,
.motto,
.colophon {
  position: relative;
}

.masthead::before,
.motto::before,
.colophon::before {
  content: "";
  position: absolute;
  inset: -18% -22%;
  z-index: -1;
  background: radial-gradient(52% 62% at 50% 50%,
    rgba(24, 3, 12, .58) 0%,
    rgba(24, 3, 12, .34) 55%,
    rgba(24, 3, 12, 0) 100%);
  filter: blur(6px);
  pointer-events: none;
}

.eyebrow {
  font-family: "Jost", sans-serif;
  font-weight: 400;
  font-size: clamp(.62rem, 1.6vw, .78rem);
  letter-spacing: .42em;
  text-indent: .42em;
  text-transform: uppercase;
  color: var(--ivory);
  opacity: .85;
  text-shadow: 0 1px 4px rgba(20, 2, 10, .9), 0 3px 14px rgba(20, 2, 10, .7);
  margin-bottom: clamp(.5rem, 1.4vh, 1.5rem);
  animation: fade-down 1.4s .2s cubic-bezier(.22,1,.36,1) both;
}

.title {
  display: flex;
  flex-direction: column;
  line-height: .96;
  font-weight: 400;
  text-shadow:
    0 1px 3px rgba(20, 2, 10, .85),
    0 3px 12px rgba(20, 2, 10, .6),
    0 8px 40px rgba(20, 2, 10, .5);
}

.title-line {
  display: block;
  animation: fade-down 1.6s cubic-bezier(.22,1,.36,1) both;
}

.t1 {
  font-size: clamp(1.1rem, min(4.5vw, 3vh), 2.6rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: .1em;
  color: var(--ivory);
  opacity: .92;
  animation-delay: .35s;
}

.t2 {
  font-size: clamp(1.7rem, min(8vw, 5.2vh), 4.6rem);
  letter-spacing: .12em;
  text-indent: .12em;
  text-transform: uppercase;
  font-weight: 400;
  animation-delay: .5s;
}

.t3 {
  font-size: clamp(2rem, min(10vw, 6.4vh), 5.8rem);
  letter-spacing: .2em;
  text-indent: .2em;
  text-transform: uppercase;
  font-weight: 500;
  background: linear-gradient(175deg, #ffffff 20%, #f3dde7 55%, #d9a3bd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(0 1px 3px rgba(20, 2, 10, .8))
    drop-shadow(0 6px 26px rgba(20, 2, 10, .55));
  animation-delay: .65s;
  padding-bottom: .06em;
}

@keyframes fade-down {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- palco della sfera ---------- */

.orb-stage {
  position: relative;
  display: grid;
  place-items: center;
  animation: fade-up 1.8s .9s cubic-bezier(.22,1,.36,1) both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(26px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* contenitore (vuoto per ora) delle bolle satellite con i loghi partner */
.satellites {
  position: absolute;
  inset: calc(var(--orb-size) * -0.28);
  pointer-events: none;
  z-index: 3;
}

.satellites .sat {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .35);
  box-shadow:
    inset 0 1px 8px rgba(255, 255, 255, .35),
    0 8px 24px rgba(44, 6, 22, .25);
  overflow: hidden;
  transition: transform .4s cubic-bezier(.22,1,.36,1);
}

.satellites .sat:hover { transform: scale(1.12); }

.satellites .sat img {
  width: 62%;
  height: 62%;
  object-fit: contain;
}

/* ---------- la sfera di vetro ---------- */

.orb {
  position: relative;
  width: var(--orb-size);
  height: var(--orb-size);
  border-radius: 50%;
  isolation: isolate;

  /* vetro: il retro traspare, bordo luminoso, ombra a terra */
  background:
    /* finestra riflessa in alto a sinistra */
    radial-gradient(circle at 32% 24%, rgba(255,255,255,.42) 0%, rgba(255,255,255,.12) 28%, rgba(255,255,255,0) 48%),
    /* luce ambiente rosata riflessa in basso */
    radial-gradient(circle at 66% 84%, rgba(224,164,192,.20) 0%, rgba(224,164,192,0) 44%),
    /* corpo del vetro: velo uniforme + bordo che raccoglie la luce */
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.07) 0%, rgba(255,255,255,.07) 55%, rgba(255,255,255,.16) 86%, rgba(255,255,255,.38) 100%);
  backdrop-filter: blur(4px) saturate(1.2) brightness(1.3);
  -webkit-backdrop-filter: blur(4px) saturate(1.2) brightness(1.3);
  border: 1px solid rgba(255, 255, 255, .55);
  box-shadow:
    /* spessore del vetro sul bordo */
    inset 0 0 0 2px rgba(255, 255, 255, .10),
    inset 0 0 52px rgba(255, 255, 255, .17),
    /* luce da sinistra in alto */
    inset 12px 18px 48px rgba(255, 255, 255, .20),
    /* rifrazione luminosa lungo il bordo basso-destro */
    inset -10px -14px 30px rgba(236, 202, 219, .16),
    inset -18px -26px 60px rgba(44, 6, 22, .30),
    /* alone e distacco dallo sfondo */
    0 0 60px rgba(236, 202, 219, .12),
    0 34px 70px -18px rgba(10, 1, 5, .8),
    0 4px 18px rgba(10, 1, 5, .45);
  /* --ox / --oy: spostamento interattivo; --os: scala al click (JS) */
  transform: translate3d(var(--ox, 0px), var(--oy, 0px), 0) scale(var(--os, 1));
  animation: orb-float 9s ease-in-out infinite;
  touch-action: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@keyframes orb-float {
  0%, 100% { transform: translate3d(var(--ox, 0px), var(--oy, 0px), 0) scale(var(--os, 1)); }
  50%      { transform: translate3d(var(--ox, 0px), calc(var(--oy, 0px) - 10px), 0) scale(var(--os, 1)); }
}

/* anello di risonanza: parte al click sulla sfera */
.orb-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .6);
  opacity: 0;
  pointer-events: none;
}

.orb-ring.ping { animation: ring-ping .7s cubic-bezier(.22,1,.36,1); }

@keyframes ring-ping {
  0%   { opacity: .85; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.24); }
}

/* liquido: SVG a tutto tondo, ritagliato dalla sfera */
.liquid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  z-index: -1;
  /* --tilt: inclinazione del vino (giroscopio / tocco), impostata da JS */
  transform: rotate(var(--tilt, 0deg));
  will-change: transform;
}

/* il livello viene impostato da JS con --fill (0 → 1):
   la cresta dell'onda è a y≈24, quindi la corsa utile è 376px */
.liquid-level {
  transform: translateY(calc((1 - var(--fill, 0)) * 376px));
  transition: transform 2.4s cubic-bezier(.45, 0, .2, 1);
  will-change: transform;
}

/* deriva orizzontale delle onde (il path è largo 800, il viewBox 400) */
.wave-drift { will-change: transform; }
.wave-slow  { animation: drift 9s linear infinite; }
.wave-fast  { animation: drift 5.2s linear infinite reverse; }

@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(-400px); }
}

/* respiro verticale dell'onda, per un moto più liquido */
.wave-shape {
  animation: swell 4.4s ease-in-out infinite;
}
.wave-slow .wave-shape { animation-duration: 6.1s; animation-delay: -2s; }

@keyframes swell {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* bollicine nel vino */
.fizz .fz {
  opacity: 0;
  animation: rise var(--dur, 8s) linear var(--delay, 0s) infinite;
}

@keyframes rise {
  0%   { transform: translateY(var(--rise, 340px)); opacity: 0; }
  12%  { opacity: .5; }
  85%  { opacity: .35; }
  100% { transform: translateY(14px); opacity: 0; }
}

/* riflessi sopra il liquido */
.orb-sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    /* riflesso principale della "finestra" in alto a sinistra */
    radial-gradient(34% 22% at 30% 17%, rgba(255,255,255,.62) 0%, rgba(255,255,255,.14) 55%, rgba(255,255,255,0) 100%),
    /* secondo riflesso piccolo e netto */
    radial-gradient(10% 6% at 62% 9%, rgba(255,255,255,.75) 0%, rgba(255,255,255,0) 100%),
    /* luce di rimbalzo dal basso (dal vino/ambiente) */
    radial-gradient(56% 24% at 50% 99%, rgba(233,201,214,.28) 0%, rgba(233,201,214,0) 100%),
    /* striscia di riflessione laterale destra */
    radial-gradient(8% 42% at 91% 52%, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 100%),
    /* striscia laterale sinistra più tenue */
    radial-gradient(6% 34% at 8% 58%, rgba(255,255,255,.12) 0%, rgba(255,255,255,0) 100%);
  mix-blend-mode: screen;
}

/* scintilla: punto speculare vivo che pulsa lentamente */
.orb-glint {
  position: absolute;
  top: 13%;
  left: 34%;
  width: 7%;
  height: 4.5%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,255,255,.95) 0%, rgba(255,255,255,0) 100%);
  transform: rotate(-24deg);
  filter: blur(1px);
  animation: glint 7s ease-in-out infinite;
  mix-blend-mode: screen;
}

@keyframes glint {
  0%, 100% { opacity: .95; transform: rotate(-24deg) scale(1); }
  50%      { opacity: .55; transform: rotate(-24deg) scale(.82); }
}

/* ombra proiettata a terra, respira in controtempo col galleggiamento */
.orb-ground {
  width: calc(var(--orb-size) * .62);
  height: calc(var(--orb-size) * .085);
  margin-top: calc(var(--orb-size) * .055);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(10, 1, 5, .5) 0%, rgba(10, 1, 5, .22) 55%, rgba(10, 1, 5, 0) 100%);
  filter: blur(6px);
  animation: ground-breathe 9s ease-in-out infinite;
}

@keyframes ground-breathe {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  50%      { transform: scaleX(.88); opacity: .72; }
}

/* ---------- countdown dentro la sfera ---------- */

.orb-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: opacity 1.6s ease;
}

/* capsula di vetro: tiene le cifre leggibili anche sul vino */
.count-pill {
  display: flex;
  align-items: stretch;
  gap: clamp(.55rem, 2.4vw, 1.05rem);
  padding: clamp(.7rem, 2.4vw, 1.05rem) clamp(1rem, 3.6vw, 1.7rem);
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.05) 45%, rgba(255,255,255,.10) 100%);
  backdrop-filter: blur(10px) brightness(1.08);
  -webkit-backdrop-filter: blur(10px) brightness(1.08);
  border: 1px solid rgba(255, 255, 255, .30);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .38),
    inset 0 -6px 16px rgba(44, 6, 22, .22),
    0 10px 30px rgba(20, 2, 10, .35);
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-width: 2.3ch;
}

.num {
  font-size: clamp(1.65rem, 7vw, 2.9rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 1px 2px rgba(20, 2, 10, .75),
    0 3px 16px rgba(20, 2, 10, .55),
    0 0 26px rgba(255, 224, 238, .22);
}

.num.tick { animation: tick .4s cubic-bezier(.22,1,.36,1); }

@keyframes tick {
  0%   { transform: translateY(.18em); }
  100% { transform: translateY(0); }
}

.lbl {
  font-family: "Jost", sans-serif;
  font-weight: 400;
  font-size: clamp(.48rem, 1.4vw, .6rem);
  letter-spacing: .32em;
  text-indent: .32em; /* compensa l'ultimo tracking: etichetta centrata davvero */
  text-transform: uppercase;
  color: rgba(249, 242, 234, .85);
  text-shadow: 0 1px 3px rgba(20, 2, 10, .7);
}

.sep {
  width: 1px;
  align-self: center;
  height: clamp(1.7rem, 5.8vw, 2.7rem);
  margin-bottom: .95em;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,.55), transparent);
}

/* messaggio finale (calice pieno) */
.orb-final {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2.2s ease .6s;
}

.orb-final .final-line {
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  letter-spacing: .08em;
  line-height: 1.15;
  text-shadow: 0 2px 18px rgba(30, 4, 15, .6);
}

.orb-final .em {
  font-size: clamp(2.2rem, 8.4vw, 3.6rem);
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-style: normal;
}

.orb.is-full .orb-count { opacity: 0; }
.orb.is-full .orb-final { opacity: 1; }

/* ---------- didascalia, motto, colophon ---------- */

.orb-caption {
  margin-top: clamp(.4rem, 1.2vh, 1.2rem);
  padding: 0 1rem;
  font-family: "Jost", sans-serif;
  font-weight: 400;
  font-size: clamp(.58rem, min(1.8vw, 1.5vh), .8rem);
  letter-spacing: .3em;
  text-indent: .3em;
  text-transform: uppercase;
  color: var(--ivory);
  opacity: .8;
  text-shadow: 0 1px 4px rgba(20, 2, 10, .85), 0 3px 12px rgba(20, 2, 10, .6);
}

.motto {
  max-width: 34em;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(.82rem, min(2.6vw, 2vh), 1.35rem);
  line-height: 1.55;
  color: var(--ivory);
  text-shadow:
    0 1px 3px rgba(20, 2, 10, .8),
    0 3px 18px rgba(20, 2, 10, .55);
  animation: fade-up 1.8s 1.2s cubic-bezier(.22,1,.36,1) both;
}

.colophon {
  animation: fade-up 1.8s 1.45s cubic-bezier(.22,1,.36,1) both;
}

.colophon .place {
  font-size: clamp(.92rem, min(3vw, 2.2vh), 1.5rem);
  letter-spacing: .28em;
  text-indent: .28em;
  text-transform: uppercase;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(20, 2, 10, .85), 0 3px 14px rgba(20, 2, 10, .6);
}

.colophon .org {
  margin-top: .35rem;
  font-family: "Jost", sans-serif;
  font-weight: 400;
  font-size: clamp(.52rem, min(1.6vw, 1.3vh), .72rem);
  letter-spacing: .3em;
  text-indent: .3em;
  line-height: 1.9;
  text-transform: uppercase;
  color: var(--ivory);
  opacity: .8;
  text-shadow: 0 1px 4px rgba(20, 2, 10, .85);
}

/* link "invisibile" al sito dell'Ordine: nessuno stile da link */
.org-link {
  color: inherit;
  text-decoration: none;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

/* link al luogo (Maps): stesso aspetto del testo */
.place-link {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- smartphone: tutto in una schermata ---------- */

@media (max-width: 640px) {
  :root {
    --orb-size: min(74vw, 34vh);
  }

  .page {
    padding: clamp(.6rem, 2vh, 1.4rem) .9rem;
  }

  .eyebrow {
    font-size: clamp(.68rem, 2.9vw, .8rem);
    letter-spacing: .28em;
    text-indent: .28em; /* compensa il tracking: resta centrato */
  }

  .t1 { font-size: clamp(1.3rem, min(5.4vw, 3.2vh), 2.2rem); }
  .t2 { font-size: clamp(2rem, min(9vw, 5.4vh), 3.4rem); letter-spacing: .09em; text-indent: .09em; }
  .t3 { font-size: clamp(2.4rem, min(11vw, 6.6vh), 4.2rem); letter-spacing: .15em; text-indent: .15em; }

  .count-pill {
    gap: clamp(.45rem, 2.4vw, .8rem);
    padding: .6rem .95rem;
  }

  .num { font-size: clamp(1.4rem, min(7vw, 3.6vh), 2.2rem); }
  .lbl { font-size: clamp(.55rem, 2.1vw, .62rem); }

  .orb-caption {
    font-size: clamp(.64rem, min(2.9vw, 1.6vh), .78rem);
    letter-spacing: .14em;
    text-indent: .14em;
    line-height: 1.8;
    max-width: 30em;
    margin-left: auto;
    margin-right: auto;
  }

  .motto {
    max-width: 20em;
    font-size: clamp(.95rem, min(3.7vw, 2.1vh), 1.15rem);
  }

  /* su schermi stretti il testo scorre libero, senza a-capo forzati */
  .motto br { display: none; }

  .colophon .place {
    font-size: clamp(1.05rem, min(4vw, 2.4vh), 1.4rem);
  }

  .colophon .org {
    font-size: clamp(.62rem, min(2.5vw, 1.5vh), .72rem);
    letter-spacing: .22em;
    text-indent: .22em;
  }

  .orb-ground {
    margin-top: calc(var(--orb-size) * .04);
    height: calc(var(--orb-size) * .07);
  }
}

/* schermi molto bassi (telefoni in orizzontale): compatta ancora */
@media (max-height: 460px) {
  :root { --orb-size: min(30vw, 44vh); }
  .motto { display: none; }
}

/* ---------- accessibilità: meno movimento ---------- */

@media (prefers-reduced-motion: reduce) {
  .stain-wrap,
  .orb,
  .orb-glint,
  .orb-ground,
  .wave-drift,
  .wave-shape,
  .fizz .fz { animation: none !important; }
  .liquid-level { transition: none; }
}
