/* ═══════════════════════════════════════════════════════════════
   ALCHIMIA — grimorio da speziale, verde bottiglia e oro
   ═══════════════════════════════════════════════════════════════ */

@font-face { font-family: 'Cormorant SC'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../vendor/fonts/cormorant-sc-v19-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant SC'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../vendor/fonts/cormorant-sc-v19-latin-700.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/cormorant-garamond-v21-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/cormorant-garamond-v21-latin-italic.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../vendor/fonts/cormorant-garamond-v21-latin-600.woff2') format('woff2'); }

:root {
  --verde: #0E3B2E;
  --verde-chiaro: #175946;
  --verde-cupo: #08251d;
  --verde-nero: #051811;
  --oro: #C9A227;
  --oro-chiaro: #E8C96A;
  --oro-pallido: #f0dfa8;
  --avorio: #F3E9D2;
  --pergamena: #EADFC4;
  --pergamena-scura: #d9c69a;
  --ceralacca: #8C2B1F;
  --inchiostro: #2b2418;
  --display: 'Cormorant SC', serif;
  --testo: 'Cormorant Garamond', Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--testo);
  color: var(--avorio);
  background:
    radial-gradient(1100px 700px at 50% 24%, rgba(46,116,94,.55), rgba(0,0,0,0) 62%),
    radial-gradient(1600px 1100px at 50% 60%, var(--verde) 0%, var(--verde-cupo) 68%, var(--verde-nero) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'%3E%3Cpath d='M3 3l8 19 2.6-7.8L22 11.6z' fill='%23E8C96A' stroke='%23241c08' stroke-width='1.4'/%3E%3C/svg%3E") 3 3, auto;
}

/* grana di pergamena su tutto */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.85 0 0 0 0 0.72 0 0 0 0 0.4 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: screen; opacity: .8;
}
/* vignettatura */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(130% 95% at 50% 42%, rgba(0,0,0,0) 55%, rgba(2,10,7,.55) 100%);
}

/* lume di candela che respira */
#lume {
  position: fixed; inset: -20%; pointer-events: none; z-index: 3;
  background: radial-gradient(720px 520px at 50% 30%, rgba(232,201,106,.10), rgba(0,0,0,0) 70%);
  animation: respiro 7s ease-in-out infinite alternate;
}
@keyframes respiro { from { opacity: .55; transform: scale(1);} to { opacity: 1; transform: scale(1.06);} }

#defs-globali { position: absolute; }

::selection { background: rgba(201,162,39,.35); }
button { font-family: inherit; cursor: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--oro-chiaro); outline-offset: 3px; }

/* ── bottoni ─────────────────────────────────────────────── */
.btn-oro {
  font-family: var(--display); font-weight: 700; font-size: 1.02rem; letter-spacing: .08em;
  color: var(--verde-cupo); border: 1px solid #8a6c14; border-radius: 3px;
  background: linear-gradient(160deg, #f0d98a 0%, var(--oro) 55%, #a87f1d 100%);
  padding: .5rem 1.15rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,244,200,.7);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease, filter .18s ease;
}
.btn-oro:hover { transform: translateY(-1.5px); filter: brightness(1.07); box-shadow: 0 5px 16px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,244,200,.7); }
.btn-oro:active { transform: translateY(0); }

.btn-fantasma {
  font-family: var(--display); font-weight: 600; font-size: .98rem; letter-spacing: .07em;
  color: var(--oro-chiaro); background: rgba(232,201,106,.05);
  border: 1px solid rgba(201,162,39,.45); border-radius: 3px; padding: .48rem 1rem;
  transition: background .2s ease, border-color .2s ease, transform .18s ease;
}
.btn-fantasma:hover { background: rgba(232,201,106,.13); border-color: var(--oro); transform: translateY(-1px); }
.btn-piccolo { font-size: .8rem; padding: .3rem .7rem; opacity: .75; }

/* ═══════════ VISTA I · GRIMORIO ═══════════ */
#grimorio { position: relative; z-index: 6; padding: clamp(1.6rem, 4vh, 3.5rem) 2rem 4.5rem; text-align: center; }

.masthead .fregio-sopra { color: var(--oro); letter-spacing: 1.2em; text-indent: 1.2em; font-size: .9rem; opacity: .85; }

.masthead h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(3.6rem, 8.5vw, 7rem); line-height: 1.02;
  letter-spacing: .16em; text-indent: .16em; margin-top: .5rem;
  background: linear-gradient(178deg, #f6e7ae 8%, var(--oro-chiaro) 38%, var(--oro) 62%, #8f6f14 96%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 14px rgba(201,162,39,.22));
}
.masthead .sottotitolo {
  font-family: var(--display); font-weight: 600; font-size: clamp(1.05rem, 2vw, 1.5rem);
  letter-spacing: .42em; text-indent: .42em; color: var(--avorio); opacity: .92; margin-top: .4rem;
}
.masthead .sottotitolo::before, .masthead .sottotitolo::after { content: '— '; color: var(--oro); opacity: .8; }
.masthead .sottotitolo::after { content: ' —'; }
.masthead .esergo {
  font-style: italic; font-size: clamp(1rem, 1.5vw, 1.22rem); line-height: 1.55;
  color: rgba(243,233,210,.78); margin-top: 1.1rem;
}

.tomi {
  display: flex; justify-content: center; align-items: stretch;
  gap: clamp(1.2rem, 3vw, 3rem); margin-top: clamp(1.8rem, 4.5vh, 3.4rem); flex-wrap: wrap;
  perspective: 1400px;
}

/* ── il tomo: copertina in pelle verde con doratura ── */
.tomo {
  position: relative; width: clamp(255px, 22vw, 315px); text-align: center;
  display: flex; flex-direction: column;
  border-radius: 6px 14px 14px 6px; padding: 1.5rem 1.4rem 1.3rem;
  background:
    linear-gradient(100deg, rgba(0,0,0,.42) 0%, rgba(0,0,0,0) 7%),
    linear-gradient(160deg, #14503f 0%, var(--verde) 45%, #0a2e23 100%);
  border: 1px solid rgba(201,162,39,.35);
  box-shadow: 0 18px 45px rgba(0,0,0,.55), inset 0 0 60px rgba(0,0,0,.35);
  transition: transform .45s cubic-bezier(.22,1,.36,1), box-shadow .45s ease;
  opacity: 0; transform: translateY(34px) rotateX(6deg);
  animation: tomo-entra .8s cubic-bezier(.22,1,.36,1) forwards;
  animation-delay: calc(var(--i) * 160ms + 150ms);
}
.tomo:nth-child(1) { rotate: -1.3deg; }
.tomo:nth-child(3) { rotate: 1.3deg; }
@keyframes tomo-entra { to { opacity: 1; transform: translateY(0) rotateX(0); } }
.tomo:hover {
  transform: translateY(-9px) scale(1.015);
  box-shadow: 0 30px 60px rgba(0,0,0,.65), 0 0 40px rgba(201,162,39,.14), inset 0 0 60px rgba(0,0,0,.3);
}
/* filetto dorato interno */
.tomo::before {
  content: ''; position: absolute; inset: 9px; pointer-events: none;
  border: 1.5px solid rgba(201,162,39,.55); border-radius: 4px 10px 10px 4px;
  background:
    radial-gradient(circle at 0 0, rgba(232,201,106,.35), transparent 26px),
    radial-gradient(circle at 100% 0, rgba(232,201,106,.35), transparent 26px),
    radial-gradient(circle at 0 100%, rgba(232,201,106,.35), transparent 26px),
    radial-gradient(circle at 100% 100%, rgba(232,201,106,.35), transparent 26px);
}
.tomo .tomo-numero {
  font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--oro-chiaro);
  letter-spacing: .3em; text-indent: .3em;
}
.tomo .tomo-numero::before, .tomo .tomo-numero::after { content: ' ✦ '; font-size: .75em; opacity: .8; }
.tomo .tomo-medaglione {
  width: 168px; height: 168px; margin: .9rem auto .6rem; position: relative; border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, #f6eeda, var(--pergamena) 62%, var(--pergamena-scura));
  border: 2px solid var(--oro); outline: 1px dashed rgba(201,162,39,.6); outline-offset: 5px;
  box-shadow: inset 0 3px 14px rgba(94,66,15,.35), 0 6px 18px rgba(0,0,0,.5);
  display: grid; place-items: center; overflow: hidden;
}
.tomo .tomo-medaglione img { width: 88%; height: 88%; object-fit: contain; filter: sepia(.15) saturate(.9); transition: transform .5s cubic-bezier(.22,1,.36,1); }
.tomo:hover .tomo-medaglione img { transform: scale(1.06) rotate(.5deg); }
.tomo h2 { font-family: var(--display); font-weight: 700; font-size: 1.55rem; letter-spacing: .05em; color: var(--oro-pallido); line-height: 1.15; }
.tomo .tomo-motto { font-style: italic; color: rgba(243,233,210,.65); font-size: 1.02rem; margin-top: .15rem; }
.tomo .tomo-desc { font-size: .98rem; line-height: 1.45; color: rgba(243,233,210,.82); margin-top: .65rem; min-height: 3.5em; }
.tomo .tomo-meta {
  display: flex; justify-content: center; gap: 1.4rem; margin-top: .7rem;
  font-family: var(--display); font-size: .88rem; letter-spacing: .1em; color: var(--oro-chiaro);
}
.tomo .tomo-apri {
  margin-top: auto; font-family: var(--display); font-weight: 600; letter-spacing: .18em; text-indent: .18em;
  font-size: .92rem; color: var(--verde-cupo);
  background: linear-gradient(160deg, #f0d98a, var(--oro) 60%, #a87f1d);
  border: 1px solid #8a6c14; border-radius: 3px; padding: .5rem 1.3rem; width: 100%;
  box-shadow: 0 2px 9px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,244,200,.7);
  transition: filter .2s ease, transform .2s ease;
}
.tomo:hover .tomo-apri { filter: brightness(1.08); transform: translateY(-1px); }
/* avanzamento sul tomo */
.tomo .tomo-stato { margin: .55rem 0 .9rem; font-size: .85rem; font-style: italic; color: rgba(232,201,106,.75); min-height: 1.2em; }

/* timbro rosso ruotato (SENZA PANNA) */
.timbro {
  display: inline-grid; place-items: center; text-align: center;
  font-family: var(--display); font-weight: 700; font-size: .72rem; line-height: 1.15; letter-spacing: .12em;
  color: #d4553d; width: 74px; height: 74px; border-radius: 50%;
  border: 2.5px solid #c04a33; box-shadow: inset 0 0 0 1.5px rgba(192,74,51,.5);
  rotate: -14deg; opacity: .92;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.92 0.08'/%3E%3C/filter%3E%3Crect width='80' height='80' filter='url(%23r)'/%3E%3C/svg%3E");
}
.tomo .timbro { position: absolute; top: 54px; right: 12px; z-index: 2; }
#lab-testata .timbro { width: 62px; height: 62px; font-size: .6rem; border-width: 2px; }

.colophon { margin-top: clamp(1.6rem, 4vh, 3rem); font-style: italic; font-size: 1.02rem; line-height: 1.6; color: rgba(243,233,210,.55); }

/* ═══════════ VISTA II · LABORATORIO ═══════════ */
#laboratorio { position: relative; z-index: 6; height: 100vh; display: flex; flex-direction: column; }

#lab-testata {
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
  padding: .8rem 1.6rem .7rem;
  background: linear-gradient(180deg, rgba(5,24,17,.88), rgba(5,24,17,.55) 80%, rgba(5,24,17,0));
  border-bottom: 1px solid rgba(201,162,39,.28);
  position: relative; z-index: 8;
}
.lab-titolo { display: flex; align-items: center; gap: .9rem; }
.lab-numero {
  font-family: var(--display); font-weight: 700; font-size: 2rem; color: var(--oro);
  width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid rgba(201,162,39,.6); outline: 1px dashed rgba(201,162,39,.4); outline-offset: 3px;
}
.lab-titolo h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.3rem, 2.2vw, 1.8rem); letter-spacing: .04em; color: var(--oro-pallido); line-height: 1.05; }
.lab-titolo p { font-style: italic; color: rgba(243,233,210,.6); font-size: .98rem; }
.lab-comandi { display: flex; align-items: center; gap: 1.1rem; margin-left: auto; flex-wrap: wrap; }

.dosi { display: flex; align-items: center; gap: .35rem; }
.dosi-eti { font-family: var(--display); font-size: .85rem; letter-spacing: .12em; color: rgba(243,233,210,.65); margin-right: .2rem; }
.btn-dose {
  font-family: var(--display); font-weight: 700; font-size: .95rem; color: var(--oro-chiaro);
  width: 40px; height: 34px; background: rgba(232,201,106,.06);
  border: 1px solid rgba(201,162,39,.4); border-radius: 3px;
  transition: all .2s ease;
}
.btn-dose:hover { background: rgba(232,201,106,.14); }
.btn-dose.attiva { background: linear-gradient(160deg, #f0d98a, var(--oro) 60%, #a87f1d); color: var(--verde-cupo); border-color: #8a6c14; box-shadow: inset 0 1px 0 rgba(255,244,200,.7); }

.avanzamento { display: flex; align-items: center; gap: .6rem; }
#avz-testo { font-family: var(--display); font-size: .92rem; letter-spacing: .08em; color: var(--oro-chiaro); white-space: nowrap; }
.avz-barra { width: 130px; height: 7px; border: 1px solid rgba(201,162,39,.5); border-radius: 4px; overflow: hidden; background: rgba(0,0,0,.4); }
.avz-barra i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #a87f1d, var(--oro-chiaro)); transition: width .6s cubic-bezier(.22,1,.36,1); box-shadow: 0 0 8px rgba(232,201,106,.7); }

#lab-canvas { flex: 1; position: relative; overflow: hidden; }
#grafo { width: 100%; height: 100%; display: block; touch-action: none; }
#lab-aiuto {
  position: absolute; bottom: 10px; left: 16px;
  font-style: italic; font-size: .85rem; color: rgba(243,233,210,.4); pointer-events: none; white-space: nowrap;
}

/* filigrana alchemica dietro il piatto finale */
.sigillo-magico { pointer-events: none; }
.sigillo-magico .sm-cerchio { fill: none; stroke: rgba(201,162,39,.13); stroke-width: 1.2; }
.sigillo-magico .sm-dash { stroke-dasharray: 4 7; animation: ruota 90s linear infinite; transform-box: fill-box; transform-origin: center; }
.sigillo-magico .sm-dash2 { stroke-dasharray: 2 5; animation: ruota 60s linear infinite reverse; transform-box: fill-box; transform-origin: center; }
.sigillo-magico .sm-tacca { stroke: rgba(201,162,39,.18); stroke-width: 1.2; }
@keyframes ruota { to { transform: rotate(360deg); } }

.stelo { stroke: rgba(201,162,39,.55); stroke-width: 1.2; }

/* pulviscolo dorato */
.mote {
  position: absolute; width: 4px; height: 4px; border-radius: 50%; pointer-events: none; z-index: 2;
  background: radial-gradient(circle, rgba(240,217,138,.9), rgba(240,217,138,0) 70%);
  animation: galleggia 10s ease-in-out infinite alternate;
}
@keyframes galleggia {
  from { transform: translate(0, 0); opacity: .15; }
  40% { opacity: .8; }
  to { transform: translate(26px, -46px); opacity: .1; }
}

/* ── archi ── */
.arco { fill: none; stroke: url(#grad-arco); stroke-width: 2; opacity: .9; transition: stroke-dashoffset 1.4s cubic-bezier(.4,0,.2,1); }
.arco-alone { fill: none; stroke: rgba(232,201,106,.07); stroke-width: 7; }
.particella { fill: var(--oro-chiaro); }
.particella-alone { fill: rgba(232,201,106,.28); }

/* ── nodi: comparsa a scaglioni ── */
.nodo { opacity: 0; transform-box: fill-box; transform-origin: center; }
.nodo.appare { animation: nodo-entra .7s cubic-bezier(.22,1.35,.36,1) forwards; animation-delay: calc(var(--i) * 90ms); }
@keyframes nodo-entra { from { opacity: 0; scale: .55; } to { opacity: 1; scale: 1; } }

/* ampolla / medaglione ingrediente */
.nodo-ing .med-alone { fill: rgba(232,201,106,.05); transition: fill .3s ease; }
.nodo-ing:hover .med-alone { fill: rgba(232,201,106,.12); }
.nodo-ing .med-fondo { fill: url(#grad-medaglione); stroke: rgba(94,66,15,.4); stroke-width: .5; }
.nodo-ing .med-bordo { fill: none; stroke: var(--oro); stroke-width: 2; }
.nodo-ing .med-anello { fill: none; stroke: rgba(201,162,39,.55); stroke-width: 1; stroke-dasharray: 3 5; }
.nodo-ing image { filter: sepia(.12) saturate(.92); }

/* etichetta da speziale con flip */
.fo-etichetta { overflow: visible; }
.etichetta { width: 190px; height: 74px; perspective: 700px; margin: 0 auto; }
.eti-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.4,0,.2,1); }
.etichetta:hover .eti-inner { transform: rotateY(180deg); }
.eti-fronte, .eti-retro {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 3px; padding: .35rem .5rem .3rem; text-align: center;
  background:
    linear-gradient(175deg, #f6eeda, var(--pergamena) 70%, #e0d0a8);
  border: 1px solid #8a6c14; box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 0 0 2px rgba(138,108,20,.25);
  display: flex; flex-direction: column; justify-content: center; gap: .1rem;
}
.eti-fronte .eti-nome { font-family: var(--display); font-weight: 700; font-size: .92rem; letter-spacing: .06em; color: var(--inchiostro); line-height: 1.05; }
.eti-fronte .eti-qta { font-size: .92rem; font-weight: 600; color: #6b5313; font-variant-numeric: lining-nums; }
.eti-fronte .eti-fregio { font-size: .55rem; color: #a4813a; letter-spacing: .5em; text-indent: .5em; }
.eti-retro { transform: rotateY(180deg); background: linear-gradient(175deg, #efe2c2, #e2d1a6); }
.eti-retro p { font-size: .78rem; line-height: 1.28; font-style: italic; color: #4a3c1c; }

/* stazione azione */
.nodo-az { cursor: pointer; }
.nodo-az .staz-alone { fill: rgba(232,201,106,.04); transition: fill .3s ease; }
.nodo-az:hover .staz-alone { fill: rgba(232,201,106,.11); }
.nodo-az .staz-fondo { fill: url(#grad-stazione); stroke: rgba(0,0,0,.5); stroke-width: 1; transition: filter .3s ease; }
.nodo-az .staz-bordo { fill: none; stroke: var(--oro); stroke-width: 1.8; }
.nodo-az .staz-rombo { fill: none; stroke: rgba(201,162,39,.45); stroke-width: 1; }
.nodo-az .staz-verbo { font-family: var(--display); font-weight: 700; font-size: 21px; fill: var(--oro-pallido); text-anchor: middle; letter-spacing: .5px; }
.nodo-az .staz-tempo { font-family: var(--testo); font-style: italic; font-size: 15px; fill: rgba(243,233,210,.75); text-anchor: middle; }
.nodo-az .staz-play { font-size: 11px; fill: rgba(232,201,106,.85); text-anchor: middle; letter-spacing: 1px; }

/* anello timer */
.timer-ring { fill: none; stroke: rgba(232,201,106,.16); stroke-width: 3.5; }
.timer-ring-avz { fill: none; stroke: var(--oro-chiaro); stroke-width: 3.5; stroke-linecap: round;
  transform: rotate(-90deg); transform-box: fill-box; transform-origin: center;
  filter: drop-shadow(0 0 4px rgba(232,201,106,.8)); }

.nodo-az.attivo .staz-fondo { filter: drop-shadow(0 0 14px rgba(232,201,106,.35)); }
.nodo-az.attivo .staz-tempo { fill: var(--oro-chiaro); font-style: normal; font-weight: 600; }
.nodo-az.attivo .staz-alone { fill: rgba(232,201,106,.1); animation: pulsa 1.6s ease-in-out infinite alternate; }
@keyframes pulsa { from { fill: rgba(232,201,106,.06);} to { fill: rgba(232,201,106,.16);} }

/* stazione compiuta: si spegne d'oro */
.nodo-az.fatto .staz-fondo { fill: url(#grad-stazione-fatta); }
.nodo-az.fatto .staz-verbo { fill: #3a2c07; }
.nodo-az.fatto .staz-tempo { fill: rgba(58,44,7,.75); }
.nodo-az.fatto .staz-play { fill: rgba(58,44,7,.6); }
.nodo-az.fatto .staz-bordo { stroke: #f6e7ae; stroke-width: 2.2; filter: drop-shadow(0 0 7px rgba(232,201,106,.55)); }

/* sigillo "fatto" sul nodo */
.sigillo { cursor: pointer; }
.sigillo .sig-cerchio { fill: rgba(5,24,17,.85); stroke: rgba(201,162,39,.6); stroke-width: 1.2; transition: fill .25s ease; }
.sigillo:hover .sig-cerchio { fill: rgba(23,89,70,.95); }
.sigillo .sig-stella { font-size: 13px; fill: rgba(232,201,106,.55); text-anchor: middle; }
.nodo-az.fatto .sigillo .sig-cerchio { fill: var(--ceralacca); stroke: #5e1a11; }
.nodo-az.fatto .sigillo .sig-stella { fill: var(--oro-pallido); }

/* striscia descrizione del passo */
.fo-desc { overflow: visible; pointer-events: none; }
.passo-desc {
  font-size: .8rem; line-height: 1.3; text-align: center; color: rgba(243,233,210,.78);
  background: rgba(5,24,17,.55); border: 1px solid rgba(201,162,39,.2); border-radius: 3px;
  padding: .3rem .45rem; backdrop-filter: blur(2px);
}
.nodo-az.fatto + * .passo-desc { opacity: .5; }

/* nodo finale */
.nodo-fin .fin-fondo { fill: url(#grad-medaglione); stroke: rgba(94,66,15,.5); }
.nodo-fin .fin-bordo { fill: none; stroke: var(--oro); stroke-width: 2.5; }
.nodo-fin .fin-anello { fill: none; stroke: rgba(201,162,39,.6); stroke-width: 1; stroke-dasharray: 2 4; }
.nodo-fin image { filter: sepia(.15) saturate(.9); opacity: .38; transition: opacity .8s ease, filter .8s ease; }
.nodo-fin.compiuto image { opacity: 1; filter: sepia(.05) saturate(1); }
.nodo-fin .fin-nome { font-family: var(--display); font-weight: 700; font-size: 21px; fill: var(--oro-chiaro); letter-spacing: 1px; }
.nodo-fin .fin-attesa { font-family: var(--testo); font-style: italic; font-size: 13.5px; fill: rgba(243,233,210,.55); }

/* ═══════════ CORNICE ORNAMENTALE RIUSABILE ═══════════ */
.cornice { position: relative; }
.cornice .ang {
  position: absolute; width: 56px; height: 56px; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23C9A227' stroke-width='1.6'%3E%3Cpath d='M4 54V22C4 11 11 4 22 4h32'/%3E%3Cpath d='M10 54V24c0-8 6-14 14-14h30' opacity='.5' stroke-width='1'/%3E%3Cpath d='M4 34c8 0 10-6 6-10s-10-2-10 6' stroke-width='1.2'/%3E%3Cpath d='M34 4c0 8 6 10 10 6s2-10-6-10' stroke-width='1.2'/%3E%3C/g%3E%3Ccircle cx='13' cy='13' r='2.4' fill='%23C9A227'/%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat; opacity: .9;
}
.cornice .tl { top: 10px; left: 10px; }
.cornice .tr { top: 10px; right: 10px; transform: scaleX(-1); }
.cornice .bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
.cornice .br { bottom: 10px; right: 10px; transform: scale(-1); }

/* ═══════════ VISTA III · RITO ═══════════ */
#rito {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: radial-gradient(1000px 700px at 50% 40%, rgba(14,59,46,.92), rgba(3,14,10,.97));
  animation: velo-entra .45s ease forwards;
}
@keyframes velo-entra { from { opacity: 0; } to { opacity: 1; } }

.rito-pagina {
  width: min(860px, 92vw); max-height: 92vh; overflow-y: auto;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,250,235,.9), rgba(0,0,0,0) 60%),
    linear-gradient(178deg, #f6eeda, var(--pergamena) 55%, #dcc99e);
  color: var(--inchiostro); border-radius: 4px;
  border: 1px solid #8a6c14; box-shadow: 0 30px 90px rgba(0,0,0,.7), inset 0 0 0 3px rgba(138,108,20,.28), inset 0 0 80px rgba(160,120,40,.15);
  padding: 2.3rem 2.6rem 1.6rem; text-align: center;
  animation: pagina-entra .5s cubic-bezier(.22,1.2,.36,1) forwards;
}
@keyframes pagina-entra { from { opacity: 0; transform: translateY(26px) scale(.96); } to { opacity: 1; transform: none; } }

#rito-chiudi { position: absolute; top: 24px; right: 78px; color: #6b5313; border: none; background: transparent; z-index: 2; font-size: 1.05rem; padding: .3rem .5rem; }
#rito-chiudi:hover { background: rgba(107,83,19,.12); transform: none; }

.rito-testa #rito-opera { font-family: var(--display); font-weight: 600; letter-spacing: .3em; text-indent: .3em; font-size: .95rem; color: #6b5313; }
.rito-testa #rito-passo-n { font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: #a4813a; margin-top: .2rem; letter-spacing: .12em; }

.rito-corpo h3 {
  font-family: var(--display); font-weight: 700; font-size: clamp(2.6rem, 5vw, 3.8rem);
  line-height: 1; color: var(--inchiostro); margin-top: .6rem;
  background: linear-gradient(178deg, #4a3a10, #8a6c14 70%, #b08c1e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rito-corpo #rito-desc { font-size: 1.22rem; line-height: 1.5; max-width: 40rem; margin: .8rem auto 0; color: #3d3316; }

#rito-ingredienti { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem .6rem; margin-top: 1rem; }
.chip-ing {
  font-size: .95rem; padding: .28rem .8rem; border-radius: 999px;
  border: 1px solid rgba(138,108,20,.45); background: rgba(255,250,235,.6);
  color: #4a3c1c;
}
.chip-ing b { font-family: var(--display); font-weight: 700; letter-spacing: .03em; }

#rito-timer { position: relative; width: 150px; margin: 1.1rem auto 0; }
.rt-fondo { fill: none; stroke: rgba(138,108,20,.22); stroke-width: 7; }
.rt-anello { fill: none; stroke: #a87f1d; stroke-width: 7; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 80px 80px; filter: drop-shadow(0 0 5px rgba(168,127,29,.6)); }
.rt-centro { position: absolute; inset: 0; display: grid; place-content: center; gap: .3rem; }
#rito-conto { font-family: var(--display); font-weight: 700; font-size: 1.5rem; color: var(--inchiostro); font-variant-numeric: tabular-nums; }

.rito-piedi { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.6rem; flex-wrap: wrap; }
.rito-piedi .btn-fantasma { color: #6b5313; border-color: rgba(107,83,19,.45); background: transparent; }
.rito-piedi .btn-fantasma:hover { background: rgba(107,83,19,.1); }
.rito-piedi .btn-fantasma:disabled { opacity: .35; pointer-events: none; }

#rito-rune { display: flex; gap: .45rem; }
#rito-rune i {
  width: 11px; height: 11px; border-radius: 50%; border: 1.4px solid #a4813a; background: transparent;
  rotate: 45deg; transition: all .3s ease;
}
#rito-rune i.corrente { border-color: #4a3a10; box-shadow: 0 0 0 3px rgba(164,129,58,.25); }
#rito-rune i.spenta { background: linear-gradient(140deg, #f0d98a, #a87f1d); border-color: #8a6c14; box-shadow: 0 0 7px rgba(201,162,39,.6); }

.rito-avz { height: 6px; margin: 1.2rem -2.6rem -1.6rem; background: rgba(138,108,20,.15); border-radius: 0 0 4px 4px; overflow: hidden; }
.rito-avz i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #b08c1e, #f0d98a); transition: width .5s cubic-bezier(.22,1,.36,1); }

/* passo già compiuto nel rito */
.rito-pagina.passo-fatto .rito-corpo h3 { filter: saturate(.7); }
.rito-pagina.passo-fatto::after {
  content: 'COMPIVTO'; position: absolute; top: 42%; left: 50%;
  font-family: var(--display); font-weight: 700; font-size: 3rem; letter-spacing: .35em;
  color: rgba(140,43,31,.28); border: 4px double rgba(140,43,31,.28); border-radius: 6px;
  padding: .2rem 1.2rem; transform: translate(-50%,-50%) rotate(-11deg); pointer-events: none;
}

/* ═══════════ OPVS PERFECTVM ═══════════ */
#opus {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(900px 700px at 50% 45%, rgba(23,89,70,.9), rgba(2,10,7,.97));
  animation: velo-entra .5s ease forwards;
}
.opus-scena { text-align: center; padding: 2rem; }
.opus-piatto {
  width: min(330px, 60vw); aspect-ratio: 1; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, #f6eeda, var(--pergamena) 62%, var(--pergamena-scura));
  border: 3px solid var(--oro); outline: 1.5px dashed rgba(201,162,39,.65); outline-offset: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 60px rgba(201,162,39,.22), inset 0 4px 20px rgba(94,66,15,.3);
  display: grid; place-items: center; overflow: hidden;
  animation: piatto-entra 1s cubic-bezier(.22,1.2,.36,1) both .15s;
}
.opus-piatto img { width: 88%; height: 88%; object-fit: contain; filter: sepia(.1); }
@keyframes piatto-entra { from { opacity: 0; transform: scale(.6) rotate(-6deg); } to { opacity: 1; transform: none; } }

.opus-sigillo { margin-top: -46px; position: relative; z-index: 2; transform-origin: center;
  animation: ceralacca-cala .7s cubic-bezier(.34,1.56,.64,1) both .75s;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.55)); }
.sigillo-a { font-family: var(--display); font-weight: 700; font-size: 74px; fill: #e9b7a5; opacity: .9; }
@keyframes ceralacca-cala { from { opacity: 0; transform: scale(1.9) rotate(18deg); } to { opacity: 1; transform: scale(1) rotate(-6deg); } }

.opus-titolo {
  font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: .3em; text-indent: .3em; margin-top: 1rem;
  background: linear-gradient(178deg, #f6e7ae, var(--oro-chiaro) 45%, #8f6f14);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: velo-entra .6s ease both 1.1s;
}
#opus-nome { font-family: var(--display); font-size: 1.3rem; color: var(--avorio); margin-top: .4rem; animation: velo-entra .6s ease both 1.25s; }
.opus-motto { font-style: italic; color: rgba(243,233,210,.6); animation: velo-entra .6s ease both 1.35s; }
.opus-bottoni { display: flex; gap: 1rem; justify-content: center; margin-top: 1.6rem; animation: velo-entra .6s ease both 1.5s; }

/* ═══════════ FIRMA ═══════════ */
#firma {
  position: fixed; bottom: 12px; right: 16px; z-index: 30;
  display: flex; gap: .9rem; align-items: baseline;
  font-family: var(--display); font-size: .85rem; letter-spacing: .08em;
}
#firma a { color: rgba(232,201,106,.75); text-decoration: none; border-bottom: 1px solid rgba(232,201,106,.3); transition: color .2s ease; }
#firma a:hover { color: var(--oro-chiaro); }
#firma span { color: rgba(243,233,210,.4); font-style: italic; }

/* ═══════════ RESPONSIVE & MOTION ═══════════ */
@media (max-width: 1100px) {
  .lab-comandi { gap: .7rem; }
  #lab-aiuto { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .15s !important; }
  #lume { animation: none; }
  .nodo { opacity: 1; }
}
