/* Phone menu: on narrow screens the top bar keeps the brand and one ☰ button;
   About, the account links, the "?" and everything else open in a drawer. */

.nav-menu-btn { display: none; }
.nav-drawer[hidden] { display: none; }

@media (max-width: 720px) {
  .nav.has-menu { grid-template-columns: 1fr auto; }
  .nav.has-menu .nav-about,
  .nav.has-menu .nav-auth,
  .nav.has-menu .nav-help,
  .nav.has-menu .nav-cta { display: none !important; }

  .nav-menu-btn {
    display: inline-grid; place-items: center; justify-self: end;
    width: 38px; height: 38px; padding: 0; cursor: pointer;
    background: var(--white, #fffdf8); color: var(--ink, #2a2016);
    border: 1px solid var(--line, #3a2c1e); border-radius: 12px;
    box-shadow: 0 4px 14px -10px rgba(42, 32, 22, 0.24);
  }
  .nav-menu-btn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; }

  .nav-drawer {
    position: fixed; inset: 0; z-index: 900;
    background: rgba(30, 22, 14, 0.45);
    display: flex; justify-content: flex-end;
  }
  .nav-drawer-panel {
    width: min(300px, 86vw); height: 100%; overflow-y: auto;
    background: var(--paper, #fbf7f0); border-left: 1px solid var(--line, #3a2c1e);
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.25);
    padding: 14px 16px 24px;
    font-family: "Sora", "Segoe UI", sans-serif;
  }
  .nav-drawer-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .nav-drawer-top b { font-weight: 800; font-size: 14px; letter-spacing: 0.14em; color: var(--ink, #2a2016); }
  .nav-drawer-close {
    width: 34px; height: 34px; cursor: pointer; font-size: 18px; line-height: 1;
    background: transparent; border: 1px solid var(--line, #3a2c1e); border-radius: 10px; color: var(--ink, #2a2016);
  }
  .nav-drawer-account { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
  .nav-drawer-account a {
    display: block; text-align: center; padding: 10px 8px; border-radius: 12px;
    border: 1px solid var(--line, #3a2c1e); font-weight: 700; font-size: 14px;
    color: var(--ink, #2a2016); background: var(--white, #fffdf8); text-decoration: none;
  }
  .nav-drawer-account a:last-child { background: var(--ink, #2a2016); color: var(--white, #fffdf8); }
  .nav-drawer-group { margin: 14px 0 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--sanguine, #8e3a1c); }
  .nav-drawer-links { display: grid; }
  .nav-drawer-links a {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 4px; border-bottom: 1px solid rgba(42, 32, 22, 0.18);
    font-size: 15px; font-weight: 600; color: var(--ink, #2a2016); text-decoration: none;
  }
  .nav-drawer-links a::after { content: "›"; font-size: 18px; color: var(--ink-soft, #5a4630); }
  .nav-drawer-links a[aria-current="page"] { color: var(--sanguine, #8e3a1c); }
  html.nav-drawer-open { overflow: hidden; }
}

/* Desktop: brand on the left, page links centred, the visitor's own actions
   (Refer & earn, Account - or Log in, Sign up) on the right. */
.nav-links { display: none; }
@media (min-width: 721px) {
  .nav.has-menu {
    grid-template-columns: 1fr auto 1fr;
    padding-top: 12px; padding-bottom: 12px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
  }
  .nav.has-menu.is-scrolled {
    background: rgba(251, 247, 240, 0.94);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px -10px rgba(42, 32, 22, 0.24);
  }
  .nav.has-menu .nav-left { grid-column: 1; }
  .nav.has-menu .nav-about,
  .nav.has-menu .nav-help,
  .nav.has-menu .nav-cta { display: none !important; }

  .nav-links {
    grid-column: 2; display: flex; align-items: center; gap: clamp(18px, 2.4vw, 34px);
  }
  .nav-links a {
    position: relative; padding: 6px 0;
    font: 600 14.5px/1 "Sora", "Segoe UI", sans-serif; letter-spacing: 0.01em;
    color: var(--ink, #2a2016); text-decoration: none;
  }
  .nav-links a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
    background: var(--sanguine, #8e3a1c); border-radius: 2px;
    transform: scaleX(0); transform-origin: left; transition: transform 0.2s ease;
  }
  .nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }
  .nav-links a[aria-current="page"] { color: var(--sanguine, #8e3a1c); }

  .nav.has-menu .nav-auth {
    grid-column: 3; justify-self: end;
    display: inline-flex; align-items: center; gap: 16px;
    padding: 0; background: none; border: 0; box-shadow: none;
  }
  .nav.has-menu .nav-auth .nav-login {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 0;
    background: none; border: 0; box-shadow: none;
    font: 600 14.5px/1 "Sora", "Segoe UI", sans-serif; color: var(--ink, #2a2016);
  }
  .nav.has-menu .nav-auth .nav-login:hover { background: none; color: var(--sanguine, #8e3a1c); }
  .nav.has-menu .nav-auth .nav-refer::before {
    content: ""; width: 16px; height: 16px; flex: none;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='4' rx='1'/%3E%3Cpath d='M12 8v13M19 12v9H5v-9M7.5 8a2.5 2.5 0 0 1 0-5C11 3 12 8 12 8s1-5 4.5-5a2.5 2.5 0 0 1 0 5'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='4' rx='1'/%3E%3Cpath d='M12 8v13M19 12v9H5v-9M7.5 8a2.5 2.5 0 0 1 0-5C11 3 12 8 12 8s1-5 4.5-5a2.5 2.5 0 0 1 0 5'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .nav.has-menu .nav-auth .nav-signup {
    padding: 10px 18px; border: 1px solid var(--ink, #2a2016);
    background: var(--ink, #2a2016); color: var(--paper, #fbf7f0);
    font: 700 14.5px/1 "Sora", "Segoe UI", sans-serif;
    border-radius: var(--wobble-pill, 999px); box-shadow: 0 4px 14px -10px rgba(42, 32, 22, 0.24);
  }
  .nav.has-menu .nav-auth .nav-signup:hover { background: var(--sanguine, #8e3a1c); border-color: var(--sanguine, #8e3a1c); }
}
