/* =============================================================
   ITI Design System — Scroll to top
   Loaded site-wide (with iti-tokens.css, which only declares custom
   properties). Deliberately self-contained: it sets no global element
   styles, so pages that have not been redesigned yet are untouched.
   Replaces the old .main-arrow / .scroll-on-top-button circle.
   ============================================================= */

.iti-totop {
  position: fixed;
  right: clamp(14px, 1.4vw, 30px);
  bottom: clamp(14px, 2vw, 44px);
  z-index: 999;

  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;

  background: rgba(6, 25, 44, .9);
  border: 1px solid rgba(var(--iti-electric-rgb), .55);
  color: var(--iti-electric);
  cursor: pointer;

  /* chamfered corner, matching the cards */
  clip-path: var(--iti-clip-sm);

  /* hidden until the page is scrolled */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .3s cubic-bezier(.2, .7, .3, 1),
              transform .3s cubic-bezier(.2, .7, .3, 1),
              visibility 0s linear .3s,
              background .3s cubic-bezier(.2, .7, .3, 1),
              border-color .3s cubic-bezier(.2, .7, .3, 1),
              box-shadow .3s cubic-bezier(.2, .7, .3, 1),
              color .3s cubic-bezier(.2, .7, .3, 1);
}

.iti-totop[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .3s cubic-bezier(.2, .7, .3, 1),
              transform .3s cubic-bezier(.2, .7, .3, 1),
              visibility 0s,
              background .3s cubic-bezier(.2, .7, .3, 1),
              border-color .3s cubic-bezier(.2, .7, .3, 1),
              box-shadow .3s cubic-bezier(.2, .7, .3, 1),
              color .3s cubic-bezier(.2, .7, .3, 1);
}

.iti-totop:hover,
.iti-totop:focus-visible {
  background: var(--iti-electric);
  border-color: var(--iti-electric);
  color: #04121f;
  box-shadow: 0 0 22px rgba(var(--iti-electric-rgb), .5);
}

.iti-totop:focus-visible {
  outline: 2px solid var(--iti-electric);
  outline-offset: 3px;
}

.iti-totop svg {
  display: block;
  transition: transform .3s cubic-bezier(.2, .7, .3, 1);
}
.iti-totop:hover svg { transform: translateY(-3px); }

/* Thin progress rail down the right edge of the button */
.iti-totop::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 2px;
  height: var(--iti-totop-progress, 0%);
  background: var(--iti-electric);
  box-shadow: 0 0 8px rgba(var(--iti-electric-rgb), .8);
  transition: height .12s linear;
}
.iti-totop:hover::after { background: #04121f; box-shadow: none; }

@media (max-width: 767px) {
  .iti-totop { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .iti-totop,
  .iti-totop svg,
  .iti-totop::after { transition: none; }
}
