/* ============================================
   PolDoc AI — interaction layer
   Burger menu · scroll progress · ripple · glow · toast
   Loaded last: its responsive rules win.
   ============================================ */

/* --------------------------------------------
   Reading progress bar
   -------------------------------------------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 70;
  pointer-events: none;
  background: transparent;
}
.scroll-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), #4A63D8 60%, var(--yellow));
  transition: width .12s linear;
}

/* --------------------------------------------
   Burger
   -------------------------------------------- */
.burger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border: 1px solid var(--line-08);
  background: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4.5px;
  transition: border-color var(--t), background var(--t);
}
.burger span {
  display: block;
  width: 17px;
  height: 1.8px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform .3s var(--ease), opacity .2s var(--ease), width .3s var(--ease);
}
.burger[aria-expanded="true"] {
  background: var(--ink);
  border-color: var(--ink);
}
.burger[aria-expanded="true"] span { background: #fff; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.3px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(.2); }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.3px) rotate(-45deg); }

/* --------------------------------------------
   Mobile menu panel
   -------------------------------------------- */
.menu {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  z-index: 45;
  padding: 20px var(--pad) 28px;
  background: rgba(251, 250, 247, .97);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line-08);
  box-shadow: 0 30px 60px -40px rgba(22, 22, 40, .6);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(-14px);
  opacity: 0;
  transition: transform .32s var(--ease), opacity .25s var(--ease);
}
.menu[hidden] { display: none; }
.menu.is-open { transform: translateY(0); opacity: 1; }

.menu__nav { display: flex; flex-direction: column; }
.menu__nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 4px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  border-bottom: 1px solid var(--line-08);
  opacity: 0;
  transform: translateX(-10px);
}
.menu.is-open .menu__nav a { animation: menu-item .38s var(--ease) forwards; }
.menu.is-open .menu__nav a:nth-child(1) { animation-delay: .04s; }
.menu.is-open .menu__nav a:nth-child(2) { animation-delay: .09s; }
.menu.is-open .menu__nav a:nth-child(3) { animation-delay: .14s; }
.menu.is-open .menu__nav a:nth-child(4) { animation-delay: .19s; }
@keyframes menu-item {
  to { opacity: 1; transform: none; }
}
.menu__nav a i {
  font-style: normal;
  color: var(--ink-200);
  transition: transform var(--t), color var(--t);
}
.menu__nav a:hover { color: var(--blue); }
.menu__nav a:hover i { color: var(--blue); transform: translateX(4px); }

.menu__cta { margin-top: 2px; }

.menu__contacts {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

body.menu-open { overflow: hidden; }

/* --------------------------------------------
   Header responsive (wins over components.css)
   -------------------------------------------- */
@media (max-width: 860px) {
  .nav          { display: none; }
  .header__cta  { display: none; }
  .burger       { display: flex; }
  .header__inner { gap: 12px; }
}

/* --------------------------------------------
   Ripple on press
   -------------------------------------------- */
[data-ripple] { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: .28;
  transform: scale(0);
  animation: ripple-out .55s var(--ease) forwards;
  pointer-events: none;
}
@keyframes ripple-out {
  to { transform: scale(2.4); opacity: 0; }
}

/* --------------------------------------------
   Cursor-follow glow on cards
   -------------------------------------------- */
[data-glow] { position: relative; }
[data-glow]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    220px circle at var(--mx, 50%) var(--my, 50%),
    rgba(34, 56, 158, .07),
    transparent 62%
  );
  opacity: 0;
  transition: opacity .25s var(--ease);
  pointer-events: none;
  z-index: 0;
}
[data-glow]:hover::before { opacity: 1; }
[data-glow] > * { position: relative; z-index: 1; }

/* --------------------------------------------
   Nav scrollspy
   -------------------------------------------- */
.nav a.is-active { color: var(--ink); }
.nav a.is-active::after { transform: scaleX(1); }

/* --------------------------------------------
   24/7 ring — animated fill on reveal
   -------------------------------------------- */
.ring {
  background: conic-gradient(
    var(--blue) 0turn calc(var(--fill, 0) * 1turn),
    rgba(22, 22, 26, .1) calc(var(--fill, 0) * 1turn) 1turn
  );
  transition: --fill 1.3s var(--ease);
}
.ring.is-filled { --fill: .62; }

@property --fill {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

/* --------------------------------------------
   Contact links with icons
   -------------------------------------------- */
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.contact-link svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .65;
  transition: opacity var(--t), transform var(--t);
}
.contact-link:hover svg { opacity: 1; transform: translateX(2px); }

/* --------------------------------------------
   Toast
   -------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  transform: translate(-50%, 140%);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: var(--r-lg);
  box-shadow: 0 20px 40px -22px rgba(22, 22, 40, .8);
  opacity: 0;
  pointer-events: none;
  transition: transform .38s var(--ease), opacity .28s var(--ease);
  max-width: calc(100vw - 32px);
}
.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}
@media (max-width: 860px) {
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* --------------------------------------------
   Reduced motion
   -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ripple { animation: none; display: none; }
  .menu.is-open .menu__nav a { animation: none; opacity: 1; transform: none; }
  .ring { transition: none; }
  .ring.is-filled { --fill: .62; }
}
