/*
 * css/topbar.css — Single source of truth for the marketing topbar.
 * Loaded by every marketing page via <link rel="stylesheet" href="/css/topbar.css">.
 * Defines/overrides all .topbar, .topbar-nav, .signin-link, and .topbar-cta rules.
 * Do NOT copy these rules into page-specific CSS files.
 */

/* ── Motion tokens (defined here so topbar.css is self-contained) ─────────── */
:root {
    --radius-pill: 999px;
    --duration-fast:  150ms;
    --duration-base:  220ms;
    --ease-standard:  cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out:       cubic-bezier(0.25, 1, 0.5, 1);
    --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Topbar shell ─────────────────────────────────────────────────────────── */
/*
 * The topbar element must always span the full viewport width so the background
 * extends edge-to-edge. The page-specific CSS (blog.css, help-page.css, etc.)
 * incorrectly applies max-width: 1200px to the header itself — we reset that
 * here. Adaptive padding keeps the brand + nav within a ~1200px centered zone
 * on wide screens without needing an inner wrapper element.
 */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    /* Adaptive horizontal padding: at ≤1200px viewport = 40px each side;
       above 1200px grows so content stays centered in a ~1200px band. */
    padding: 18px max(40px, calc((100vw - 1200px) / 2));
    border-bottom: 1px solid var(--rule);
}

/*
 * Homepage only: .topbar-inner.frame is a flex child of .topbar. By default
 * flex items don't grow, so the frame collapses to content width (747px) instead
 * of expanding to its max-width (1180px). flex-grow: 1 fixes that.
 * Pages without .topbar-inner are unaffected.
 */
.topbar-inner {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Brand mark / icon — sized here so any page using topbar.css gets it ─── */
.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    color: var(--ink, #0E1B2C);
    text-decoration: none;
}
.brand-mark,
.brand-icon {
    width: 28px;
    height: 28px;
    display: inline-block;
    transform: translateY(3px);
    flex-shrink: 0;
}
.brand-mark svg,
.brand-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}
.brand-name {
    font-style: italic;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.015em;
    line-height: 1;
    color: var(--ink, #0E1B2C);
}

/* ── Nav container ────────────────────────────────────────────────────────── */
.topbar-nav {
    display: inline-flex;
    align-items: center;
    gap: 24px;
    font-size: 0.88rem;
    list-style: none;
}

/* ── Nav links (regular content links) ───────────────────────────────────── */
.topbar-nav a {
    color: var(--ink-soft);
    font-weight: 500;
    text-decoration: none !important;
    position: relative;
    padding: 6px 0;
    transition: color var(--duration-fast) var(--ease-standard);
}
.topbar-nav a:hover {
    color: var(--ink);
}

/* Underline draw-in — only on content links, not on auth elements */
.topbar-nav a:not(.signin-link):not(.topbar-cta)::after {
    content: '';
    position: absolute;
    left: 0; bottom: 3px;
    height: 1px; width: 0;
    background: var(--ink);
    transition: width var(--duration-base) var(--ease-out);
}
.topbar-nav a:not(.signin-link):not(.topbar-cta):hover::after {
    width: 100%;
}

/* ── Sign in — quiet text, visually separated from nav links ─────────────── */
.topbar-nav .signin-link,
.signin-link {
    margin-left: 8px;          /* subtle visual gap before auth group */
    color: var(--ink-soft) !important;
    font-weight: 500 !important;
    background: none !important;
    border: none !important;
    padding: 6px 0 !important;
    border-radius: 0 !important;
    font-size: 0.88rem !important;
    white-space: nowrap;
    text-decoration: none !important;
    transition: color var(--duration-fast) var(--ease-standard) !important;
    min-height: unset !important;
}
.topbar-nav .signin-link:hover,
.signin-link:hover {
    color: var(--ink) !important;
    background: none !important;
}
/* No underline draw on Sign in */
.signin-link::after { display: none !important; }

/* ── Start free — sienna pill acquisition CTA ────────────────────────────── */
.topbar-nav .topbar-cta,
.topbar-cta {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 8px 18px !important;
    background: var(--accent) !important;
    color: var(--paper) !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    border-radius: var(--radius-pill) !important;
    border: none !important;
    white-space: nowrap;
    letter-spacing: 0.01em;
    text-decoration: none !important;
    transition:
        background var(--duration-fast) var(--ease-standard),
        transform  var(--duration-base) var(--ease-spring) !important;
}
.topbar-nav .topbar-cta:hover,
.topbar-cta:hover {
    background: var(--accent-deep) !important;
    color: var(--paper) !important;
}
.topbar-cta:active {
    transform: scale(0.97) !important;
}
/* No underline draw on the pill */
.topbar-cta::after { display: none !important; }

/* ── Hairline rule under topbar (if not already in page CSS) ─────────────── */
.topbar::after {
    display: none; /* managed by page CSS; avoid double hairline */
}

/* ── Mobile: hide content nav, keep auth ─────────────────────────────────── */
@media (max-width: 640px) {
    .topbar {
        padding: 14px 20px;
    }
    /* Non-home pages wrap the topbar content in .frame which adds its own
       32px horizontal padding — zero it here so only the topbar's 20px applies.
       (Homepage zeroes topbar padding instead, via .page-home .topbar.) */
    .topbar .frame {
        padding-left: 0;
        padding-right: 0;
    }
    .topbar-nav {
        gap: 14px;
    }
    .topbar-nav a:not(.signin-link):not(.topbar-cta) {
        display: none;
    }
    /* Hide the pill CTA from the topbar rail at mobile — brand (163px) +
       sign-in (46px) + hamburger (44px) + gaps already fills the 353px
       content area. The CTA lives in the hamburger drawer on small screens.
       !important overrides the base rule's inline-flex !important. */
    .topbar-nav .topbar-cta {
        display: none !important;
    }
}

/* ── Hamburger button (injected by nav.js) ──────────────────────────────── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px 8px;
    border-radius: 8px;
    flex-shrink: 0;
    color: inherit;
}
.nav-hamburger span {
    display: block;
    height: 2px;
    width: 22px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.15s ease;
    transform-origin: center;
}
.nav-hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile nav drawer (injected by nav.js after topbar) ───────────────── */
.nav-drawer {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--paper, #FAFAF8);
    border-bottom: 1px solid rgba(14, 27, 44, 0.10);
    box-shadow: 0 12px 40px rgba(14, 27, 44, 0.14);
    transform: translateY(-8px);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.18s ease;
    pointer-events: none;
}
.nav-drawer.is-open {
    display: block;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.nav-drawer .nav-drawer-link,
.nav-drawer .nav-drawer-signin {
    display: block;
    padding: 16px 24px;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--ink, #1C1917);
    border-bottom: 1px solid rgba(14, 27, 44, 0.07);
}
.nav-drawer .nav-drawer-link:hover,
.nav-drawer .nav-drawer-signin:hover { background: rgba(14, 27, 44, 0.03); }
.nav-drawer .nav-drawer-link--current { font-weight: 700; }
.nav-drawer .nav-drawer-signin { color: var(--ink-soft, #57534E); font-weight: 400; }
.nav-drawer .nav-drawer-cta {
    display: block;
    margin: 16px 24px 24px;
    padding: 16px 24px;
    background: var(--accent-deep, #A83817);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    border-radius: 10px;
}
.nav-drawer .nav-drawer-cta:hover { background: #8f2e13; color: #fff; }

/* ── Mobile breakpoint ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .nav-hamburger { display: flex; }
    /* Drawer handles links on mobile — hide them from the topbar */
    .topbar-nav a:not(.signin-link):not(.topbar-cta) { display: none; }
    .topbar-cta { display: none !important; } /* also in drawer */
}
