/*
 * Chrome for the logged-out surfaces: the public topbar, the public footer and
 * the handful of primitives the public pages share (hero, card grid, table,
 * pagination, sign-in CTA).
 *
 * Loaded by app/Views/template/public_topbar.php. The signed-in app never pulls
 * this file - a member sees the normal SPA shell instead.
 *
 * Palette is the user-side redesign palette, same tokens the landing page uses.
 */

:root {
    /* Near-black with the app's orange, matching the landing page and the
       logged-in app. See docs/PUBLIC-SEO.md. */
    --lp-bg:           #0d0d0e;
    --lp-bg-2:         #09090a;
    --lp-card:         #151516;
    --lp-card-hover:   #1b1b1d;
    --lp-border:       rgba(255, 153, 0, 0.22);
    --lp-border-soft:  rgba(255, 255, 255, 0.07);
    --lp-accent:       #ff9900;
    --lp-accent-2:     #ffb84d;
    --lp-text:         #f2f2f2;
    --lp-text-soft:    rgba(242, 242, 242, 0.76);
    --lp-text-muted:   rgba(242, 242, 242, 0.60);
    --lp-f-display:    'Rajdhani', system-ui, -apple-system, sans-serif;
    --lp-f-body:       'Exo 2', system-ui, -apple-system, sans-serif;
    --lp-f-mono:       'IBM Plex Mono', ui-monospace, monospace;
    --lp-ease:         cubic-bezier(.21, .61, .35, 1);
}

html, body {
    background: var(--lp-bg);
    color: var(--lp-text);
    font-family: var(--lp-f-body);
}

.lp-shell {
    /* Push content below the fixed 64px-tall nav */
    padding-top: 64px;
    min-height: 100vh;
    background: var(--lp-bg);
}
/* The guest pages render into <main class="lp-shell content">. dark.css gives
   .content its own padding and a 100vw width under 768px, so restate the nav
   clearance here (it used to be cancelled by a p-0 utility, which left the top
   of every guest page under the nav). --lp-nav-h is 56px on phones. */
.lp-shell.content {
    padding: calc(var(--lp-nav-h, 64px) + var(--vt-safe-t, 0px)) 0 0;
    width: auto;
    max-width: 100%;
}

/* Fixed nav (port of the fabby landing .lp-nav) */
.lp-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(13, 13, 14, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--lp-border);
    transition: background 0.3s var(--lp-ease);
}
.lp-nav.scrolled { background: rgba(13, 13, 14, 0.94); }

.lp-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex: 0 0 auto;
}
.lp-brand img { width: 32px; height: 32px; }
.lp-brand > span {
    font-family: var(--lp-f-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--lp-text);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.lp-brand-dot { color: var(--lp-accent); }

.lp-nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0; padding: 0;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.lp-nav-links::-webkit-scrollbar { display: none; }
/* Each link is a 44px tap box; the negative margin and the smaller gap keep
   the text exactly where it was. */
.lp-nav-links {
    --lp-link-px: .6rem;
    gap: calc(2rem - 2 * var(--lp-link-px));
    margin: 0 calc(-1 * var(--lp-link-px));
}
.lp-nav-links a {
    display: inline-block;
    padding: .9rem var(--lp-link-px);
    font-family: var(--lp-f-mono);
    font-size: 0.75rem;
    color: var(--lp-text-soft);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: color 0.25s var(--lp-ease);
    position: relative;
    text-decoration: none;
    white-space: nowrap;
}
.lp-nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px; left: 0;
    width: 0; height: 1px;
    background: var(--lp-accent);
    transition: width 0.3s var(--lp-ease);
}
.lp-nav-links a:hover,
.lp-nav-links a.active { color: var(--lp-accent); }
.lp-nav-links a:hover::after,
.lp-nav-links a.active::after { width: 100%; }

/* Sign-in button in the nav */
.lp-nav-cta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    border-radius: 0;
    border: 1px solid var(--lp-border);
    background: rgba(255, 153, 0, 0.08);
    color: var(--lp-accent);
    font-family: var(--lp-f-mono);
    font-size: .72rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: background .25s var(--lp-ease), color .25s var(--lp-ease);
}
.lp-nav-cta:hover { background: var(--lp-accent); color: #161617; }

/* Page primitives shared by the public pages */
.lp-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}
.lp-page-head { margin-bottom: 2rem; }
.lp-page-head h1 {
    font-family: var(--lp-f-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    letter-spacing: .5px;
    margin: 0 0 .5rem;
    color: var(--lp-text);
}
.lp-page-head p {
    margin: 0;
    color: var(--lp-text-soft);
    max-width: 70ch;
    line-height: 1.6;
}

.lp-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
    font-family: var(--lp-f-mono);
    font-size: .7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--lp-text-muted);
    margin-bottom: 1rem;
}
.lp-crumbs a { color: var(--lp-text-muted); text-decoration: none; }
.lp-crumbs a:hover { color: var(--lp-accent); }

.lp-card {
    background: var(--lp-card);
    border: 1px solid var(--lp-border-soft);
    border-radius: 0;
    padding: 1.25rem;
    transition: background .2s var(--lp-ease), border-color .2s var(--lp-ease);
}
a.lp-card { display: block; text-decoration: none; color: inherit; }
a.lp-card:hover { background: var(--lp-card-hover); border-color: var(--lp-border); }

.lp-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.lp-table-wrap { overflow-x: auto; }
.lp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.lp-table th {
    text-align: left;
    font-family: var(--lp-f-mono);
    font-size: .68rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--lp-text-muted);
    padding: .65rem .8rem;
    border-bottom: 1px solid var(--lp-border-soft);
    white-space: nowrap;
}
.lp-table td {
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--lp-border-soft);
    color: var(--lp-text);
}
.lp-table tbody tr:hover { background: var(--lp-card-hover); }
.lp-table a { color: inherit; text-decoration: none; }
.lp-table a:hover { color: var(--lp-accent); }
.lp-table .ta-r { text-align: right; }

.lp-pager {
    display: flex;
    gap: .5rem;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}
.lp-pager a, .lp-pager span {
    padding: .45rem .8rem;
    border-radius: 0;
    border: 1px solid var(--lp-border-soft);
    font-family: var(--lp-f-mono);
    font-size: .75rem;
    color: var(--lp-text-soft);
    text-decoration: none;
}
.lp-pager a:hover { border-color: var(--lp-border); color: var(--lp-accent); }
.lp-pager .is-current { background: var(--lp-card); color: var(--lp-accent); border-color: var(--lp-border); }

/* The conversion unit: every public page ends on one of these */
.lp-cta {
    margin-top: 3rem;
    padding: 2rem;
    border-radius: 0;
    border: 1px solid var(--lp-border);
    background: linear-gradient(135deg, rgba(255,153,0,.10), rgba(255,153,0,.02));
    text-align: center;
}
.lp-cta h2 {
    font-family: var(--lp-f-display);
    font-size: 1.5rem;
    margin: 0 0 .5rem;
    color: var(--lp-text);
}
.lp-cta p {
    margin: 0 auto 1.25rem;
    max-width: 60ch;
    color: var(--lp-text-soft);
    line-height: 1.6;
}
.lp-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .75rem 1.5rem;
    border-radius: 0;
    background: var(--lp-accent);
    color: #161617;
    font-family: var(--lp-f-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: .5px;
    text-transform: uppercase;
    text-decoration: none;
    transition: background .2s var(--lp-ease);
}
.lp-cta-btn:hover { background: var(--lp-accent-2); color: #161617; }

/* Footer */
.lp-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    padding: 1.6rem 2rem;
    background: var(--lp-bg-2);
    border-top: 1px solid var(--lp-border);
    font-family: var(--lp-f-mono);
    font-size: 0.75rem;
    color: var(--lp-text-muted);
    letter-spacing: 0.3px;
}
.lp-footer a { color: var(--lp-text-muted); text-decoration: none; }
.lp-footer a:hover { color: var(--lp-accent); }
.lp-footer-brand {
    font-family: var(--lp-f-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--lp-text);
}
.lp-footer-brand .dot { color: var(--lp-accent); }
.lp-footer-copy {
    font-size: 0.72rem;
    color: var(--lp-text-muted);
    margin-top: 2px;
}
.lp-footer-right {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.lp-footer-right a {
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-size: 0.7rem;
    transition: color 0.2s var(--lp-ease);
}

@media (max-width: 860px) {
    .lp-nav { padding: 0 1.2rem; }
    .lp-nav-links { --lp-link-px: .55rem; gap: 0; }
    .lp-nav-links a { font-size: .7rem; letter-spacing: 1px; }
}
@media (max-width: 720px) {
    .lp-page { padding: 1.75rem 1rem 3rem; }
    .lp-footer { flex-direction: column; align-items: flex-start; padding: 1.4rem 1.2rem; }
    .lp-footer-right { gap: 1rem; }
}

/*
 * Legal-page variant of the nav: three columns so the four legal sub-pages sit
 * in the middle with Home/Blog on the right. Used by template/public_topbar_legal.php.
 */
.lp-nav--legal {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
}
.lp-nav--legal > .lp-brand { justify-self: start; }
.lp-nav--legal .lp-nav-center { justify-self: center; }
.lp-nav--legal .lp-nav-right  { justify-self: end; }

@media (max-width: 960px) {
    .lp-nav--legal .lp-nav-center { display: none; }
    .lp-nav--legal { grid-template-columns: 1fr auto; }
}

/*
 * Phones and tablets (docs/MOBILE.md 3.8). Under 768px the link row folds into
 * a menu (<details class="lp-menu">, closed by js/public-chrome.js on an
 * outside tap or Esc) and the bottom tab bar (template/partials/nav.php) takes
 * over the sign-in button. Desktop is unchanged.
 */
.lp-menu { display: none; }
@media (max-width: 1199.98px), (any-pointer: coarse) {
    .lp-nav-cta { min-height: 44px; }
}
@media (max-width: 767.98px) {
    :root { --lp-nav-h: 56px; }
    .lp-nav,
    .lp-nav--legal {
        display: flex;
        height: calc(var(--lp-nav-h) + var(--vt-safe-t, 0px));
        padding: var(--vt-safe-t, 0px) calc(4px + var(--vt-safe-r, 0px)) 0 calc(16px + var(--vt-safe-l, 0px));
        gap: 4px;
    }
    .lp-nav-links,
    .lp-nav--legal .lp-nav-center,
    .lp-nav--legal .lp-nav-right { display: none !important; }
    .lp-nav-cta {
        margin-left: auto;
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
        border: 0;
        background: none;
        font-size: 0;
    }
    .lp-nav-cta i { font-size: 1.15rem; }
    .lp-menu { display: block; margin-left: auto; }
    .lp-nav-cta + .lp-menu { margin-left: 0; }
    .lp-menu > summary {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        list-style: none;
        color: var(--lp-text);
        font-size: 1.15rem;
        cursor: pointer;
    }
    .lp-menu > summary::-webkit-details-marker { display: none; }
    .lp-menu > summary i { color: inherit; }
    .lp-menu[open] > summary { color: var(--lp-accent); }
    /* While open, the summary's own backdrop covers the page: a tap outside the
       panel lands on the summary, which closes the menu and goes no further. */
    .lp-menu[open] > summary::before {
        content: "";
        position: fixed;
        left: 0;
        right: 0;
        top: calc(var(--lp-nav-h) + var(--vt-safe-t, 0px));
        height: 100vh;
        z-index: 1000;
        background: rgba(9, 9, 10, 0.6);
        cursor: default;
    }
    .lp-menu-panel {
        position: fixed;
        left: 0;
        right: 0;
        top: calc(var(--lp-nav-h) + var(--vt-safe-t, 0px));
        z-index: 1001;
        max-height: calc(100vh - var(--lp-nav-h) - var(--vt-safe-t, 0px) - var(--vt-tabbar-h, 0px));
        max-height: calc(100dvh - var(--lp-nav-h) - var(--vt-safe-t, 0px) - var(--vt-tabbar-h, 0px) - var(--vt-safe-b, 0px));
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 8px 0 calc(8px + var(--vt-safe-b, 0px));
        background: var(--lp-bg);
        border-bottom: 2px solid var(--lp-accent);
        box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
    }
    .lp-menu-panel a {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 0 calc(16px + var(--vt-safe-r, 0px)) 0 calc(16px + var(--vt-safe-l, 0px));
        color: var(--lp-text-soft);
        font: 600 .95rem/1 var(--lp-f-display);
        letter-spacing: .06em;
        text-transform: uppercase;
        text-decoration: none;
    }
    .lp-menu-panel a:hover { color: var(--lp-text); background: var(--lp-card); }
    .lp-menu-panel a.active {
        color: var(--lp-accent);
        background: rgba(255, 153, 0, .08);
        box-shadow: inset 3px 0 0 var(--lp-accent);
    }
    .lp-menu-sep { height: 1px; margin: 6px 16px; background: var(--lp-border-soft); }

    .lp-footer { padding-bottom: calc(1.4rem + var(--vt-tabbar-h, 0px) + var(--vt-safe-b, 0px)); }
    .lp-footer-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 1rem;
        width: 100%;
    }
    .lp-footer-right a { display: flex; align-items: center; min-height: 44px; }
}
/* Phones in portrait: the bottom bar carries Sign in. */
@media (max-width: 767.98px) and (min-height: 501px) {
    .vt-has-tabbar .lp-nav-cta { display: none; }
}

/* Footer links on touch at tablet widths too (the phone grid is above). */
@media (any-pointer: coarse) {
    .lp-footer-right a { display: inline-flex; align-items: center; min-height: 44px; }
    .lp-footer-copy a { padding-block: 14px; }
}
