/* ═══════════════════════════════════════════════════════════════════
   CENDRIUM · BASE  (shell + ambient background)
   Depends on cx-tokens.css. Everything is prefixed .cx-
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.cx-body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden; transition: background-color .45s ease, color .45s ease;
}
.cx-body a { color: inherit; text-decoration: none; }
.cx-body img, .cx-body svg, .cx-body canvas { max-width: 100%; }
.cx-body ::selection { background: rgba(var(--accent-rgb), .3); color: var(--text); }
.cx-body button { font-family: inherit; }
.cx-body :focus-visible { outline: 2px solid var(--aurum); outline-offset: 3px; border-radius: 6px; }
.cx-body { scrollbar-width: thin; scrollbar-color: var(--bg4) transparent; }
.cx-body ::-webkit-scrollbar { width: 10px; height: 10px; }
.cx-body ::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 10px; border: 2px solid var(--bg); }

/* ── Ambient background: aurora + grid + grain ───────────────────── */
.cx-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.cx-bg i { position: absolute; border-radius: 50%; width: 62vmax; height: 62vmax; opacity: var(--aurora-op); will-change: transform; }
.cx-bg i:nth-child(1) { top: -26vmax; left: -16vmax; background: radial-gradient(circle, rgba(var(--accent-rgb), .30), transparent 62%); animation: cxDrift1 26s ease-in-out infinite alternate; }
.cx-bg i:nth-child(2) { bottom: -30vmax; right: -18vmax; background: radial-gradient(circle, rgba(var(--ion-rgb), .26), transparent 62%); animation: cxDrift2 32s ease-in-out infinite alternate; }
.cx-bg i:nth-child(3) { top: 34%; left: 38%; width: 38vmax; height: 38vmax; background: radial-gradient(circle, rgba(var(--aurum-rgb), .16), transparent 62%); animation: cxDrift3 22s ease-in-out infinite alternate; }
.cx-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 75%);
}
.cx-bg::after {
  content: ""; position: absolute; inset: -50%; opacity: var(--grain-op);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: cxGrain 1.2s steps(6) infinite;
}
@keyframes cxDrift1 { to { transform: translate3d(14vmax, 10vmax, 0) scale(1.15); } }
@keyframes cxDrift2 { to { transform: translate3d(-12vmax, -8vmax, 0) scale(1.1); } }
@keyframes cxDrift3 { to { transform: translate3d(-10vmax, 6vmax, 0) scale(.85); } }
@keyframes cxGrain { 0%{transform:translate(0,0)} 20%{transform:translate(-3%,2%)} 40%{transform:translate(2%,-3%)} 60%{transform:translate(-2%,-1%)} 80%{transform:translate(3%,3%)} 100%{transform:translate(0,0)} }

.cx-progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 300; transform-origin: 0 50%; transform: scaleX(0); background: var(--grad); box-shadow: 0 0 14px rgba(var(--accent-rgb), .7); }
#content { position: relative; z-index: 2; }
