/* ============================================================
   🎬 cinematic.css — Documents 22 + 24 + 25 + 26
   Cinematic AI typing · orchestration DAGs · holographic depth
   "Into the system" feeling · Premium metallic materials
   ============================================================ */

/* ─── Holographic depth materials ────────────────── */
.cine-hologram {
  position: relative;
  background:
    linear-gradient(135deg,
      rgba(120,200,255,.04) 0%,
      rgba(180,100,200,.02) 50%,
      rgba(120,255,180,.04) 100%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  overflow: hidden;
  isolation: isolate;
}
.cine-hologram::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(120,200,255,.06) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  animation: cineHoloSweep 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.cine-hologram > * { position: relative; z-index: 1; }

@keyframes cineHoloSweep {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

/* ─── Metallic surface (premium buttons / cards) ── */
.cine-metallic {
  background: linear-gradient(
    135deg,
    rgba(40,50,70,.95) 0%,
    rgba(30,40,60,.95) 50%,
    rgba(20,30,50,.95) 100%
  );
  border: 1px solid rgba(255,255,255,.1);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    inset 0 -1px 0 rgba(0,0,0,.5),
    0 4px 12px rgba(0,0,0,.4);
  border-radius: 12px;
}

/* ─── AI typing cursor (cinematic) ────────────────── */
.cine-typing::after {
  content: "▊";
  display: inline-block;
  color: var(--a2, #35f1c6);
  margin-left: 2px;
  animation: cineBlink 1s steps(2) infinite;
  text-shadow: 0 0 8px rgba(53,241,198,.7);
}
@keyframes cineBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ─── Streaming text reveal ──────────────────────── */
.cine-stream {
  display: inline;
  animation: cineFadeReveal .4s cubic-bezier(.16,1,.3,1);
}
@keyframes cineFadeReveal {
  from { opacity: 0; filter: blur(2px); }
  to { opacity: 1; filter: blur(0); }
}

/* ─── "Into the system" navigation portal ────────── */
.cine-portal {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,.95) 100%);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cine-portal.active {
  animation: cinePortalEnter .8s cubic-bezier(.65,0,.35,1);
}
.cine-portal::before {
  content: "";
  width: 6px;
  height: 6px;
  background: linear-gradient(135deg, #c6f135, #35f1c6);
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(53,241,198,.8);
  animation: cinePortalCore .8s cubic-bezier(.65,0,.35,1);
}
@keyframes cinePortalEnter {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes cinePortalCore {
  0%   { transform: scale(0); }
  50%  { transform: scale(40); opacity: 1; }
  100% { transform: scale(80); opacity: 0; }
}

/* ─── Orchestration DAG container ────────────────── */
.cine-dag {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(120,200,255,.03), transparent 70%),
    rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.cine-dag::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

/* ─── AI thinking pulse (chat) ───────────────────── */
.cine-ai-pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(53,241,198,.06);
  border: 1px solid rgba(53,241,198,.2);
  border-radius: 100px;
  color: #cde;
  font-size: 12px;
  letter-spacing: .5px;
}
.cine-ai-pulse::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #35f1c6;
  border-radius: 50%;
  box-shadow: 0 0 8px #35f1c6;
  animation: cinePulse 1.4s ease-in-out infinite;
}
@keyframes cinePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: .5; }
}

/* ─── Deep work environment (immersive focus) ───── */
body.cine-deep-work {
  background:
    radial-gradient(ellipse at top, rgba(20,30,60,.4), transparent 60%),
    var(--bg, #0a0a0f);
}
body.cine-deep-work #sidebar,
body.cine-deep-work #topbar {
  opacity: .25;
  transition: opacity .8s cubic-bezier(.16,1,.3,1);
}
body.cine-deep-work #sidebar:hover,
body.cine-deep-work #topbar:hover {
  opacity: 1;
}
body.cine-deep-work .chat-content {
  filter: brightness(1.05) contrast(1.05);
}

/* ─── Workflow timeline (orchestration replay) ──── */
.cine-timeline {
  position: relative;
  padding-left: 32px;
}
.cine-timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg,
    transparent,
    rgba(53,241,198,.4) 20%,
    rgba(53,241,198,.4) 80%,
    transparent);
}
.cine-timeline-item {
  position: relative;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  animation: cineTimelineEnter .5s cubic-bezier(.16,1,.3,1) both;
}
.cine-timeline-item::before {
  content: "";
  position: absolute;
  left: -29px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #35f1c6;
  box-shadow: 0 0 10px rgba(53,241,198,.6);
  border: 2px solid var(--bg, #0a0a0f);
}
.cine-timeline-item.running::before {
  animation: cinePulse 1.2s ease-in-out infinite;
  background: #c6f135;
  box-shadow: 0 0 12px rgba(198,241,53,.7);
}
.cine-timeline-item.error::before {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239,68,68,.6);
}
@keyframes cineTimelineEnter {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Operational mode indicator (top-right) ────── */
.cine-mode-bar {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 100px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  z-index: 500;
  font-size: 11px;
  color: #89a;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.cine-mode-bar::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mode-color, #35f1c6);
  box-shadow: 0 0 6px var(--mode-color, #35f1c6);
  align-self: center;
}

/* ─── Smooth page transition wrapper ─────────────── */
.cine-page-transition {
  animation: cinePageEnter .6s cubic-bezier(.16,1,.3,1);
}
@keyframes cinePageEnter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.99);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ─── Mobile responsive ──────────────────────────── */
@media (max-width: 600px) {
  .cine-mode-bar { display: none; }
  .cine-timeline { padding-left: 24px; }
  .cine-timeline::before { left: 6px; }
  .cine-timeline-item::before { left: -23px; }
}

/* ─── Reduced motion respect ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cine-hologram::before,
  .cine-typing::after,
  .cine-ai-pulse::before,
  .cine-portal.active,
  .cine-portal::before {
    animation: none !important;
  }
}

/* ════════════════════════════════════════════════
   ROBUSTNESS
   The effects above assume backdrop-filter and GPU compositing. Where
   either is missing the result is not a lesser effect but an unusable
   one — translucent panels over moving content with no blur to
   separate them.
   ════════════════════════════════════════════════ */

/* ── No backdrop-filter ──────────────────────────
   Roughly the Firefox default before 103 and older Android WebViews.
   Without blur, a translucent panel shows whatever scrolls beneath it
   and the text stops being readable. Those surfaces become opaque. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cine-mode-bar,
  .nx-resume,
  .nx-bell,
  .nx-notif-panel,
  .nxs-rail,
  .nxs-drawer,
  .nxui-panel {
    background: #0d0d14f2;
  }

  .cine-hologram,
  .nx-glass,
  .nx-glass-bright {
    background: #14141ff5;
  }
}

/* ── Compositing hints ───────────────────────────
   Only the handful of elements that animate continuously are promoted.
   Applying will-change broadly costs memory and can make things slower
   rather than faster, so these are the looping effects alone. */
.cine-hologram::before,
.cine-ai-pulse::before,
.cine-portal::before,
.nxo-step.running::after,
.nx-ambient-particles {
  will-change: transform, opacity;
}

/* Release the promotion once the animation is finished. */
@media (prefers-reduced-motion: reduce) {
  .cine-hologram::before,
  .cine-ai-pulse::before,
  .cine-portal::before,
  .nxo-step.running::after,
  .nx-ambient-particles {
    will-change: auto;
  }
}

/* ── Keyboard visibility over cinematic surfaces ──
   A focus ring loses contrast against a holographic or metallic fill,
   so it gains a dark halo to stay legible on any backdrop. */
.cine-hologram :focus-visible,
.cine-metallic :focus-visible,
.cine-timeline-item :focus-visible {
  outline: 2px solid var(--a2, #35f1c6);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px #0a0a0fcc;
}

/* ── Deep work ───────────────────────────────────
   Dimmed chrome must still be reachable by keyboard, not only by
   hovering — otherwise deep work mode traps a keyboard user. */
body.cine-deep-work #sidebar:focus-within,
body.cine-deep-work #topbar:focus-within {
  opacity: 1;
}

/* ── Portal ──────────────────────────────────────
   The transition overlay covers the viewport at z-index 9998. If a
   class is ever left behind it would silently block every click. */
.cine-portal:not(.active) {
  display: none;
}