/* ============================================
   Rise Bright Shared Header
   Floating pill nav with glass effect,
   mobile menu, and scroll behaviour.
   ============================================ */

/* --- Header bar --- */
.rb-header {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 1000;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .rb-header {
    background: rgba(19, 17, 26, 0.85);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
}

/* --- Inner layout --- */
.rb-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Logo --- */
.rb-header-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    flex-shrink: 0;
}
.rb-header-logo img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}
.rb-header-logo-text {
    display: flex;
    flex-direction: column;
}
.rb-header-logo-name {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.15rem;
    color: var(--rb-text-dark, #1f2937);
    line-height: 1.2;
}
[data-theme="dark"] .rb-header-logo-name {
    color: #e8e2f0;
}
.rb-header-logo-tagline {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    color: var(--rb-text-light, #6b7280);
    line-height: 1.2;
}

/* --- Nav links (desktop) --- */
.rb-header-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}
.rb-header-links a {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--rb-text-dark, #1f2937);
    text-decoration: none;
    transition: color 150ms ease;
    position: relative;
}
[data-theme="dark"] .rb-header-links a {
    color: #d4cfe0;
}
.rb-header-links a:hover {
    color: #f97316;
}
.rb-header-links a[aria-current="page"] {
    color: #f97316;
}
.rb-header-links a[aria-current="page"]::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: #f97316;
    border-radius: 1px;
}

/* --- Actions (right side) --- */
.rb-header-actions {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.rb-header-login-link {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--rb-text-dark, #1f2937);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    transition: color 150ms ease;
}
[data-theme="dark"] .rb-header-login-link {
    color: #d4cfe0;
}
.rb-header-login-link:hover {
    color: #f97316;
}

.rb-header-cta {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
}

/* --- Hamburger (hidden on desktop) --- */
.rb-header-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}
.rb-header-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--rb-text-dark, #1f2937);
    border-radius: 1px;
    transition: transform 200ms ease, opacity 200ms ease;
}
[data-theme="dark"] .rb-header-hamburger span {
    background: #d4cfe0;
}

/* --- Mobile overlay and menu --- */
.rb-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 200ms ease;
}
.rb-mobile-overlay.rb-mobile-open {
    display: block;
    opacity: 1;
}

.rb-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    z-index: 1001;
    background: #ffffff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
[data-theme="dark"] .rb-mobile-menu {
    background: #1a1724;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}
.rb-mobile-menu.rb-mobile-open {
    transform: translateX(0);
}

.rb-mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .rb-mobile-menu-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.rb-mobile-close {
    font-size: 1.75rem;
    color: var(--rb-text-light, #6b7280);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.rb-mobile-menu-links {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}
.rb-mobile-menu-links a {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--rb-text-dark, #1f2937);
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    transition: background 150ms ease;
}
[data-theme="dark"] .rb-mobile-menu-links a {
    color: #d4cfe0;
}
.rb-mobile-menu-links a:hover {
    background: rgba(249, 115, 22, 0.06);
}

.rb-mobile-menu-actions {
    padding: 1rem 1.25rem;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .rb-mobile-menu-actions {
    border-top-color: rgba(255, 255, 255, 0.08);
}
.rb-mobile-login {
    width: 100%;
    text-align: center;
}

/* --- Theme toggle in header (reuse dark-mode.css styles) --- */
.rb-header-actions .theme-toggle {
    margin: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .rb-header {
        top: 8px;
        left: 8px;
        right: 8px;
    }
    .rb-header-inner {
        padding: 0.5rem 0.75rem;
    }
    .rb-header-links {
        display: none;
    }
    .rb-header-login-link {
        display: none;
    }
    .rb-header-cta {
        display: none;
    }
    .rb-header-hamburger {
        display: flex;
    }
    .rb-header-logo-tagline {
        display: none;
    }
}

/* --- Spacer for fixed header (add to body/main) --- */
.rb-header-spacer {
    height: 80px;
}

@media (max-width: 768px) {
    .rb-header-spacer {
        height: 64px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .rb-header,
    .rb-mobile-menu,
    .rb-mobile-overlay {
        transition: none;
    }
}
