/* =========================================================
   BLOG ARTICLE (blog.php) — builds on home / programs / blogs / course-details CSS
   ========================================================= */

/* ---------- Header ---------- */
.hm .bp-hero {
    padding-bottom: clamp(28px, 4vw, 48px);
}

.bp-hero-inner {
    max-width: 880px;
    text-align: center;
}

.bp-hero .cd-crumbs {
    justify-content: center;
    margin-bottom: 24px;
}

.bp-cat {
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.bp-cat:hover {
    border-color: rgba(13, 148, 136, 0.5);
    transform: translateY(-1px);
}

.hm .bp-title {
    margin: 18px auto 0;
    max-width: 18ch;
    font-size: clamp(2.1rem, 4.6vw, 3.6rem);
    line-height: 1.08;
}

.bp-dek {
    margin: 18px auto 0;
    max-width: 640px;
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    line-height: 1.65;
    color: var(--muted);
}

.bp-draft {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-weight: 700;
    font-size: 0.85rem;
}

.bp-draft svg {
    width: 16px;
    height: 16px;
}

.bp-byline {
    margin-top: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px 24px;
    padding: 14px 18px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.bp-author {
    text-align: left;
}

.bp-author .hm-avatar {
    width: 42px;
    height: 42px;
    font-size: 0.8rem;
}

.bp-author strong {
    display: block;
    color: var(--ink);
    font-size: 0.92rem;
}

.bp-author small {
    display: block;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: var(--muted);
    font-size: 0.78rem;
}

.bp-stats {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 0.86rem;
    color: var(--muted);
}

.bp-stats li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bp-stats svg {
    width: 15px;
    height: 15px;
    color: var(--teal);
}

.bp-shares {
    display: flex;
    gap: 6px;
}

.bp-share {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink-2);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.bp-share svg {
    width: 16px;
    height: 16px;
}

.bp-share:hover {
    transform: translateY(-2px);
    color: #ffffff;
    background: var(--ink);
    border-color: var(--ink);
}

.bp-share-wa:hover { background: #16a34a; border-color: #16a34a; }
.bp-share-fb:hover { background: #1d4ed8; border-color: #1d4ed8; }
.bp-share-li:hover { background: #0a66c2; border-color: #0a66c2; }

.bp-copy-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, 4px);
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--ink);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.bp-copy.is-copied {
    background: var(--teal);
    border-color: var(--teal);
    color: #ffffff;
}

.bp-copy.is-copied .bp-copy-tip {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- Cover ---------- */
.bp-cover {
    position: relative;
    z-index: 1;
    margin: 0 auto;
    max-width: 1100px;
    aspect-ratio: 21 / 9;
    border-radius: 28px;
    overflow: hidden;
    border: 6px solid #ffffff;
    box-shadow: var(--shadow-lg);
    background: #e2e8f0;
}

.bp-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Layout ---------- */
.bp-body {
    padding: clamp(36px, 5vw, 64px) 0 clamp(48px, 6vw, 88px);
    background: #ffffff;
}

.bp-layout {
    display: grid;
    grid-template-columns: minmax(0, 720px) 300px;
    justify-content: center;
    gap: clamp(32px, 4vw, 56px);
    align-items: start;
}

.bp-layout.has-toc {
    grid-template-columns: 220px minmax(0, 720px) 280px;
}

.bp-toc-wrap,
.bp-aside {
    position: sticky;
    top: 96px;
}

/* ---------- Table of contents ---------- */
.bp-toc-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.bp-toc-title svg {
    width: 16px;
    height: 16px;
}

.bp-toc ol {
    list-style: none;
    border-left: 2px solid var(--line);
}

.bp-toc a {
    position: relative;
    display: block;
    margin-left: -2px;
    padding: 7px 0 7px 14px;
    border-left: 2px solid transparent;
    font-size: 0.86rem;
    line-height: 1.4;
    color: var(--muted);
    transition: color 0.2s ease, border-color 0.2s ease, padding 0.2s ease;
}

.bp-toc-h3 a {
    padding-left: 26px;
    font-size: 0.82rem;
}

.bp-toc a:hover {
    color: var(--ink);
}

.bp-toc a.is-active {
    color: var(--teal-d);
    font-weight: 700;
    border-left-color: var(--teal);
    padding-left: 18px;
}

.bp-toc-h3 a.is-active {
    padding-left: 30px;
}

.bp-toc-progress {
    margin-top: 18px;
    height: 4px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}

.bp-toc-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal-2), var(--teal-d));
    transition: width 0.15s linear;
}

.bp-toc-left {
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

/* ---------- Prose (admin-authored HTML) ---------- */
.bp-prose {
    font-size: 1.08rem;
    line-height: 1.85;
    color: #273449;
}

.bp-prose > * + * {
    margin-top: 1.2em;
}

.bp-prose .lead-para,
.bp-prose > p:first-child {
    font-size: 1.22rem;
    line-height: 1.75;
    color: var(--ink);
}

.bp-prose > p:first-child::first-letter {
    float: left;
    margin: 0.08em 0.12em 0 0;
    font-family: var(--font-h);
    font-size: 3.4em;
    font-weight: 800;
    line-height: 0.85;
    color: var(--teal);
}

.bp-prose h2,
.bp-prose h3,
.bp-prose h4 {
    margin-top: 2em;
    font-family: var(--font-h);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--ink);
    scroll-margin-top: 100px;
}

.bp-prose h2 { font-size: 1.75rem; }
.bp-prose h3 { font-size: 1.4rem; }
.bp-prose h4 { font-size: 1.15rem; }

.bp-prose h2 + *,
.bp-prose h3 + *,
.bp-prose h4 + * {
    margin-top: 0.6em;
}

.bp-prose a {
    color: var(--teal-d);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(13, 148, 136, 0.35);
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
    transition: text-decoration-color 0.2s ease;
}

.bp-prose a:hover {
    text-decoration-color: var(--teal);
}

.bp-prose strong {
    color: var(--ink);
}

.bp-prose ul,
.bp-prose ol {
    padding-left: 0;
    list-style: none;
    display: grid;
    gap: 0.6em;
}

.bp-prose ul li,
.bp-prose ol li {
    position: relative;
    padding-left: 34px;
}

.bp-prose ul li::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0.72em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal-2);
    box-shadow: 0 0 0 4px var(--mint);
}

.bp-prose ol {
    counter-reset: bp;
}

.bp-prose ol li {
    counter-increment: bp;
}

.bp-prose ol li::before {
    content: counter(bp);
    position: absolute;
    left: 0;
    top: 0.25em;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}

.bp-prose blockquote {
    position: relative;
    margin: 2em 0;
    padding: 24px 28px 24px 30px;
    border-radius: 0 20px 20px 0;
    border-left: 4px solid var(--teal);
    background: var(--mint);
    font-family: var(--font-h);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.55;
    color: var(--teal-dd);
}

.bp-prose img {
    border-radius: 18px;
    box-shadow: var(--shadow-md);
}

.bp-prose .bp-zoomable {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.bp-prose .bp-zoomable:hover {
    transform: scale(1.01);
}

.bp-prose figure {
    margin: 2em 0;
}

.bp-prose figcaption {
    margin-top: 10px;
    font-size: 0.86rem;
    color: var(--muted);
    text-align: center;
}

.bp-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    display: block;
    overflow-x: auto;
}

.bp-prose th,
.bp-prose td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.bp-prose th {
    background: var(--soft);
    font-weight: 700;
    color: var(--ink);
}

.bp-prose code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--soft);
    border: 1px solid var(--line);
    font-size: 0.9em;
}

.bp-prose pre {
    padding: 18px 20px;
    border-radius: 16px;
    background: var(--ink);
    color: #e2e8f0;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
}

.bp-prose pre code {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
}

.bp-prose hr {
    border: 0;
    height: 1px;
    margin: 2.4em 0;
    background: var(--line);
}

/* ---------- Gallery ---------- */
.bp-gallery {
    margin-top: 48px;
}

.hm .bp-gallery-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-family: var(--font-h);
    font-size: 1.3rem;
    font-weight: 800;
}

.bp-gallery-title svg {
    width: 20px;
    height: 20px;
    color: var(--teal);
}

.bp-gallery-title span {
    margin-left: auto;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted);
}

.bp-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: 12px;
}

.bp-gallery-item {
    position: relative;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    cursor: zoom-in;
    background: #e2e8f0;
}

.bp-gallery-item:first-child {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: auto;
}

.bp-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.bp-gallery-item:hover img {
    transform: scale(1.07);
}

.bp-gallery-zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.7);
    color: #ffffff;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.bp-gallery-zoom svg {
    width: 16px;
    height: 16px;
}

.bp-gallery-item:hover .bp-gallery-zoom,
.bp-gallery-item:focus-visible .bp-gallery-zoom {
    opacity: 1;
    transform: none;
}

/* ---------- Article end ---------- */
.bp-end {
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 24px;
}

.bp-end-share {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 18px;
    background: var(--soft);
    border: 1px solid var(--line);
}

.bp-end-share p {
    color: var(--muted);
}

.bp-end-share strong {
    color: var(--ink);
}

.bp-prevnext {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.bp-pn {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.bp-pn:hover {
    color: var(--ink);
    border-color: rgba(13, 148, 136, 0.4);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.bp-pn small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--teal-d);
}

.bp-pn small svg {
    width: 14px;
    height: 14px;
}

.bp-pn strong {
    font-family: var(--font-ui);
    font-size: 0.98rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bp-pn-next {
    text-align: right;
    align-items: flex-end;
    grid-column: 2;
}

/* ---------- Side CTA ---------- */
.bp-cta {
    padding: 26px 24px;
    border-radius: 24px;
    color: rgba(236, 253, 245, 0.85);
    background:
        radial-gradient(80% 60% at 100% 0%, rgba(94, 234, 212, 0.25) 0%, rgba(94, 234, 212, 0) 60%),
        linear-gradient(160deg, var(--teal-d) 0%, var(--teal-dd) 100%);
    box-shadow: 0 30px 50px -24px rgba(13, 148, 136, 0.65);
}

.bp-cta-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.12);
    color: #5eead4;
}

.bp-cta-icon svg {
    width: 24px;
    height: 24px;
}

.hm .bp-cta h2 {
    margin-top: 16px;
    font-family: var(--font-h);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.25;
    color: #ffffff;
}

.bp-cta p {
    margin: 8px 0 20px;
    font-size: 0.92rem;
    line-height: 1.6;
}

.bp-cta-link {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ccfbf1;
    font-weight: 700;
    font-size: 0.88rem;
}

.bp-cta-link:hover {
    color: #ffffff;
}

.bp-cta-link svg {
    width: 16px;
    height: 16px;
}

/* ---------- Related ---------- */
.hm .bp-related {
    background: var(--soft);
    border-top: 1px solid var(--line);
}

/* ---------- Not found ---------- */
.bp-missing {
    margin-top: 40px;
    margin-bottom: 40px;
}

/* ---------- Lightbox ---------- */
.bp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.bp-lightbox[hidden] {
    display: none;
}

.bp-lightbox.is-open {
    opacity: 1;
}

.bp-lb-figure {
    max-width: min(1100px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transform: scale(0.96);
    transition: transform 0.3s var(--mo-ease, ease);
}

.bp-lightbox.is-open .bp-lb-figure {
    transform: none;
}

.bp-lb-figure img {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    border-radius: 14px;
    object-fit: contain;
}

.bp-lb-figure figcaption {
    color: #cbd5e1;
    font-size: 0.9rem;
    text-align: center;
}

.bp-lb-btn {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.bp-lb-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.06);
}

.bp-lb-btn svg {
    width: 22px;
    height: 22px;
}

.bp-lb-close {
    position: absolute;
    top: 18px;
    right: 18px;
}

.bp-lightbox.is-single .bp-lb-prev,
.bp-lightbox.is-single .bp-lb-next {
    display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .bp-layout.has-toc {
        grid-template-columns: 200px minmax(0, 1fr);
    }

    .bp-layout.has-toc .bp-aside {
        grid-column: 1 / -1;
        position: static;
        max-width: 720px;
        width: 100%;
        margin: 0 auto;
    }
}

@media (max-width: 992px) {
    .bp-layout,
    .bp-layout.has-toc {
        grid-template-columns: minmax(0, 1fr);
    }

    .bp-toc-wrap,
    .bp-aside {
        position: static;
    }

    .bp-toc {
        padding: 18px 20px;
        border-radius: 18px;
        background: var(--soft);
        border: 1px solid var(--line);
    }

    .bp-toc-progress,
    .bp-toc-left {
        display: none;
    }

    .bp-cover {
        aspect-ratio: 16 / 9;
    }
}

@media (max-width: 640px) {
    .bp-hero-inner {
        text-align: left;
    }

    .bp-hero .cd-crumbs {
        justify-content: flex-start;
    }

    .hm .bp-title,
    .bp-dek {
        margin-left: 0;
        margin-right: 0;
    }

    .bp-byline {
        justify-content: flex-start;
    }

    .bp-cover {
        border-radius: 18px;
        border-width: 4px;
    }

    .bp-prose {
        font-size: 1.02rem;
    }

    .bp-prose .lead-para,
    .bp-prose > p:first-child {
        font-size: 1.1rem;
    }

    .bp-prevnext {
        grid-template-columns: 1fr;
    }

    .bp-pn-next {
        grid-column: auto;
    }

    .bp-gallery-item:first-child {
        grid-column: span 1;
        grid-row: span 1;
        aspect-ratio: 4 / 3;
    }

    .bp-lb-prev,
    .bp-lb-next {
        position: absolute;
        bottom: 24px;
    }

    .bp-lb-prev { left: calc(50% - 60px); }
    .bp-lb-next { right: calc(50% - 60px); }
}
