/* =========================================================================
   SHEFA Holy Grail layout — left nav + right content pane
   Active when <html class="shefa-layout-holy-grail">
   ========================================================================= */

:root {
    --shefa-hg-header-offset: 96px;
    --shefa-hg-nav-width: 288px;
    --shefa-hg-gutter: 0.25rem;
    --shefa-hg-radius: 1.125rem;
}

.shefa-layout-options {
    display: flex;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem 0.15rem;
}

.shefa-layout-option {
    flex: 1 1 0;
    border: 2px solid #e3e6ea;
    border-radius: 0.75rem;
    background: #fff;
    padding: 0.55rem 0.35rem;
    cursor: pointer;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: #444;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.shefa-layout-option i {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.shefa-layout-option:hover,
.shefa-layout-option.active {
    border-color: var(--primary-green, #5b8c52);
    background: rgba(91, 140, 81, 0.10);
    color: var(--primary-green, #5b8c52);
}

/* Shell: always wraps page content */
.shefa-hg-shell {
    display: block;
    width: 100%;
}

.shefa-hg-nav {
    display: none;
}

.shefa-hg-main {
    width: 100%;
    min-width: 0;
}

/* Holy Grail active */
html.shefa-layout-holy-grail footer.site-footer {
    display: none !important;
}

html.shefa-layout-holy-grail .shefa-hg-shell {
    display: flex;
    align-items: stretch;
    gap: 0.85rem;
    min-height: calc(100vh - var(--shefa-hg-header-offset));
    padding: 0.35rem var(--shefa-hg-gutter) 0.75rem calc(var(--shefa-hg-gutter) + 0.15rem);
    box-sizing: border-box;
}

html.shefa-layout-holy-grail .shefa-hg-nav {
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--shefa-hg-nav-width);
    width: var(--shefa-hg-nav-width);
    min-width: var(--shefa-hg-nav-width);
    align-self: stretch;
    position: sticky;
    top: var(--shefa-hg-header-offset);
    height: auto;
    min-height: calc(100vh - var(--shefa-hg-header-offset) - 0.75rem);
    max-height: none;
    overflow: hidden;
    background: var(--shefa-card, #f8f9fa);
    border: none;
    border-radius: var(--shefa-hg-radius);
    box-shadow: var(--shefa-panel-shadow, 0 8px 28px rgba(15, 23, 42, 0.08));
    z-index: 10;
}

html.shefa-layout-holy-grail .shefa-hg-nav-inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

html.shefa-layout-holy-grail .shefa-hg-more-trigger {
    margin-top: auto;
}

html.shefa-layout-holy-grail .shefa-hg-nav-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0 0.5rem;
    scrollbar-width: thin;
}

html.shefa-layout-holy-grail .shefa-hg-main {
    flex: 1 1 auto;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    padding: 0 0.25rem 0.75rem 0;
    min-width: 0;
    min-height: calc(100vh - var(--shefa-hg-header-offset) - 0.75rem);
    background: var(--shefa-card, #fff);
    border: none;
    border-radius: var(--shefa-hg-radius);
    box-shadow: var(--shefa-panel-shadow, 0 8px 28px rgba(15, 23, 42, 0.08));
    overflow: hidden;
}

/* Hide traditional category mega-menu when Holy Grail is on */
html.shefa-layout-holy-grail .bottom_menu_block {
    display: none !important;
}

/* Section labels */
.shefa-hg-nav-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9aa0a6;
    padding: 0.35rem 1.1rem 0.45rem;
}

.shefa-hg-nav-title--categories {
    margin-top: 0.65rem;
    padding-top: 0.85rem;
    border-top: none;
}

/* Primary links */
.shefa-hg-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.shefa-hg-nav-list a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.62rem 1.1rem;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.shefa-hg-nav-list a:hover,
.shefa-hg-nav-list a.active {
    background: rgba(91, 140, 81, 0.12);
    color: var(--primary-green, #5b8c52);
    border-left-color: var(--primary-green, #5b8c52);
}

.shefa-hg-nav-list a i {
    width: 1.1rem;
    text-align: center;
    opacity: 0.85;
}

/* Category accordion groups */
.shefa-hg-category-groups {
    padding: 0 0.55rem 0.25rem;
}

.shefa-hg-category-group {
    margin-bottom: 0.2rem;
}

.shefa-hg-category-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.62rem 0.75rem;
    border: none;
    border-radius: 0.65rem;
    background: transparent;
    color: #2d2d2d;
    font-weight: 600;
    font-size: 0.92rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.shefa-hg-category-toggle:hover,
.shefa-hg-category-toggle:not(.collapsed) {
    background: rgba(91, 140, 81, 0.10);
    color: var(--primary-green, #5b8c52);
}

.shefa-hg-category-toggle-label {
    flex: 1 1 auto;
    min-width: 0;
}

.shefa-hg-category-chevron {
    font-size: 0.72rem;
    opacity: 0.65;
    transition: transform 0.2s ease;
}

.shefa-hg-category-toggle:not(.collapsed) .shefa-hg-category-chevron {
    transform: rotate(180deg);
}

.shefa-hg-sublist {
    list-style: none;
    margin: 0.15rem 0 0.35rem;
    padding: 0 0 0 0.35rem;
}

.shefa-hg-sublist a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.48rem 0.75rem 0.48rem 1.35rem;
    color: #444;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border-left: 2px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.shefa-hg-sublist a:hover,
.shefa-hg-sublist a.active {
    background: rgba(91, 140, 81, 0.10);
    color: var(--primary-green, #5b8c52);
    border-left-color: var(--primary-green, #5b8c52);
}

.shefa-hg-sublist-label {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
}

.shefa-hg-count.badge {
    background-color: #5c8e52 !important;
    color: #fff !important;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2em 0.45em;
    border-radius: 999px;
    flex-shrink: 0;
}

/* Left panel footer (replaces site footer in Holy Grail) */
.shefa-hg-nav-footer {
    flex-shrink: 0;
    padding: 0.75rem 1rem 1rem;
    border-top: none;
    background: transparent;
}

.shefa-hg-nav-title--footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.shefa-hg-footer-links {
    list-style: none;
    margin: 0 0 0.65rem;
    padding: 0;
}

.shefa-hg-footer-links a {
    display: block;
    padding: 0.35rem 0.1rem;
    color: #555;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
}

.shefa-hg-footer-links a:hover {
    color: var(--primary-green, #5b8c52);
}

.shefa-hg-footer-contact {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.shefa-hg-footer-contact a {
    color: #666;
    text-decoration: none;
    font-size: 0.8rem;
}

.shefa-hg-footer-contact a i {
    width: 1rem;
    margin-right: 0.35rem;
    opacity: 0.75;
}

.shefa-hg-footer-contact a:hover {
    color: var(--primary-green, #5b8c52);
}

.shefa-hg-footer-copy {
    margin: 0;
    font-size: 0.72rem;
    color: #9aa0a6;
}

@media (min-width: 992px) {
    html.shefa-layout-holy-grail .shefa-hg-nav-inner {
        min-height: 100%;
    }
}

@media (max-width: 991.98px) {
    html.shefa-layout-holy-grail .shefa-hg-shell {
        flex-direction: column;
        padding: 0.5rem 0.75rem 1rem;
        min-height: 0;
    }

    html.shefa-layout-holy-grail .shefa-hg-nav {
        position: relative;
        top: 0;
        width: 100%;
        min-width: 0;
        flex: none;
        min-height: 0;
        max-height: 55vh;
        margin-left: 0;
    }

    html.shefa-layout-holy-grail .shefa-hg-main {
        padding: 0;
        min-height: 0;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }
}

/* Dark mode */
html[data-bs-theme="dark"] .shefa-hg-nav,
html[data-bs-theme="dark"] .shefa-hg-main {
    background: var(--shefa-card, #2a2a2a) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

html[data-bs-theme="dark"] .shefa-hg-nav {
    border: none;
}

html[data-bs-theme="dark"] .shefa-hg-nav-list a,
html[data-bs-theme="dark"] .shefa-hg-category-toggle {
    color: var(--shefa-text, #f0f0f0);
}

html[data-bs-theme="dark"] .shefa-hg-sublist a {
    color: var(--shefa-text-muted, #cfcfcf);
}

html[data-bs-theme="dark"] .shefa-hg-nav-title--categories {
    border-top: none;
}

html[data-bs-theme="dark"] .shefa-hg-nav-footer {
    background: transparent;
}

html[data-bs-theme="dark"] .shefa-hg-footer-links a,
html[data-bs-theme="dark"] .shefa-hg-footer-contact a {
    color: var(--shefa-text-muted, #cfcfcf);
}

html[data-bs-theme="dark"] .shefa-layout-option {
    background: var(--shefa-surface-2, #1a1a1a);
    border-color: var(--shefa-border, #3a3a3a);
    color: var(--shefa-text, #f0f0f0);
}
