/* =========================================================
   METQ — harakatlar (motion v1)
   Oddiy fade-up o'rniga: xiralikdan ochilish, kartalar
   ketma-ketligi, rasm "parda" ochilishi, hero'da tok oqimi.
   prefers-reduced-motion yoqilgan bo'lsa hammasi o'chadi.
   ========================================================= */

:root {
  --mo-ease: cubic-bezier(.22, 1, .36, 1);
  --mo-dur: 1s;
}

/* ---------- Scroll bilan ochilish ---------- */
html.js-motion [data-aos] { opacity: 0; }

html.js-motion [data-reveal] {
  opacity: 0;
  transition:
    opacity var(--mo-dur) var(--mo-ease),
    transform var(--mo-dur) var(--mo-ease),
    filter var(--mo-dur) var(--mo-ease),
    clip-path 1.2s var(--mo-ease);
  transition-delay: var(--rv-delay, 0ms);
  will-change: opacity, transform;
}
html.js-motion [data-reveal="up"]    { transform: translate3d(0, 34px, 0); filter: blur(6px); }
html.js-motion [data-reveal="down"]  { transform: translate3d(0, -34px, 0); filter: blur(6px); }
html.js-motion [data-reveal="left"]  { transform: translate3d(-44px, 0, 0); filter: blur(6px); }
html.js-motion [data-reveal="right"] { transform: translate3d(44px, 0, 0); filter: blur(6px); }
html.js-motion [data-reveal="fade"]  { filter: blur(6px); }
html.js-motion [data-reveal="zoom"]  { transform: scale(.92); filter: blur(6px); }
html.js-motion [data-reveal="rise"]  {
  transform: perspective(1000px) translate3d(0, 40px, 0) rotateX(10deg) scale(.96);
  transform-origin: 50% 100%;
  filter: blur(4px);
}

/* Rasm: parda kabi ochiladi, ichidagi rasm sekin joyiga tushadi */
html.js-motion [data-reveal="mask"] {
  opacity: 1;
  clip-path: inset(14% 14% 14% 14% round var(--metq-radius, 16px));
}
html.js-motion [data-reveal="mask"] img {
  transform: scale(1.18);
  transition: transform 1.6s var(--mo-ease);
  transition-delay: var(--rv-delay, 0ms);
}
html.js-motion [data-reveal="mask"].is-in img { transform: scale(1); }

/* Bo'lim sarlavhasi: belgi → sarlavha → matn */
html.js-motion [data-reveal="title"] { opacity: 1; }
html.js-motion [data-reveal="title"] > * {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  filter: blur(6px);
  transition: opacity .9s var(--mo-ease), transform .9s var(--mo-ease), filter .9s var(--mo-ease);
}
html.js-motion [data-reveal="title"] > :nth-child(2) { transition-delay: .12s; }
html.js-motion [data-reveal="title"] > :nth-child(3) { transition-delay: .24s; }
html.js-motion [data-reveal="title"].is-in > * { opacity: 1; transform: none; filter: none; }

html.js-motion [data-reveal].is-in {
  opacity: 1;
  transform: none;
  filter: none;
  clip-path: inset(0 0 0 0 round var(--metq-radius, 16px));
}

/* ---------- Sarlavha belgisidagi "tok" nuqtasi ---------- */
.section-title small::before,
.section-tag::before,
.why-left small::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--metq-accent, #4fd18b);
  box-shadow: 0 0 0 0 rgba(79, 209, 139, .6);
  animation: moPing 2.4s ease-out infinite;
  flex: none;
}
@keyframes moPing {
  0%   { box-shadow: 0 0 0 0 rgba(79, 209, 139, .55); }
  70%  { box-shadow: 0 0 0 9px rgba(79, 209, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 209, 139, 0); }
}

/* =========================================================
   HERO
   ========================================================= */
.hero { background-image: none; }
.hero-kb {
  position: absolute;
  inset: -2%;
  z-index: -1;
  background: url("../img/hero-bg.webp") center / cover no-repeat;
  animation: moKenBurns 28s ease-in-out infinite alternate;
  transform-origin: 70% 40%;
}
@keyframes moKenBurns {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to   { transform: scale(1.16) translate3d(-1.5%, -1%, 0); }
}

/* Simlar bo'ylab oqayotgan tok */
.hero-energy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: clamp(120px, 18vh, 200px);
  z-index: 1;
  pointer-events: none;
  opacity: .9;
}
.hero-energy .wire {
  fill: none;
  stroke: rgba(255, 255, 255, .10);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}
.hero-energy .pulse {
  fill: none;
  stroke: var(--metq-accent, #4fd18b);
  stroke-width: 2.4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 70 1000;
  stroke-dashoffset: 1070;
  filter: drop-shadow(0 0 6px rgba(79, 209, 139, .9));
  animation: moCurrent 5.5s linear infinite;
}
.hero-energy .pulse:nth-of-type(5) { animation-delay: -1.8s; animation-duration: 6.5s; }
.hero-energy .pulse:nth-of-type(6) { animation-delay: -3.6s; animation-duration: 7.5s; }
@keyframes moCurrent { to { stroke-dashoffset: 0; } }

/* Hero matni: xiralikdan aniqlikka */
.hero-badge, .hero-left h1, .hero-left p, .hero-buttons, .hero-card {
  animation-name: moHeroIn;
  animation-duration: 1.1s;
  animation-timing-function: var(--mo-ease);
  animation-fill-mode: both;
}
.hero-badge { animation-delay: .15s; }
.hero-left h1 { animation-delay: .3s; }
.hero-left p { animation-delay: .5s; }
.hero-buttons { animation-delay: .65s; }
.hero-card:nth-child(1) { animation-delay: .8s; }
.hero-card:nth-child(2) { animation-delay: .92s; }
.hero-card:nth-child(3) { animation-delay: 1.04s; }
.hero-card:nth-child(4) { animation-delay: 1.16s; }
@keyframes moHeroIn {
  from { opacity: 0; transform: translate3d(0, 36px, 0); filter: blur(12px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* "birgalikda quramiz" — yashil yaltirash */
.hero-left h1 span {
  background: linear-gradient(100deg, #4fd18b 0%, #4fd18b 40%, #d7ffe8 50%, #4fd18b 60%, #4fd18b 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: moShine 5s ease-in-out 1.6s infinite;
}
@keyframes moShine {
  0%   { background-position: 100% 0; }
  60%, 100% { background-position: -50% 0; }
}

/* =========================================================
   KARTALAR — kursor ortidan yorug'lik
   ========================================================= */
.service-card, .why-card, .news-card, .cms-card, .hero-card, .stat-card {
  position: relative;
  isolation: isolate;
}
.metq-spot {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%),
              rgba(79, 209, 139, .16), transparent 60%);
}
.hero-card .metq-spot, .stat-card .metq-spot {
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%),
              rgba(79, 209, 139, .28), transparent 65%);
}
.is-hovering > .metq-spot { opacity: 1; }


/* 3D egilish: kartalar, statistika, rasmlar */
html .metq-tilt {
  transition: transform .7s var(--mo-ease), box-shadow .3s ease, border-color .3s ease, background-color .3s ease;
  transform-style: preserve-3d;
}
html .metq-tilt.is-tilting {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translate3d(0, -6px, 0);
  transition: transform .12s ease-out, box-shadow .3s ease, border-color .3s ease, background-color .3s ease;
  box-shadow: 0 30px 60px -20px rgba(7, 61, 45, .35);
}
/* Ikonka va raqamlar karta ichida "suzadi" — chuqurlik hissi */
.metq-tilt .service-icon, .metq-tilt .why-icon, .metq-tilt .stat-icon,
.metq-tilt h2, .metq-tilt .news-date {
  translate: calc(var(--px, 0) * 14px) calc(var(--py, 0) * 14px);
  transition: translate .5s var(--mo-ease);
}
.metq-tilt.is-tilting .service-icon, .metq-tilt.is-tilting .why-icon, .metq-tilt.is-tilting .stat-icon,
.metq-tilt.is-tilting h2, .metq-tilt.is-tilting .news-date { transition-duration: .12s; }

/* Rasmlar ustidan oq yaltirash */
.metq-glare {
  z-index: 3;
  mix-blend-mode: soft-light;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
              rgba(255, 255, 255, .55), transparent 55%);
}
.about-right { border-radius: 20px; }

/* =========================================================
   KURSOR ORTIDAN YURUVCHI NUR
   ========================================================= */
.metq-glow { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.metq-glow span {
  position: fixed;
  left: 0;
  top: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease, width .35s var(--mo-ease), height .35s var(--mo-ease),
              margin .35s var(--mo-ease), background .4s ease;
  will-change: transform;
}
.metq-glow-halo {
  width: 520px; height: 520px; margin: -260px 0 0 -260px;
  background: radial-gradient(circle, rgba(79, 209, 139, .16) 0%, rgba(11, 107, 76, .08) 35%, transparent 68%);
}
.metq-glow-core {
  width: 90px; height: 90px; margin: -45px 0 0 -45px;
  background: radial-gradient(circle, rgba(79, 209, 139, .22) 0%, transparent 70%);
}
.metq-glow.on span { opacity: 1; }
/* Qorong'i bo'limlarda (hero, statistika, footer) nur yorqinroq */
.metq-glow.dark .metq-glow-halo {
  background: radial-gradient(circle, rgba(79, 209, 139, .30) 0%, rgba(79, 209, 139, .10) 38%, transparent 68%);
}
.metq-glow.dark .metq-glow-core {
  background: radial-gradient(circle, rgba(170, 255, 205, .35) 0%, transparent 70%);
}
/* Tugma / havola ustida nur kattalashadi */
.metq-glow.link .metq-glow-core { width: 150px; height: 150px; margin: -75px 0 0 -75px; }

/* =========================================================
   HERO — sichqonchaga qarab chuqurlik
   ========================================================= */
.hero-kb { translate: calc(var(--hx, 0) * -18px) calc(var(--hy, 0) * -12px); transition: translate 1.2s var(--mo-ease); }
.hero-energy { translate: calc(var(--hx, 0) * -30px) 0; transition: translate 1.2s var(--mo-ease); }
.hero-left { translate: calc(var(--hx, 0) * 10px) calc(var(--hy, 0) * 8px); transition: translate 1s var(--mo-ease); }
.hero-right {
  transform: perspective(1200px) rotateY(calc(var(--hx, 0) * -7deg)) rotateX(calc(var(--hy, 0) * 6deg));
  transform-style: preserve-3d;
  transition: transform 1s var(--mo-ease);
}
@media (max-width: 992px) {
  .hero-right { transform: none; }
  .hero-left, .hero-kb, .hero-energy { translate: none; }
}

/* Ikonka hover'da "tok urgandek" */
.service-card:hover .service-icon i,
.service-card:hover > i,
.why-card:hover i {
  animation: moZap .6s ease;
}
@keyframes moZap {
  0%, 100% { transform: none; }
  20% { transform: rotate(-12deg) scale(1.15); }
  40% { transform: rotate(10deg) scale(1.15); }
  60% { transform: rotate(-6deg) scale(1.08); }
}

/* Yashil tugma ustidan yorug'lik o'tadi */
.btn-green, .why-btn { position: relative; overflow: hidden; isolation: isolate; }
.btn-green::after, .why-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-20deg);
  transition: left .7s var(--mo-ease);
  pointer-events: none;
}
.btn-green:hover::after, .why-btn:hover::after { left: 130%; }

/* Galereya rasmi hover'da sekin yaqinlashadi */
.gallery-item img, .news-image img, .cms-card img {
  transition: transform 1.1s var(--mo-ease);
}
.gallery-item:hover img, .news-card:hover .news-image img, .cms-card:hover img { transform: scale(1.07); }

/* ---------- Harakatni kamaytirish so'ralganda ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .hero-energy { display: none; }
}

/* =========================================================
   3D HERO (hero3d.js) — elektr uzatish liniyasi bo'ylab uchish
   ========================================================= */
.hero-3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  display: block;
}
.hero-captions { display: none; }

html.hero-3d-on .hero-kb,
html.hero-3d-on .hero-energy { display: none; }
html.hero-3d-on .hero-overlay {
  background: linear-gradient(90deg, rgba(2, 20, 13, .78) 0%, rgba(2, 20, 13, .42) 45%, rgba(2, 20, 13, 0) 75%),
              linear-gradient(0deg, rgba(2, 20, 13, .65) 0%, rgba(2, 20, 13, 0) 30%);
}
html.hero-3d-on .hero::before { opacity: .5; }

@media (min-width: 993px) {
  html.hero-3d-on .hero-stage { height: 320vh; position: relative; }
  html.hero-3d-on .hero-stage .hero {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 620px;
  }
  html.hero-3d-on .hero-content { will-change: opacity, transform; }
  html.hero-3d-on .hero-captions { display: block; position: absolute; inset: 0; z-index: 4; pointer-events: none; }
  .hero .hero-caption {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(900px, 90vw);
    margin: -90px 0 0;
    opacity: 0;
    text-align: center;
    color: #fff;
    font-size: clamp(38px, 4.6vw, 68px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    text-shadow: 0 10px 40px rgba(0, 0, 0, .45);
    transform: translate3d(-50%, 40px, 0);
  }
  .hero .hero-caption small {
    display: block;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--metq-accent, #4fd18b);
  }
  .hero .hero-caption strong { display: block; font-weight: 800; color: #fff; }
  .hero .hero-caption p {
    margin: 0; font: inherit; line-height: inherit; opacity: 1;
    max-width: none; color: var(--metq-accent, #4fd18b);
  }
}

/* Admin "Vizual tahrirlash" rejimida: scroll yozuvlari hero ostida tahrirlash uchun ko'rinadi */
body.metq-live-edit .hero { flex-wrap: wrap; height: auto; min-height: 0; padding: 140px 0 60px; }
body.metq-live-edit .hero-captions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  position: relative; z-index: 5; width: min(1200px, 92%); margin: 0 auto;
}
body.metq-live-edit .hero-captions::before {
  content: "3D sahnada scroll qilganda chiqadigan yozuvlar";
  grid-column: 1 / -1; color: #4fd18b; font-size: 13px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
}
body.metq-live-edit .hero-caption {
  position: static; opacity: 1; transform: none; filter: none; width: auto; margin: 0; font-size: 16px; text-shadow: none;
  padding: 24px; border: 1px dashed rgba(79, 209, 139, .6); border-radius: 16px;
  background: rgba(2, 20, 13, .6); color: #fff; text-align: center;
}
body.metq-live-edit .hero-caption small { display: block; color: #4fd18b; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 10px; }
body.metq-live-edit .hero-caption strong { display: block; font-size: 28px; line-height: 1.15; }
body.metq-live-edit .hero-caption p { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.15; color: #4fd18b; }

/* sticky ishlashi uchun: overflow-x:hidden body'ni scroll-konteynerga aylantiradi, clip esa yo'q */
html.hero-3d-on, html.hero-3d-on body { overflow-x: clip; overflow-y: visible; }
