/* Site navigation — shared by every page, linked right after each page's own
   <style>. A page sets only the bar itself (.nav, .nav.scrolled — fixed and
   transparent on the homepage, sticky and frosted on the doc pages) plus any
   theme overrides; everything inside the bar lives here so it reads the same
   on every page. /nav.js drives the signed-in state (html.signed-in). */
.nav-inner { max-width: var(--shell); margin-inline: auto; padding: 14px var(--pad); display: flex; align-items: center; gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; margin-right: auto; color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 600; letter-spacing: -.022em; }
.brand .mark { transition: transform 400ms cubic-bezier(.34,1.4,.5,1), color 200ms ease; }
.brand:hover .mark { color: var(--flame); transform: rotate(-12deg); }
.nav-links { display: flex; gap: 28px; align-items: center; }
/* Top-level items only — menu links are styled separately below. */
.nav-links > a, .nav-drop-btn { position: relative; font-size: 13.5px; font-weight: 450; color: var(--body); text-decoration: none; transition: color 160ms ease; }
/* Underline grows from the centre rather than wiping in from one side. */
.nav-links > a::after, .nav-drop-btn::after { content: ""; position: absolute; left: 50%; right: 50%; bottom: -5px; height: 1.5px; background: var(--red); border-radius: 2px; transition: left 240ms cubic-bezier(.22,.61,.36,1), right 240ms cubic-bezier(.22,.61,.36,1); }
.nav-links > a:hover, .nav-drop-btn:hover { color: var(--ink); }
.nav-links > a:hover::after, .nav-drop-btn:hover::after { left: 0; right: 0; }

/* Dropdowns (the Product menu and the account menu) are pure CSS — :hover and
   :focus-within — so they need no script and work for keyboard users. The
   padding-top on .nav-menu is the hover bridge: without it the pointer falls
   into the gap between button and card and the menu flickers shut. */
.nav-drop { position: relative; display: flex; }
.nav-drop-btn { display: inline-flex; align-items: center; gap: 6px; }
.caret { width: 9px; height: 6px; flex: none; transition: transform 200ms ease; }
.nav-drop:hover .caret, .nav-drop:focus-within .caret { transform: rotate(180deg); }
.nav-menu { position: absolute; top: 100%; left: -16px; padding-top: 14px; z-index: 60; opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity 180ms ease, transform 220ms cubic-bezier(.22,.61,.36,1), visibility 0s linear 180ms; }
.nav-drop:hover .nav-menu, .nav-drop:focus-within .nav-menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.nav-menu-right { left: auto; right: 0; }   /* account menu opens leftwards so it never leaves the viewport */
.nav-menu-card { min-width: 240px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 6px rgba(22,17,15,.06), 0 14px 32px rgba(22,17,15,.07), 0 32px 72px rgba(22,17,15,.06); padding: 8px; display: flex; flex-direction: column; }
.nav-menu-card a, .nav-menu-card button { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 12px; border-radius: 9px; text-decoration: none; font: 500 13.5px var(--sans); color: var(--ink); background: none; border: 0; cursor: pointer; text-align: left; transition: background 140ms ease, color 140ms ease; }
.nav-menu-card a:hover, .nav-menu-card button:hover { background: var(--blush); color: var(--red-d); }
.nav-menu-email { padding: 8px 12px 10px; font-family: var(--mono); font-size: 12px; color: var(--mute); border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }

/* Right-hand side: Log in / Sign up for visitors, the account circle when signed in. */
.nav .btn { padding: 9px 17px; font-size: 13.5px; }
.nav-auth { display: inline-flex; align-items: center; gap: 18px; }
.nav-login { font-size: 13.5px; font-weight: 450; color: var(--body); text-decoration: none; }
.nav-login:hover { color: var(--ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blush); color: var(--red-d); border: 1px solid #F3B4BE; font: 600 14px/1 var(--sans); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.avatar:hover, .nav-user:focus-within .avatar { background: #FBDDE1; border-color: var(--red); }
/* html.signed-in is set by /nav.js in <head>, before first paint, so a
   signed-in visitor never sees Log in / Sign up jump to the circle. */
#nav-user, .nav-console { display: none; }
html.signed-in #nav-user { display: flex; }
html.signed-in .nav-console { display: inline-flex; }
html.signed-in #nav-auth { display: none; }
/* Page bodies swap their calls to action the same way: .when-out is for
   visitors (Sign up, Get an API key), .when-in for signed-in people (Open console). */
html:not(.signed-in) .when-in { display: none !important; }
html.signed-in .when-out { display: none !important; }

/* Narrow screens: drop the secondary items first, keep Pricing / Developers and the Sign up button. */
@media (max-width: 900px) { .nav-links { gap: 18px; } .nav-links > .nav-drop, .nav-links > a[href="/#team"] { display: none; } }
@media (max-width: 600px) { .nav-inner { gap: 14px; } .nav-links > a[href="/#models"], .nav-login { display: none; } .nav .btn { padding: 8px 13px; } html.signed-in .nav-console { display: none; } }
