﻿/* ============================================================
   OpenMathBook · Public-shell header
   Loaded site-wide from _PublicLayout.cshtml.
   Independent of home.css — no .ob-home scope dependency.
   ============================================================ */

:root {
    --obh-bg: oklch(0.985 0.005 85);
    --obh-bg-2: oklch(0.96 0.014 85);
    --obh-bg-card: #ffffff;
    --obh-ink: oklch(0.18 0.040 250);
    --obh-ink-2: oklch(0.40 0.025 250);
    --obh-ink-3: oklch(0.58 0.018 250);
    --obh-line: oklch(0.90 0.014 85);
    --obh-line-2: oklch(0.84 0.018 85);
    --obh-accent: oklch(0.32 0.08 250);
    --obh-accent-tint: oklch(0.94 0.018 250);
    --obh-accent-ink: #ffffff;
    --obh-radius: 8px;
    --obh-shadow-lg: 0 4px 12px rgba(20,30,50,.06), 0 24px 60px rgba(20,30,50,.08);
    --obh-pad-x: clamp(20px, 4vw, 56px);
}

.ob-public-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in oklab, var(--obh-bg) 92%, transparent);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--obh-line);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

    .ob-public-header[data-lang="he"] {
        font-family: 'Heebo', -apple-system, sans-serif;
    }

    .ob-public-header[data-lang="ar"] {
        font-family: 'Cairo', -apple-system, sans-serif;
    }

.ob-public-header__inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px var(--obh-pad-x);
    display: flex;
    align-items: center;
    gap: 32px;
}

.ob-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--obh-ink);
    flex-shrink: 0;
    text-decoration: none;
}

    .ob-brand:hover {
        text-decoration: none;
    }

.ob-brand__mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    background: var(--obh-accent);
    color: var(--obh-accent-ink);
    border-radius: 6px;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

.ob-brand__name {
    font-size: 17px;
}

.ob-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

    .ob-nav a {
        padding: 8px 14px;
        border-radius: 8px;
        font-weight: 500;
        font-size: 14.5px;
        color: var(--obh-ink-2);
        text-decoration: none;
        transition: background .12s, color .12s;
    }

        .ob-nav a:hover, .ob-nav a[aria-current="page"] {
            background: var(--obh-bg-2);
            color: var(--obh-ink);
        }

.ob-public-header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.ob-iconbtn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    border-radius: 8px;
    color: var(--obh-ink-2);
}

    .ob-iconbtn:hover {
        background: var(--obh-bg-2);
        color: var(--obh-ink);
    }

/* Language switch */
.ob-langswitch {
    position: relative;
}

.ob-langswitch__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--obh-line);
    border-radius: 8px;
    background: var(--obh-bg-card);
    color: var(--obh-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

    .ob-langswitch__btn:hover {
        border-color: var(--obh-line-2);
        background: var(--obh-bg-2);
    }

.ob-langswitch__menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    min-width: 180px;
    padding: 6px;
    margin: 0;
    list-style: none;
    background: var(--obh-bg-card);
    border: 1px solid var(--obh-line);
    border-radius: 10px;
    box-shadow: var(--obh-shadow-lg);
    z-index: 60;
}

    .ob-langswitch__menu li a {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 8px 10px;
        border-radius: 6px;
        font-size: 14px;
        color: var(--obh-ink);
        text-decoration: none;
    }

        .ob-langswitch__menu li a:hover {
            background: var(--obh-bg-2);
        }

        .ob-langswitch__menu li a.is-active {
            color: var(--obh-accent);
        }

.ob-langswitch__code {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    background: var(--obh-bg-2);
    color: var(--obh-ink-2);
    border-radius: 4px;
}

.ob-langswitch__menu li a.is-active .ob-langswitch__code {
    background: var(--obh-accent-tint);
    color: var(--obh-accent);
}

.ob-langswitch__menu li a > svg.ob-langswitch__check {
    margin-inline-start: auto;
    color: var(--obh-accent);
}

/* Search overlay */
.ob-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(20, 30, 50, 0.45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

    .ob-search-overlay[hidden] {
        display: none;
    }

.ob-search-overlay__inner {
    background: var(--obh-bg-card);
    border-bottom: 1px solid var(--obh-line);
    padding: 18px var(--obh-pad-x);
    box-shadow: var(--obh-shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ob-search-overlay__form {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 6px 0 16px;
    background: var(--obh-bg-card);
    border: 1px solid var(--obh-line);
    border-radius: var(--obh-radius);
}

    .ob-search-overlay__form:focus-within {
        border-color: var(--obh-accent);
        box-shadow: 0 0 0 4px var(--obh-accent-tint);
    }

.ob-search-overlay__icon {
    color: var(--obh-ink-3);
    flex: none;
}

.ob-search-overlay__form input[type="search"] {
    flex: 1;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 16px;
    color: var(--obh-ink);
}

    .ob-search-overlay__form input[type="search"]::placeholder {
        color: var(--obh-ink-3);
    }

.ob-search-overlay__form button[type="submit"] {
    height: 36px;
    padding: 0 18px;
    border: 0;
    cursor: pointer;
    border-radius: 6px;
    background: var(--obh-accent);
    color: var(--obh-accent-ink);
    font: inherit;
    font-weight: 600;
    font-size: 14px;
}

.ob-search-overlay__close {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    color: #fff;
}

    .ob-search-overlay__close:hover {
        background: rgba(255, 255, 255, .15);
    }

/* Mobile defaults — hidden on desktop */
.ob-mobile-toggle {
    display: none;
}

.ob-mobile-nav {
    display: none;
}

/* RTL */
.ob-public-header[dir="rtl"] .ob-search-overlay__icon {
    transform: scaleX(-1);
}

.ob-public-header[dir="rtl"] .ob-langswitch__menu li a > svg.ob-langswitch__check {
    transform: scaleX(-1);
}

/* Responsive — collapse nav, show hamburger */
@media (max-width: 980px) {
    .ob-public-header__inner {
        gap: 16px;
        padding: 12px var(--obh-pad-x);
    }

    .ob-nav {
        display: none;
    }

    .ob-mobile-toggle {
        display: grid;
        place-items: center;
        width: 36px;
        height: 36px;
        border: 0;
        background: transparent;
        cursor: pointer;
        border-radius: 8px;
        color: var(--obh-ink-2);
        order: -1;
    }

        .ob-mobile-toggle:hover {
            background: var(--obh-bg-2);
            color: var(--obh-ink);
        }

    .ob-mobile-nav {
        display: none;
        border-top: 1px solid var(--obh-line);
        background: var(--obh-bg-card);
        padding: 8px var(--obh-pad-x);
    }

        .ob-mobile-nav.is-open {
            display: block;
        }

        .ob-mobile-nav a {
            display: block;
            padding: 12px 8px;
            color: var(--obh-ink);
            font-size: 16px;
            font-weight: 500;
            text-decoration: none;
            border-bottom: 1px solid var(--obh-line);
        }

            .ob-mobile-nav a:last-child {
                border-bottom: 0;
            }

            .ob-mobile-nav a:hover, .ob-mobile-nav a[aria-current="page"] {
                background: var(--obh-bg-2);
            }

    .ob-langswitch__btn span:not(.ob-langswitch__code) {
        display: none;
    }
}

@media (max-width: 480px) {
    .ob-brand__name {
        display: none;
    }
}
