/* Font Switcher CSS - Inline Navigation Version */
/* Lexend as default, OpenDyslexic as option */

/* ============================================
   FONT DEFINITIONS
   ============================================ */

/* OpenDyslexic Font - Host locally for best performance */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('../fonts/OpenDyslexic-Regular.woff2') format('woff2'),
    url('../fonts/OpenDyslexic-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('../fonts/OpenDyslexic-Bold.woff2') format('woff2'),
    url('../fonts/OpenDyslexic-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* ============================================
   BODY FONT CLASSES
   ============================================ */

/* Default is Arial - applied globally to body */
body {
    font-family: Arial, Helvetica, sans-serif !important;
    transition: font-family 0.3s ease;
}

body * {
    font-family: inherit;
}

/* Lexend Font Class - when user selects Lexend */
body.font-lexend,
body.font-lexend * {
    font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif !important;
}

/* OpenDyslexic Font Class - only when user selects it */
body.font-opendyslexic,
body.font-opendyslexic * {
    font-family: 'OpenDyslexic', Arial, sans-serif !important;
}

/* ============================================
   NAV FONT SWITCHER BUTTON
   ============================================ */

/* Container in nav */
.font-switcher-nav {
    position: relative;
}

/* Button styling to match theme toggle exactly */
.font-switcher-nav .btn {
    padding: 0.375rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px; /* Match theme toggle height */
    min-width: 38px;
}

/* Make sure theme toggle has same height */
#theme-toggle {
    height: 38px;
    min-width: 38px;
    padding: 0.375rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   DROPDOWN MENU
   ============================================ */

.font-dropdown {
    /* Remove default dropdown display */
    display: none !important;

    /* Position below button */
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;

    /* Styling */
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 8px;
    min-width: 220px;
    border: 1px solid rgba(0,0,0,0.1);
    z-index: 1050;
}

/* Show dropdown when active */
.font-dropdown.active {
    display: block !important;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   FONT OPTIONS
   ============================================ */

.font-option {
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 4px;
}

.font-option:last-child {
    margin-bottom: 0;
}

.font-option:hover {
    background: #f5f5f5;
}

.font-option.active {
    background: #467a5f;
    color: white;
}

.font-option.active small {
    color: rgba(255,255,255,0.9) !important;
}

.font-option.active span {
    background: rgba(255,255,255,0.2) !important;
    color: white !important;
}

/* ============================================
   FONT PREVIEW TEXT
   ============================================ */

.font-preview {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.3;
    color: inherit;
}

.font-option small {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 2px;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 991px) {
    /* Target the navbar-nav on mobile */
    .navbar-collapse .navbar-nav {
        display: flex;
        flex-direction: column;
    }

    /* Make font and theme nav items display as grid on mobile */
    .navbar-nav .font-switcher-nav,
    .navbar-nav .theme-toggle-nav {
        display: inline-block;
        width: calc(50% - 0.5rem);
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0.25rem;
    }

    /* Position them side-by-side using float */
    .navbar-nav .font-switcher-nav {
        float: left;
        clear: none;
    }

    .navbar-nav .theme-toggle-nav {
        float: left;
        clear: none;
        margin-left: 0.5rem !important;
    }

    /* Clear float after these items */
    .navbar-nav .theme-toggle-nav::after {
        content: "";
        display: table;
        clear: both;
    }

    /* Make buttons fill their containers */
    .font-switcher-nav .btn,
    #theme-toggle {
        width: 100% !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Position dropdown absolutely so it doesn't affect layout */
    .font-switcher-nav {
        position: relative;
    }

    .font-dropdown {
        position: absolute !important;
        top: calc(100% + 0.5rem) !important;
        right: 0;
        left: auto;
        margin: 0;
        min-width: 220px;
        max-width: 90vw;
        z-index: 1060;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

/* Keep dropdown light for visibility */
body.dark-mode .font-dropdown {
    background: white;
    color: #333;
}

body.dark-mode .font-option:hover {
    background: #f0f0f0;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .font-switcher-nav {
        display: none;
    }
}