/* ============================================================================
   رِماية — the floating island header
   ----------------------------------------------------------------------------
   One glass capsule that floats over the whole page. Desktop: five centred
   section links with a sliding highlight, a quiet login link and the primary
   install pill. ≤960px: the same capsule plus a full-screen menu sheet.
   Tokens come from css/landing.css (`:root`); only transform / opacity /
   filter / clip-path animate, and reduced motion turns every move off.
   ========================================================================== */

/* ------------------------------------------------------------ the capsule -- */
.nav {
  position: fixed;
  inset-block-start: 14px;
  inset-inline: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.nav__bar {
  --nav-inset: 14px;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(1220px, calc(100% - 32px));
  height: 64px;
  margin-inline: auto;
  padding-inline: 18px;
  border-radius: 20px;
  background: rgba(14, 11, 20, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  pointer-events: auto;
  transition:
    width 0.4s var(--ease),
    height 0.4s var(--ease),
    background-color 0.4s var(--ease),
    box-shadow 0.4s var(--ease),
    transform 0.45s var(--ease),
    opacity 0.32s var(--ease);
}

/* frosted glass needs a real backdrop-filter; without it, go solid */
@supports not ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
  .nav__bar {
    background: rgba(12, 9, 18, 0.94);
  }
}

/* the hairline rim: a 1px masked ring, white → electric → violet → white */
.nav__bar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.1),
    rgba(92, 23, 253, 0.25) 34%,
    rgba(187, 80, 248, 0.2) 62%,
    rgba(255, 255, 255, 0.1)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* airy at the top → tighter and darker once the page moves */
.nav__bar.is-stuck {
  width: min(1080px, calc(100% - 32px));
  height: 56px;
  background: rgba(11, 9, 16, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 26px 60px -30px rgba(0, 0, 0, 0.95),
    0 0 60px -34px rgba(92, 23, 253, 0.7);
}

/* scrolled down past the hero: the island leaves, and comes back on the way up */
.nav__bar.is-hidden {
  transform: translateY(calc(-100% - var(--nav-inset) - 10px));
  opacity: 0;
  pointer-events: none;
}

/* the 2px scroll-progress bar: a faint track and a fill that grows from the
   right (RTL). A track is what makes a short fill read as progress instead of an
   underline under the wordmark. */
.nav__prog {
  position: absolute;
  inset-inline: 16px;
  inset-block-end: 0;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}

.nav__prog::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--electric), var(--violet));
  transform: scaleX(var(--p, 0));
  transform-origin: right center;
}

/* --------------------------------------------------------------- the logo -- */
.nav__brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  order: 1;
}

.nav__word {
  display: block;
  width: 93px;
  height: 38px;
}

.nav__word img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  filter: brightness(0) invert(1);
  opacity: 0.96;
}

/* ------------------------------------------------- shared wordmark (footer)
   The old header owned these base rules in css/landing.css; they live here now
   because the footer's `.brand--foot` variant still needs them — `position:
   relative` + `overflow: hidden` clip the square source down to the horizontal
   wordmark. Only the box geometry differs between header and footer. */
.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.brand__word {
  display: block;
  position: relative;
  width: 80px;
  height: 38px;
  overflow: hidden;
}

.brand__word img {
  position: absolute;
  width: 85px;
  height: 85px;
  max-width: none;
  inset-block-start: -23.5px;
  inset-inline-start: -1px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.96;
}

/* ------------------------------------------------------- the section links -- */
.nav__links {
  position: absolute;
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
}

.nav__links a {
  position: relative;
  z-index: 1;
  padding: 8px 12px;
  border-radius: 10px;
  transition: color 0.3s var(--ease);
}

.nav__links a:hover,
.nav__links a:focus-visible,
.nav__links a[aria-current="true"] {
  color: var(--white);
}

/* the single highlight that glides between links */
.nav__glide {
  position: absolute;
  inset-block-start: calc(50% - 16px);
  left: 0;
  width: 0;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateX(0);
  transition:
    transform 0.45s var(--ease),
    width 0.45s var(--ease),
    opacity 0.3s var(--ease);
  pointer-events: none;
}

.nav__glide.is-on {
  opacity: 1;
}

/* -------------------------------------------------------- login + install -- */
.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  order: 2;
}

.nav__login {
  padding: 8px 6px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: nowrap;
  transition: color 0.3s var(--ease);
}

.nav__login:hover,
.nav__login:focus-visible {
  color: var(--white);
}

.nav__cta {
  overflow: hidden;
  min-height: 40px;
  padding-block: 6px;
  /* logical: start (right in RTL) gets the room, the inline end holds the disc */
  padding-inline: 16px 8px;
  font-size: 13.5px;
}

.nav__cta-short {
  display: none;
}

/* the «go» affordance: the arrow-up-left, centred in a 28px disc */
.nav__go {
  display: grid;
  place-items: center;
  inline-size: 28px;
  block-size: 28px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: background-color 0.35s var(--ease);
}

.nav__arrow {
  inline-size: 20px;
  block-size: 20px;
  flex: none;
  transition: transform 0.35s var(--ease);
}

.nav__cta:hover .nav__go,
.nav__cta:focus-visible .nav__go {
  background: rgba(255, 255, 255, 0.26);
}

.nav__cta:hover .nav__arrow,
.nav__cta:focus-visible .nav__arrow {
  transform: translate(-2px, -2px);
}

/* light sweep across the pill on hover */
.nav__cta::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.42) 50%,
    transparent 62%
  );
  transform: translateX(-130%);
  transition: transform 0.7s var(--ease);
  pointer-events: none;
}

.nav__cta:hover::after,
.nav__cta:focus-visible::after {
  transform: translateX(130%);
}

/* ---------------------------------------------------------- the burger -- */
.nav__burger {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--hair-2);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.nav__burger span {
  position: absolute;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: 18px;
  height: 1.6px;
  border-radius: 2px;
  background: var(--white);
  transition:
    transform 0.35s var(--ease),
    top 0.35s var(--ease),
    opacity 0.25s var(--ease);
}

.nav__burger span:nth-child(1) {
  top: 18px;
}

.nav__burger span:nth-child(2) {
  top: 25px;
}

.nav__burger[aria-expanded="true"] span:nth-child(1) {
  top: 21.5px;
  transform: rotate(45deg);
}

.nav__burger[aria-expanded="true"] span:nth-child(2) {
  top: 21.5px;
  transform: rotate(-45deg);
}

/* ------------------------------------------------------------ the sheet --- */
.menu {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-block: calc(10px + 56px + 6px + env(safe-area-inset-top, 0px)) 0;
  background: rgba(8, 6, 13, 0.9);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  backdrop-filter: blur(22px) saturate(130%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--ease);
}

@supports (height: 100dvh) {
  .menu {
    height: 100dvh;
  }
}

@supports not ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
  .menu {
    background: rgba(8, 6, 13, 0.96);
  }
}

/* The sheet is where focus goes when the menu opens (docs/ACCESSIBILITY.md, focus
   policy 1) — a focus TARGET, never a control. It carries `tabindex="-1"` and
   draws no ring of its own, on `:focus` or on `:focus-visible` (a browser may call
   a programmatic focus "visible"): the keyboard reaches the first link with one
   Tab, and that link's ring is real. */
.menu:focus,
.menu:focus-visible {
  outline: none;
}

.menu.is-open {
  opacity: 1;
  pointer-events: auto;
}

.menu__in {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(100% - 32px, 560px);
  margin-inline: auto;
  padding-block-end: calc(22px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.menu__link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
  font-size: clamp(22px, 6.4vw, 26px);
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.42s var(--ease),
    transform 0.5s var(--ease),
    background-color 0.3s var(--ease);
  transition-delay: calc(var(--i, 0) * 40ms);
}

.menu.is-open .menu__link,
.menu.is-open .menu__cta,
.menu.is-open .menu__login {
  opacity: 1;
  transform: none;
}

.menu:not(.is-open) .menu__link,
.menu:not(.is-open) .menu__cta,
.menu:not(.is-open) .menu__login {
  transition-delay: 0s;
}

.menu__link:hover,
.menu__link:focus-visible {
  background: rgba(187, 80, 248, 0.1);
  color: var(--white);
}

.menu__n {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
}

.menu__chev {
  width: 20px;
  height: 20px;
  color: var(--text-3);
  transition:
    transform 0.35s var(--ease),
    color 0.3s var(--ease);
}

.menu__link:hover .menu__chev,
.menu__link:focus-visible .menu__chev {
  color: var(--violet);
  transform: translateX(-4px);
}

.menu__hr {
  height: 1px;
  margin: 12px 4px;
  background: var(--hair);
}

.menu__cta,
.menu__login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  text-align: center;
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.42s var(--ease),
    transform 0.5s var(--ease);
  transition-delay: calc(var(--i, 0) * 40ms);
}

.menu__cta {
  color: var(--white);
  background: linear-gradient(135deg, var(--electric), #7a2bff 55%, var(--violet));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 18px 40px -22px rgba(92, 23, 253, 0.95);
}

/* the same «go» disc as the other primary CTAs */
.menu__go {
  display: grid;
  place-items: center;
  inline-size: 28px;
  block-size: 28px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.menu__goico {
  inline-size: 20px;
  block-size: 20px;
  transition: transform 0.35s var(--ease);
}

.menu__cta:hover .menu__goico,
.menu__cta:focus-visible .menu__goico {
  transform: translate(-2px, -2px);
}

.menu__login {
  margin-block-start: 10px;
  color: var(--text);
  border: 1px solid var(--hair-2);
  background: rgba(255, 255, 255, 0.03);
}

.menu__login:hover,
.menu__login:focus-visible {
  color: var(--white);
  border-color: rgba(187, 80, 248, 0.5);
  background: rgba(187, 80, 248, 0.08);
}

/* body scroll lock while the sheet is open (compensated in JS) */
body.is-locked {
  overflow: hidden;
}

/* One install action at a time: the sheet carries the primary pill, so the
   capsule's copy steps aside while it is open. */
body.is-locked .nav__cta {
  opacity: 0;
  pointer-events: none;
}

/* --------------------------------------------------------- anchor offset -- */
main section[id] {
  scroll-margin-top: 96px;
}

/* ============================================================== responsive == */
@media (max-width: 960px) {
  .nav {
    inset-block-start: 10px;
  }

  .nav__bar {
    --nav-inset: 10px;
    width: min(100% - 44px, 1220px);
    height: 56px;
    padding-inline: 12px;
    border-radius: 18px;
  }

  .nav__bar.is-stuck {
    width: min(100% - 44px, 1220px);
    height: 56px;
  }

  .nav__links {
    display: none;
  }

  .nav__login {
    display: none;
  }

  .nav__burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav__cta-full {
    display: none;
  }

  .nav__cta-short {
    display: inline;
  }

  .nav__cta {
    min-height: 38px;
    padding-block: 5px;
    padding-inline: 12px 7px;
    font-size: 13px;
  }

  .nav__word {
    width: 80px;
    height: 33px;
  }
}

@media (max-width: 359px) {
  .nav__cta {
    display: none;
  }
}

/* At the phone gutter the capsule is exactly the `.wrap` width, so its edge,
   the hero copy and every section share one vertical line. */
@media (max-width: 720px) {
  .nav__bar,
  .nav__bar.is-stuck {
    width: min(100% - 36px, 1220px);
  }
}

/* --------------------------------------------------- no-JS: no dependencies -- */
.no-js .nav {
  position: static;
  padding-block: 14px;
  pointer-events: auto;
}

.no-js .nav__glide,
.no-js .nav__prog,
.no-js .nav__burger,
.no-js .menu,
.no-js .nav__cta-short {
  display: none !important;
}

.no-js .nav__cta-full {
  display: inline;
}

@media (max-width: 960px) {
  .no-js .nav {
    padding-block: 10px;
  }

  .no-js .nav__bar {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding-block: 12px;
    row-gap: 0;
  }

  .no-js .nav__links {
    display: flex;
    position: static;
    order: 3;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
    margin-inline: 0;
    gap: 6px 14px;
  }
}

/* ============================================== reduced motion + a11y paths == */
@media (prefers-reduced-motion: reduce) {
  .nav__bar,
  .nav__prog,
  .nav__glide,
  .nav__cta::after,
  .nav__arrow,
  .menu,
  .menu__link,
  .menu__cta,
  .menu__login {
    transition: none !important;
  }

  .menu__link,
  .menu__cta,
  .menu__login {
    transition-delay: 0s !important;
  }
}
