/* =====================================================================
   TARVIDEH — motion & light layer  (additive only)

   Every selector here either uses :where() (zero specificity) or targets
   a pseudo-element nobody else uses, so no layout, spacing or existing
   color rule can be broken by this file. Removing it restores the old look.
   ===================================================================== */

/* ---------- scroll progress ---------- */

.tv-progress {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  height: 2px;
  z-index: 99999;
  transform: scaleX(0);
  transform-origin: right center; /* RTL */
  background: linear-gradient(90deg, #22d3ee, #a78bfa 45%, #fcd34d);
  box-shadow: 0 0 12px rgba(34, 211, 238, .55);
  pointer-events: none;
  will-change: transform;
}

/* ---------- micro lift ---------- */
/* Uses the individual `scale`/`translate` properties: they compose with any
   existing `transform:` rule instead of fighting it. */

@media (hover: hover) and (pointer: fine) {
  :where(.tv-rail-app, .tv-tile, .tv-trust-item, .tv-course-card) {
    transition: translate .3s cubic-bezier(.2, .7, .3, 1),
                scale .3s cubic-bezier(.2, .7, .3, 1),
                box-shadow .3s ease;
  }

  :where(.tv-rail-app, .tv-tile, .tv-trust-item, .tv-course-card):hover {
    translate: 0 -4px;
    scale: 1.025;
    box-shadow: 0 16px 34px rgba(0, 0, 0, .38), 0 0 0 1px rgba(103, 232, 249, .18);
  }

  /* the app icons come alive on hover */
  :where(.tv-rail-app) .tv-rail-ico {
    transition: scale .3s cubic-bezier(.2, .7, .3, 1), filter .3s ease;
  }

  :where(.tv-rail-app):hover .tv-rail-ico {
    scale: 1.09;
    filter: drop-shadow(0 0 10px rgba(103, 232, 249, .55));
  }
}

/* ---------- cursor spotlight on cards ---------- */
/* The JS writes --mx/--my in percent; the overlay is a transparent pseudo,
   so the card's own background stays untouched. */

:where(.tv-rail-app, .tv-tile, .tv-trust-item, .tv-course-card, .tv-stat) {
  position: relative;
}

:where(.tv-tile, .tv-trust-item, .tv-course-card)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%),
              rgba(103, 232, 249, .16), transparent 65%);
  opacity: 0;
  transition: opacity .35s ease;
  z-index: 1;
}

@media (hover: hover) and (pointer: fine) {
  :where(.tv-tile, .tv-trust-item, .tv-course-card):hover::after { opacity: 1; }
}

/* keep the card's own content above the light */
:where(.tv-tile, .tv-trust-item, .tv-course-card) > * { position: relative; z-index: 2; }

/* ---------- buttons ---------- */

:where(.btn-action-primary, .btn-action-secondary, .tvcx-btn, .btn-portal-entry) {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-action-primary::after {
  content: "";
  position: absolute;
  inset-block: -40%;
  inset-inline-start: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .34), transparent);
  transform: skewX(-18deg) translateX(0);
  opacity: 0;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn-action-primary:hover::after {
    animation: tvSheen .75s ease forwards;
  }

  :where(.btn-action-primary, .btn-action-secondary, .tvcx-btn):hover {
    translate: 0 -2px;
    box-shadow: 0 12px 26px rgba(34, 211, 238, .28);
  }

  :where(.btn-action-primary, .btn-action-secondary, .tvcx-btn):active {
    translate: 0 0;
    scale: .985;
  }
}

@keyframes tvSheen {
  0%   { opacity: .9; transform: skewX(-18deg) translateX(0); }
  100% { opacity: 0;  transform: skewX(-18deg) translateX(420%); }
}

/* ---------- hero: aurora + headline shimmer ---------- */

.tv-hero3::after {
  content: "";
  position: absolute;
  inset: -25% -10% -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 42% at 22% 18%, rgba(34, 211, 238, .34), transparent 62%),
    radial-gradient(34% 38% at 78% 26%, rgba(167, 139, 250, .30), transparent 64%),
    radial-gradient(30% 34% at 52% 82%, rgba(252, 211, 77, .18), transparent 66%);
  filter: blur(42px) saturate(1.25);
  mix-blend-mode: screen;
  animation: tvDrift 18s ease-in-out infinite alternate;
}

/* text stays above the aurora */
.tv-hero3 :is(h1, h2, p, ul, .tv-hero3-kicker, .tv-hero3-links, .tv-appmenu) {
  position: relative;
  z-index: 1;
}

@keyframes tvDrift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  50%  { transform: translate3d(2%, 1.5%, 0) scale(1.06); }
  100% { transform: translate3d(-1%, 2%, 0) scale(1.02); }
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .tv-headline-title {
    background-image: linear-gradient(100deg, #ffffff 12%, #a5f3fc 34%, #fcd34d 52%, #ffffff 72%);
    background-size: 240% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: tvShine 9s linear infinite;
  }
}

@keyframes tvShine {
  0%   { background-position: 0% 50%; }
  100% { background-position: 240% 50%; }
}

/* ---------- section reveal ---------- */

.tv-motion-on .tv-reveal {
  opacity: 0;
  transform: translateY(18px) scale(.985);
  filter: blur(6px);
  transition: opacity .55s ease,
              transform .6s cubic-bezier(.2, .7, .3, 1),
              filter .55s ease;
  transition-delay: calc(var(--tv-i, 0) * 70ms);
}

.tv-motion-on .tv-reveal.is-in {
  opacity: 1;
  transform: none;
  filter: none;
}

/* ---------- keyboard focus ---------- */

:where(a, button, [role="button"], input, select, textarea, summary):focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 3px;
  border-radius: 8px;
}

/* =====================================================================
   TOUCH / MOBILE LAYER
   Most visitors come from phones, so the motion has to work there too.
   Everything below is opacity / transform only (cheap on battery), and
   only runs when the visitor has not asked for reduced motion.
   ===================================================================== */

@media (prefers-reduced-motion: no-preference) {

  /* --- tap feedback: the card answers the finger --- */
  @media (hover: none), (pointer: coarse) {
    :where(.tv-rail-app, .tv-tile, .tv-trust-item, .tv-course-card, .tv-box, .tv-item,
           .btn-action-primary, .btn-action-secondary, .tvcx-btn, .tv-mini-btn,
           .tv-chip, .tv-tab, .tv-nav button, .tv-quick-actions > *) {
      transition: transform .14s ease, filter .14s ease;
      -webkit-tap-highlight-color: transparent;
    }

    :where(.tv-rail-app, .tv-tile, .tv-trust-item, .tv-course-card, .tv-box, .tv-item,
           .btn-action-primary, .btn-action-secondary, .tvcx-btn, .tv-mini-btn,
           .tv-chip, .tv-tab, .tv-nav button, .tv-quick-actions > *):active {
      transform: scale(.965);
      filter: brightness(1.12);
    }
  }

  /* --- cards breathe a soft ring so the page never feels static --- */
  :where(.tv-tile, .tv-trust-item, .tv-course-card, .tv-box) {
    position: relative;
  }

  :where(.tv-tile, .tv-trust-item, .tv-course-card, .tv-box)::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(103, 232, 249, .30), 0 0 22px rgba(34, 211, 238, .16);
    opacity: 0;
    animation: tvBreath 6.5s ease-in-out infinite;
  }

  @keyframes tvBreath {
    0%, 100% { opacity: 0; }
    45%      { opacity: .55; }
    60%      { opacity: .15; }
  }

  /* --- content inside a revealed section arrives piece by piece --- */
  .tv-motion-on .tv-reveal.is-in > * {
    animation: tvPiece .6s cubic-bezier(.2, .7, .3, 1) both;
  }

  .tv-motion-on .tv-reveal.is-in > *:nth-child(2) { animation-delay: .07s; }
  .tv-motion-on .tv-reveal.is-in > *:nth-child(3) { animation-delay: .14s; }
  .tv-motion-on .tv-reveal.is-in > *:nth-child(4) { animation-delay: .21s; }
  .tv-motion-on .tv-reveal.is-in > *:nth-child(5) { animation-delay: .28s; }

  @keyframes tvPiece {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* --- tap ripple (created by motion.js) --- */
  .tv-ripple {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(103, 232, 249, .45), transparent 70%);
    transform: scale(0);
    opacity: .9;
    animation: tvRipple .55s ease-out forwards;
    z-index: 3;
  }

  @keyframes tvRipple {
    to { transform: scale(1); opacity: 0; }
  }

  /* --- phones: keep the light but spend less GPU on it --- */
  @media (max-width: 782px) {
    .tv-hero3::after {
      filter: blur(26px) saturate(1.15);
      animation-duration: 26s;
      inset: -18% -6% -6%;
    }

    :where(.tv-tile, .tv-trust-item, .tv-course-card, .tv-box)::before {
      animation-duration: 8s;
    }

    .tv-motion-on .tv-reveal {
      transform: translateY(22px) scale(.98);
    }

    /* a touch more room for the reveal to be seen on short screens */
    .tv-motion-on .tv-reveal.is-in > *:nth-child(n+5) { animation-delay: .3s; }
  }
}

/* ---------- respect the OS setting ---------- */

@media (prefers-reduced-motion: reduce) {
  .tv-progress { display: none; }

  .tv-ripple { display: none; }

  :where(.tv-tile, .tv-trust-item, .tv-course-card, .tv-box)::before { animation: none; opacity: 0; }

  .tv-hero3::after { animation: none; }

  .tv-motion-on .tv-reveal,
  .tv-motion-on .tv-reveal.is-in {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
    transition-delay: 0s;
  }

  :where(.tv-rail-app, .tv-tile, .tv-trust-item, .tv-course-card),
  :where(.btn-action-primary, .btn-action-secondary, .tvcx-btn) {
    transition: none;
  }

  :where(.tv-rail-app, .tv-tile, .tv-trust-item, .tv-course-card):hover,
  :where(.btn-action-primary, .btn-action-secondary, .tvcx-btn):hover {
    translate: none;
    scale: none;
    box-shadow: none;
  }

  :where(.tv-tile, .tv-trust-item, .tv-course-card)::after { display: none; }

  .tv-headline-title {
    -webkit-text-fill-color: currentColor;
    color: inherit;
    background: none;
    animation: none;
  }
}

/* =====================================================================
   Owner switches (from «حرکت و افکت‌ها» in the dashboard).
   Each class is added by body_class only when that part is switched off.
   ===================================================================== */

.tv-no-hero .tv-hero3::after { display: none !important; }

.tv-no-progress .tv-progress { display: none !important; }

.tv-no-reveal .tv-reveal,
.tv-no-reveal .tv-reveal.is-in {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
  transition: none !important;
}

.tv-no-reveal .tv-reveal.is-in > * { animation: none !important; }

.tv-no-hover .tv-ripple { display: none !important; }

.tv-no-hover :where(.tv-tile, .tv-trust-item, .tv-course-card)::after { display: none !important; }

.tv-no-hover :where(.tv-tile, .tv-trust-item, .tv-course-card, .tv-box)::before {
  animation: none !important;
  opacity: 0 !important;
}

@media (hover: hover) and (pointer: fine) {
  .tv-no-hover :where(.tv-rail-app, .tv-tile, .tv-trust-item, .tv-course-card):hover {
    translate: none !important;
    scale: none !important;
    box-shadow: none !important;
  }

  .tv-no-hover :where(.tv-rail-app):hover .tv-rail-ico {
    scale: none !important;
    filter: none !important;
  }

  .tv-no-hover :where(.btn-action-primary, .btn-action-secondary, .tvcx-btn):hover {
    translate: none !important;
    box-shadow: none !important;
  }

  .tv-no-hover .btn-action-primary:hover::after { animation: none !important; }
}

/* =====================================================================
   BROAD COVERAGE — the rest of the site's components
   Every rule is additive: translate/scale/opacity only.
   ===================================================================== */

@media (prefers-reduced-motion: no-preference) {

  /* --- cards that were not covered before --- */
  :where(.tv-sp-item, .tv-review, .tv-profile-card, .tv-wallet-card,
         .tv-card-box, .tv-enroll-box, .tv-pay-summary, .tv-fabitem,
         .tv-legal-links a) {
    transition: translate .28s cubic-bezier(.2, .7, .3, 1),
                scale .28s cubic-bezier(.2, .7, .3, 1),
                box-shadow .28s ease,
                color .2s ease;
  }

  @media (hover: hover) and (pointer: fine) {
    :where(.tv-sp-item, .tv-review, .tv-profile-card, .tv-wallet-card,
           .tv-card-box, .tv-enroll-box, .tv-pay-summary, .tv-fabitem):hover {
      translate: 0 -3px;
      scale: 1.012;
      box-shadow: 0 12px 26px rgba(0, 0, 0, .32);
    }
  }

  @media (hover: none), (pointer: coarse) {
    :where(.tv-sp-item, .tv-review, .tv-profile-card, .tv-wallet-card,
           .tv-card-box, .tv-enroll-box, .tv-pay-summary, .tv-fabitem,
           .bottom-nav-item, .drawer-links a):active {
      scale: .97;
    }
  }

  /* --- every section heading draws a short accent line --- */
  main h2 {
    position: relative;
  }

  main h2::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: -7px;
    height: 1px;
    border-radius: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .45), rgba(167, 139, 250, .45), transparent);
    opacity: 0;
    pointer-events: none;
    animation: tvLine .8s ease .15s forwards;
  }

  @keyframes tvLine {
    to { opacity: 1; }
  }

  /* --- form fields answer focus --- */
  :where(.input-field-ui, input[type="text"], input[type="email"], input[type="tel"],
         input[type="password"], input[type="number"], input[type="search"], select, textarea) {
    transition: box-shadow .2s ease, border-color .2s ease;
  }

  :where(.input-field-ui, input[type="text"], input[type="email"], input[type="tel"],
         input[type="password"], input[type="number"], input[type="search"], select, textarea):focus {
    box-shadow: 0 0 0 3px rgba(34, 211, 238, .16);
    border-color: rgba(34, 211, 238, .55);
  }

  /* --- FAQ / any <details> opens smoothly --- */
  details[open] > :not(summary) {
    animation: tvOpen .32s ease both;
  }

  @keyframes tvOpen {
    from { opacity: 0; translate: 0 -4px; }
    to   { opacity: 1; translate: 0 0; }
  }

  /* --- footer and legal links --- */
  :where(footer a, .tv-legal-links a):hover {
    color: #a5f3fc;
  }

  /* --- tap feedback on the fixed bottom bar --- */
  .bottom-nav-item {
    transition: scale .16s ease, color .16s ease;
  }
}

/* ---------- brand logo: floating light ---------- */

@media (prefers-reduced-motion: no-preference) {
  .brand-logo-img {
    animation: tvLogoFloat 5.5s ease-in-out infinite;
    will-change: translate, filter;
  }

  @keyframes tvLogoFloat {
    0%, 100% { translate: 0 0;  filter: brightness(1.32) contrast(1.14) drop-shadow(0 0 5px rgba(34, 211, 238, .35)); }
    50%      { translate: 0 -3px; filter: brightness(1.32) contrast(1.14) drop-shadow(0 0 13px rgba(34, 211, 238, .65)); }
  }

  @media (hover: hover) and (pointer: fine) {
    .brand-wrap:hover .brand-logo-img {
      animation-play-state: paused;
      scale: 1.08;
      rotate: -5deg;
      filter: drop-shadow(0 0 18px rgba(251, 191, 36, .65));
      transition: scale .3s ease, rotate .3s ease, filter .3s ease;
    }
  }

  @media (max-width: 782px) {
    .brand-logo-img { animation-duration: 7s; }
  }
}

.tv-no-hover .brand-wrap:hover .brand-logo-img {
  scale: none;
  rotate: none;
  filter: none;
}

/* ---------- logo: spinning halo + light sweep ---------- */

.brand-logo-ring {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: 50%;
  isolation: isolate;
}

.brand-logo-ring .brand-logo-img {
  position: relative;
  z-index: 2;
  display: block;
}

@media (prefers-reduced-motion: no-preference) {
  .brand-logo-ring {
    animation: tvLogoGlow 3.6s ease-in-out infinite;
  }

  @keyframes tvLogoGlow {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(34, 211, 238, .35)); }
    50%      { filter: drop-shadow(0 0 12px rgba(34, 211, 238, .75)); }
  }

  .brand-logo-ring::before {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
      rgba(34, 211, 238, 0) 0deg,
      rgba(34, 211, 238, .9) 40deg,
      rgba(167, 139, 250, .95) 85deg,
      rgba(251, 191, 36, .95) 125deg,
      rgba(34, 211, 238, 0) 185deg,
      rgba(34, 211, 238, 0) 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    animation: tvLogoSpin 3.6s linear infinite;
    z-index: 0;
    pointer-events: none;
  }

  @keyframes tvLogoSpin {
    to { rotate: 360deg; }
  }

  .brand-logo-ring::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, .55) 50%, transparent 58%);
    background-size: 280% 100%;
    -webkit-mask: radial-gradient(circle, #000 70%, transparent 71%);
    mask: radial-gradient(circle, #000 70%, transparent 71%);
    animation: tvLogoSweep 3.4s ease-in-out infinite;
    z-index: 3;
    pointer-events: none;
    mix-blend-mode: screen;
  }

  @keyframes tvLogoSweep {
    0%   { background-position: 120% 0; }
    100% { background-position: -120% 0; }
  }

  .brand-wrap:hover .brand-logo-ring::before {
    animation-duration: 1.1s;
  }

  .brand-wrap:hover .brand-logo-img {
    animation-play-state: paused;
    scale: 1.1;
    rotate: -6deg;
    filter: brightness(1.32) contrast(1.14) drop-shadow(0 0 18px rgba(251, 191, 36, .7));
    transition: scale .3s ease, rotate .3s ease, filter .3s ease;
  }
}

/* ================= brand about card motion ================= */

@media (prefers-reduced-motion: no-preference) {

  /* the whole card springs in each time it opens */
  .tv-brandmodal .tv-brandcard {
    animation: tvCardIn .55s cubic-bezier(.16, .84, .32, 1) both;
  }

  @keyframes tvCardIn {
    from { opacity: 0; scale: .9; filter: blur(10px) brightness(.8); }
    to   { opacity: 1; scale: 1;  filter: none; }
  }

  /* content arrives piece by piece */
  .tv-brandmodal .tv-brandcard-inner > * {
    animation: tvCardPiece .55s cubic-bezier(.2, .7, .3, 1) both;
  }

  .tv-brandmodal .tv-brandcard-inner > *:nth-child(1) { animation-delay: .10s; }
  .tv-brandmodal .tv-brandcard-inner > *:nth-child(2) { animation-delay: .16s; }
  .tv-brandmodal .tv-brandcard-inner > *:nth-child(3) { animation-delay: .22s; }
  .tv-brandmodal .tv-brandcard-inner > *:nth-child(4) { animation-delay: .28s; }
  .tv-brandmodal .tv-brandcard-inner > *:nth-child(5) { animation-delay: .34s; }
  .tv-brandmodal .tv-brandcard-inner > *:nth-child(6) { animation-delay: .40s; }
  .tv-brandmodal .tv-brandcard-inner > *:nth-child(7) { animation-delay: .46s; }

  @keyframes tvCardPiece {
    from { opacity: 0; translate: 0 12px; }
    to   { opacity: 1; translate: 0 0; }
  }

  /* the aurora breathes behind the content */
  .tv-brandmodal .tv-brandcard-aurora {
    animation: tvCardAurora 9s ease-in-out infinite alternate;
  }

  @keyframes tvCardAurora {
    from { transform: translate3d(-3%, -2%, 0) scale(1); }
    to   { transform: translate3d(3%, 2%, 0) scale(1.08); }
  }

  /* a light travels along the top edge of the card */
  .tv-brandmodal .tv-brandcard::before {
    content: "";
    position: absolute;
    inset-inline: 16%;
    top: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .9), rgba(167, 139, 250, .9), rgba(251, 191, 36, .9), transparent);
    background-size: 220% 100%;
    animation: tvCardTop 5s linear infinite;
    pointer-events: none;
    z-index: 5;
  }

  @keyframes tvCardTop {
    0%   { background-position: 0% 0; }
    100% { background-position: 220% 0; }
  }

  /* stat tiles react */
  .tv-brandmodal .tv-brandcard-stats div {
    transition: translate .25s ease, border-color .25s ease, box-shadow .25s ease;
  }

  @media (hover: hover) and (pointer: fine) {
    .tv-brandmodal .tv-brandcard-stats div:hover {
      translate: 0 -3px;
      border-color: rgba(103, 232, 249, .45);
      box-shadow: 0 10px 22px rgba(34, 211, 238, .18);
    }
  }

  /* the card's own logo keeps the halo but calmer */
  .tv-brandmodal .brand-logo-img {
    animation-duration: 6.5s;
  }
}

/* ================= brand card: extra effects ================= */

@media (prefers-reduced-motion: no-preference) {

  /* 3D tilt follows the pointer (JS writes --rx/--ry) */
  .tv-brandmodal .tv-brandcard {
    transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transform-style: preserve-3d;
    transition: transform .18s ease;
    will-change: transform;
  }

  /* headline: light travelling through the letters */
  @supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .tv-brandmodal .tv-brandcard-title {
      background-image: linear-gradient(100deg, #ffffff 12%, #a5f3fc 34%, #fcd34d 54%, #ffffff 76%);
      background-size: 220% 100%;
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      color: transparent;
      animation: tvBrandTitle 7s linear infinite;
    }
  }

  @keyframes tvBrandTitle {
    0%   { background-position: 0% 50%; }
    100% { background-position: 220% 50%; }
  }

  /* tiny sparks drifting inside the card */
  .tv-brandmodal .tv-brandcard-grid::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
      radial-gradient(2px 2px at 12% 22%, rgba(255, 255, 255, .95), transparent 60%),
      radial-gradient(1.6px 1.6px at 78% 18%, rgba(165, 243, 252, .85), transparent 60%),
      radial-gradient(1.8px 1.8px at 62% 64%, rgba(251, 191, 36, .8), transparent 60%),
      radial-gradient(1.5px 1.5px at 28% 76%, rgba(196, 181, 253, .8), transparent 60%),
      radial-gradient(1.4px 1.4px at 88% 48%, rgba(255, 255, 255, .7), transparent 60%);
    animation: tvSpark 6s ease-in-out infinite alternate;
  }

  @keyframes tvSpark {
    from { opacity: .25; transform: translateY(0); }
    to   { opacity: .95; transform: translateY(-7px); }
  }

  /* the aurora is stronger and breathes faster */
  .tv-brandmodal .tv-brandcard-aurora {
    opacity: .95;
    animation-duration: 6.5s;
  }

  /* primary CTA keeps a soft pulse of light */
  .tv-brandmodal .tv-brandcard-cta .btn-action-primary {
    animation: tvBrandBtn 3.2s ease-in-out infinite;
  }

  @keyframes tvBrandBtn {
    0%, 100% { box-shadow: 0 6px 18px rgba(34, 211, 238, .25); }
    50%      { box-shadow: 0 12px 30px rgba(34, 211, 238, .55); }
  }

  /* stat numbers pop as they count up */
  .tv-brandmodal .tv-brandcard-stats b {
    animation: tvStatPop .6s cubic-bezier(.2, .7, .3, 1) .3s both;
  }

  @keyframes tvStatPop {
    from { opacity: 0; scale: .8; filter: blur(4px); }
    to   { opacity: 1; scale: 1;  filter: none; }
  }
}

/* ================= brand card: touch devices ================= */

@media (prefers-reduced-motion: no-preference) {
  @media (hover: none), (pointer: coarse) {

    /* no pointer to tilt with, so the card sways on its own (very gentle) */
    .tv-brandmodal .tv-brandcard {
      animation: tvCardIn .55s cubic-bezier(.16,.84,.32,1) both,
                 tvCardSway 7s ease-in-out .6s infinite;
      transition: none;
    }

    @keyframes tvCardSway {
      0%, 100% { transform: perspective(1100px) rotateX(0deg) rotateY(-2.2deg); }
      50%      { transform: perspective(1100px) rotateX(1.2deg) rotateY(2.2deg); }
    }

    /* cheaper light on a phone battery */
    .tv-brandmodal .tv-brandcard-aurora {
      filter: blur(18px);
      opacity: .8;
      animation-duration: 9s;
    }

    .tv-brandmodal .tv-brandcard-grid::after {
      opacity: .6;
      animation-duration: 8s;
    }

    .tv-brandmodal .tv-brandcard-cta .btn-action-primary:active,
    .tv-brandmodal .tv-brandcard-cta .tv-brand-alt:active {
      scale: .97;
    }

    .tv-brandmodal .tv-brandcard-stats div:active {
      scale: .97;
      border-color: rgba(103, 232, 249, .45);
    }
  }
}

/* =====================================================================
   SITE-WIDE MOTION GRAPHICS
   Light animations that make every block feel alive on phone and desktop.
   Only translate / opacity / background-position are animated (cheap).
   ===================================================================== */

@media (prefers-reduced-motion: no-preference) {

  /* ---- icons breathe ---- */
  :where(.tv-rail-ico, .tv-sp-item-ic, .tv-trust-icon, .tv-fabitem-ic,
         .tv-tile i, .tv-course-card i, .tv-stat i, .service-icon-box i) {
    animation: tvIconBob 4.6s ease-in-out infinite;
  }

  :where(.tv-rail-app:nth-child(2n), .tv-tile:nth-child(2n), .tv-sp-item:nth-child(2n)) :is(i) {
    animation-delay: .7s;
  }

  :where(.tv-rail-app:nth-child(3n), .tv-tile:nth-child(3n), .tv-sp-item:nth-child(3n)) :is(i) {
    animation-delay: 1.3s;
  }

  @keyframes tvIconBob {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -3px; }
  }

  /* ---- section headings shimmer like light through glass ---- */
  @supports ((-webkit-background-clip: text) or (background-clip: text)) {
    main h2:not(.tv-h1) {
      background-image: linear-gradient(100deg, #ffffff 16%, #a5f3fc 38%, #fcd34d 52%, #ffffff 72%);
      background-size: 220% 100%;
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      color: transparent;
      animation: tvH2Shine 9s linear infinite;
    }
  }

  @keyframes tvH2Shine {
    0%   { background-position: 0% 50%; }
    100% { background-position: 220% 50%; }
  }

  /* ---- chips and badges glow softly ---- */
  :where(.tv-chip, .tv-badges span, .tv-review-by b) {
    animation: tvChipGlow 5.2s ease-in-out infinite;
  }

  @keyframes tvChipGlow {
    0%, 100% { box-shadow: 0 0 0 rgba(34, 211, 238, 0); }
    50%      { box-shadow: 0 0 12px rgba(34, 211, 238, .35); }
  }

  /* ---- primary buttons keep a slow pulse of light ---- */
  :where(.btn-action-primary):not(.tvcpay-btn) {
    animation: tvBtnPulse 4.4s ease-in-out infinite;
  }

  @keyframes tvBtnPulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(34, 211, 238, .18); }
    50%      { box-shadow: 0 10px 26px rgba(34, 211, 238, .42); }
  }

  /* ---- links inside copy grow an animated underline ---- */
  :where(main p a, footer a, .tv-legal-links a):not([class*="btn"]) {
    background-image: linear-gradient(90deg, #22d3ee, #a78bfa);
    background-repeat: no-repeat;
    background-position: 100% 100%;
    background-size: 0% 1px;
    transition: background-size .3s ease, color .2s ease;
  }

  :where(main p a, footer a, .tv-legal-links a):not([class*="btn"]):hover {
    background-size: 100% 1px;
  }

  /* ---- section chips row: gentle float ---- */
  :where(.tv-filters button, .tv-tab) {
    animation: tvChipFloat 6s ease-in-out infinite;
  }

  @keyframes tvChipFloat {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -2px; }
  }

  /* ---- phones: same motion, softer and slower (battery) ---- */
  @media (hover: none), (pointer: coarse) {
    :where(.tv-rail-ico, .tv-sp-item-ic, .tv-trust-icon, .tv-tile i, .tv-course-card i) {
      animation-duration: 6s;
    }

    main h2:not(.tv-h1) { animation-duration: 12s; }

    :where(.btn-action-primary):not(.tvcpay-btn) { animation-duration: 6s; }

    :where(.tv-chip, .tv-badges span) { animation-duration: 7s; }
  }
}

/* ---- header + hero buttons also feel alive ---- */

@media (prefers-reduced-motion: no-preference) {
  :where(.tvcx-btn):not(.tvcpay-btn) {
    animation: tvBtnPulse 4.4s ease-in-out infinite;
  }

  .btn-portal-entry {
    position: relative;
    overflow: hidden;
    isolation: isolate;
  }

  .btn-portal-entry::after {
    content: "";
    position: absolute;
    inset-block: -40%;
    inset-inline-start: -70%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
    transform: skewX(-18deg);
    animation: tvHeaderSheen 6s ease-in-out infinite;
    pointer-events: none;
  }

  @keyframes tvHeaderSheen {
    0%, 62%  { opacity: 0; translate: 0 0; }
    70%      { opacity: .9; }
    100%     { opacity: 0; translate: 420% 0; }
  }

  .btn-header-call:hover,
  .btn-portal-entry:hover {
    filter: brightness(1.08);
  }

  @media (hover: none), (pointer: coarse) {
    .tvcx-btn { animation-duration: 6s; }
    .btn-portal-entry::after { animation-duration: 9s; }
  }
}

/* ================= forms: motion ================= */

@media (prefers-reduced-motion: no-preference) {

  /* fields arrive one after another */
  .tv-form > * {
    animation: tvFieldIn .5s cubic-bezier(.2, .7, .3, 1) both;
  }
  .tv-form > *:nth-child(2) { animation-delay: .05s; }
  .tv-form > *:nth-child(3) { animation-delay: .10s; }
  .tv-form > *:nth-child(4) { animation-delay: .15s; }
  .tv-form > *:nth-child(5) { animation-delay: .20s; }
  .tv-form > *:nth-child(6) { animation-delay: .25s; }

  @keyframes tvFieldIn {
    from { opacity: 0; translate: 0 8px; }
    to   { opacity: 1; translate: 0 0; }
  }

  /* a focused field breathes light */
  .input-field-ui:focus {
    animation: tvFieldGlow 2.4s ease-in-out infinite;
  }

  @keyframes tvFieldGlow {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34, 211, 238, .12), 0 0 14px rgba(34, 211, 238, .18); }
    50%      { box-shadow: 0 0 0 4px rgba(34, 211, 238, .22), 0 0 24px rgba(34, 211, 238, .35); }
  }

  /* the glowing frame around the form breathes too */
  .tv-form:focus-within::before {
    animation: tvFormAura 3.6s ease-in-out infinite;
  }

  @keyframes tvFormAura {
    0%, 100% { opacity: .45; }
    50%      { opacity: .8; }
  }

  /* inline messages pop in */
  .tv-form .tv-msg {
    animation: tvMsgIn .38s cubic-bezier(.2, .7, .3, 1) both;
  }

  @keyframes tvMsgIn {
    from { opacity: 0; translate: 0 -6px; }
    to   { opacity: 1; translate: 0 0; }
  }

  /* on phones keep it calm */
  @media (hover: none), (pointer: coarse) {
    .tv-form > * { animation-duration: .45s; }
    .input-field-ui:focus { animation-duration: 3.2s; }
    .tv-form:focus-within::before { animation-duration: 4.5s; }
  }
}

/* the breathing focus keeps the underline visible */
@media (prefers-reduced-motion: no-preference) {
  .input-field-ui:focus {
    animation: tvFieldGlow2 2.4s ease-in-out infinite;
  }

  @keyframes tvFieldGlow2 {
    0%, 100% {
      box-shadow: inset 0 -2px 0 0 #22d3ee,
                  0 0 0 3px rgba(34, 211, 238, .12),
                  0 0 14px rgba(34, 211, 238, .18);
    }
    50% {
      box-shadow: inset 0 -2px 0 0 #a78bfa,
                  0 0 0 4px rgba(34, 211, 238, .22),
                  0 0 24px rgba(34, 211, 238, .35);
    }
  }
}

/* the field focus itself stops animating; the ring is on the label now */
.input-field-ui:focus{animation:none}

@media (prefers-reduced-motion: no-preference){
  .tv-form label:focus-within::after{animation:tvFocusRing 2.2s ease-in-out infinite}
  @keyframes tvFocusRing{
    0%,100%{box-shadow:0 0 10px rgba(34,211,238,.25);border-color:rgba(34,211,238,.45)}
    50%    {box-shadow:0 0 24px rgba(34,211,238,.55);border-color:rgba(103,232,249,.85)}
  }

  .tv-form .is-next > .input-field-ui{animation:tvNextPulse 1.9s ease-in-out infinite}
  @keyframes tvNextPulse{
    0%,100%{box-shadow:0 0 0 3px rgba(34,211,238,.12),0 0 12px rgba(34,211,238,.16)}
    50%    {box-shadow:0 0 0 5px rgba(34,211,238,.24),0 0 26px rgba(34,211,238,.42)}
  }

  .tv-form .is-next::before{animation:tvNextLabel 1.9s ease-in-out infinite}
  @keyframes tvNextLabel{
    0%,100%{translate:0 0;opacity:.9}
    50%    {translate:0 -2px;opacity:1}
  }

  .tv-form:focus-within::after{animation:tvFormTop 3.4s linear infinite}
  @keyframes tvFormTop{
    0%{background-position:0% 0}
    100%{background-position:220% 0}
  }
}

/* ================= form fields: living light ================= */

@media (prefers-reduced-motion: no-preference) {

  .tv-form .input-field-ui,
  .tv-form select,
  .tv-form textarea {
    animation: tvFieldIdle 5.2s ease-in-out infinite;
  }

  /* stagger so the whole form breathes in waves */
  .tv-form > *:nth-child(2n) .input-field-ui,
  .tv-form > *:nth-child(2n) select,
  .tv-form > *:nth-child(2n) textarea { animation-delay: .9s; }
  .tv-form > *:nth-child(3n) .input-field-ui,
  .tv-form > *:nth-child(3n) select,
  .tv-form > *:nth-child(3n) textarea { animation-delay: 1.7s; }

  @keyframes tvFieldIdle {
    0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 rgba(34, 211, 238, 0); }
    50%      { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), 0 0 16px rgba(34, 211, 238, .26); }
  }

  .tv-form .input-field-ui:focus,
  .tv-form select:focus,
  .tv-form textarea:focus {
    animation: tvFieldLive 2.2s ease-in-out infinite;
    border-color: #67e8f9;
  }

  @keyframes tvFieldLive {
    0%, 100% {
      box-shadow: inset 0 -2px 0 0 #22d3ee,
                  0 0 0 3px rgba(34, 211, 238, .20),
                  0 0 20px rgba(34, 211, 238, .30);
      border-color: #22d3ee;
    }
    50% {
      box-shadow: inset 0 -2px 0 0 #a78bfa,
                  0 0 0 5px rgba(167, 139, 250, .26),
                  0 0 30px rgba(167, 139, 250, .45);
      border-color: #a78bfa;
    }
  }

  @media (hover: none), (pointer: coarse) {
    .tv-form .input-field-ui,
    .tv-form select,
    .tv-form textarea { animation-duration: 7s; }
    .tv-form .input-field-ui:focus,
    .tv-form select:focus,
    .tv-form textarea:focus { animation-duration: 3s; }
  }
}

/* fields glow through filter (no conflict with legacy box-shadow rules) */
@media (prefers-reduced-motion: no-preference) {
  .tv-form .input-field-ui,
  .tv-form select,
  .tv-form textarea {
    animation: tvFieldBreathe 4.6s ease-in-out infinite;
  }

  .tv-form > *:nth-child(2n) :is(.input-field-ui, select, textarea) { animation-delay: .8s; }
  .tv-form > *:nth-child(3n) :is(.input-field-ui, select, textarea) { animation-delay: 1.6s; }

  @keyframes tvFieldBreathe {
    0%, 100% { filter: none; }
    50%      { filter: drop-shadow(0 0 7px rgba(34, 211, 238, .55)); }
  }

  .tv-form .input-field-ui:focus,
  .tv-form select:focus,
  .tv-form textarea:focus {
    animation: tvFieldFocusGlow 2.2s ease-in-out infinite;
    border-color: #22d3ee !important;
  }

  @keyframes tvFieldFocusGlow {
    0%, 100% {
      filter: drop-shadow(0 0 10px rgba(34, 211, 238, .6));
      border-color: #22d3ee;
    }
    50% {
      filter: drop-shadow(0 0 18px rgba(167, 139, 250, .8));
      border-color: #a78bfa;
    }
  }

  @media (hover: none), (pointer: coarse) {
    .tv-form .input-field-ui,
    .tv-form select,
    .tv-form textarea { animation-duration: 6.5s; }
    .tv-form .input-field-ui:focus,
    .tv-form select:focus,
    .tv-form textarea:focus { animation-duration: 3s; }
  }
}

/* =====================================================================
   EVERY FORM ON THE SITE + THE COURSES SECTION
   ===================================================================== */

@media (prefers-reduced-motion: no-preference) {

  /* ---- all form fields breathe and glow (any form, any page) ---- */
  form .input-field-ui,
  form input[type="text"],
  form input[type="email"],
  form input[type="tel"],
  form input[type="password"],
  form input[type="number"],
  form input[type="search"],
  form input[type="url"],
  form select,
  form textarea {
    animation: tvFieldBreathe 4.6s ease-in-out infinite;
  }

  form .input-field-ui:focus,
  form input:focus,
  form select:focus,
  form textarea:focus {
    animation: tvFieldFocusGlow 2.2s ease-in-out infinite;
    border-color: #22d3ee !important;
  }

  /* ---- course cards come alive ---- */
  .tvcrs-card,
  .tvcrs-fcard {
    transition: translate .3s cubic-bezier(.2, .7, .3, 1),
                scale .3s cubic-bezier(.2, .7, .3, 1),
                box-shadow .3s ease,
                border-color .3s ease;
  }

  .tvcrs-card .tvcrs-cover,
  .tvcrs-card .tvcrs-cover img {
    transition: scale .45s cubic-bezier(.2, .7, .3, 1), filter .35s ease;
  }

  .tvcrs-card .tvcrs-ic {
    animation: tvIconBob 5s ease-in-out infinite;
  }

  .tvcrs-card .tvcrs-badge {
    animation: tvChipGlow 5.2s ease-in-out infinite;
  }

  .tvcrs-card .tvcrs-price strong {
    display: inline-block;
    animation: tvPricePop 4.8s ease-in-out infinite;
  }

  @keyframes tvPricePop {
    0%, 100% { translate: 0 0; filter: none; }
    50%      { translate: 0 -2px; filter: drop-shadow(0 0 8px rgba(252, 211, 77, .65)); }
  }

  .tvcrs-card .tvcrs-go {
    position: relative;
    overflow: hidden;
    isolation: isolate;
  }

  .tvcrs-card .tvcrs-go::after {
    content: "";
    position: absolute;
    inset-block: -40%;
    inset-inline-start: -60%;
    width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent);
    transform: skewX(-18deg);
    animation: tvCrsSheen 5.5s ease-in-out infinite;
    pointer-events: none;
  }

  @keyframes tvCrsSheen {
    0%, 70% { opacity: 0; translate: 0 0; }
    78%     { opacity: .95; }
    100%    { opacity: 0; translate: 430% 0; }
  }

  @media (hover: hover) and (pointer: fine) {
    .tvcrs-card:hover,
    .tvcrs-fcard:hover {
      translate: 0 -5px;
      scale: 1.015;
      box-shadow: 0 20px 44px rgba(0, 0, 0, .45), 0 0 0 1px rgba(103, 232, 249, .28);
      border-color: rgba(103, 232, 249, .45);
    }

    .tvcrs-card:hover .tvcrs-cover,
    .tvcrs-card:hover .tvcrs-cover img {
      scale: 1.06;
      filter: saturate(1.15) brightness(1.05);
    }
  }

  @media (hover: none), (pointer: coarse) {
    .tvcrs-card:active,
    .tvcrs-fcard:active { scale: .98; }
  }

  /* ---- phones: keep the field pulse gentler ---- */
  @media (hover: none), (pointer: coarse) {
    form .input-field-ui,
    form input, form select, form textarea { animation-duration: 6.5s; }
    form .input-field-ui:focus,
    form input:focus, form select:focus, form textarea:focus { animation-duration: 3s; }
  }
}

/* corrections: price element + card transition priority */
@media (prefers-reduced-motion: no-preference) {
  .tvcrs-card.tvcrs-card,
  .tvcrs-fcard.tvcrs-fcard {
    transition: translate .3s cubic-bezier(.2, .7, .3, 1),
                scale .3s cubic-bezier(.2, .7, .3, 1),
                box-shadow .3s ease,
                border-color .3s ease,
                transform .18s ease;
  }

  .tvcrs-card .tvcrs-price {
    display: inline-block;
    animation: tvPricePop 4.8s ease-in-out infinite;
  }

  .tvcrs-fcard .tvcrs-ffree {
    animation: tvChipGlow 5.4s ease-in-out infinite;
  }

  .tvcrs-fcard .tvcrs-fgo {
    position: relative;
    overflow: hidden;
    isolation: isolate;
  }

  .tvcrs-fcard .tvcrs-fgo::after {
    content: "";
    position: absolute;
    inset-block: -40%;
    inset-inline-start: -60%;
    width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent);
    transform: skewX(-18deg);
    animation: tvCrsSheen 6.2s ease-in-out infinite;
    pointer-events: none;
  }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .tvcrs-card:hover{
    border-color:var(--acc);
    box-shadow:0 20px 44px rgba(0,0,0,.42),0 0 26px var(--accA);
  }
  .tvcrs-fcard:hover{
    border-color:var(--acc);
    box-shadow:0 18px 40px rgba(0,0,0,.4),0 0 24px var(--accA);
  }
}

@media (prefers-reduced-motion: no-preference){
  @media (hover: hover) and (pointer: fine){
    .tvcrs-grid>.tvcrs-card:hover{border-color:var(--acc)}
    .tvcrs-grid>.tvcrs-fcard:hover{border-color:var(--acc)}
  }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine){
  .tv-sp-items > *:hover,
  .tv-tiles > *:hover,
  .tv-trust-grid > *:hover,
  .tv-course-grid > *:hover{
    border-color:var(--acc,#67e8f9);
    box-shadow:0 18px 40px rgba(0,0,0,.4),0 0 24px var(--accA,rgba(103,232,249,.3));
  }
}

/* touch: the card lights up in its own colour while pressed */
@media (prefers-reduced-motion: no-preference) and (hover: none), (pointer: coarse){
  .tvcrs-grid > *:active,
  .tv-sp-items > *:active,
  .tv-tiles > *:active,
  .tv-trust-grid > *:active,
  .tv-course-grid > *:active{
    border-color:var(--acc,#67e8f9);
    box-shadow:0 0 22px var(--accA,rgba(103,232,249,.35));
  }
}
