/* UKT GLASS — «жидкое стекло» для всех внутренних страниц. Работает только при html.ukt-glass.
   Без него страницы выглядят как раньше. Включает/выключает админ (Sentinel → Внешний вид). */

/* цветовые токены, общие для страниц: регистрируем, чтобы они ПЛАВНО меняли цвет при переключении */
@property --bg-alt   { syntax: '<color>'; inherits: true; initial-value: #111317; }
@property --surface  { syntax: '<color>'; inherits: true; initial-value: #15171b; }
@property --surface-2{ syntax: '<color>'; inherits: true; initial-value: #1a1d22; }
@property --line     { syntax: '<color>'; inherits: true; initial-value: rgba(237,238,235,0.08); }
@property --line-strong{ syntax: '<color>'; inherits: true; initial-value: rgba(237,238,235,0.18); }

html{ --ug-ease: cubic-bezier(.22,.9,.28,1); }

/* ---------- фон-подсветка (виден только в стеклянном режиме) ----------
   Палитра — родная: тёплый янтарь и приглушённый серо-синий на почти чёрном. Два слоя света очень медленно
   «дышат» и смещаются (только transform — идёт на видеокарте и почти ничего не стоит). */
html::before, html::after{
  content:''; position:fixed; inset:-22%; z-index:-1; pointer-events:none; opacity:0; will-change:transform, opacity;
  transition:opacity 1s var(--ug-ease);
}
html::before{
  background:
    radial-gradient(46vmax 34vmax at 18% 14%, rgba(201,138,62,.15), transparent 64%),
    radial-gradient(30vmax 24vmax at 64% 46%, rgba(95,174,122,.05), transparent 70%);
}
html::after{
  background: radial-gradient(48vmax 38vmax at 84% 88%, rgba(111,147,196,.13), transparent 64%);
}
html.ukt-glass::before{ opacity:1; animation:ug-drift-a 58s ease-in-out infinite alternate; }
html.ukt-glass::after { opacity:1; animation:ug-drift-b 76s ease-in-out infinite alternate; }
@keyframes ug-drift-a{ 0%{ transform:translate3d(-3%,-2%,0) scale(1); } 50%{ transform:translate3d(4%,3%,0) scale(1.12); } 100%{ transform:translate3d(9%,-1%,0) scale(1.04); } }
@keyframes ug-drift-b{ 0%{ transform:translate3d(3%,2%,0) scale(1.06); } 50%{ transform:translate3d(-5%,-3%,0) scale(1); } 100%{ transform:translate3d(-8%,2%,0) scale(1.12); } }
html.ukt-glass{ background:#06080c; }
html.ukt-glass body{ background-color:transparent !important; background-image:none !important; }

/* ---------- токены ---------- */
html.ukt-glass{
  --bg-alt:      rgba(255,255,255,0.055);
  --surface:     rgba(255,255,255,0.075);
  --surface-2:   rgba(255,255,255,0.10);
  --line:        rgba(255,255,255,0.13);
  --line-strong: rgba(255,255,255,0.24);
}

/* ---------- анимация переключения (класс держится ~1 с) ----------
   Цвета из токенов (--bg-alt, --surface, …) плавно меняются на <html> — этого хватает всем, кто их использует.
   Отдельно анимируем тени/размытие и те поверхности, у которых стекло задаёт собственный цвет. */
html.ukt-glass-anim{
  transition:
    --bg-alt .75s var(--ug-ease), --surface .75s var(--ug-ease), --surface-2 .75s var(--ug-ease),
    --line .75s var(--ug-ease), --line-strong .75s var(--ug-ease), background-color .75s var(--ug-ease) !important;
}
html.ukt-glass-anim body{ transition: background-color .75s var(--ug-ease) !important; }
html.ukt-glass-anim :where(div,section,header,footer,aside,nav,main,form,table,thead,tr,th,td,ul,li,label,input,select,textarea,button,a,span,img,pre,code){
  transition: box-shadow .75s var(--ug-ease), backdrop-filter .75s var(--ug-ease), -webkit-backdrop-filter .75s var(--ug-ease), color .5s var(--ug-ease) !important;
}
html.ukt-glass-anim :is(.gate-card, .modal-box, .modal, #pageModalInner, #docModalInner, #codeModalInner, th){
  transition: background-color .75s var(--ug-ease), border-color .75s var(--ug-ease), box-shadow .75s var(--ug-ease), backdrop-filter .75s var(--ug-ease), -webkit-backdrop-filter .75s var(--ug-ease) !important;
}

/* ---------- стеклянные поверхности ---------- */
html.ukt-glass :is(
  .panel, .group-card, .key-row, .link-tile, .gate-card, .modal-box, .modal, .box, .series-card, .mcard, .stat,
  .top, .topbar, .sidebar, .tblwrap, .access-list, .folder-chips, .suggest-list, .toast, .sentinel-toast,
  #pageModalInner, #docModalInner, #codeModalInner, .viewer-body,
  .kpis, .navbtns, .fbar, .legal, .foot, .split > .side, .split > .det, .scn .cfg
){
  -webkit-backdrop-filter: blur(22px) saturate(1.8);
          backdrop-filter: blur(22px) saturate(1.8);
}
html.ukt-glass :is(.panel, .group-card, .key-row, .link-tile, .gate-card, .modal-box, .modal, .box, .series-card, .mcard, .stat,
  .top, .topbar, .sidebar, .tblwrap, .access-list, .folder-chips, #pageModalInner, #docModalInner, #codeModalInner, .viewer-body, .toast, .sentinel-toast){
  border-color:rgba(255,255,255,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.20), inset 0 0 0 .5px rgba(255,255,255,.07), 0 20px 56px -26px rgba(0,0,0,.7);
}
html.ukt-glass :is(.top, .topbar){ background-image:none; }
html.ukt-glass :is(.gate-card, .modal-box, .modal, #pageModalInner, #docModalInner, #codeModalInner){ background-color:rgba(24,28,36,.55); }
html.ukt-glass :is(.input, select, textarea, input){ box-shadow: inset 0 1px 2px rgba(0,0,0,.35), inset 0 0 0 .5px rgba(255,255,255,.08); }
html.ukt-glass .btn:not(.danger):not(.secondary):hover, html.ukt-glass button:hover{ box-shadow: inset 0 1px 0 rgba(255,255,255,.28); }
html.ukt-glass select option{ background:#15181d; color:#edeeeb; }
html.ukt-glass th{ background-color:rgba(18,22,29,.55); -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px); }
html.ukt-glass ::selection{ background:rgba(201,138,62,.35); }

/* внутренние панели модулей с непрозрачным фоном */
html.ukt-glass :is(.listcol, .reader, .picker-list, .text-area, .scard, .rb-tool){
  background-color:rgba(10,13,18,.38) !important;
  -webkit-backdrop-filter:blur(16px) saturate(1.5); backdrop-filter:blur(16px) saturate(1.5);
}
html.ukt-glass-anim :is(.listcol, .reader, .picker-list, .text-area, .scard, .rb-tool){ transition:background-color .75s var(--ug-ease), backdrop-filter .75s var(--ug-ease), -webkit-backdrop-filter .75s var(--ug-ease) !important; }

/* окна общего оконного менеджера (Finder, Браузер, OSINT) */
html.ukt-glass .wm-win{ background-color:rgba(14,16,19,.62); -webkit-backdrop-filter:blur(26px) saturate(1.7); backdrop-filter:blur(26px) saturate(1.7);
  border-color:rgba(255,255,255,.16); box-shadow:inset 0 1px 0 rgba(255,255,255,.16), 0 30px 70px -22px rgba(0,0,0,.85); }
html.ukt-glass .wm-task{ background-color:rgba(17,19,23,.55); -webkit-backdrop-filter:blur(20px) saturate(1.6); backdrop-filter:blur(20px) saturate(1.6); }
html.ukt-glass-anim :is(.wm-win, .wm-task){ transition:background-color .75s var(--ug-ease), border-color .75s var(--ug-ease), box-shadow .75s var(--ug-ease), backdrop-filter .75s var(--ug-ease), -webkit-backdrop-filter .75s var(--ug-ease) !important; }

/* оверлеи за модальными окнами: мягче и с размытием */
html.ukt-glass :is(.modal-overlay, .overlay, #pageModal, .scrim){ background:rgba(4,6,10,.50) !important; -webkit-backdrop-filter:blur(10px) saturate(1.4); backdrop-filter:blur(10px) saturate(1.4); }

/* сетка/скобки старой главной не нужны на стеклянном фоне */
html.ukt-glass :is(.grid-bg, .bracket){ opacity:.18; transition:opacity .75s var(--ug-ease); }

/* меньше движения: без переходов */
@media (prefers-reduced-motion: reduce){
  html::before, html::after{ animation:none !important; transition:none !important; }
  html.ukt-glass-anim, html.ukt-glass-anim *{ transition:none !important; }
}
