/* ============================================================
   Akdeniz — общая кайма. Один приём на весь сайт:
   конический градиент под маской оставляет от себя ровно рамку.
   ============================================================ */

@property --beam{ syntax:"<angle>"; initial-value:0deg; inherits:false; }

:root{
  /* запасной угол для браузеров без @property — там кайма просто не бежит */
  --beam:0deg;
  --edge-cold:rgba(143,178,198,.07);
  --edge-warm:rgba(53,224,200,.9);
  --edge-warm-2:rgba(126,196,255,.95);
}

/* --- у кого кайма вместо рамки --- */
.stage,
.card,
.steps li,
.gains li,
.term,
.contact__row,
.status,
.cgrid > div,
.cmetrics div,
.cstack span,
.chero__tag,
.chero__links a:not(.is-primary),
.btn--ghost,
.restage,
.cookie__no,
.doc__note,
.case__shot,
.cgallery__shot,
.cgrid__shot{
  position:relative;
  border:0;
}


/* баннер и без того зафиксирован: relative из общего списка ронял его в подвал */
.cookie{ border:0; }

/* --- сама кайма --- */
.stage::before,
.card::before,
.steps li::before,
.gains li::before,
.term::before,
.contact__row::before,
.cookie::before,
.status::before,
.cgrid > div::before,
.cmetrics div::before,
.cstack span::before,
.chero__tag::before,
.chero__links a:not(.is-primary)::before,
.btn--ghost::before,
.restage::before,
.cookie__no::before,
.doc__note::before,
/* у скриншотов ::before занят подсказкой прокрутки, берём ::after —
   он освобождается ровно тогда, когда картинка на месте */
.case__shot:has(img)::after,
.cgallery__shot:has(img)::after,
.cgrid__shot:has(img)::after{
  content:""; position:absolute; z-index:1; inset:0;
  border-radius:inherit; padding:1px; pointer-events:none;
  background:conic-gradient(from var(--beam),
    var(--edge-cold)  0deg 62deg,
    var(--edge-warm)  104deg,
    var(--edge-warm-2)132deg,
    var(--edge-cold)  184deg 360deg);
  -webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite:xor; mask-composite:exclude;
  animation:beam 12s linear infinite;
}
@keyframes beam{ to{ --beam:360deg; } }

/* --- разводим фазы, иначе весь экран мигает в такт --- */
.card::before          { animation-duration:9s; }
.steps li::before      { animation-duration:11s; animation-delay:-3s; }
.gains li::before      { animation-duration:10s; animation-delay:-6s; }
.cgrid > div::before   { animation-duration:11s; animation-delay:-4s; }
.cmetrics div::before  { animation-duration:10s; animation-delay:-7s; }
.stage::before         { animation-duration:16s; }
.term::before          { animation-duration:13s; animation-delay:-5s; }
.contact__row::before  { animation-duration:12s; animation-delay:-2s; }
.status::before        { animation-duration:7s; }
.doc__note::before     { animation-duration:15s; animation-delay:-5s; }
.case__shot:has(img)::after,
.cgallery__shot:has(img)::after,
.cgrid__shot:has(img)::after{ animation-duration:14s; animation-delay:-6s; }

/* мелочь крутится вяло — там важнее читаемость, чем блеск */
.cstack span::before,
.chero__tag::before,
.chero__links a:not(.is-primary)::before,
.btn--ghost::before,
.restage::before,
.cookie__no::before{ animation-duration:18s; }

/* --- наведение: кайма разгоняется и целиком уходит в бирюзу --- */
.card:hover::before,
.cgrid > div:hover::before,
.cmetrics div:hover::before,
.steps li:hover::before,
.gains li:hover::before,
.contact__row:hover::before{ animation-duration:3.4s; }

.chero__links a:not(.is-primary):hover,
.btn--ghost:hover,
.restage:hover,
.restage:focus-visible,
.cookie__no:hover,
.contact__row:hover{ --edge-cold:rgba(53,224,200,.4); }

.chero__links a:not(.is-primary):hover::before,
.btn--ghost:hover::before,
.restage:hover::before,
.cookie__no:hover::before{ animation-duration:4s; }

@media (max-width:900px){
  /* на телефоне бегущая кайма — лишний расход батареи */
  .stage::before,.card::before,.steps li::before,.gains li::before,
  .term::before,.contact__row::before,.cookie::before,
  .cgrid > div::before,.cmetrics div::before,.cstack span::before,
  .chero__tag::before,.chero__links a:not(.is-primary)::before,
  .btn--ghost::before,.restage::before,.cookie__no::before,.doc__note::before,
  .case__shot:has(img)::after,
  .cgallery__shot:has(img)::after,
  .cgrid__shot:has(img)::after{ animation:none; }
}
@media (prefers-reduced-motion:reduce){
  .stage::before,.card::before,.steps li::before,.gains li::before,
  .term::before,.contact__row::before,.cookie::before,
  .cgrid > div::before,.cmetrics div::before,.cstack span::before,
  .chero__tag::before,.chero__links a:not(.is-primary)::before,
  .btn--ghost::before,.restage::before,.cookie__no::before,.doc__note::before,
  .case__shot:has(img)::after,
  .cgallery__shot:has(img)::after,
  .cgrid__shot:has(img)::after{ animation:none; }
}
