/* ==========================================================================
   CRI — advanced visual layer
   Loaded after cri.css. Everything here is additive: if this file fails to
   load the site still works, it just looks flatter.

   All motion is gated on prefers-reduced-motion at the bottom of the file.
   ========================================================================== */

/* --- aurora field ------------------------------------------------------- */
/* Slow-drifting colour clouds behind dark sections. Two blurred radial
   blobs on independent timings, so the loop never reads as a loop. */
.aurora{position:absolute;inset:-20%;pointer-events:none;z-index:0;filter:blur(64px);opacity:.5}
.aurora i{position:absolute;display:block;border-radius:50%;mix-blend-mode:screen}
.aurora i:nth-child(1){width:46%;aspect-ratio:1;left:2%;top:6%;
  background:radial-gradient(circle,rgb(61 133 223/.42),transparent 68%);
  animation:drift1 26s ease-in-out infinite}
.aurora i:nth-child(2){width:52%;aspect-ratio:1;right:0;bottom:0;
  background:radial-gradient(circle,rgb(11 76 140/.62),transparent 68%);
  animation:drift2 34s ease-in-out infinite}
.aurora i:nth-child(3){width:34%;aspect-ratio:1;left:38%;top:44%;
  background:radial-gradient(circle,rgb(4 38 89/.7),transparent 70%);
  animation:drift3 42s ease-in-out infinite}
@keyframes drift1{0%,100%{transform:translate3d(0,0,0) scale(1)}
  50%{transform:translate3d(14%,10%,0) scale(1.18)}}
@keyframes drift2{0%,100%{transform:translate3d(0,0,0) scale(1.1)}
  50%{transform:translate3d(-16%,-12%,0) scale(.9)}}
@keyframes drift3{0%,100%{transform:translate3d(0,0,0) scale(.95)}
  50%{transform:translate3d(10%,-14%,0) scale(1.2)}}

/* --- particle canvas ---------------------------------------------------- */
.particles{position:absolute;inset:0;width:100%;height:100%;z-index:0;pointer-events:none;opacity:.85}

/* --- grain -------------------------------------------------------------- */
/* Fine noise stops large gradients from banding on cheap panels and adds
   a printed, premium quality. */
.grain::after{content:"";position:absolute;inset:0;z-index:1;pointer-events:none;opacity:.035;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}

/* Dark sections need their content above aurora/grain/particles. */
.hero .wrap,.dark .wrap,.final .wrap{position:relative;z-index:2}

/* --- scroll reveal ------------------------------------------------------ */
[data-reveal]{opacity:0;transform:translateY(22px);
  transition:opacity .7s var(--ease),transform .7s var(--ease)}
[data-reveal].in{opacity:1;transform:none}
[data-reveal-stagger]>*{opacity:0;transform:translateY(20px);
  transition:opacity .6s var(--ease),transform .6s var(--ease)}
[data-reveal-stagger].in>*{opacity:1;transform:none}
[data-reveal-stagger].in>*:nth-child(1){transition-delay:.04s}
[data-reveal-stagger].in>*:nth-child(2){transition-delay:.10s}
[data-reveal-stagger].in>*:nth-child(3){transition-delay:.16s}
[data-reveal-stagger].in>*:nth-child(4){transition-delay:.22s}
[data-reveal-stagger].in>*:nth-child(5){transition-delay:.28s}
[data-reveal-stagger].in>*:nth-child(6){transition-delay:.34s}
[data-reveal-stagger].in>*:nth-child(7){transition-delay:.40s}
[data-reveal-stagger].in>*:nth-child(8){transition-delay:.46s}

/* --- spotlight cards ---------------------------------------------------- */
/* A soft light follows the cursor across the card. --mx/--my are written by
   cri-fx.js; the fallback keeps the highlight centred on touch devices. */
.card,.pillar{position:relative;isolation:isolate}
.card::after,.pillar::after{content:"";position:absolute;inset:0;z-index:-1;border-radius:inherit;
  opacity:0;transition:opacity .35s var(--ease);
  background:radial-gradient(340px circle at var(--mx,50%) var(--my,50%),
    rgb(61 133 223/.13),transparent 62%)}
.card:hover::after,.pillar:hover::after{opacity:1}
.dark .card::after{background:radial-gradient(340px circle at var(--mx,50%) var(--my,50%),
  rgb(61 133 223/.22),transparent 62%)}

/* --- gradient edge on hover --------------------------------------------- */
.pillar{background:
  linear-gradient(#fff,#fff) padding-box,
  linear-gradient(135deg,var(--line),var(--line)) border-box;
  border:1px solid transparent;transition:background .4s var(--ease),transform .35s var(--ease),box-shadow .35s var(--ease)}
.pillar:hover{background:
  linear-gradient(#fff,#fff) padding-box,
  linear-gradient(135deg,var(--blue-500),var(--cyan-500)) border-box}

/* --- animated counters -------------------------------------------------- */
.stat[data-count]{font-variant-numeric:tabular-nums}

/* --- glass panel -------------------------------------------------------- */
.glass{background:rgb(255 255 255/.06);border:1px solid rgb(255 255 255/.13);
  backdrop-filter:blur(14px) saturate(140%);-webkit-backdrop-filter:blur(14px) saturate(140%);
  border-radius:var(--radius)}

/* --- AI badge ----------------------------------------------------------- */
.ai-badge{display:inline-flex;align-items:center;gap:.45rem;padding:.35rem .8rem;
  border-radius:999px;font-size:.75rem;font-weight:600;letter-spacing:.04em;
  background:rgb(61 133 223/.12);border:1px solid rgb(61 133 223/.35);color:var(--cyan-500)}
.ai-badge svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2}
.ai-badge .dot{width:6px;height:6px;border-radius:50%;background:var(--cyan-500);
  animation:pulseDot 2.2s ease-in-out infinite}
@keyframes pulseDot{0%,100%{opacity:1;box-shadow:0 0 0 0 rgb(61 133 223/.6)}
  50%{opacity:.65;box-shadow:0 0 0 6px rgb(61 133 223/0)}}

/* ==========================================================================
   AI ASSISTANT
   ========================================================================== */
.chat-launch{position:fixed;right:1.25rem;bottom:1.25rem;z-index:90;
  display:flex;align-items:center;gap:.6rem;padding:.8rem 1.15rem .8rem .9rem;
  border:0;border-radius:999px;color:#fff;font-family:var(--sans);font-weight:600;
  font-size:.9375rem;cursor:pointer;
  background:linear-gradient(135deg,var(--navy-600),var(--blue-500));
  box-shadow:0 8px 30px -6px rgb(7 54 111/.65);
  transition:transform .3s var(--ease),box-shadow .3s var(--ease)}
.chat-launch:hover{transform:translateY(-3px) scale(1.02);
  box-shadow:0 14px 38px -8px rgb(7 54 111/.8)}
.chat-launch svg{width:20px;height:20px;stroke:#fff;fill:none;stroke-width:1.8;flex:none}
.chat-launch .ring{position:absolute;inset:0;border-radius:999px;
  border:1px solid rgb(61 133 223/.7);animation:ringOut 2.8s ease-out infinite;pointer-events:none}
@keyframes ringOut{0%{transform:scale(1);opacity:.7}70%,100%{transform:scale(1.25);opacity:0}}
.chat-launch[hidden]{display:none}

.chat-panel{position:fixed;right:1.25rem;bottom:1.25rem;z-index:95;
  width:min(26rem,calc(100vw - 2.5rem));height:min(37rem,calc(100dvh - 2.5rem));
  display:flex;flex-direction:column;overflow:hidden;
  border-radius:1.15rem;border:1px solid rgb(255 255 255/.14);
  background:linear-gradient(160deg,#020D1A 0%,#042659 55%,#07366F 100%);
  box-shadow:0 30px 70px -20px rgb(4 20 38/.7);
  transform:translateY(16px) scale(.97);opacity:0;visibility:hidden;
  transition:all .32s var(--ease)}
.chat-panel[data-open="true"]{transform:none;opacity:1;visibility:visible}

.chat-head{display:flex;align-items:center;gap:.75rem;padding:.9rem 1rem;
  border-bottom:1px solid rgb(255 255 255/.12);background:rgb(255 255 255/.04)}
.chat-avatar{width:36px;height:36px;border-radius:50%;flex:none;display:grid;place-items:center;
  background:linear-gradient(135deg,var(--blue-500),var(--cyan-500))}
.chat-avatar svg{width:18px;height:18px;stroke:#031424;fill:none;stroke-width:2}
.chat-head h2{font-size:.9375rem;color:#fff;margin:0;line-height:1.2}
.chat-head p{font-size:.6875rem;color:var(--cyan-500);margin:0;letter-spacing:.03em}
.chat-close{margin-left:auto;background:none;border:1px solid rgb(255 255 255/.18);
  border-radius:.5rem;width:34px;height:34px;min-height:34px;color:#fff;font-size:1.2rem;
  line-height:1;flex:none}
.chat-close:hover{background:rgb(255 255 255/.1)}

.chat-log{flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;gap:.75rem;
  scrollbar-width:thin;scrollbar-color:rgb(255 255 255/.2) transparent}
.chat-log::-webkit-scrollbar{width:6px}
.chat-log::-webkit-scrollbar-thumb{background:rgb(255 255 255/.2);border-radius:3px}

.msg{max-width:88%;padding:.7rem .9rem;border-radius:1rem;font-size:.875rem;line-height:1.55;
  animation:msgIn .3s var(--ease)}
@keyframes msgIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.msg-bot{align-self:flex-start;background:rgb(255 255 255/.08);
  border:1px solid rgb(255 255 255/.12);color:#DCE9F9;border-bottom-left-radius:.3rem}
.msg-user{align-self:flex-end;color:#fff;border-bottom-right-radius:.3rem;
  background:linear-gradient(135deg,var(--navy-600),var(--blue-500));font-weight:500}
.msg a{color:var(--cyan-500);text-decoration:underline;text-underline-offset:3px}
.msg-user a{color:#D6E6FA}
.msg strong{color:#fff}
.msg-user strong{color:#fff}

.chat-typing{display:flex;gap:.28rem;align-self:flex-start;padding:.8rem .95rem;
  background:rgb(255 255 255/.08);border:1px solid rgb(255 255 255/.12);
  border-radius:1rem;border-bottom-left-radius:.3rem}
.chat-typing span{width:6px;height:6px;border-radius:50%;background:var(--cyan-500);
  animation:typing 1.3s ease-in-out infinite}
.chat-typing span:nth-child(2){animation-delay:.18s}
.chat-typing span:nth-child(3){animation-delay:.36s}
@keyframes typing{0%,60%,100%{opacity:.3;transform:translateY(0)}30%{opacity:1;transform:translateY(-4px)}}

.chat-chips{display:flex;flex-wrap:wrap;gap:.4rem;padding:0 1rem .75rem}
.chat-chips button{padding:.45rem .8rem;border-radius:999px;font-size:.78rem;font-weight:500;
  min-height:auto;background:rgb(61 133 223/.1);border:1px solid rgb(61 133 223/.3);
  color:var(--cyan-500);font-family:var(--sans);transition:all .2s}
.chat-chips button:hover{background:rgb(61 133 223/.2);transform:translateY(-1px)}

.chat-foot{padding:.75rem 1rem 1rem;border-top:1px solid rgb(255 255 255/.12)}
.chat-form{display:flex;gap:.5rem;align-items:flex-end}
.chat-form textarea{flex:1;min-height:44px;max-height:7rem;resize:none;padding:.7rem .9rem;
  border-radius:.85rem;border:1px solid rgb(255 255 255/.18);background:rgb(255 255 255/.07);
  color:#fff;font-family:inherit;font-size:.875rem;line-height:1.4}
.chat-form textarea::placeholder{color:#7C93B5}
.chat-form textarea:focus{outline:2px solid var(--cyan-500);outline-offset:1px;border-color:transparent}
.chat-send{width:44px;height:44px;flex:none;border:0;border-radius:.85rem;display:grid;place-items:center;
  background:linear-gradient(135deg,var(--blue-500),var(--cyan-500));transition:transform .2s}
.chat-send:hover:not(:disabled){transform:scale(1.06)}
.chat-send:disabled{opacity:.45;cursor:not-allowed}
.chat-send svg{width:18px;height:18px;stroke:#fff;fill:none;stroke-width:2}
.chat-disclosure{font-size:.6875rem;color:#7C93B5;margin-top:.6rem;line-height:1.4;text-align:center}
.chat-disclosure a{color:var(--cyan-500);text-decoration:underline;text-underline-offset:2px}

@media(max-width:640px){
  .chat-panel{right:.5rem;left:.5rem;bottom:.5rem;width:auto;height:calc(100dvh - 1rem)}
  .chat-launch{right:1rem;bottom:1rem;padding:.75rem 1rem .75rem .85rem;font-size:.875rem}
}

/* --- motion opt-out ------------------------------------------------------ */
/* Reveals must resolve to visible, or content stays invisible forever. */
@media(prefers-reduced-motion:reduce){
  .aurora i,.chat-launch .ring,.ai-badge .dot,.chat-typing span{animation:none!important}
  .aurora{opacity:.4}
  .particles{display:none}
  [data-reveal],[data-reveal-stagger]>*{opacity:1!important;transform:none!important;
    transition:none!important}
  .card::after,.pillar::after{display:none}
}
