/* ═══════════════════════════════════════════════════════════════════════════
   misa.lol landing · navigation
   ───────────────────────────────────────────────────────────────────────────
   Landing-only styling of the shared header. navigation.css (shared with the
   inner pages) loads first and keeps the structure, colours and the TOS
   dropdown; this file turns the bar into the floating pill, adds the
   hide-on-scroll state that landing/nav.js drives, the phone menu that the
   shared mobile-header.js toggles, and the fixed scroll-progress bar.

   Selectors keep the `.landing-atmosphere` prefix so they outrank the shared
   rules by specificity, not only by load order. The pill's background stays
   at (0,2,0) so render-mode's `html.gpu-lite .site-nav` (0,2,1) still wins on
   software renderers.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Scroll progress ── */

/* Fixed 2px bar; nav.js scales it on the compositor (transform only). */
.progress {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  z-index: 80;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--crimson), #ff6a8a);
  transform: scaleX(0) translateZ(0);
  transform-origin: 0 50%;
  will-change: transform;
  pointer-events: none;
}

/* ── Pill header (desktop) ── */

.landing-atmosphere .site-nav--pill {
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  width: calc(100% - 32px);
  max-width: 1680px;
  min-height: 72px;
  margin: 12px auto;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(165deg, #252128 0%, #151316 42%, #101011 72%);
  box-shadow: inset 0 1px 0 #ffffff24, inset 0 -1px 0 #ffffff08, 0 12px 32px -24px #0009;
  font-size: clamp(18px, 1.4vw, 26px);
  /* navigation.css promotes the bar with translateZ(0); its will-change already keeps the pill on its own layer. */
  transform: none;
  /* The pill is opaque, so the shared bar's blur is not needed (perf). */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.landing-atmosphere .site-nav--pill .site-nav__in {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  min-width: 0;
  padding: 12px 28px;
}

.landing-atmosphere .site-nav--pill .site-nav__brand {
  gap: 9px;
  font-size: clamp(26px, 2.2vw, 34px);
}

.landing-atmosphere .site-nav--pill .site-nav__links {
  grid-column: 2;
  grid-row: 1;
  gap: 0;
}

.landing-atmosphere .site-nav--pill .site-nav__links > a,
.landing-atmosphere .site-nav--pill .site-nav__tos > summary {
  min-height: 52px;
  padding-inline: 9px;
  font-size: clamp(13px, 1vw, 17px);
}

.landing-atmosphere .site-nav--pill .site-nav__cta {
  grid-column: 3;
  grid-row: 1;
}

/* ── Hidden while scrolling down (nav.js toggles .hide) ── */

.landing-atmosphere .site-nav--pill.hide {
  transform: translateY(calc(-100% - env(safe-area-inset-top, 0px) - 32px));
  pointer-events: none;
}

/* Keyboard focus, the open phone menu and the open TOS dropdown keep it on screen. */
.landing-atmosphere .site-nav--pill:focus-within,
.landing-atmosphere .site-nav--pill.mobile-menu-open,
.landing-atmosphere .site-nav--pill:has(details[open]) {
  transform: none;
  pointer-events: auto;
}

/* ── Phone controls (hidden until the breakpoints below show them) ── */

.mobile-dashboard,
.mobile-menu-toggle {
  display: none;
}

.landing-atmosphere .site-nav--pill .site-nav__links > .mobile-nav-dashboard {
  display: none;
}

/* ── Short desktop viewports ── */

/* Below 1051px the phone header's margin:0 wins, so the old min-width:601px range is effectively this one. */
@media (min-width: 1051px) and (max-height: 500px) {
  .landing-atmosphere .site-nav--pill {
    margin-block: 6px;
  }
}

/* ── ≤1099px: links tighten one step before the phone header takes over ── */

@media (max-width: 1099px) {
  .landing-atmosphere .site-nav--pill .site-nav__links > a,
  .landing-atmosphere .site-nav--pill .site-nav__tos > summary {
    min-height: 36px;
    padding-block: 6px;
  }
}

/* ── ≤1050px: full-width bar with a menu button; the links become a panel ── */

@media (max-width: 1050px) {
  .landing-atmosphere .site-nav--pill {
    margin: 0 auto;
    padding: env(safe-area-inset-top, 0px) 0 0;
    border-radius: 0;
    background: #080809;
    box-shadow: none;
  }

  .landing-atmosphere .site-nav--pill .site-nav__in {
    grid-template-columns: minmax(0, 1fr) auto 44px;
    gap: 8px;
    padding: 8px 14px;
  }

  .landing-atmosphere .site-nav--pill .site-nav__brand {
    gap: 6px;
    font-size: clamp(21px, 5.5vw, 24px);
  }

  .landing-atmosphere .site-nav--pill .site-nav__cta {
    display: none;
  }

  .landing-atmosphere .mobile-dashboard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 13px;
    border-radius: 999px;
    background: #eee8e2;
    color: #080809;
    font: 700 13px/1.2 Inter, system-ui, sans-serif;
    white-space: nowrap;
  }

  .landing-atmosphere .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 0;
    background: none;
    color: #f00646;
    cursor: pointer;
  }

  .mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    border-radius: 3px;
    background: currentColor;
    transition: transform .25s, opacity .2s;
  }

  .mobile-menu-toggle[aria-expanded="true"] span:first-child {
    transform: translateY(9px) rotate(45deg);
  }

  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle[aria-expanded="true"] span:last-child {
    transform: translateY(-9px) rotate(-45deg);
  }

  .mobile-menu-toggle:focus-visible {
    outline: 2px solid #f00646;
    outline-offset: 2px;
    border-radius: 8px;
  }

  .landing-atmosphere .site-nav--pill .site-nav__links {
    display: none;
    position: absolute;
    top: calc(100% - 2px);
    right: 12px;
    left: 12px;
    grid-column: auto;
    grid-row: auto;
    width: auto;
    gap: 4px;
    padding: 12px;
    border: 1px solid #ffffff20;
    border-radius: 18px;
    background: #101011;
    box-shadow: 0 18px 40px #000a;
  }

  .landing-atmosphere .site-nav--pill.mobile-menu-open .site-nav__links {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .landing-atmosphere .site-nav--pill .site-nav__links > a,
  .landing-atmosphere .site-nav--pill .site-nav__tos > summary {
    min-height: 44px;
    padding-inline: 12px;
    font-size: clamp(14px, 1.2vw, 18px);
  }

  .landing-atmosphere .site-nav--pill .site-nav__tos {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

/* ── ≤760px ── */

@media (max-width: 760px) {
  .landing-atmosphere .site-nav--pill {
    width: calc(100% - 20px);
    min-height: 60px;
  }
}

/* ── ≤700px: the phone experience — floating pill, single-column menu ── */

@media (max-width: 700px) {
  .landing-atmosphere .site-nav--pill {
    top: 12px;
    width: calc(100% - 28px);
    max-width: 512px;
    min-height: 64px;
    margin: 16px auto 0;
    padding: 0;
    border: 1px solid #ffffff0d;
    border-radius: 999px;
    background: #121114f2;
    box-shadow: 0 12px 32px #0004;
  }

  .landing-atmosphere .site-nav--pill .site-nav__in {
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 14px;
    padding: 9px 19px;
  }

  .landing-atmosphere .site-nav--pill .site-nav__brand {
    gap: 9px;
    font-size: 25px;
    letter-spacing: -.035em;
  }

  .landing-atmosphere .site-nav--pill .site-nav__mark {
    width: 23px;
    height: 35px;
  }

  .landing-atmosphere .site-nav--pill .mobile-dashboard {
    display: none;
  }

  .landing-atmosphere .site-nav--pill .mobile-menu-toggle {
    align-items: center;
  }

  .landing-atmosphere .site-nav--pill .site-nav__links {
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    max-height: calc(100svh - 120px);
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-color: #ffffff15;
    border-radius: 24px;
    background: #151216;
    box-shadow: 0 24px 60px #0009;
  }

  .landing-atmosphere .site-nav--pill.mobile-menu-open .site-nav__links {
    grid-template-columns: 1fr;
  }

  .landing-atmosphere .site-nav--pill .site-nav__links > a {
    justify-content: space-between;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 16px;
    text-align: left;
  }

  .landing-atmosphere .site-nav--pill .site-nav__links > .mobile-nav-dashboard {
    display: flex;
    margin-bottom: 8px;
    background: #eee8e2;
    color: #141115;
    font-weight: 650;
  }

  .landing-atmosphere .site-nav--pill .site-nav__tos {
    width: 100%;
    justify-self: stretch;
  }

  .landing-atmosphere .site-nav--pill .site-nav__tos > summary {
    justify-content: space-between;
    padding: 12px 14px;
  }
}

/* ── ≤600px ── */

@media (max-width: 600px) {
  /* navigation.css gives the summary a 96px minimum from 540px down; the phone menu has no room for it. */
  .landing-atmosphere .site-nav--pill .site-nav__tos > summary {
    min-width: 0;
  }
}

/* ── ≤360px ── */

@media (max-width: 360px) {
  .landing-atmosphere .site-nav--pill .site-nav__brand {
    font-size: 23px;
  }
}

/* ── Motion ── */

@media (prefers-reduced-motion: reduce) {
  /* Re-asserts the shared rule: the menu button's own transition above loads after navigation.css. */
  .mobile-menu-toggle span {
    transition: none;
  }
}
