/*
Theme Name: HFEMS Fluent Portal Pro
Theme URI: https://holyfamilyems.com/
Author: Holy Family EMS
Author URI: https://holyfamilyems.com/
Description: Enterprise Microsoft Fluent & Bing-inspired lightweight portal theme with Circle Reading Mode Toggle, Responsive Accordion Navigation, Reader-Friendly Post Margins, and Zero White-Box Architecture.
Version: 4.5.0
Text Domain: hfems-fluent
*/

:root {
    color-scheme: light;
    --ms-page-bg: #f8fafc;
    --ms-surface: #ffffff;
    --ms-surface-subtle: #f1f5f9;
    --ms-border: #e2e8f0;
    --ms-border-strong: #cbd5e1;
    --ms-text-primary: #0f172a;
    --ms-text-secondary: #475569;
    --ms-accent: #0067b8;
    --ms-accent-hover: #005a9e;
    --ms-accent-tint: #eff6fc;
    --ms-accent-border: #cce0f5;
    --bing-glass-bg: rgba(255, 255, 255, 0.94);
    --bing-header-bg: #ffffff;
}

html.hf-reading-mode,
body.hf-reading-mode {
    --ms-page-bg: #f2e9d8 !important;
    --ms-surface: #fbf6ec !important;
    --ms-surface-subtle: #e8dec8 !important;
    --ms-border: #d5c7ad !important;
    --ms-border-strong: #baa888 !important;
    --ms-text-primary: #2b2118 !important;
    --ms-text-secondary: #5c4b3b !important;
    --ms-accent: #005a9e !important;
    --ms-accent-hover: #004578 !important;
    --ms-accent-tint: #e6dfd1 !important;
    --ms-accent-border: #c2b49a !important;
    --bing-glass-bg: rgba(251, 246, 236, 0.96) !important;
    --bing-header-bg: #f2e9d8 !important;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    font-family: 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background-color: var(--ms-page-bg) !important;
    color: var(--ms-text-primary) !important;
    line-height: 1.7;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* Global White-Box Eliminator in Reading Mode */
html.hf-reading-mode .hf-main-container,
html.hf-reading-mode .hf-content-area,
html.hf-reading-mode .entry-content,
html.hf-reading-mode .wp-block-group,
html.hf-reading-mode div[style*="background: #ffffff"],
html.hf-reading-mode div[style*="background:#ffffff"],
html.hf-reading-mode div[style*="background: #fff"] {
    background-color: var(--ms-surface) !important;
    border-color: var(--ms-border) !important;
    color: var(--ms-text-primary) !important;
}

/* Header Brand Styling */
.hf-brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.hf-site-title {
    font-size: 1.28rem;
    font-weight: 800;
    color: var(--ms-text-primary);
    letter-spacing: -0.3px;
    line-height: 1.15;
    display: block;
}

.hf-site-tagline {
    font-size: 0.74rem;
    color: var(--ms-accent);
    font-weight: 600;
    display: block;
}

.hf-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Main Wrapper & Balanced Side Margins (Desktop & Mobile) */
.hf-main-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 24px 56px 24px;
    background: transparent !important;
    overflow: hidden;
}

.hf-layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 28px;
    align-items: start;
    width: 100%;
}

.hf-layout-full-width {
    display: block;
    width: 100%;
    max-width: 100%;
}

.hf-content-area {
    width: 100%;
    min-width: 0; /* Prevents flex/grid blowout from wide tables or code */
    max-width: 100%;
}

/* Article & Post Container - Strictly Contained & Reader-Friendly */
.hf-article-card {
    background: var(--ms-surface);
    border: 1px solid var(--ms-border);
    border-radius: 12px;
    padding: 32px 36px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 24px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.hf-tool-clean-surface {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    width: 100%;
    max-width: 100%;
}

/* Optimal Reading Typography Inside Posts & Pages */
.entry-content {
    width: 100%;
    max-width: 100%;
    font-size: 16.5px;
    line-height: 1.78;
    color: var(--ms-text-primary);
    overflow-wrap: break-word;
}

.entry-content p {
    margin: 0 0 1.25em 0;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
    color: var(--ms-text-primary);
    font-weight: 700;
    line-height: 1.35;
    margin: 1.6em 0 0.6em 0;
}

.entry-content h2 { font-size: 1.45rem; }
.entry-content h3 { font-size: 1.22rem; }

.entry-content ul,
.entry-content ol {
    margin: 0 0 1.25em 0;
    padding-left: 22px;
}

.entry-content li {
    margin-bottom: 0.45em;
}

/* Prevent Images, Iframes, Tables & Pre Blocks from Breaking Out of Container */
.entry-content img,
.entry-content iframe,
.entry-content video,
.entry-content embed,
.entry-content figure {
    max-width: 100% !important;
    height: auto;
    border-radius: 8px;
}

.entry-content table {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1.25em 0;
    font-size: 14.5px;
}

.entry-content th,
.entry-content td {
    border: 1px solid var(--ms-border-strong);
    padding: 10px 12px;
    text-align: left;
}

.entry-content th {
    background: var(--ms-surface-subtle);
    font-weight: 700;
}

.entry-content pre,
.entry-content code {
    max-width: 100%;
    overflow-x: auto;
    background: var(--ms-surface-subtle);
    border-radius: 6px;
}

.entry-content pre {
    padding: 14px;
    border: 1px solid var(--ms-border);
}

/* Sidebar Widgets */
.hf-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    min-width: 0;
}

.hf-widget-card {
    background: var(--ms-surface);
    border: 1px solid var(--ms-border);
    border-radius: 10px;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
}

.hf-widget-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ms-text-primary);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--ms-accent);
    display: inline-block;
}

.hf-widget-card ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hf-widget-card li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--ms-border);
    font-size: 14px;
}

.hf-widget-card li:last-child {
    border-bottom: none;
}

.hf-widget-card a {
    color: var(--ms-text-primary);
    text-decoration: none;
    font-weight: 500;
}

.hf-widget-card a:hover {
    color: var(--ms-accent);
}

/* Bing Homepage Hero */
.bing-hero-banner {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background-size: cover;
    background-position: center;
    margin-bottom: 28px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.bing-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0.78) 100%);
    z-index: 1;
}

.bing-hero-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
    width: 100%;
    text-align: center;
}

.bing-hero-title {
    color: #ffffff;
    font-size: 2.15rem;
    font-weight: 800;
    margin: 0 0 10px 0;
    line-height: 1.25;
}

.bing-hero-subtitle {
    color: rgba(255, 255, 255, 0.92);
    font-size: 1rem;
    margin: 0 0 22px 0;
}

.bing-search-form {
    display: flex;
    align-items: center;
    background: var(--bing-glass-bg);
    border: 1px solid var(--ms-border-strong);
    border-radius: 999px;
    padding: 6px 8px 6px 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    width: 100%;
}

.bing-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--ms-text-primary);
    outline: none;
    padding: 8px 0;
}

.bing-search-submit {
    background: var(--ms-accent);
    color: #ffffff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Section Headers & Responsive Cards Grid */
.bing-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ms-border);
}

.bing-section-header h2,
.bing-section-header h1 {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 700;
    color: var(--ms-text-primary);
}

.bing-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 34px;
    width: 100%;
}

.bing-tool-tile {
    background: var(--ms-surface);
    border: 1px solid var(--ms-border);
    border-radius: 10px;
    padding: 18px 16px;
    text-decoration: none;
    color: var(--ms-text-primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.bing-tool-tile:hover {
    transform: translateY(-2px);
    border-color: var(--ms-accent);
    box-shadow: 0 8px 20px rgba(0, 103, 184, 0.08);
}

.bing-tile-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ms-accent);
    background: var(--ms-accent-tint);
    border: 1px solid var(--ms-accent-border);
    padding: 2px 8px;
    border-radius: 4px;
    width: fit-content;
}

.bing-tile-title {
    font-size: 15.5px;
    font-weight: 700;
    margin: 0;
    line-height: 1.38;
    overflow-wrap: break-word;
}

.bing-tile-desc {
    font-size: 13px;
    color: var(--ms-text-secondary);
    margin: 0;
    line-height: 1.5;
    overflow-wrap: break-word;
}

/* Pagination */
.hf-pagination {
    display: flex;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.hf-pagination .page-numbers {
    padding: 6px 12px;
    border: 1px solid var(--ms-border-strong);
    background: var(--ms-surface);
    color: var(--ms-text-primary);
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.hf-pagination .page-numbers.current {
    background: var(--ms-accent);
    color: #ffffff;
    border-color: var(--ms-accent);
}

/* Floating Back to Top Circle Button */
.hf-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ms-accent);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.hf-back-to-top.visible {
    display: inline-flex;
}

/* Footer */
.hf-site-footer {
    border-top: 1px solid var(--ms-border);
    background: var(--ms-surface);
    padding: 26px 20px;
    margin-top: 48px;
    font-size: 13.5px;
    color: var(--ms-text-secondary);
}

.hf-footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

/* Tablet & Mobile Responsive Margins & Readability Adjustments */
@media (max-width: 960px) {
    .hf-layout-with-sidebar {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .hf-main-container {
        padding: 20px 16px 44px 16px;
    }
    .hf-article-card {
        padding: 24px 22px;
    }
}

@media (max-width: 600px) {
    .hf-main-container {
        padding: 14px 12px 36px 12px;
    }
    .hf-article-card {
        padding: 18px 16px;
        border-radius: 10px;
    }
    .entry-content {
        font-size: 15.5px;
        line-height: 1.72;
    }
    .bing-hero-banner {
        min-height: 290px;
        padding: 28px 14px;
        margin-bottom: 20px;
    }
    .bing-hero-title {
        font-size: 1.55rem;
    }
    .bing-hero-subtitle {
        font-size: 0.92rem;
    }
    .bing-tiles-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    #hfEngagementSection {
        padding: 16px !important;
        margin-top: 24px !important;
    }
}
/* --- Header Branding: Non-Wrapping, Flexible & Red Title --- */
.site-branding, .site-header .site-branding {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    overflow: visible !important;
}

/* Title: Red Color, Auto-Flexible Clamp Size, Never Wraps */
.site-title a, .custom-logo-link + .site-branding .site-title a, .custom-logo-link + .site-branding .site-title {
    color: #dc2626 !important; /* Pure Red Color */
    font-size: clamp(16px, 3.8vw, 26px) !important; /* Auto-scales smoothly based on viewport width */
    font-weight: 800 !important;
    white-space: nowrap !important; /* Prevent line wrapping */
    line-height: 1.2 !important;
}

/* Tagline: 100% Always Visible, Auto-Flexible, Never Hidden */
.site-branding .site-description, 
.site-header .site-description {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: clamp(10px, 1.8vw, 13px) !important; /* Auto-adjusts cleanly across mobile and desktop screens */
    white-space: nowrap !important; /* Keep tagline on a single line */
    line-height: 1.2 !important;
    margin-top: 2px !important;
}