/* =====================================================
   BG Resource Grid & Site Components
   v1.5.1 — Icon optical centering fix (margin-top: 2px)
   v1.5   — Big Shoulders weight 500 + letter-spacing -0.5px throughout
          — Horizontal icon+title card layout, reduced vertical padding
          — Sticky-nav fix for Divi 5 flex columns (folded in from interim patch)
   v1.4   — added left nav, retains card grid and embedded doc styles
   ===================================================== */

/* Brand colours used across components */
:root {
    --bg-teal: #13505b;
    --bg-orange: #fe4d00;
    --bg-yellow: #ffbe00;
    --bg-green: #30e1b1;
    --bg-grey: #434343;
    --bg-light-grey: #f2f2f2;
    --bg-border: #e0e0e0;
}

/* =====================================================
   RESOURCE GRID — Page type C card layout
   ===================================================== */

.bg-resource-grid-wrapper {
    width: 100%;
    margin: 0 auto;
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
}

/* Sub-category section (outer level) */
.bg-resource-subcategory {
    margin-bottom: 96px;
    scroll-margin-top: 100px; /* anchored nav links land below sticky header */
}
.bg-resource-subcategory:last-child {
    margin-bottom: 0;
}

.bg-resource-subcategory-heading {
    font-family: 'Big Shoulders', 'DM Sans', sans-serif;
    font-size: 2.5rem;
    font-weight: 500;
    letter-spacing: -0.5px;
    color: var(--bg-teal);
    text-transform: uppercase;
    margin: 0 0 32px;
    padding-bottom: 16px;
    border-bottom: 4px solid var(--bg-teal);
    line-height: 1.1;
}

/* Group section (inner level) */
.bg-resource-group {
    margin-bottom: 48px;
}
.bg-resource-group:last-child {
    margin-bottom: 0;
}

.bg-resource-group-heading {
    font-family: 'Big Shoulders', 'DM Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.5px;
    color: var(--bg-orange);
    text-transform: uppercase;
    margin: 0 0 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--bg-orange);
    line-height: 1.2;
}

.bg-resource-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.bg-resource-card {
    background: #ffffff;
    border: 1px solid var(--bg-border);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    display: flex;
    flex-direction: column;
}

.bg-resource-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(19, 80, 91, 0.12);
    border-color: var(--bg-teal);
}

/* Primary card content area — condensed in v1.5 */
.bg-resource-card-primary {
    display: block;
    padding: 18px 20px;
    color: var(--bg-grey);
    text-decoration: none;
    flex: 1;
}

.bg-resource-card-primary:hover,
.bg-resource-card-primary:focus {
    text-decoration: none;
    color: var(--bg-grey);
}

/* Header row: icon and title sit side-by-side (v1.5 change) */
.bg-resource-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.bg-resource-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-top: 2px; /* optical centering against title's line-height padding */
    color: var(--bg-orange);
    background: rgba(254, 77, 0, 0.08);
    border-radius: 8px;
    flex-shrink: 0; /* keep icon from squashing when title wraps */
}

.bg-resource-card-icon svg {
    width: 20px;
    height: 20px;
}

.bg-resource-card-title {
    font-family: 'Big Shoulders', 'DM Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: -0.5px;
    color: var(--bg-teal);
    margin: 0;
    line-height: 1.15;
    flex: 1; /* take the rest of the header row */
}

.bg-resource-card-description {
    font-size: 0.95rem;
    color: var(--bg-grey);
    margin: 0;
    line-height: 1.45;
}

.bg-resource-card-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-light-grey);
    color: var(--bg-teal);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-top: 1px solid var(--bg-border);
    transition: background 0.15s ease, color 0.15s ease;
}

.bg-resource-card-secondary:hover,
.bg-resource-card-secondary:focus {
    background: var(--bg-teal);
    color: #ffffff;
    text-decoration: none;
}

.bg-resource-card-secondary-icon {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1;
}

.bg-resource-empty {
    padding: 40px;
    text-align: center;
    color: var(--bg-grey);
    background: var(--bg-light-grey);
    border-radius: 10px;
    font-style: italic;
}

/* =====================================================
   LEFT NAVIGATION — contextual sidebar
   ===================================================== */

/* Sticky-nav fix for Divi 5 flex columns
   Divi 5 wraps columns in flexbox; sticky needs the wrapper to be
   the sticky element, not the nav itself, otherwise flex-item height
   collapses the sticky travel distance. */
#bg-page-c-nav-col > .et_pb_code {
    position: sticky;
    top: 100px;
    align-self: flex-start;
}

.bg-left-nav {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    /* position: sticky moved up to the .et_pb_code wrapper above */
    padding-right: 24px;
    border-right: 1px solid var(--bg-border);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.bg-left-nav-heading {
    font-family: 'Big Shoulders', 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: -0.5px;
    color: var(--bg-grey);
    text-transform: uppercase;
    margin: 0 0 16px;
    padding: 0;
}

.bg-left-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bg-left-nav-item {
    margin: 0;
    padding: 0;
}

.bg-left-nav-link {
    display: block;
    padding: 10px 12px;
    margin: 2px 0;
    color: var(--bg-grey);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    border-left: 3px solid transparent;
}

.bg-left-nav-link:hover,
.bg-left-nav-link:focus {
    background: var(--bg-light-grey);
    color: var(--bg-teal);
    text-decoration: none;
}

.bg-left-nav-item--active > .bg-left-nav-link {
    color: var(--bg-teal);
    font-weight: 500;
    border-left-color: var(--bg-orange);
    background: rgba(19, 80, 91, 0.04);
}

/* Sub-category drill-down list */
.bg-left-nav-sublist {
    list-style: none;
    padding: 0;
    margin: 4px 0 12px 12px;
    border-left: 1px solid var(--bg-border);
}

.bg-left-nav-subitem {
    margin: 0;
}

.bg-left-nav-sublink {
    display: block;
    padding: 6px 12px;
    color: var(--bg-grey);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: color 0.15s ease, background 0.15s ease;
    border-radius: 4px;
}

.bg-left-nav-sublink:hover,
.bg-left-nav-sublink:focus {
    background: var(--bg-light-grey);
    color: var(--bg-teal);
    text-decoration: none;
}

/* =====================================================
   EMBEDDED DOCUMENT — Page type D
   ===================================================== */

.bg-doc-wrapper {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.bg-doc-embed {
    display: block;
    width: 100% !important;
    height: 85vh;
    min-height: 700px;
    border: 1px solid var(--bg-border);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(19, 80, 91, 0.06);
    background: #fff;
}

.bg-doc-open-link {
    text-align: right;
    margin-top: 16px;
    font-size: 0.95rem;
    font-family: 'DM Sans', system-ui, sans-serif;
}

.bg-doc-open-link a {
    color: var(--bg-teal);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.bg-doc-open-link a:hover,
.bg-doc-open-link a:focus {
    border-bottom-color: var(--bg-orange);
}

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

/* Mobile: collapse left nav */
@media (max-width: 900px) {
    /* Release the sticky wrapper at mobile so the nav scrolls inline */
    #bg-page-c-nav-col > .et_pb_code {
        position: static;
    }

    .bg-left-nav {
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--bg-border);
        padding: 16px 0;
        margin-bottom: 24px;
    }

    .bg-resource-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .bg-resource-subcategory-heading {
        font-size: 1.75rem;
    }
    .bg-resource-group-heading {
        font-size: 1.25rem;
    }
    .bg-resource-subcategory {
        margin-bottom: 64px;
    }
    .bg-resource-card-primary {
        padding: 16px 18px;
    }

    .bg-doc-embed {
        height: 75vh;
        min-height: 480px;
    }
}

@media (min-width: 901px) and (max-width: 1100px) {
    .bg-resource-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
