/* ==========================================================================
   RASTAKHIZ — MOTION & POLISH LAYER (v3.0.24)
   Loaded after style.css. One consistent motion language:
     blur → sharp, fade in, pop up with a soft spring.
   Rules of the road:
   - Only opacity / transform / filter are animated (GPU-friendly, no jank).
   - Hero entrance is pure CSS (no flash, no JS dependency).
   - Scroll reveals are added by enhance.js, cleaned up after playing, and
     always have a fail-safe so content can never stay hidden.
   - Everything is off under prefers-reduced-motion.
   ========================================================================== */

:root {
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-soft: cubic-bezier(.16, 1, .3, 1);
  --ease-pop: cubic-bezier(.34, 1.4, .64, 1);
  --grad-brand: linear-gradient(120deg, #3fb9d4 0%, #c9a227 100%);
  --blur-in: 14px;
}
@media (max-width: 700px) { :root { --blur-in: 8px; } }

/* ---------- Lenis (smooth scroll) required rules ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Selection, scrollbar ---------- */
::selection { background: rgba(63,185,212,.28); color: var(--navy-3); }
html { scrollbar-width: thin; scrollbar-color: #8fb0c4 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #3fb9d4, #2a6f87); border-radius: 999px; border: 3px solid var(--paper); }

/* ==========================================================================
   1. ENTRANCE KEYFRAME (shared)
   ========================================================================== */
@keyframes rzxIn {
  from { opacity: 0; filter: blur(var(--blur-in)); transform: translate3d(0, 26px, 0) scale(.95); }
  to   { opacity: 1; filter: blur(0);              transform: none; }
}

/* ==========================================================================
   2. HERO ENTRANCE — pure CSS, staggered
   ========================================================================== */
.hx-pill        { animation: rzxIn 1s var(--ease-soft) .10s backwards; }
.hx-hero-in h1  { animation: rzxIn 1.2s var(--ease-soft) .25s backwards; }
.hx-hero-in > p { animation: rzxIn 1s var(--ease-soft) .50s backwards; }
.hx-hero-btns   { animation: rzxIn 1s var(--ease-pop)  .70s backwards; }
.hx-search      { animation: rzxIn 1s var(--ease-soft) .88s backwards; }
.hx-dots        { animation: rzxIn 1s var(--ease-soft) 1.05s backwards; }

/* Inner-page & section heroes (same language, shorter) */
.page-hero .container > *, .rsv2-hero .rsv2-inner > *, .msv3-hero .msv3-inner > *,
.rz-dir-hero-inner > *, .rz-mm-hero-inner > *, .rz-about-hero .container > * {
  animation: rzxIn .95s var(--ease-soft) backwards;
}
.page-hero .container > :nth-child(2), .rsv2-hero .rsv2-inner > :nth-child(2), .msv3-hero .msv3-inner > :nth-child(2),
.rz-dir-hero-inner > :nth-child(2), .rz-mm-hero-inner > :nth-child(2), .rz-about-hero .container > :nth-child(2) { animation-delay: .12s; }
.page-hero .container > :nth-child(3), .rsv2-hero .rsv2-inner > :nth-child(3), .msv3-hero .msv3-inner > :nth-child(3),
.rz-dir-hero-inner > :nth-child(3), .rz-mm-hero-inner > :nth-child(3), .rz-about-hero .container > :nth-child(3) { animation-delay: .24s; }
.page-hero .container > :nth-child(n+4), .rsv2-hero .rsv2-inner > :nth-child(n+4), .msv3-hero .msv3-inner > :nth-child(n+4),
.rz-dir-hero-inner > :nth-child(n+4), .rz-mm-hero-inner > :nth-child(n+4) { animation-delay: .36s; }


/* v3.0.24 merge fix — one driver per element: anything the theme's own
   reveal system drives ([data-reveal]) must not ALSO run the CSS entrance
   above, or the two animations fight over the same opacity/transform. */
[data-reveal] { animation: none !important; }

/* ==========================================================================
   3. SCROLL REVEAL — blur-fade + pop (classes added by enhance.js)
   ========================================================================== */
.rzx-r {
  opacity: 0;
  filter: blur(var(--blur-in));
  transform: translate3d(0, 30px, 0) scale(.95);
  transition:
    opacity .8s var(--ease-soft),
    filter .8s var(--ease-soft),
    transform 1s var(--ease-pop);
  transition-delay: var(--d, 0ms);
  will-change: opacity, filter, transform;
}
.rzx-r--pop   { transform: translate3d(0, 34px, 0) scale(.88); }
.rzx-r--soft  { transform: translate3d(0, 18px, 0) scale(.985); }
.rzx-r--zoom  { transform: scale(.9); }
.rzx-r--left  { transform: translate3d(-40px, 0, 0) scale(.97); }
.rzx-r--right { transform: translate3d(40px, 0, 0) scale(.97); }
.rzx-r.rzx-in { opacity: 1; filter: blur(0); transform: none; }
.rzx-r.rzx-instant { transition: none; }

/* Existing in-theme reveal hooks ([data-reveal], groups, about page) get the same look */
.rz-pre, .rz-about-reveal {
  opacity: 0; filter: blur(var(--blur-in));
  transform: translate3d(0, 30px, 0) scale(.95);
  transition: opacity .8s var(--ease-soft), filter .8s var(--ease-soft), transform 1s var(--ease-pop);
}
.rz-pre.rz-in, .rz-about-reveal.rz-in { opacity: 1; filter: blur(0); transform: none; }

/* Section rule draws itself once its heading is revealed */
.hx-head.rzx-r::after, .section-head.rzx-r::after { transform: scaleX(0); transition: transform .9s var(--ease-soft) .35s; }
.hx-head.rzx-r.rzx-in::after, .section-head.rzx-r.rzx-in::after { transform: scaleX(1); }

/* ==========================================================================
   4. HEADER
   ========================================================================== */
.site-header { transition: box-shadow .3s ease, background .3s ease; }
.site-header.is-scrolled {
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
}
.header-inner { transition: padding-block .35s var(--ease-soft); }
.site-header.is-scrolled .header-inner { padding-block: .4rem; }

.primary-nav > ul > li > a { position: relative; }
.primary-nav > ul > li > a::after {
  content: ""; position: absolute; inset-inline: 1em; bottom: .3em; height: 2px;
  background: var(--grad-brand); border-radius: 2px;
  transform: scaleX(0); transform-origin: 100% 50%;
  transition: transform .4s var(--ease-soft);
}
[dir="ltr"] .primary-nav > ul > li > a::after { transform-origin: 0 50%; }
.primary-nav > ul > li > a:hover::after,
.primary-nav > ul > li.current-menu-item > a::after,
.primary-nav > ul > li.current-menu-ancestor > a::after { transform: scaleX(1); }
.primary-nav .sub-menu { animation: rzxIn .35s var(--ease-soft) backwards; --blur-in: 6px; transform-origin: top; }

.icon-btn { transition: transform .3s var(--ease-pop), background .2s ease, color .2s ease; }
.icon-btn:hover { transform: translateY(-2px) scale(1.08); }
.icon-btn:active { transform: scale(.94); }

/* Mobile drawer: items blur-pop in one after another when it opens */
body.drawer-open .mobile-drawer nav ul > li { animation: rzxIn .6s var(--ease-soft) backwards; animation-delay: calc(.12s + var(--i, 0) * 55ms); --blur-in: 8px; }
.drawer-overlay { transition: opacity .35s ease, backdrop-filter .35s ease; }
body.drawer-open .drawer-overlay { backdrop-filter: blur(4px); }

/* Scroll progress bar (grows from the reading-start edge) */
/* v3.0.41 — the .rzx-progress bar rules are gone with the bar itself:
   enhance.js no longer injects a second progress system. The theme's
   #reading-progress (articles) is the one progress bar. */

/* ==========================================================================
   5. BUTTONS — shine, ripple, press
   ========================================================================== */
.btn, .hx-btn, .mitra-btn, .pf2-btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::after, .hx-btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-130%); transition: transform .8s var(--ease-soft);
}
.btn:hover::after, .hx-btn:hover::after { transform: translateX(130%); }
.btn:active, .hx-btn:active { transform: scale(.97); }
.rzx-ripple { position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255,255,255,.4); transform: scale(0); animation: rzxRipple .6s ease-out forwards; }
@keyframes rzxRipple { to { transform: scale(1); opacity: 0; } }

/* ==========================================================================
   6. CARDS — soft cursor light + gradient hairline (no tilt, no jank)
   ========================================================================== */
.rzx-glow-el {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  background: radial-gradient(340px circle at var(--gx, 50%) var(--gy, 50%), rgba(63,185,212,.15), transparent 45%);
  opacity: 0; transition: opacity .35s ease;
}
.rzx-glow:hover > .rzx-glow-el { opacity: 1; }
.hx-card::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 3px; pointer-events: none;
  background: var(--grad-brand); transform: scaleX(0); transform-origin: 100% 50%;
  transition: transform .5s var(--ease-soft);
}
[dir="ltr"] .hx-card::after { transform-origin: 0 50%; }
.hx-card:hover::after { transform: scaleX(1); }
.hx-pimg img, .post-thumb img, .hx-aimg img { transition: transform .9s var(--ease-soft); }
.hx-card:hover .hx-pimg img, .hx-card:hover .hx-aimg img, .post-card:hover .post-thumb img { transform: scale(1.06); }

/* ==========================================================================
   7. SMALL POLISH
   ========================================================================== */
.hx-pill::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #3fb9d4; margin-inline-end: .7em; vertical-align: middle;
  animation: rzxPulse 2.2s ease-out infinite;
}
@keyframes rzxPulse { 0% { box-shadow: 0 0 0 0 rgba(63,185,212,.7); } 100% { box-shadow: 0 0 0 10px rgba(63,185,212,0); } }

.hx-mitra-dust {
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(201,162,39,.7), transparent),
    radial-gradient(1.5px 1.5px at 70% 20%, rgba(255,255,255,.6), transparent),
    radial-gradient(2px 2px at 85% 65%, rgba(201,162,39,.6), transparent),
    radial-gradient(1.5px 1.5px at 35% 80%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 2px at 55% 55%, rgba(63,185,212,.5), transparent);
  background-size: 420px 420px; animation: rzxDust 50s linear infinite;
}
@keyframes rzxDust { to { background-position: 420px -420px; } }
.hx-mitra-in { position: relative; z-index: 1; }

.entry-content a:not(.btn) { background: linear-gradient(var(--cyan), var(--cyan)) no-repeat 100% 100% / 0 2px; transition: background-size .4s var(--ease-soft), color .2s ease; }
[dir="ltr"] .entry-content a:not(.btn) { background-position: 0 100%; }
.entry-content a:not(.btn):hover { background-size: 100% 2px; }

input[type="text"], input[type="email"], input[type="search"], input[type="url"], input[type="password"], textarea, select {
  transition: border-color .25s ease, box-shadow .3s ease;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="search"]:focus, input[type="url"]:focus,
input[type="password"]:focus, textarea:focus, select:focus {
  border-color: var(--cyan) !important; box-shadow: 0 0 0 4px rgba(63,185,212,.18); outline: 2px solid transparent;
}
.hx-search { transition: box-shadow .35s ease; }
.hx-search:focus-within { box-shadow: 0 0 0 4px rgba(63,185,212,.22), 0 18px 40px -14px rgba(63,185,212,.5); }

.footer-col a { transition: color .25s ease, padding .3s var(--ease-soft); }
.site-footer { position: relative; }
.site-footer::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, #c9a227, #3fb9d4, #c9a227, transparent); opacity: .8;
}

/* Back-to-top progress ring */
.to-top { overflow: visible; transition: opacity .25s ease, transform .35s var(--ease-pop), visibility .25s, background .2s ease; }
.to-top:hover { transform: translateY(-4px) scale(1.08); }
.to-top .rzx-ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; }
.to-top .rzx-ring circle { fill: none; stroke: #3fb9d4; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 144.5; stroke-dashoffset: calc(144.5 - 144.5 * var(--p, 0)); }

/* Touch devices: no hover-only decoration */
@media (hover: none) { .rzx-glow-el { display: none; } }
@media print { .to-top { display: none !important; } }

/* ==========================================================================
   8. REDUCED MOTION — calm and instantly visible
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .hx-pill, .hx-hero-in h1, .hx-hero-in > p, .hx-hero-btns, .hx-search, .hx-dots,
  .page-hero .container > *, .rsv2-hero .rsv2-inner > *, .msv3-hero .msv3-inner > *,
  .rz-dir-hero-inner > *, .rz-mm-hero-inner > *, .rz-about-hero .container > *,
  .primary-nav .sub-menu, .hx-pill::before, .hx-mitra-dust,
  body.drawer-open .mobile-drawer nav ul > li { animation: none !important; }
  .rzx-r, .rz-pre, .rz-about-reveal { opacity: 1 !important; filter: none !important; transform: none !important; transition: none !important; }
  .btn::after, .hx-btn::after, .primary-nav > ul > li > a::after, .hx-card::after { transition: none; }
}
