/* Nexus – «Viaggio 3D» (contenuto premium): scena fissa, ingresso, comandi e testi dei capitoli.
   Il mondo lo disegna assets/js/journey3d.js; qui ci sono solo gli strati HTML sopra la tela. Generato da Nexus Solution. */
.nxj {
  --img-cloud-a: url(../img/journey/cloud-a.webp); --img-cloud-c: url(../img/journey/cloud-c.webp);
  --paper: #f5f1e8; --paper-2: #ece6d8; --ink: #0e1a2b; --ink-2: #33415a; --gold: #b08d57; --gold-hi: #dcc08c; --gold-lo: #7d6236;
  --mist: #f7f4ee; --line: rgba(14, 26, 43, .16);
  --display: var(--nx-font-display, Georgia, serif); --ui: var(--nx-font-text, system-ui, sans-serif);
  --gut: clamp(18px, 4.5vw, 56px); --ease: cubic-bezier(.2, .7, .2, 1);
  
}
.nxj-stage, .nxj-pre, .nxj-hud, .nxj-stage *, .nxj-pre *, .nxj-hud * { box-sizing: border-box; }
.nxj-pre, .nxj-hud { font: 400 16px/1.6 var(--ui); }
.nxj-pre p, .nxj-hud h2, .nxj-hud p { margin: 0; padding: 0; }
.nxj-chapters button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; box-shadow: none; border-radius: 0; min-height: 0; }
.nxj-enter { border: 0; cursor: pointer; box-shadow: none; }
.nxj-pre :focus-visible, .nxj-hud :focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; border-radius: 4px; }
.nxj-label { font: 600 12px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; }

/* ---------- scena fissa ---------- */
.nxj-stage { position: fixed; inset: 0; z-index: 0; background: var(--paper); overflow: hidden; }
.nxj-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.nxj-stage__shade { position: absolute; inset: 0; pointer-events: none; opacity: var(--shade, 0); transition: opacity .6s;
  background: linear-gradient(180deg, rgba(14, 26, 43, .34) 0, rgba(14, 26, 43, 0) 26%, rgba(14, 26, 43, 0) 46%, rgba(14, 26, 43, .72) 100%); }
.nxj-cloud { position: absolute; background: center / contain no-repeat; pointer-events: none; opacity: var(--clouds, 0); transition: opacity 1.2s; will-change: transform; }
.nxj-cloud--a { background-image: var(--img-cloud-a); width: clamp(220px, 34vw, 520px); aspect-ratio: 440 / 272; left: -6%; bottom: 8%; animation: drift 46s linear infinite alternate; }
.nxj-cloud--b { background-image: var(--img-cloud-c); width: clamp(260px, 42vw, 640px); aspect-ratio: 460 / 247; right: -10%; bottom: -3%; animation: drift 58s linear infinite alternate-reverse; }
.nxj-cloud--c { background-image: var(--img-cloud-c); width: clamp(160px, 22vw, 340px); aspect-ratio: 460 / 247; left: 38%; top: 12%; opacity: calc(var(--clouds, 0) * .55); animation: drift 70s linear infinite alternate; }
@keyframes drift { from { transform: translate3d(-5vw, 0, 0); } to { transform: translate3d(7vw, -1.2vh, 0); } }

/* ---------- ingresso ---------- */
.nxj-pre { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; text-align: center; padding: var(--gut); transition: opacity .9s var(--ease), visibility .9s; }
.nxj-pre.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.nxj-pre__in { display: grid; justify-items: center; gap: 26px; }
.nxj-pre__logo { width: min(74vw, 400px); color: var(--ink); }
.nxj-pre__logo svg { display: block; width: 100%; height: auto; overflow: visible; }
.nxj-pre__logo .globe { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw 1.6s var(--ease) .2s forwards; }
.nxj-pre__logo .globe--2 { animation-delay: .5s; } .nxj-pre__logo .globe--3 { animation-delay: .8s; }
.nxj-pre__logo .dot { transform-origin: 60px 60px; transform: scale(0); animation: pop .5s var(--ease) 1.5s forwards; }
.nxj-pre__logo .word { opacity: 0; animation: rise .9s var(--ease) 1.1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } } @keyframes pop { to { transform: scale(1); } } @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.nxj-pre__line { max-width: 34ch; color: var(--ink-2); font-size: 15px; opacity: 0; animation: rise .9s var(--ease) 1.5s forwards; }
.nxj-enter { position: relative; overflow: hidden; min-height: 52px; padding: 0 30px; border-radius: 999px; background: var(--ink); color: var(--paper); font: 600 13px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; opacity: 0; animation: rise .9s var(--ease) 1.9s forwards; transition: background .25s; }
.nxj-enter:hover { background: #1a2c47; }
.nxj-enter::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(220, 192, 140, .55) 50%, transparent 70%); transform: translateX(-120%); animation: gild 3.4s ease-in-out 2.6s infinite; }
@keyframes gild { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.nxj-pre__bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transform-origin: 0 50%; transform: scaleX(var(--load, 0)); transition: transform .4s; }

/* ---------- comandi sopra la scena ---------- */
.nxj-hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity .8s; color: var(--mist); }
.nxj-hud.is-on { opacity: 1; } .nxj-hud.is-paper { opacity: 0; visibility: hidden; transition: opacity .4s, visibility .4s; }
.nxj-hud > * { pointer-events: auto; }
.nxj-hud__top { position: absolute; left: var(--gut); right: var(--gut); top: calc(18px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nxj-chip { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 8px; border-radius: 999px; background: rgba(245, 241, 232, .94); color: var(--ink); text-decoration: none; font: 700 13px/1 var(--ui); letter-spacing: .04em; box-shadow: 0 8px 26px -14px rgba(0, 0, 0, .6); }
.nxj-chip svg { width: 30px; height: 30px; }
.nxj-pillbtn { min-height: 44px; padding: 0 18px; border-radius: 999px; background: rgba(14, 26, 43, .58); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--mist); font: 600 12px/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; text-decoration: none; display: inline-flex; align-items: center; box-shadow: inset 0 0 0 1px rgba(245, 241, 232, .28); transition: background .25s; }
.nxj-pillbtn:hover { background: rgba(14, 26, 43, .82); }
.nxj-chapters { position: absolute; right: var(--gut); top: 50%; transform: translateY(-50%); display: grid; gap: 4px; }
.nxj-chapters button { width: 44px; height: 40px; display: grid; place-items: center; font: 500 15px/1 var(--display); color: rgba(247, 244, 238, .6); position: relative; transition: color .3s; }
.nxj-chapters button::after { content: ""; position: absolute; right: 2px; top: 50%; width: 0; height: 1px; background: var(--gold-hi); transition: width .4s var(--ease); }
.nxj-chapters button[aria-current="true"] { color: var(--mist); } .nxj-chapters button[aria-current="true"]::after { width: 12px; }
.nxj-story { position: absolute; left: var(--gut); right: calc(var(--gut) + 54px); bottom: calc(clamp(40px, 9vh, 96px) + env(safe-area-inset-bottom, 0px)); max-width: 620px; }
.nxj-story__num { display: flex; align-items: center; gap: 12px; color: var(--gold-hi); }
.nxj-story__num::after { content: ""; width: 44px; height: 1px; background: currentColor; opacity: .7; }
.nxj-story h2 { margin-top: 14px; font: 500 clamp(30px, 6vw, 58px)/1.04 var(--display); letter-spacing: -.015em; text-wrap: balance; text-shadow: 0 2px 26px rgba(8, 12, 20, .5); }
.nxj-story p { margin-top: 14px; max-width: 46ch; font-size: clamp(15px, 1.7vw, 18px); line-height: 1.55; color: rgba(247, 244, 238, .92); text-shadow: 0 1px 16px rgba(8, 12, 20, .6); }
.nxj-story__more { margin-top: 20px; }
.nxj-story > * { opacity: var(--t, 0); transform: translateY(calc((1 - var(--t, 0)) * 16px)); transition: opacity .5s var(--ease), transform .7s var(--ease); }
.nxj-story h2 { transition-delay: .06s; } .nxj-story p { transition-delay: .12s; } .nxj-story__more { transition-delay: .18s; }
.nxj-cue { position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; justify-items: center; gap: 8px; color: rgba(247, 244, 238, .8); opacity: var(--cue, 1); transition: opacity .5s; pointer-events: none; }
.nxj-cue i { width: 1px; height: 26px; background: linear-gradient(180deg, currentColor, transparent); animation: cue 2s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes cue { 0%, 100% { transform: scaleY(.4); opacity: .5; } 50% { transform: scaleY(1); opacity: 1; } }


/* numero del capitolo sulla parete di marmo, fra una scena e l'altra */
.nxj-inter { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; color: var(--ink); opacity: 0; visibility: hidden; pointer-events: none; padding: var(--gut); }
.nxj-hud > .nxj-inter { pointer-events: none; }
.nxj-inter .nxj-label { color: var(--gold-lo); display: flex; align-items: center; gap: 14px; }
.nxj-inter .nxj-label::before, .nxj-inter .nxj-label::after { content: ""; width: 34px; height: 1px; background: currentColor; opacity: .6; }
.nxj-inter b { font: 500 clamp(64px, 14vw, 128px)/1 var(--display); letter-spacing: .02em; background: linear-gradient(100deg, var(--gold-lo), var(--gold-hi) 45%, var(--gold) 70%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nxj-inter em { font: 500 clamp(17px, 2.4vw, 22px)/1.3 var(--display); font-style: normal; color: var(--ink-2); max-width: 24ch; }
.nxj-enter { pointer-events: none; } .nxj-pre.is-ready .nxj-enter { pointer-events: auto; }

/* spazio che fa scorrere il viaggio */
.nxj-journey { position: relative; z-index: 1; height: calc(var(--n, 5) * 170vh); pointer-events: none; }


@media (max-width: 640px) { .nxj-chapters { top: auto; bottom: calc(clamp(40px, 9vh, 96px) + env(safe-area-inset-bottom, 0px)); transform: none; } .nxj-pillbtn { padding: 0 14px; font-size: 11px; } .nxj-chip span { display: none; } .nxj-chip { padding: 0 8px; } }
@media (prefers-reduced-motion: reduce) {
  .nxj-cloud, .nxj-cue i, .nxj-enter::after { animation: none; }
  .nxj-pre__logo .globe, .nxj-pre__logo .dot, .nxj-pre__logo .word, .nxj-pre__line, .nxj-enter { animation: none; opacity: 1; stroke-dashoffset: 0; transform: none; }
  .nxj-story > * { transition: none; transform: none; }
}

/* contenuto della pagina sotto il viaggio */
.nxj-pillbtn[hidden] { display: none; }
.nxj-after { position: relative; z-index: 12; background: var(--nx-bg, var(--paper)); color: var(--nx-fg, var(--ink)); box-shadow: 0 -40px 80px -30px rgba(8, 12, 20, .55); }
.nxj-after__in { max-width: 1100px; margin-inline: auto; padding: clamp(48px, 8vw, 110px) clamp(18px, 4.5vw, 56px); }
.nxj-chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.nxj-pre__logo img { display: block; max-width: 100%; height: auto; margin-inline: auto; }
.nxj-pre__name { font: 500 clamp(30px, 6vw, 52px)/1.05 var(--display); color: var(--ink); }
/* il viaggio ha il suo «torna all'inizio»: il pulsante del tema qui non serve */
.nxj .nx-totop { display: none !important; }
