/* -------------------------------------------------------- */
/* 🔹 Navbar                                                */
/* -------------------------------------------------------- */
/* Sticky top bar — brand, page links and the App Store CTA  */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-outline);
}

.navbar__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 64px;
}

/* Keep the brand hit area to its content — the 1fr cell would
   otherwise make the empty space beside the logo clickable */
.navbar__inner .app-brand {
  justify-self: start;
}


/* -------------------------------------------------------- */
/* 🔹 Links                                                 */
/* -------------------------------------------------------- */

.navbar__links {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: var(--space-xl);
  list-style: none;
}

.navbar__link {
  font-size: var(--text-body-medium);
  font-weight: 500;
  color: var(--color-on-surface);
  transition: color var(--animation-fast) var(--animation-curve);
}

.navbar__link:hover {
  color: var(--color-primary);
  text-decoration: none;
}


/* -------------------------------------------------------- */
/* 🔹 Right side                                            */
/* -------------------------------------------------------- */

.navbar__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.navbar__download {
  position: relative;
}

.navbar__cta {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 var(--space-l);
  background-color: var(--color-secondary);
  color: var(--color-on-primary);
  border-radius: var(--radius-pill);
  font-size: var(--text-body-medium);
  font-weight: var(--text-title-weight);
  white-space: nowrap;
  transition: opacity var(--animation-fast) var(--animation-curve);
}

.navbar__cta:hover {
  opacity: var(--opacity-pressed);
  text-decoration: none;
}


/* -------------------------------------------------------- */
/* 🔹 Download Popover                                      */
/* -------------------------------------------------------- */
/* App Store badge + QR code — scan to install on iPhone     */

.navbar__download-popover {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-s));
  right: 0;
  flex-direction: column;
  align-items: center;
  gap: var(--space-m);
  width: 264px;
  padding: var(--space-l);
  background-color: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 200;
}

/* Transparent bridge over the gap so hover survives the move
   from the button down onto the popover */
.navbar__download-popover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: var(--space-s);
}

.navbar__download-popover--open {
  display: flex;
}

.navbar__download-badge img {
  display: block;
  height: 46px;
  width: auto;
}

/* White backing keeps the QR scannable regardless of theme */
.navbar__download-qr {
  padding: var(--space-s);
  background-color: #ffffff;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-small);
}

.navbar__download-qr img {
  display: block;
  width: 184px;
  height: 184px;
}


/* -------------------------------------------------------- */
/* 🔹 Hamburger (mobile only)                               */
/* -------------------------------------------------------- */

.navbar__hamburger {
  display: none;
  cursor: pointer;
  padding: var(--space-s);
  margin-right: calc(-1 * var(--space-s));
  line-height: 0;
  color: var(--color-on-surface);
}

.navbar__hamburger svg {
  display: block;
  width: 24px;
  height: 24px;
}

/* Menu icon by default, close icon once open */
.navbar__hamburger svg:last-child {
  display: none;
}

.navbar__hamburger[aria-expanded="true"] svg:first-child {
  display: none;
}

.navbar__hamburger[aria-expanded="true"] svg:last-child {
  display: block;
}


/* -------------------------------------------------------- */
/* 🔹 Mobile Menu                                           */
/* -------------------------------------------------------- */

.navbar__mobile-menu {
  display: none;
  position: fixed;
  inset: 64px 0 0 0;
  background-color: var(--color-surface);
  padding: var(--space-xl) 0;
  z-index: 99;
  list-style: none;
}

.navbar__mobile-menu--open {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

.navbar__mobile-menu .navbar__link {
  display: block;
  padding: var(--space-m) var(--space-lxl);
  font-size: var(--text-title-medium);
}


/* -------------------------------------------------------- */
/* 🔹 Responsive                                            */
/* -------------------------------------------------------- */

@media (max-width: 767px) {
  .navbar__inner {
    grid-template-columns: 1fr auto;
  }

  /* Hidden with the popover — the hamburger menu links directly */
  .navbar__links,
  .navbar__download {
    display: none;
  }

  .navbar__hamburger {
    display: grid;
    place-items: center;
  }
}
