/*
 * Global Site Header & Footer (v2)
 * Used on all non-app pages. Book Editor / Reader keep their own in-context header.
 * Design tokens: docs/design-system/design-tokens.md
 */

/* Keep the footer pinned to the bottom of the viewport on pages whose
   content is shorter than the screen, instead of floating mid-page. */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

:root {
    --obx-brand-blue: #3B82F6;
    --obx-brand-blue-dark: #2563EB;
    --obx-brand-blue-mid: #60A5FA;
    --obx-brand-blue-tint: #EFF6FF;
    --obx-brand-blue-border: #BFDBFE;
    --obx-text-dark: #1F2937;
    --obx-text-mid: #374151;
    --obx-text-muted: #6B7280;
    --obx-text-faint: #9CA3AF;
    --obx-bg-light: #F9FAFB;
    --obx-bg-mid: #F3F4F6;
    --obx-border-light: #E5E7EB;
    --obx-gradient: linear-gradient(135deg, #3B82F6 0%, #60A5FA 100%);
    --obx-font: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Header ─────────────────────────────────────────────────────────── */

.obx-site-header {
    background: white;
    border-bottom: 1px solid var(--obx-border-light);
    font-family: var(--obx-font);
}

.obx-site-header__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    height: 88px;
    display: flex;
    align-items: center;
}

.obx-site-header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.obx-site-header__logo img {
    height: 32px;
    width: auto;
    display: block;
}

/* Logged-in: logo + Dashboard grouped as one "brand block" */
.obx-site-header__brand-block {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.obx-site-header__brand-sep {
    width: 1px;
    height: 24px;
    background: var(--obx-border-light);
}

.obx-site-header__brand-link {
    font-size: 15px;
    font-weight: 700;
    color: var(--obx-text-dark);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
}

.obx-site-header__brand-link:hover {
    background: var(--obx-bg-light);
    text-decoration: none;
    color: var(--obx-text-dark);
}

.obx-site-header__brand-link.is-active {
    background: var(--obx-brand-blue-tint);
    color: var(--obx-brand-blue);
}

/* Right-aligned nav group (logged-out: full nav, logged-in: Showcase/Help/Avatar) */
.obx-site-header__nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.obx-site-header__nav-link {
    font-size: 15px;
    font-weight: 600;
    color: var(--obx-text-mid);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.obx-site-header__nav-link:hover {
    background: var(--obx-bg-light);
    color: var(--obx-text-dark);
    text-decoration: none;
}

.obx-site-header__nav-link.is-active {
    background: var(--obx-brand-blue-tint);
    color: var(--obx-brand-blue);
}

/* Primary CTA — "Start Creating" */
.obx-site-header__cta {
    display: inline-flex;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
    color: white;
    background: var(--obx-gradient);
    padding: 12px 28px;
    border-radius: 10px;
    text-decoration: none;
    margin-left: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.obx-site-header__cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
    color: white;
    text-decoration: none;
}

/* Mobile burger toggle */
.obx-site-header__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.obx-site-header__burger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--obx-text-dark);
    border-radius: 2px;
}

/* Avatar / account dropdown */
.obx-site-header__user {
    position: relative;
    margin-left: 8px;
}

.obx-site-header__avatar-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--obx-border-light);
    background: var(--obx-brand-blue-tint);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

.obx-site-header__avatar-btn:hover {
    border-color: var(--obx-brand-blue);
}

.obx-site-header__avatar-initials {
    font-size: 13px;
    font-weight: 700;
    color: var(--obx-brand-blue);
    line-height: 1;
    user-select: none;
}

.obx-site-header__user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    background: white;
    border: 1px solid var(--obx-border-light);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    z-index: 200;
}

.obx-site-header__user-menu.is-open {
    display: block;
}

.obx-site-header__user-info {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.obx-site-header__user-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--obx-text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.obx-site-header__user-email {
    font-size: 13px;
    font-weight: 400;
    color: var(--obx-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.obx-site-header__user-divider {
    height: 1px;
    background: var(--obx-border-light);
}

.obx-site-header__user-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    font-family: var(--obx-font);
    font-size: 14px;
    font-weight: 700;
    color: var(--obx-text-mid);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.15s, color 0.15s;
}

.obx-site-header__user-item:hover {
    background: var(--obx-bg-light);
    color: var(--obx-text-dark);
    text-decoration: none;
}

.obx-site-header__user-item--logout {
    color: var(--obx-text-muted);
    font-weight: 400;
}

.obx-site-header__user-item--logout:hover {
    background: #FEF2F2;
    color: #DC2626;
}

/* ─── Header responsive ──────────────────────────────────────────────── */

@media (max-width: 900px) {
    .obx-site-header__inner {
        height: 72px;
        padding: 0 20px;
    }

    .obx-site-header__burger {
        display: flex;
    }

    .obx-site-header__nav {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        background: white;
        border-bottom: 1px solid var(--obx-border-light);
        padding: 12px 20px 20px;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
        margin-left: 0;
    }

    .obx-site-header__nav.is-open {
        display: flex;
    }

    .obx-site-header__nav-link,
    .obx-site-header__cta {
        width: 100%;
        text-align: center;
        margin-left: 0;
    }

    .obx-site-header__user {
        margin-left: 0;
        align-self: center;
        margin-top: 8px;
    }

    .obx-site-header__user-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ─── Footer ─────────────────────────────────────────────────────────── */

.obx-site-footer {
    background: white;
    border-top: 1px solid var(--obx-border-light);
    font-family: var(--obx-font);
    margin-top: auto;
}

.obx-site-footer__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.obx-site-footer__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.obx-site-footer__logo img {
    width: 125px;
    height: 30px;
    display: block;
}

.obx-site-footer__copy {
    font-size: 13px;
    color: var(--obx-text-muted);
}

.obx-site-footer__links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.obx-site-footer__links a {
    font-size: 14px;
    font-weight: 600;
    color: var(--obx-text-mid);
    text-decoration: none;
    transition: color 0.2s;
}

.obx-site-footer__links a:hover {
    color: var(--obx-brand-blue);
    text-decoration: none;
}

@media (max-width: 600px) {
    .obx-site-footer__inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px 20px;
    }

    .obx-site-footer__links {
        flex-wrap: wrap;
        gap: 16px;
    }
}

/* ─── Default Page Template (page.php) ──────────────────────────────────
   Long-form reading pages with no dedicated template — Terms, Privacy,
   Accessibility Statement, etc. Scoped to body.page-template-default so
   page-*.php templates (login, about, dashboard...) keep their own styles. */

body.page-template-default article.container {
    padding-top: clamp(48px, 8vw, 96px);
    padding-bottom: clamp(48px, 8vw, 96px);
}

body.page-template-default .entry-title {
    max-width: 720px;
    margin: 0 auto clamp(24px, 4vw, 40px);
    font-family: var(--obx-font);
    font-size: clamp(28px, 4vw + 12px, 40px);
    font-weight: 800;
    line-height: 1.2;
    color: var(--obx-text-dark);
}

body.page-template-default .entry-content {
    max-width: 720px;
    margin: 0 auto;
    font-family: var(--obx-font);
    font-size: clamp(17px, 1vw + 14px, 18px);
    line-height: 1.7;
    color: var(--obx-text-mid);
}

body.page-template-default .entry-content p {
    margin: 0 0 20px;
}

body.page-template-default .entry-content h2 {
    font-size: clamp(22px, 2vw + 16px, 28px);
    font-weight: 700;
    line-height: 1.3;
    color: var(--obx-text-dark);
    margin: 48px 0 12px;
}

body.page-template-default .entry-content h3 {
    font-size: clamp(18px, 1vw + 14px, 22px);
    font-weight: 700;
    line-height: 1.3;
    color: var(--obx-text-dark);
    margin: 36px 0 10px;
}

body.page-template-default .entry-content h2:first-child,
body.page-template-default .entry-content h3:first-child {
    margin-top: 0;
}

body.page-template-default .entry-content a {
    color: var(--obx-brand-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

body.page-template-default .entry-content a:hover {
    color: var(--obx-brand-blue-dark);
}

body.page-template-default .entry-content ul,
body.page-template-default .entry-content ol {
    margin: 0 0 20px;
    padding-left: 28px;
    line-height: 1.7;
}

body.page-template-default .entry-content li {
    margin-bottom: 8px;
}

body.page-template-default .entry-content li:last-child {
    margin-bottom: 0;
}

body.page-template-default .entry-content li > ul,
body.page-template-default .entry-content li > ol {
    margin-top: 8px;
    margin-bottom: 0;
}

@media (max-width: 480px) {
    body.page-template-default article.container {
        padding-top: 48px;
        padding-bottom: 48px;
    }
}
