/*
 * LibreHost shared header: the ONE source of truth for the header row on libre.wtf (site,
 * Panel, cart), the advanced panel (ISPConfigLibreHostTheme) and webmail (RoundcubeLibreHostTheme).
 *
 * Edit it only here, in LibreHost/css/header.css. The other two get a byte-for-byte copy when
 * they deploy (their deploy refuses to run if their copy differs), so all three render the
 * same header to the pixel. Their markup is the same block of HTML too; see includes/_nav.php.
 *
 * Plain CSS in exact pixels (no rem): each app has its own root font size (libre.wtf 16px,
 * ISPConfig 10px, webmail 14px), so rem would size the header differently in each. Every
 * property that the host app's own CSS (Bootstrap, Elastic) might set is set here explicitly.
 * Light/dark follows the device setting, like the rest of LibreHost.
 */

@font-face { font-family: "LibreHost Header"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/manrope-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "LibreHost Header"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/manrope-latin-700-normal.woff2") format("woff2"); }

.lhh {
    --lhh-panel: #eaf0f8;
    --lhh-border: #dce3ef;
    --lhh-ink: #111e36;
    --lhh-muted: #526079;
    --lhh-highlight: #315dff;
    --lhh-accent: #315dff;
    --lhh-accent-hover: #2148dc;
    --lhh-on-accent: #ffffff;
    display: block;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    color: var(--lhh-ink);
    font-family: "LibreHost Header", "Manrope", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (prefers-color-scheme: dark) {
    .lhh {
        --lhh-panel: #0d172b;
        --lhh-border: #26344c;
        --lhh-ink: #f4f7fc;
        --lhh-muted: #aab8d1;
        --lhh-highlight: #9bb7ff;
    }
}

.lhh *,
.lhh *::before,
.lhh *::after {
    box-sizing: border-box;
}

/* The row: 1280px page width with 32px gutters (22px on phones), 92px tall (76px on phones). */
.lhh .lhh-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    max-width: 1280px;
    min-height: 92px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Logo: two bars + LibreHost + a highlighted dot. */
.lhh .lhh-brand {
    display: inline-flex;
    align-items: center;
    flex: none;
    margin: 0;
    padding: 0;
    color: var(--lhh-ink);
    font-size: 24.8px;
    font-weight: 700;
    line-height: 1.7;
    letter-spacing: -0.065em;
    white-space: nowrap;
    text-decoration: none;
}

.lhh .lhh-mark {
    display: inline-block;
    position: relative;
    flex: 0 0 26px;
    width: 26px;
    height: 28px;
    margin: 0 12px 0 0;
    color: var(--lhh-highlight);
}

.lhh .lhh-mark::before,
.lhh .lhh-mark::after {
    content: "";
    position: absolute;
    left: 0;
    width: 26px;
    height: 10px;
    border-radius: 3px;
    background: currentColor;
}

.lhh .lhh-mark::before { top: 2px; }
.lhh .lhh-mark::after { bottom: 2px; width: 20px; }
.lhh .lhh-dot { color: var(--lhh-highlight); }

/* Right side: Webmail, Panel | Advanced, cart, Log out (logged out: Webmail, cart, Log in). */
.lhh .lhh-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.lhh .lhh-actions form { display: contents; }

.lhh .lhh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    height: 42px;
    min-height: 42px;
    margin: 0;
    padding: 0 20px;
    border: 1px solid var(--lhh-border);
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    color: var(--lhh-ink);
    font-family: inherit;
    font-size: 12.8px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: normal;
    text-decoration: none;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s;
}

.lhh .lhh-btn:hover,
.lhh .lhh-btn:focus {
    background: var(--lhh-panel);
    color: var(--lhh-ink);
    text-decoration: none;
}

.lhh .lhh-btn:focus { outline: 0; }
.lhh .lhh-btn:focus-visible { outline: 2px solid var(--lhh-accent); outline-offset: 2px; }

/* The page you're on (cart on the cart page, Webmail in webmail) is filled in. */
.lhh .lhh-btn[aria-current="page"],
.lhh .lhh-btn[aria-current="page"]:hover {
    border-color: var(--lhh-accent);
    background: var(--lhh-accent);
    color: var(--lhh-on-accent);
}

.lhh .lhh-btn[aria-current="page"]:hover {
    border-color: var(--lhh-accent-hover);
    background: var(--lhh-accent-hover);
}

.lhh .lhh-cart { padding: 0 14px; }

.lhh .lhh-cart svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Panel | Advanced: one bordered box, the half you're on filled in. */
.lhh .lhh-switch {
    display: flex;
    flex: none;
    height: 42px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--lhh-border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 12.8px;
    font-weight: 600;
    line-height: 1.7;
}

.lhh .lhh-switch a,
.lhh .lhh-switch span {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--lhh-muted);
    font: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.lhh .lhh-switch > * + * { border-left: 1px solid var(--lhh-border); }

.lhh .lhh-switch a:hover,
.lhh .lhh-switch a:focus {
    background: var(--lhh-panel);
    color: var(--lhh-ink);
    text-decoration: none;
}

.lhh .lhh-switch [aria-current="page"] {
    background: var(--lhh-accent);
    color: var(--lhh-on-accent);
}

/* ☰ for the app's own menu (Panel pages, advanced panel), phones only. */
.lhh .lhh-burger {
    display: none;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin: 0 -4px 0 0;
    padding: 0;
    border: 1px solid var(--lhh-border);
    border-radius: 8px;
    background: transparent;
    color: var(--lhh-ink);
    font-size: 0;
    line-height: 0;
    cursor: pointer;
}

.lhh .lhh-burger span,
.lhh .lhh-burger span::before,
.lhh .lhh-burger span::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

.lhh .lhh-burger span { position: relative; }
.lhh .lhh-burger span::before,
.lhh .lhh-burger span::after { content: ""; position: absolute; left: 0; }
.lhh .lhh-burger span::before { top: -6px; }
.lhh .lhh-burger span::after { top: 6px; }
.lhh .lhh-burger:hover { background: var(--lhh-panel); }

/* Second row on phones: Panel | Advanced (and, on the Panel, where you are). */
.lhh .lhh-sub { display: none; }

.lhh .lhh-where {
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0 auto 0 0;
    color: var(--lhh-ink);
    font-size: 14.4px;
    font-weight: 600;
    white-space: nowrap;
}

.lhh .lhh-where > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Webmail can't read the LibreHost login, so it sets data-state after asking libre.wtf. */
.lhh[data-state="pending"] .lhh-actions { visibility: hidden; }
.lhh[data-state="pending"] .lhh-out,
.lhh[data-state="in"] .lhh-out,
.lhh[data-state="out"] .lhh-in { display: none !important; }

/* Logged in (Panel | Advanced showing): Webmail steps aside on narrower screens, the cart on tiny ones. */
@media (max-width: 864px) {
    .lhh:not([data-state="out"]) .lhh-actions:has(.lhh-switch) .lhh-webmail { display: none; }
}

@media (max-width: 767px) {
    .lhh .lhh-row { min-height: 76px; gap: 12px; }
    .lhh .lhh-brand { font-size: 19.2px; }
    .lhh .lhh-mark { margin-right: 8px; transform: scale(.8); }
    .lhh .lhh-actions { gap: 8px; }
    .lhh .lhh-btn { padding: 0 12px; }
    .lhh .lhh-cart { padding: 0 10px; }
    .lhh .lhh-switch a,
    .lhh .lhh-switch span { padding: 0 10px; }
}

@media (max-width: 639px) {
    .lhh .lhh-row { padding: 0 22px; }
}

@media (max-width: 600px) {
    .lhh .lhh-burger { display: inline-flex; }
    .lhh .lhh-burger + .lhh-brand { margin-right: auto; }
    .lhh .lhh-actions .lhh-switch { display: none; }
    .lhh .lhh-sub {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 12px;
        width: 100%;
        margin: 0;
        padding: 0 22px 12px;
    }
    .lhh .lhh-sub .lhh-switch { height: 38px; }
}

@media (max-width: 352px) {
    .lhh:not([data-state="out"]) .lhh-actions:has(.lhh-switch) .lhh-cart { display: none; }
}
