/* ── The public-site header (templates/includes/site_header.html) ────────────────────────────────
   One stylesheet for the ONE header, loaded on every public page by site_header_head.html — the
   landing-skin pages (with landing.css), the simple-skin pages (trellis.css), the blog posts.
   It may not depend on any page stylesheet, so it carries its own colours, fonts and resets; and no
   page stylesheet may restyle the header (owner report 2026-10-13: the header moved between pages).
   Bump `site-header.css?v=` in site_header_head.html on every change. */

:root {
    --sh-primary: #11B6E2;
    --sh-accent: #CEFE05;
    --sh-dark: #00121B;
    /* Metric-matched fallbacks (google_fonts.html): the swap to the web font moves nothing. */
    --sh-font-poppins: 'Poppins', 'Poppins Fallback', 'Poppins Fallback Android', sans-serif;
    --sh-font-inter: 'Inter', 'Inter Fallback', 'Inter Fallback Android', sans-serif;
}

/* A page with a scrollbar and one without centred the header ~15px apart on desktop browsers that
   draw classic scrollbars. */
html {
    scrollbar-gutter: stable;
}

/* Zero-specificity resets: the page's own element rules (trellis.css `header`/`nav`, Tailwind's
   preflight, Frappe's bootstrap) must not reach in, and every class rule below still wins. */
:where(.lp-header, .lp-header *, .lp-mobile-nav, .lp-mobile-nav *) {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:where(.lp-header, .lp-mobile-nav) a {
    text-decoration: none;
    color: inherit;
}

:where(.lp-header, .lp-mobile-nav) button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

:where(.lp-header, .lp-mobile-nav) img {
    max-width: 100%;
    height: auto;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.lp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 64px;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    z-index: 100;
    border: 0;
    font-family: var(--sh-font-poppins);
    line-height: normal;
    -webkit-font-smoothing: antialiased;
}

.lp-header__logo {
    display: inline-flex;
    flex-shrink: 0;
}

/* The box is fixed before the image arrives and identical on every page (the simple-skin pages drew
   a 113x32 logo). */
.lp-header__logo img {
    display: block;
    height: 29px;
    width: auto;
    aspect-ratio: 1024 / 290;
}

.lp-header__nav {
    display: flex;
    justify-content: flex-start;
    gap: 32px;
    align-items: center;
    list-style: none;
}

.lp-header__nav a {
    font-family: var(--sh-font-poppins);
    font-weight: 500;
    font-size: 16px;
    color: var(--sh-dark);
    letter-spacing: -0.08px;
    transition: color 0.2s;
    /* Each link is as wide as its BOLD label (the hidden ::after below), so the bold current-page
       link never pushes its neighbours. */
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.lp-header__nav a::after {
    content: attr(data-label);
    font-weight: 700;
    height: 0;
    overflow: hidden;
    visibility: hidden;
    user-select: none;
    pointer-events: none;
}

.lp-header__nav a:hover {
    color: var(--sh-primary);
}

.lp-header__nav a.active,
.lp-mobile-nav a.active {
    color: var(--sh-primary);
    font-weight: 700;
}

.lp-header__actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.lp-header__login {
    font-family: var(--sh-font-poppins);
    font-weight: 600;
    font-size: 16px;
    color: #000;
    letter-spacing: -0.08px;
}

.lp-header__login:hover {
    color: var(--sh-primary);
}

.lp-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--sh-accent);
    border-radius: 30px;
    font-family: var(--sh-font-poppins);
    font-weight: 600;
    font-size: 16px;
    line-height: normal;
    color: var(--sh-dark);
    letter-spacing: -0.08px;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.lp-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Hamburger */
.lp-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    padding: 4px;
    position: relative;
}

/* The drawn button is 32x24; a phone tap target should be 48x48. The pseudo-element widens the HIT
   area only (8px each side, 12px above/below): nothing moves, and the 24px actions gap and the
   header padding keep it clear of its neighbours. */
.lp-hamburger::before {
    content: "";
    position: absolute;
    inset: -12px -8px;
}

.lp-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--sh-dark);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

/* Mobile Nav Overlay */
.lp-mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.98);
    /* 101, not 99: a fixed element is its own stacking layer and the sticky header is 100 —
       at 99 the header painted over the drawer's × (owner, 2026-09-25). */
    z-index: 101;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    font-family: var(--sh-font-poppins);
    line-height: normal;
    -webkit-font-smoothing: antialiased;
}

.lp-mobile-nav.open {
    display: flex;
}

.lp-mobile-nav a {
    font-family: var(--sh-font-poppins);
    font-weight: 500;
    font-size: 20px;
    color: var(--sh-dark);
}

.lp-mobile-nav__close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    font-size: 32px;
    color: var(--sh-dark);
    line-height: 1;
}

/* ── User menu pill ─────────────────────────────────────────────────────────
   Signed-in visitors only: gated by `html.is-authed` (auth_nav_head.html, from the `user_id`
   cookie) — the pages are path-cached, so nothing here branches server-side. Name, initials and
   photo are written client-side by the include's script. */
.lp-user {
    position: relative;
    display: none;
}

html.is-authed .lp-user {
    display: block;
}

.lp-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    background: var(--sh-primary);
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
}

.lp-user-pill:hover {
    background: rgba(17, 182, 226, .9);
}

.lp-user-pill:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sh-primary);
}

.lp-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #E5E7EB;
    color: #6B7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: var(--sh-font-poppins);
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

/* The profile photo fills the circle; until it loads (and if it fails) the initials show. */
.lp-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

.lp-user-pill .lp-avatar {
    border: 2px solid #fff;
}

.lp-user-pill svg {
    width: 16px;
    height: 16px;
}

.lp-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1), 0 0 0 1px rgba(0, 0, 0, .05);
    padding: 4px 0;
    overflow: hidden;
    /* inside the header's stacking layer (100) */
    z-index: 110;
}

.lp-user-menu[hidden] {
    display: none;
}

.lp-user-menu__head {
    padding: 16px 20px 12px;
}

.lp-user-menu__id {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.lp-user-menu__id .lp-avatar {
    box-shadow: 0 0 0 2px rgba(17, 182, 226, .5);
}

.lp-user-menu__name {
    font-family: var(--sh-font-poppins);
    font-weight: 700;
    font-size: 16px;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lp-user-menu__email {
    font-size: 12px;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lp-user-menu__email[hidden] {
    display: none;
}

.lp-user-menu__rule {
    margin-top: 12px;
    border-bottom: 2px solid rgba(17, 182, 226, .4);
}

.lp-user-menu__group {
    padding: 4px 8px;
}

.lp-user-menu__sep {
    height: 1px;
    background: #F3F4F6;
    margin: 2px 16px;
}

.lp-user-menu__item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 12px;
    background: none;
    font-family: var(--sh-font-inter);
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    text-align: left;
}

.lp-user-menu__item:hover,
.lp-user-menu__item:focus-visible {
    background: #F3F4F6;
    color: #111827;
    outline: none;
}

.lp-user-menu__item svg {
    width: 20px;
    height: 20px;
    color: #9CA3AF;
    flex-shrink: 0;
}

/* Phone drawer user block (the header pill is hidden under 768px; it lives here instead). */
.lp-mobile-nav__user {
    display: none;
}

html.is-authed .lp-mobile-nav__user {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 260px;
}

/* The drawer's bottom "Open Workspace" link yields to the one in the user block. SIBLING-scoped on
   purpose: a `#mobileNav > a…` form would also strip it from a guest's drawer. */
html.is-authed .lp-mobile-nav__user ~ a.js-workspace-link {
    display: none;
}

/* Authed drawer: top-aligned and scrollable so ~11 rows fit a 667px phone; guests stay centred. */
html.is-authed .lp-mobile-nav {
    justify-content: flex-start;
    padding: 72px 0 32px;
    overflow-y: auto;
}

.lp-mobile-nav__who {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 2px solid rgba(17, 182, 226, .4);
}

.lp-mobile-nav__who .lp-avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--sh-primary);
}

.lp-mobile-nav__who .lp-avatar svg {
    width: 20px;
    height: 20px;
}

.lp-mobile-nav__name {
    font-family: var(--sh-font-poppins);
    font-weight: 600;
    font-size: 18px;
    color: var(--sh-dark);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lp-mobile-nav .lp-mobile-nav__row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    width: 100%;
    background: none;
    font-family: var(--sh-font-poppins);
    font-weight: 500;
    font-size: 17px;
    color: var(--sh-dark);
    text-align: left;
    padding: 0;
}

.lp-mobile-nav__row svg {
    width: 20px;
    height: 20px;
    color: #6B7280;
    flex-shrink: 0;
}

.lp-mobile-nav .lp-mobile-nav__row--primary {
    color: var(--sh-primary);
    font-weight: 600;
}

.lp-mobile-nav__row--primary svg {
    color: var(--sh-primary);
}

.lp-mobile-nav__divider {
    display: none;
    width: 260px;
    height: 1px;
    background: #E5E7EB;
}

html.is-authed .lp-mobile-nav__divider {
    display: block;
}

/* ── iPad / Tablet (768–1024px) ─────────────────────────────────────────── */
@media (max-width: 1024px) {
    .lp-header {
        padding: 18px 32px;
    }

    .lp-header__nav {
        gap: 20px;
    }

    .lp-header__nav a {
        font-size: 14px;
    }
}

/* ── Mobile (<768px) ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .lp-header {
        padding: 16px 20px;
    }

    .lp-header__nav {
        display: none;
    }

    .lp-hamburger {
        display: flex;
    }

    .lp-header__actions .lp-header__login {
        display: none;
    }

    /* phone: the user pill lives in the drawer (.lp-mobile-nav__user). `html.is-authed` in
       the selector so it outranks the `html.is-authed .lp-user { display: block }` gate. */
    html.is-authed .lp-header__actions .lp-user {
        display: none;
    }
}

/* ── Small Mobile (<480px) ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .lp-btn-primary {
        font-size: 15px;
        padding: 10px 20px;
    }
}
