@import "./corners.css";
@import "./switch-track.css";

:root {
  --halo-inline-arrow-gap: 2px;
  --halo-navigation-duration: 260ms;
  --halo-navigation-ease: cubic-bezier(.22,.76,.25,1);
}

:where(button, [role="button"], input:is([type="submit"],[type="reset"],[type="button"]), a:is(.button,.desk-action,.member-action,.city-nav-button,.admin-jump,.text-link,[data-nav-link])) {
  -webkit-tap-highlight-color: transparent;
}

/* Inline actions keep the arrow with its label. Full-width navigation rows use their own grid. */
:is(.desk-action,.member-action,.admin-jump,.city-nav-button,.strip-actions button,.button,.text-link):has(> :is(.lucide-arrow-right,.lucide-arrow-up-right,.lucide-chevron-right,.lucide-external-link,.lucide-arrow-left,.lucide-chevron-left,.launch-arrow,[data-nav-arrow])) {
  column-gap: var(--halo-inline-arrow-gap);
  --nav-arrow-x: 1.5px;
}
:is(.desk-action,.member-action,.admin-jump,.strip-actions button) > :is(.lucide-arrow-right,.lucide-arrow-up-right,.lucide-chevron-right,.lucide-external-link,.lucide-arrow-left,.lucide-chevron-left) {
  width: clamp(12px,1em,16px);
  height: auto;
  flex: none;
}

@keyframes halo-destination-in {
  from { opacity: .45; translate: 0 7px; }
  to { opacity: 1; translate: 0 0; }
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  html:has(> body:is(.marketing-page,.auth-page,.checkout-page,.policy-page)) { scroll-behavior: smooth; }

  ::view-transition-old(root) { animation: halo-document-out 160ms ease-out both; }
  ::view-transition-new(root) {
    animation: halo-document-in var(--halo-navigation-duration) var(--halo-navigation-ease) both;
  }
  @keyframes halo-document-out { to { opacity: 0; } }
  @keyframes halo-document-in { from { opacity: 0; translate: 0 5px; } }

  /* Keep navigation native on browsers without cross-document transitions. */
  @supports not selector(:active-view-transition) {
    body > main { animation: halo-destination-in var(--halo-navigation-duration) var(--halo-navigation-ease); }
  }

  .halo-city[data-motion="on"] [data-nav-destination]:not([hidden]),
  .ranking-desk .desk-page,
  .ranking-desk .desk-checkout-pane:not([hidden]),
  .auth-page :is(#email-field, #code-field, #name-field):not([hidden]) {
    animation: halo-destination-in var(--halo-navigation-duration) var(--halo-navigation-ease);
  }

  /* Only the arrow moves. The control keeps its original bounds and hit area. */
  :where(a, button):focus-visible { --nav-motion: 1; }
  @media (hover:hover) {
    :where(a, button):hover { --nav-motion: 1; }
  }
  :where(a, button) :is(.lucide-arrow-right,.lucide-chevron-right,.lucide-arrow-up-right,.lucide-external-link,.lucide-arrow-left,.lucide-chevron-left),
  [data-nav-link] > svg:last-of-type {
    translate: calc(var(--nav-motion,0) * var(--nav-arrow-x,3px)) calc(var(--nav-motion,0) * var(--nav-arrow-y,0px));
    transition: translate 180ms var(--halo-navigation-ease);
  }
  :is(.lucide-arrow-up-right,.lucide-external-link) { --nav-arrow-y:-2px; }
  :is(.lucide-arrow-left,.lucide-chevron-left) { --nav-arrow-x:-3px; }

  /* Separate the two sheets, then draw the confirmation in the same icon slot. */
  button .lucide-copy rect { transition: translate 140ms var(--halo-navigation-ease); }
  button:enabled:focus-visible .lucide-copy rect { translate: 1px 1px; }
  @media (hover:hover) {
    button:enabled:hover .lucide-copy rect { translate: 1px 1px; }
  }
  button .copy-confirm path { animation: halo-copy-confirm 160ms ease-out; }
  @keyframes halo-copy-confirm {
    from { stroke-dasharray: 24; stroke-dashoffset: 24; }
    to { stroke-dasharray: 24; stroke-dashoffset: 0; }
  }
}

/* Use the city HUD's clipped Tabler arrow pair on public navigation. */
[data-nav-arrow] {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: none;
  overflow: hidden;
  vertical-align: -0.16em;
  pointer-events: none;
}
[data-nav-arrow][hidden] { display: none; }
[data-nav-arrow="right"] { rotate: 45deg; }
[data-nav-arrow="left"] { rotate: -135deg; }
[data-nav-arrow="down"] { rotate: 135deg; }
[data-nav-arrow="up"] { rotate: -45deg; }
[data-nav-arrow]::before, [data-nav-arrow]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  mask: url('./tabler/arrow-up-right.svg') center / contain no-repeat;
}
[data-nav-arrow]::after { transform: translate(-100%, 100%); }
@media (prefers-reduced-motion: no-preference) {
  [data-nav-arrow]::before, [data-nav-arrow]::after {
    transition: transform 260ms cubic-bezier(.22,.7,.25,1);
  }
  :is(a[href], button:enabled, .tool-selector label):is(:focus-visible, :active),
  .tool-selector label:has(:focus-visible) { --arrow-flight: 100%; }
  @media (hover: hover) {
    :is(a[href], button:enabled, .tool-selector label):hover { --arrow-flight: 100%; }
  }
  [data-nav-arrow]::before {
    transform: translate(var(--arrow-flight, 0%), calc(0% - var(--arrow-flight, 0%)));
  }
  [data-nav-arrow]::after {
    transform: translate(calc(var(--arrow-flight, 0%) - 100%), calc(100% - var(--arrow-flight, 0%)));
  }
}
@media (forced-colors: active) {
  [data-nav-arrow]::before, [data-nav-arrow]::after { forced-color-adjust: none; background: LinkText; }
}
