/* ═══════════════════════════════════════════
   Build Digital — PHP Template Layout Styles
   These styles handle the hero, page layout,
   and structural elements rendered by the
   plugin's PHP templates.
   ═══════════════════════════════════════════ */

/* ─── Reset / Base ─── */

.bd-tpl-page {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.bd-tpl-page *,
.bd-tpl-page *::before,
.bd-tpl-page *::after {
    box-sizing: border-box;
}

/* ═══ HERO SECTION ═══ */

.bd-tpl-hero {
    background-color: #B14581;  /* Default: magenta/pink */
    color: #fff;
    position: relative;
    overflow: hidden;
}

.bd-tpl-hero--green {
    background-color: #0D5951;
}

.bd-tpl-hero--blue {
    background-color: #3F88A7;
}

.bd-tpl-hero--course {
    background-color: #B14581;
}

.bd-tpl-hero--lesson {
    background-color: #2D2926;
}

.bd-tpl-hero__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 160px 24px 80px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 40px;
}

.bd-tpl-hero__inner--centered {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 140px 24px 60px;
}

.bd-tpl-hero__content {
    flex: 0 0 65%;
    min-width: 0;
}

.bd-tpl-hero__content--wide {
    flex: 0 0 80%;
    max-width: 800px;
}

.bd-tpl-hero__image {
    flex: 0 0 35%;
    min-width: 0;
}

.bd-tpl-hero__img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.bd-tpl-hero__image {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

/* Breadcrumbs */
.bd-tpl-breadcrumbs {
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 16px;
    opacity: 0.85;
}

.bd-tpl-breadcrumbs a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.bd-tpl-breadcrumbs a:hover {
    color: #fff;
    text-decoration: underline;
}

.bd-tpl-breadcrumbs__sep {
    margin: 0 6px;
    opacity: 0.5;
}

.bd-tpl-breadcrumbs span {
    color: rgba(255,255,255,0.6);
}

/* Overline */
.bd-tpl-hero__overline {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: clamp(11px, 0.6vw + 8px, 14px);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
}

.bd-tpl-hero__overline-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}

.bd-tpl-hero__overline-link:hover {
    color: #fff;
    text-decoration: underline;
}

/* Title */
.bd-tpl-hero__title {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(2rem, 3.5vw + 0.5rem, 3.75rem);
    line-height: 1.08;
    color: #fff;
    margin: 0 0 16px;
    text-wrap: balance;
}

/* Intro */
.bd-tpl-hero__intro {
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 0.9vw + 0.75rem, 1.25rem);
    line-height: 1.5;
    color: rgba(255,255,255,0.9);
    max-width: 680px;
}

.bd-tpl-hero__intro p {
    margin: 0 0 0.5em;
}

.bd-tpl-hero__intro p:last-child {
    margin-bottom: 0;
}

/* Meta Row (Location + Date) */
.bd-tpl-hero__meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 20px;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: clamp(0.875rem, 0.6vw + 0.69rem, 1.125rem);
    color: rgba(255,255,255,0.85);
}

.bd-tpl-hero__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.bd-tpl-hero__meta-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* Quick Link Buttons */
.bd-tpl-hero__quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.bd-tpl-hero__quick-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    color: #fff;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: clamp(0.813rem, 0.5vw + 0.65rem, 1rem);
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s;
    cursor: pointer;
}

.bd-tpl-hero__quick-link:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

.bd-tpl-hero__quick-link svg {
    flex-shrink: 0;
    opacity: 0.9;
}

/* ═══ BODY SECTION ═══ */

.bd-tpl-body {
    background-color: #fff;
}

.bd-tpl-body__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 80px 24px;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 60px;
    align-items: flex-start;
}

.bd-tpl-body__inner--narrow {
    max-width: 960px;
    flex-direction: column !important;
    gap: 0;
}

.bd-tpl-body__main {
    flex: 1 1 0%;
    min-width: 0;
    max-width: calc(100% - 380px);
}

.bd-tpl-body__sidebar {
    flex: 0 0 320px;
    width: 320px;
    min-width: 280px;
    position: sticky;
    top: 100px;
}

/* Hide sidebar column entirely when it has no content */
.bd-tpl-body__sidebar:empty {
    display: none;
}

/* ── Gallery as its own section row ── */
.bd-tpl-gallery {
    background-color: #fff;
}

/* ═══ RESPONSIVE ═══ */

@media (max-width: 1024px) {
    .bd-tpl-hero__inner {
        flex-direction: column-reverse;
        padding: 120px 24px 40px;
        align-items: flex-start;
    }

    .bd-tpl-hero__content {
        flex: 0 0 auto;
        width: 100%;
    }

    .bd-tpl-hero__image {
        flex: 0 0 auto;
        width: 50%;
        margin-top: 30px;
    }

    /* Override the base !important row direction for stacked layout on tablet */
    .bd-tpl-body__inner {
        flex-direction: column !important;
        flex-wrap: wrap !important;
        padding: 60px 24px;
        gap: 40px;
    }

    .bd-tpl-body__main {
        max-width: 100%;
    }

    .bd-tpl-body__sidebar {
        flex: 0 0 auto;
        width: 100% !important;
        min-width: 0;
        position: static;
    }
}

@media (max-width: 768px) {
    .bd-tpl-hero__inner {
        padding: 100px 16px 32px;
    }

    .bd-tpl-hero__inner--centered {
        padding: 100px 16px 40px;
    }

    .bd-tpl-hero__image {
        width: 70%;
        margin-top: 30px;
    }

    .bd-tpl-hero__title {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }

    .bd-tpl-hero__meta-row {
        gap: 12px;
        flex-direction: column;
    }

    .bd-tpl-hero__quick-links {
        gap: 8px;
    }

    .bd-tpl-hero__quick-link {
        padding: 8px 16px;
        font-size: 0.813rem;
    }

    .bd-tpl-body__inner {
        padding: 40px 16px;
        gap: 32px;
    }

    .bd-sidebar-toggle {
        padding: 14px 0;
        font-size: 0.95rem;
    }
}

/* ═══ COURSE PAGE LAYOUT ═══ */

/* Hero variant — course uses brand pink (already set), lesson now matches */
.bd-tpl-hero--lesson {
    background-color: #B14581 !important;
}

/* Course body: sidebar LEFT, content RIGHT */
.bd-tpl-body__inner--course {
    flex-direction: row !important;
}

.bd-tpl-body__sidebar--course {
    flex: 0 0 300px;
    width: 300px;
    min-width: 260px;
    order: -1; /* force sidebar left */
}

.bd-tpl-body__main--course {
    flex: 1 1 0%;
    min-width: 0;
}

/* Hero layout variant for course (left-aligned, not centred) */
.bd-tpl-hero__inner--course-hero {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    padding: 160px 24px 80px;
}

/* Lesson meta (e.g. "Lesson 3 of 12") */
.bd-tpl-hero__lesson-meta {
    font-family: 'Roboto', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(255,255,255,0.7);
    margin-top: 12px;
}

/* ═══ COURSE / LESSON NAV SIDEBAR ═══ */

.bd-course-nav {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    position: sticky;
    top: 100px;
}

.bd-course-nav--lesson {
    /* same but no extra overrides needed */
}

.bd-course-nav__heading {
    font-family: 'Roboto Slab', serif;
    font-size: 1rem;
    font-weight: 700;
    color: #2D2926;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #B14581;
}

.bd-course-nav__chapter {
    font-family: 'Roboto', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
    margin: 20px 0 6px;
    padding: 0;
}

.bd-course-nav__lesson {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: #2D2926;
    font-family: 'Roboto', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.35;
    transition: background-color 0.15s;
    margin-bottom: 2px;
}

.bd-course-nav__lesson:hover {
    background-color: #f5f5f5;
    color: #B14581;
}

.bd-course-nav__lesson--current {
    background-color: #fdf0f7;
    color: #B14581;
    font-weight: 600;
}

.bd-course-nav__num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #555;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.15s;
}

.bd-course-nav__lesson--current .bd-course-nav__num {
    background: #B14581;
    color: #fff;
}

.bd-course-nav__lesson--done .bd-course-nav__num {
    background: #16a34a;
    color: #fff;
}

.bd-course-nav__lesson-title {
    flex: 1 1 0%;
    min-width: 0;
}

.bd-course-nav__check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bd-course-nav__check-icon {
    color: #d1d5db;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.bd-course-nav__lesson--done .bd-course-nav__check-icon {
    color: #16a34a;
    opacity: 1;
}

/* Back link above sidebar nav */
.bd-lesson-nav__back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Roboto', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #B14581;
    text-decoration: none;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bd-lesson-nav__back-link:hover {
    color: #8a3566;
}

/* ═══ PREV / NEXT NAV (bottom of lesson content) ═══ */

.bd-lesson-prevnext {
    display: flex;
    gap: 16px;
    margin-top: 60px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}

.bd-lesson-prevnext__btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: #2D2926;
    font-family: 'Roboto', sans-serif;
    font-size: 0.925rem;
    font-weight: 500;
    transition: border-color 0.15s, background-color 0.15s;
    line-height: 1.35;
}

.bd-lesson-prevnext__btn:hover {
    border-color: #B14581;
    background-color: #fdf0f7;
    color: #B14581;
}

.bd-lesson-prevnext__btn--disabled {
    opacity: 0.4;
    pointer-events: none;
}

.bd-lesson-prevnext__btn--next {
    justify-content: flex-end;
    text-align: right;
}

.bd-lesson-prevnext__btn span {
    display: flex;
    flex-direction: column;
}

.bd-lesson-prevnext__btn small {
    font-size: 0.75rem;
    font-weight: 400;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 2px;
}

.bd-lesson-prevnext__btn:hover small {
    color: #B14581;
}

.bd-lesson-prevnext__btn svg {
    flex-shrink: 0;
    color: #B14581;
}

/* ═══ FOOTNOTE LINKS ═══ */

.bd-footnote-ref {
    font-size: 0.75em;
    vertical-align: super;
    color: #B14581;
    text-decoration: none;
    font-weight: 600;
}

.bd-footnote-ref:hover {
    text-decoration: underline;
}

/* ═══ LIST BLOCK — HEADING ITEM ═══ */

/* When the first list item of a block looks like a section heading, it is
   rendered as an <h4 class="bd-block-list-heading"> instead of an <li>. */
.bd-block-list-heading {
    font-family: 'Roboto Slab', serif;
    font-size: 1rem;
    font-weight: 700;
    color: #2D2926;
    margin: 1.4em 0 0.4em;
    padding: 0;
}

/* ═══ COLLAPSIBLE COURSE NAV (tablet / mobile) ═══ */

/* ── Desktop heading ── always visible on desktop */
.bd-course-nav__heading--desktop {
    display: block;
}

/* ── Toggle button ── MUST be completely invisible on desktop.
   Use !important throughout to defeat WordPress theme button resets
   (many themes inject background-color, border, color on <button>). */
.bd-course-nav__toggle {
    display: none !important;          /* hidden on desktop */
    width: 100%;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    color: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

/* Reset heading span inside the button so it doesn't inherit heading border */
.bd-course-nav__toggle .bd-course-nav__heading {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
    color: #2D2926;
}

.bd-course-nav__toggle-icon {
    flex-shrink: 0;
    color: #B14581;
    transition: transform 0.25s ease;
}

.bd-course-nav__toggle[aria-expanded="true"] .bd-course-nav__toggle-icon {
    transform: rotate(180deg);
}

/* ── List wrapper ── always visible on desktop, no extra chrome needed */
.bd-course-nav__list {
    display: block;
}

/* ═══ COURSE CONTENT AREA ═══ */

.bd-course-content__desc {
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 0.7vw + 0.8rem, 1.2rem);
    line-height: 1.7;
    color: #2D2926;
}

.bd-course-content__desc p {
    margin-bottom: 1.2em;
}

.bd-course-content__footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    font-family: 'Roboto', sans-serif;
    font-size: 0.875rem;
    color: #666;
    line-height: 1.6;
}

.bd-course-content__disclaimer {
    font-style: italic;
}

/* ═══ RESPONSIVE — COURSE & LESSON ═══ */

@media (max-width: 1024px) {
    .bd-tpl-body__inner--course {
        flex-direction: column !important;
        flex-wrap: wrap !important;
    }

    .bd-tpl-body__sidebar--course {
        flex: 0 0 auto;
        width: 100%;
        order: 0;
        position: static;
    }

    .bd-course-nav {
        position: static;
    }

    .bd-tpl-hero__inner--course-hero {
        padding: 120px 24px 60px;
    }

    /* Switch to collapsible toggle on tablet/mobile */
    .bd-course-nav__toggle {
        display: flex !important;  /* override the desktop display:none !important */
        margin-bottom: 0 !important;
    }

    /* Hide the static desktop heading — toggle label replaces it */
    .bd-course-nav__heading--desktop {
        display: none !important;
    }

    /* Lesson nav list collapses by default; JS adds --open to expand */
    .bd-course-nav__list {
        display: none !important;
        border-top: 2px solid #B14581;
        padding-top: 12px;
        margin-top: 8px;
    }

    .bd-course-nav__list--open {
        display: block !important;
    }

    /* Give the sidebar a subtle card on mobile so it's visually grouped */
    .bd-tpl-body__sidebar {
        background: #fafafa;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 16px;
    }

    /* Remove inner bd-course-nav card border — sidebar wrapper provides it */
    .bd-course-nav {
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        position: static !important;
    }

    .bd-lesson-nav__back-link {
        margin-bottom: 12px;
    }
}

@media (max-width: 768px) {
    .bd-lesson-prevnext {
        flex-direction: column;
    }

    .bd-lesson-prevnext__btn--next {
        justify-content: flex-start;
        text-align: left;
    }
}

/* ═══ MASONRY GALLERY ═══ */

.bd-gallery-section {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 60px 24px 80px;
    border-top: 1px solid #e5e7eb;
}

.bd-gallery-masonry {
    columns: 3;
    column-gap: 16px;
}

.bd-gallery-item {
    margin: 0 0 16px;
    break-inside: avoid;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    opacity: 0;
    transform: translateY(24px) scale(0.97);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transition-delay: var(--delay, 0s);
}

.bd-gallery-item.bd-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.bd-gallery-item:hover .bd-gallery-img {
    transform: scale(1.03);
}

.bd-gallery-img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.35s ease;
    background: #f3f4f6;
}

/* Lazy-load placeholder: grey box with aspect ratio preserved via inline SVG src */
.bd-gallery-img.bd-lazyload:not(.bd-loaded) {
    filter: blur(4px);
}

.bd-gallery-img.bd-loaded {
    filter: none;
}

.bd-gallery-caption {
    padding: 8px 10px;
    font-size: 0.8rem;
    color: #6b7280;
    background: #fafafa;
}

/* ─── Inline auto-detected gallery (from paragraph blocks) ─── */
.bd-content-block--inline-gallery {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

/* ─── Gallery responsive ─── */

@media (max-width: 768px) {
    .bd-gallery-masonry { columns: 2; column-gap: 10px; }
    .bd-gallery-item { margin-bottom: 12px; }
    .bd-gallery-section { margin-top: 40px; padding-top: 24px; padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 480px) {
    .bd-gallery-masonry { columns: 1; }
}

/* ═══ IMAGE LIGHTBOX ═══ */

.bd-img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bd-img-lightbox[hidden] {
    display: none !important;
}

.bd-img-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(6px);
}

.bd-img-lightbox__stage {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bd-img-lightbox__stage img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bd-img-lightbox__stage img.bd-lb-loaded {
    opacity: 1;
}

.bd-img-lightbox__close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 2;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 8px;
}
.bd-img-lightbox__close:hover { opacity: 1; }

.bd-img-lightbox__prev,
.bd-img-lightbox__next {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
}
.bd-img-lightbox__prev:hover,
.bd-img-lightbox__next:hover {
    opacity: 1;
    background: rgba(255,255,255,0.2);
}
.bd-img-lightbox__prev { left: 16px; }
.bd-img-lightbox__next { right: 16px; }

.bd-img-lightbox__counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    font-family: 'Roboto', sans-serif;
}

/* ═══ Google Fonts loader ═══ */
/* The templates rely on Roboto + Roboto Slab.
   If your theme doesn't load them, uncomment the @import below
   or enqueue them in your theme/child-theme.

   @import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;700&family=Roboto:wght@300;400;500;600;700&display=swap');
*/
