/* Codivium cube component — canonical source of truth for the topbar 3D cube.
   Unlayered intentionally: must win over all @layer rules on every page.
   
   Compositing architecture:
   - .brand-mark: perspective container (no transform-style, no will-change, no filter)
   - .cube-wrap: 3D context (transform-style:preserve-3d, perspective here, NO filter/will-change)
   - .cube3d: the animated element (WAAPI runs here, will-change here)
   - .cube-face: individual faces (backface-visibility:hidden, translateZ)
   
   Drop-shadow lives on .brand-mark::after so it never touches the 3D rendering path.
*/

/* ── Perspective container ── */
.brand-mark{
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  position: relative; /* for ::after shadow */
}

/* Shadow as a pseudo-element on brand-mark — completely outside the 3D stack */
.brand-mark::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  box-shadow: 0 14px 30px rgba(0,0,0,0.55);
  pointer-events: none;
  z-index: -1;
}

/* ── 3D context wrapper ── */
.cube-wrap{
  width: 46px;
  height: 46px;
  perspective: 1100px;         /* perspective lives here, NOT on brand-mark */
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  /* NO filter — filter would flatten the 3D context and force bitmap rasterisation */
  /* NO will-change — let cube3d own the compositor layer */
}

/* ── Animated element — WAAPI target ── */
.cube3d{
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;      /* compositor layer lives here, where WAAPI animates */
  transform: rotateX(-18deg) rotateY(32deg);
  /* No CSS transition — WAAPI (cv-cube.js) owns all animation */
}

/* ── Faces ── */
.cube-face{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.12), transparent 45%),
    radial-gradient(circle at 72% 68%, rgba(246,213,138,0.08), transparent 55%),
    linear-gradient(180deg, rgba(9,10,18,0.58), rgba(12,14,24,0.34));
  border: 1px solid rgba(246,213,138,0.88);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.25),
    inset 0 0 12px rgba(246,213,138,0.08);
  backface-visibility: hidden;
}

.cube-front  { transform: rotateY(  0deg) translateZ(23px); }
.cube-back   { transform: rotateY(180deg) translateZ(23px); }
.cube-right  { transform: rotateY( 90deg) translateZ(23px); }
.cube-left   { transform: rotateY(-90deg) translateZ(23px); }
.cube-top    { transform: rotateX( 90deg) translateZ(23px); }
.cube-bottom { transform: rotateX(-90deg) translateZ(23px); }

/* ── Wire frame overlay ── */
.cube-wire{
  position: absolute;
  inset: -2px;
  pointer-events: none;
  transform: translateZ(0.5px); /* fractional Z to stay above face surface */
  opacity: 0.95;
}

.cube-wire::before{
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(246,213,138,0.86);
  box-shadow:
    0 0 12px rgba(246,213,138,0.16),
    inset 0 0 12px rgba(246,213,138,0.08);
}

.cube-wire::after{
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(246,213,138,0.30);
  opacity: 0.9;
}

/* ── Symbol ── */
.cube-symbol{
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 21px;
  line-height: 1;
  color: rgba(246,213,138,0.95);
  text-shadow:
    0 0 10px rgba(246,213,138,0.22),
    0 0 18px rgba(246,213,138,0.10);
  transform: translateZ(2px);
}

.cube-symbol sup{
  font-size: 0.62em;
  line-height: 0;
  vertical-align: super;
  margin-left: 1px;
}

.cube-symbol-small{ font-size: 18px; letter-spacing: 0.06em; }

/* Spin duration token — override per-page if needed */
:root{ --cv-spin-duration: 3200ms; }
