/* ============================================
   Beit HaMetaplim — Shared Components
   Extracted from duplicated inline styles
   Used by: index, about, training, project-lobby,
            courses, learning-portal
   ============================================ */

/* === Marketing Page Variables + Theme Bridge === */
:root {
    --deep-petrol: #003B46;
    --muted-teal: #00606B;
    --dusty-aqua: #2F8592;
    --frost-white: #E8F1F2;
    --cream: #FAF8F4;
    --pure-white: #FFFFFF;
    --gold: #D4AF37;
    --gold-light: #E6C65A;
    --gold-glow: rgba(212, 175, 55, 0.25);
    --gradient-gold: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    --text-dark: #1A2D33;
    --border-light: rgba(47, 133, 146, 0.12);
    --border-dark: rgba(47, 133, 146, 0.3);
    --font-display: 'Frank Ruhl Libre', 'Noto Serif Hebrew', serif;
    --font-body: 'Heebo', sans-serif;

    /* === Theme Bridge === */
    --cream: var(--t-bg);
    --pure-white: var(--t-bg-card);
    --text-dark: var(--t-text);
    --border-light: var(--t-border);
    --border-dark: var(--t-border-strong);
    --gold: var(--t-gold);
    --gold-light: var(--t-gold-light);
    --gold-glow: var(--t-gold-glow);
    --gradient-gold: var(--t-gradient-gold);
    --deep-petrol: var(--t-deep-petrol);
    --muted-teal: var(--t-muted-teal);
    --dusty-aqua: var(--t-dusty-aqua);
    --frost-white: var(--t-frost-white);
}

/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

html {
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--text-dark);
    line-height: 1.7;
}

/* === Film Grain Overlay === */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* === Scroll Reveal Animations === */
[data-reveal] {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

[data-reveal-delay="1"] { transition-delay: 0.1s; }
[data-reveal-delay="2"] { transition-delay: 0.2s; }
[data-reveal-delay="3"] { transition-delay: 0.3s; }
[data-reveal-delay="4"] { transition-delay: 0.4s; }

/* === Navbar === */
.navbar {
    position: fixed;
    top: 0; right: 0; left: 0;
    z-index: 1000;
    padding: 1.1rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 59, 70, 0.06);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar.scrolled {
    padding: 0.7rem 2.5rem;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: var(--text-dark);
}

.logo-icon {
    width: 42px; height: 42px;
    background: var(--gradient-gold);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--deep-petrol);
    transition: transform 0.3s;
}

.logo:hover .logo-icon {
    transform: rotate(-5deg) scale(1.05);
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.logo-text span { color: var(--t-gold-text); }

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
}

.nav-links a:hover { color: var(--muted-teal); }
.nav-links a.active { color: var(--t-gold-text); }

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px; right: 0;
    width: 0; height: 1.5px;
    background: var(--gold);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

.nav-cta {
    background: var(--gradient-gold);
    color: var(--deep-petrol);
    padding: 0.6rem 1.5rem;
    border-radius: var(--t-btn-radius, 10px);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.88rem;
    letter-spacing: -0.01em;
}

.nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px var(--gold-glow);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-dark);
    font-size: 1.4rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    width: 44px; height: 44px;
    border-radius: var(--t-btn-radius, 10px);
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mobile-cta-group {
    display: none !important;
}

/* === Section Headers === */
.section-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.section-eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--t-gold-text);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
}

.section-eyebrow::before,
.section-eyebrow::after {
    content: '';
    width: 30px;
    height: 1px;
    background: var(--t-gold-text);
    opacity: 0.4;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.02em;
}

/* === Footer === */
.footer {
    background: var(--deep-petrol);
    padding: 4rem 2rem 2rem;
    color: #E8F1F2;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand { text-align: center; }

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
}

.footer-logo-icon {
    width: 42px; height: 42px;
    background: var(--gradient-gold);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--deep-petrol);
}

.footer-logo-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

.footer-logo-text span { color: var(--gold); }

.footer-logo-img {
    height: 80px;
    width: auto;
}

.footer-brand p {
    color: rgba(232, 241, 242, 0.7);
    margin-top: 1rem;
    font-size: 0.88rem;
    line-height: 1.6;
}

.footer-links h4 {
    font-family: var(--font-display);
    color: #FFFFFF;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.footer-links ul { list-style: none; }

.footer-links li { padding: 0.3rem 0; }

.footer a { color: rgba(232, 241, 242, 0.65); text-decoration: none; font-size: 0.9rem; transition: color 0.3s; }
.footer a:hover { color: var(--gold); }

.footer-bottom {
    max-width: 1100px;
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* === Mobile Responsive — Navbar === */
@media (max-width: 768px) {
    /* Force navbar to stay fixed on mobile (iOS Safari fix) */
    .navbar {
        position: fixed !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    /* Break backdrop-filter containment when menu is open */
    .navbar:has(.nav-links.active) {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: var(--deep-petrol) !important;
        border-bottom: none !important;
    }

    .nav-links {
        display: none !important;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background: var(--deep-petrol) !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0;
        z-index: 1001;
        padding: 0;
        margin: 0;
    }

    .nav-links.active {
        display: flex !important;
    }

    .nav-links li {
        list-style: none;
        text-align: center;
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 1.2rem 2rem;
        font-size: 1.3rem;
        font-weight: 600;
        color: var(--pure-white) !important;
        -webkit-text-fill-color: var(--pure-white) !important;
        letter-spacing: 0.02em;
        transition: color 0.2s;
    }

    .nav-links a::after { display: none; }

    .nav-links a:hover,
    .nav-links a:active {
        color: var(--gold) !important;
        -webkit-text-fill-color: var(--gold) !important;
    }

    .nav-links.active .mobile-cta-group {
        display: flex !important;
        flex-direction: column;
        gap: 0.8rem;
        margin-top: 2.5rem;
        padding-top: 2rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        width: 70%;
    }

    .mobile-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 1rem 1.5rem;
        border-radius: var(--t-btn-radius, 10px);
        font-weight: 700;
        font-size: 1.05rem;
        text-decoration: none;
        transition: all 0.3s;
    }

    .mobile-cta.primary {
        background: var(--gradient-gold);
        color: var(--deep-petrol);
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1002;
        position: relative;
    }

    .mobile-menu-btn.active {
        background: rgba(212, 175, 55, 0.15);
    }

    .mobile-menu-btn.active i::before {
        content: "\f00d";
    }

    .nav-cta { display: none; }

    .footer-content { grid-template-columns: 1fr; text-align: center; }
}

@media (max-width: 480px) {
    .navbar { padding: 0.8rem 1rem; }
    .logo-icon { width: 36px; height: 36px; font-size: 1rem; }
    .logo-text { font-size: 1.1rem; }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    [data-reveal] { opacity: 1; transform: none; }
}
