/* ==========================================================================
   TECHNOVO — Interaction & Motion Layer
   Layered on top of the base design system.
   Everything here degrades gracefully and honours prefers-reduced-motion.
   ========================================================================== */

/* ---------- Scroll progress ---------- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 300;
  background: transparent; pointer-events: none;
}
.progress__bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--navy-600), var(--navy-400) 45%, var(--gold-500));
  box-shadow: 0 0 12px rgba(253,173,23,.5);
  transition: width .1s linear;
}

/* ---------- Ambient page background ---------- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(760px 520px at 8% -6%, rgba(2,49,100,.05), transparent 60%),
    radial-gradient(680px 460px at 98% 12%, rgba(253,173,23,.05), transparent 60%);
}

/* ---------- Header: shrink + scroll state ---------- */
.header { transition: height .28s cubic-bezier(.22,1,.36,1), background .3s, border-color .3s, box-shadow .3s; }
.header.is-stuck { height: 64px; background: rgba(255,255,255,.94); }
.header.is-stuck .brand img { height: 32px; }
.brand img { transition: height .28s cubic-bezier(.22,1,.36,1); }

/* ---------- Nav: animated active pill ---------- */
.nav__list { position: relative; }
.nav__list a { position: relative; z-index: 1; }
.nav__ind {
  position: absolute; top: 50%; left: 0; height: 38px; width: 0;
  transform: translateY(-50%); border-radius: 100px;
  background: var(--navy-50); z-index: 0;
  transition: transform .34s cubic-bezier(.22,1,.36,1), width .34s cubic-bezier(.22,1,.36,1), opacity .25s;
  opacity: 0; pointer-events: none;
}
.nav__ind.is-visible { opacity: 1; }
.nav__list a[aria-current="page"] { background: transparent; }
.nav__list a.is-active { color: var(--navy-700); font-weight: 600; }

/* ---------- Hero: canvas network ---------- */
.hero { isolation: isolate; }
.hero__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; opacity: 0; transition: opacity 1.1s ease; pointer-events: none;
}
.hero__canvas.is-ready { opacity: .85; }
.hero__grid { position: relative; z-index: 2; }

/* scanline sweep across the hero */
.hero__scan {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden;
}
.hero__scan::after {
  content: ""; position: absolute; left: 0; right: 0; height: 180px;
  background: linear-gradient(180deg, transparent, rgba(46,123,196,.10), transparent);
  animation: scanSweep 7.5s cubic-bezier(.45,0,.55,1) infinite;
}
@keyframes scanSweep {
  0%   { transform: translateY(-200px); opacity: 0; }
  12%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(110vh); opacity: 0; }
}

/* staggered hero entrance */
.hero__grid > * { animation: heroRise .85s cubic-bezier(.22,1,.36,1) both; }
.hero__grid > *:nth-child(2) { animation-delay: .14s; }
@keyframes heroRise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Terminal ---------- */
.term {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: .84rem; line-height: 1.85; color: #9FE8C0;
  background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-sm); padding: 16px 18px; margin-bottom: 20px;
  min-height: 132px; overflow: hidden;
}
.term__line { white-space: pre-wrap; word-break: break-word; }
.term__prompt { color: var(--gold-500); }
.term__ok { color: #56D6A0; }
.term__warn { color: var(--gold-400); }
.term__cursor {
  display: inline-block; width: 8px; height: 1em; vertical-align: -2px;
  background: var(--gold-500); margin-left: 2px; animation: blink 1.05s steps(2) infinite;
}
@keyframes blink { 0%,49% { opacity: 1; } 50%,100% { opacity: 0; } }

/* ---------- Counters: monospace digit stability ---------- */
.stat__num { font-variant-numeric: tabular-nums; }

/* ---------- Filter bar ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line);
}
.filters__label {
  font-family: var(--font-display); font-size: .74rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  margin-right: 6px;
}
.chip {
  font-family: var(--font-display); font-size: .88rem; font-weight: 500;
  padding: 9px 18px; border-radius: 100px; cursor: pointer;
  background: #fff; color: var(--ink); border: 1.5px solid var(--line);
  transition: transform .18s ease, background .22s, color .22s, border-color .22s, box-shadow .22s;
}
.chip:hover { border-color: var(--navy-400); color: var(--navy-700); transform: translateY(-2px); }
.chip[aria-pressed="true"] {
  background: var(--navy-700); color: #fff; border-color: var(--navy-700);
  box-shadow: 0 6px 18px rgba(2,49,100,.24);
}
.chip__count {
  display: inline-block; margin-left: 8px; font-size: .74rem;
  opacity: .65; font-variant-numeric: tabular-nums;
}

/* filtering transition */
.is-filtering { transition: opacity .26s ease, transform .26s ease; }
.is-hidden-filter { display: none !important; }

/* ---------- Carousel ---------- */
.carousel { position: relative; }
.carousel__viewport { overflow: hidden; border-radius: var(--r-md); }
.carousel__track {
  display: flex; gap: 22px;
  transition: transform .55s cubic-bezier(.22,1,.36,1);
  will-change: transform;
}
.carousel__slide { flex: 0 0 calc(50% - 11px); }
.carousel__nav {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  margin-top: 26px;
}
.cbtn {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); color: var(--navy-700);
  display: grid; place-items: center;
  transition: transform .18s ease, background .22s, border-color .22s, color .22s;
}
.cbtn:hover { background: var(--navy-700); border-color: var(--navy-700); color: #fff; transform: translateY(-2px); }
.cbtn svg { width: 18px; height: 18px; }
.dots { display: flex; gap: 8px; margin: 0 8px; }
.dot {
  width: 9px; height: 9px; border-radius: 50%; cursor: pointer; padding: 0;
  background: var(--line); border: 0; transition: background .25s, transform .25s, width .25s;
}
.dot[aria-current="true"] { background: var(--gold-500); width: 26px; border-radius: 100px; }

/* ---------- Card tilt + cursor spotlight ---------- */
.tilt { transform-style: preserve-3d; }
.tilt.is-tilting { transition: transform .12s ease-out, box-shadow .3s ease; }
.card, .course, .tile, .quote { position: relative; }
.spot { position: relative; overflow: hidden; }
.spot::before {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: 0;
  transition: opacity .3s ease; pointer-events: none;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(10,84,158,.10), transparent 62%);
}
.spot:hover::before { opacity: 1; }
.spot > * { position: relative; z-index: 1; }

/* ---------- Magnetic buttons ---------- */
.btn { transition: transform .22s cubic-bezier(.22,1,.36,1), box-shadow .24s, background .22s, color .22s, border-color .22s; }

/* ---------- Smooth accordion (FAQ) ---------- */
.faq__a { overflow: hidden; }
.faq__item details, .faq__item { }
.faq__panel {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .38s cubic-bezier(.22,1,.36,1);
}
.faq__item.is-open .faq__panel { grid-template-rows: 1fr; }
.faq__panel > div { overflow: hidden; }
.faq__q { position: relative; }
.faq__q::after { transition: transform .32s cubic-bezier(.22,1,.36,1), color .22s; }
.faq__item.is-open .faq__q::after { transform: rotate(45deg); color: var(--navy-600); }

/* ---------- Field micro-interactions ---------- */
.field { position: relative; }
.field input, .field select, .field textarea { transition: border-color .2s, box-shadow .25s, background .25s; }
.field.is-valid input, .field.is-valid select, .field.is-valid textarea { border-color: rgba(18,133,90,.55); }
.field.is-invalid input, .field.is-invalid select, .field.is-invalid textarea {
  border-color: rgba(192,57,43,.65); box-shadow: 0 0 0 4px rgba(192,57,43,.08);
}
.field__msg { font-size: .79rem; margin-top: 2px; min-height: 0; }
.field.is-invalid .field__msg { color: #C0392B; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 20px; bottom: 84px; z-index: 180;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); color: var(--navy-700);
  display: grid; place-items: center; box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .28s, transform .28s, visibility .28s, background .22s, color .22s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.to-top svg { width: 19px; height: 19px; }

/* ---------- Staggered reveal for grids ---------- */
.grid > .reveal, .process > .reveal, .stats > .reveal { transition-delay: var(--d, 0ms); }

/* sharper reveal with a subtle scale */
.reveal { transform: translateY(24px) scale(.985); transition: opacity .7s ease, transform .7s cubic-bezier(.22,1,.36,1); }
.reveal.is-in { transform: none; }

/* ---------- Marquee: pause on hover, gradient edges ---------- */
.marquee__item { transition: opacity .3s, color .3s; }
.marquee:hover .marquee__item { opacity: .9; }

/* ---------- Console rows: live pulse ---------- */
.console__row { transition: background .25s, padding-left .25s; border-radius: 6px; }
.console__row:hover { background: rgba(255,255,255,.05); padding-left: 8px; }
.pill--ok { position: relative; }
.pill--ok::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #56D6A0; box-shadow: 0 0 0 0 rgba(86,214,160,.6);
  animation: pulseDot 2.4s ease-out infinite;
}
@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(86,214,160,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(86,214,160,0); }
  100% { box-shadow: 0 0 0 0 rgba(86,214,160,0); }
}

/* ---------- Nav underline on hover (desktop) ---------- */
@media (min-width: 901px) {
  .nav__list a::after {
    content: ""; position: absolute; left: 15px; right: 15px; bottom: 5px; height: 2px;
    background: var(--gold-500); border-radius: 2px;
    transform: scaleX(0); transform-origin: left;
    transition: transform .28s cubic-bezier(.22,1,.36,1);
  }
  .nav__list a:hover::after { transform: scaleX(1); }
  .nav__list a.is-active::after { transform: scaleX(1); }
}

/* ---------- Reduced motion: neutralise everything ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero__canvas, .hero__scan::after, .term__cursor { display: none !important; }
  .hero__grid > * { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .carousel__track { transition: none !important; }
  .progress__bar { transition: none !important; }
  .pill--ok::before { animation: none !important; }
  .header, .brand img, .to-top { transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .carousel__slide { flex: 0 0 100%; }
  .term { font-size: .78rem; min-height: 150px; }
}
@media (max-width: 640px) {
  .filters { gap: 8px; }
  .chip { font-size: .84rem; padding: 8px 14px; }
  .filters__label { width: 100%; margin-bottom: 4px; }
  .to-top { bottom: 78px; right: 16px; }
  .nav__ind { display: none; }
}
