/* hotpath.rs top nav - shared by the docs and blog books via this theme/ dir.
   Terminal-prompt styling that ignores the mdbook theme toggle. The bar is
   fixed, outside mdbook's layout: header.hbs moves it to <body>, and the rules
   at the end of this file push everything else below it. */

/* Top Nav */
:root {
    --hp-nav-h: 48px;
    --hp-nav-bg: #0d0d0d;
    --hp-nav-border: rgba(255, 255, 255, 0.1);
    --hp-ember: #ffb454;
    --hp-prompt-green: #98c379;
    --hp-nav-fg: #e6e1d6;
    --hp-nav-fg-dim: rgba(230, 225, 214, 0.65);
    --hp-nav-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

.hp-topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--hp-nav-h);
    z-index: 1100;               /* above the fixed sidebar + menu-bar */
    background: var(--hp-nav-bg);
    border-bottom: 1px solid var(--hp-nav-border);
    box-sizing: border-box;
    font-family: var(--hp-nav-mono);
}

.hp-topnav-inner {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    height: 100%;
    padding: 0 16px;
}

.hp-brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5em;
    flex: 0 0 auto;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
}

.hp-brand:hover {
    text-decoration: none;
}

.hp-brand-prompt {
    color: var(--hp-prompt-green);
    user-select: none;
}

.hp-brand-cmd {
    color: var(--hp-ember);
}

.hp-brand:hover .hp-brand-cmd {
    text-shadow: 0 0 12px rgba(255, 180, 84, 0.45);
}

/* :visited variants needed throughout - mdbook's `a:visited { color: var(--links) }`
   otherwise out-specifies the plain class and turns visited items blue */
.hp-navlink,
.hp-navlink:visited {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 100%;
    flex: 0 0 auto;
    color: var(--hp-nav-fg-dim);
    font-size: 14px;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color 0.15s ease;
}

.hp-navlink:hover {
    color: var(--hp-nav-fg);
    text-decoration: none;
}

/* Heat strip: flamegraph-gradient underline marks the active route */
.hp-navlink::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, #ff8a3d, #ffb454);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.hp-navlink.active,
.hp-navlink.active:visited {
    color: var(--hp-ember);
}

.hp-navlink.active::after {
    opacity: 1;
    box-shadow: 0 2px 10px rgba(255, 180, 84, 0.35);
}

/* The repository, closing the left-hand group */
.hp-github,
.hp-github:visited {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    height: 100%;
    color: var(--hp-nav-fg-dim);
    text-decoration: none;
    transition: color 0.15s ease;
}

.hp-github:hover {
    color: var(--hp-nav-fg);
    text-decoration: none;
}

.hp-github-stars {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    font-size: 13px;
    white-space: nowrap;
}

/* hotpath-cloud: the product entry point, a filled button on the far right.
   It glows on its own page, where the links have the heat strip. */
.hp-cloud-button,
.hp-cloud-button:visited {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    flex: 0 0 auto;
    margin-left: auto;
    padding: 0 10px;
    box-sizing: border-box;
    height: 30px;
    border: 1px solid var(--hp-ember);
    border-radius: 6px;
    background: var(--hp-ember);
    color: var(--hp-nav-bg);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hp-cloud-button:hover {
    border-color: #ffc980;
    background: #ffc980;
    text-decoration: none;
}

/* The star count needs about 70px more than the rest of the row */
@media (max-width: 580px) {
    .hp-github-stars {
        display: none;
    }
}

/* The full row needs about 490px: tighten it, then drop the prompt and
   arrow, then shorten the button to the product name */
@media (max-width: 510px) {
    .hp-topnav-inner {
        gap: 10px;
        padding: 0 10px;
    }

    .hp-brand {
        font-size: 13px;
        letter-spacing: 0;
    }

    .hp-navlink,
    .hp-navlink:visited {
        font-size: 12px;
        letter-spacing: 0;
    }

    .hp-cloud-button,
    .hp-cloud-button:visited {
        padding: 0 7px;
        font-size: 12px;
        letter-spacing: 0;
    }
}

@media (max-width: 409px) {
    .hp-topnav-inner {
        gap: 6px;
        padding: 0 8px;
    }

    .hp-brand-prompt,
    .hp-cloud-arrow {
        display: none;
    }
}

@media (max-width: 359px) {
    .hp-cloud-try {
        display: none;
    }
}

/* The brand shrinks to its prompt: font-size 0 keeps the name for screen readers */
@media (max-width: 319px) {
    .hp-brand {
        gap: 0;
    }

    .hp-brand-prompt {
        display: inline;
    }

    .hp-brand-cmd {
        font-size: 0;
    }
}

@media (max-width: 249px) {
    .hp-github,
    .hp-github:visited {
        display: none;
    }
}

.hp-brand:focus-visible,
.hp-navlink:focus-visible {
    outline: 2px solid var(--hp-ember);
    outline-offset: -2px;
}

.hp-github:focus-visible,
.hp-cloud-button:focus-visible {
    outline: 2px solid var(--hp-ember);
    outline-offset: 2px;
}

/* Site footer - markup lives in the shared index.hbs, so its styles belong
   here (loaded by both the docs and blog books) */
.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--quote-border);
    text-align: center;
    color: var(--inline-code-color);
    font-size: 1.4rem;
}

.site-footer p {
    margin: 0;
}

.site-footer .site-footer-links {
    margin-bottom: 0.5rem;
}

.site-footer a,
.site-footer a:link,
.site-footer a:visited {
    color: var(--inline-code-color);
    text-decoration: none;
    -webkit-text-fill-color: var(--inline-code-color);
}

.site-footer a:hover {
    text-decoration: underline;
}

/* Push mdbook's fixed sidebar and menu-bar below the nav */
.sidebar {
    top: var(--hp-nav-h) !important;
}

/* Scrolls away with the page, only the top nav stays pinned (book.js toggles
   .sticky and inline `top`; these win over both). The second selector mirrors
   chrome.css's most specific rule so this loads-later declaration beats it. */
#mdbook-menu-bar,
html.sidebar-visible #mdbook-menu-bar {
    position: relative !important;
    top: 0 !important;
}

#mdbook-body-container {
    padding-top: var(--hp-nav-h);
}

/* Keep in-page anchor jumps clear of the nav; mdbook's own :target margin
   would add a menu-bar height to it */
html {
    scroll-padding-top: calc(var(--hp-nav-h) + 8px);
}

:target {
    scroll-margin-top: 0;
}
