/* Blog details page — uses vars from style.css
   (--primary, --secondary, --accent, --dark, --white,
   --light-bg, --text-dark, --text-light). Self-contained, same as blogs.css. */

:root { --bd-header-h: 72px; }
html { scroll-behavior: smooth; }

/* NOTE: no overflow on .bd-main - it would stop the sidebar from sticking */
.bd-hero, .bd-related { overflow-x: hidden; overflow-x: clip; }

/* ---------- Reading progress ---------- */
.bd-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 10000;
    pointer-events: none;
}
.bd-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--secondary));
}

/* ---------- Hero ---------- */
.bd-hero {
    position: relative;
    isolation: isolate;
    background:
        radial-gradient(ellipse 800px 450px at 10% -10%, rgba(85,171,215,0.32), transparent 60%),
        linear-gradient(150deg, var(--dark) 0%, var(--primary) 70%, #1a4f86 100%);
    padding: 48px 0 140px;
    color: var(--white);
}
.bd-hero-blob {
    position: absolute;
    z-index: -1;
    width: 380px; height: 380px;
    top: -160px; right: -90px;
    border-radius: 50%;
    filter: blur(70px);
    background: radial-gradient(circle, rgba(85,171,215,0.45), transparent 70%);
    pointer-events: none;
}
/*.bd-hero-inner { max-width: 820px; }*/

.bd-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #cfd9f0;
    margin-bottom: 26px;
}
.bd-breadcrumb a { color: #cfd9f0; text-decoration: none; }
.bd-breadcrumb a:hover { color: var(--white); text-decoration: underline; }
.bd-breadcrumb-current { color: var(--white); font-weight: 600; }

.bd-hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--white);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: 5px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.bd-hero-title {
    color: var(--white);
    font-size: clamp(1.6rem, 3.6vw, 2.5rem);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0 0 14px;
    text-wrap: balance;
}

.bd-hero-sub {
    color: #cfd9f0;
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 680px;
    margin: 0 0 24px;
}

.bd-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 22px;
    font-size: 0.86rem;
    color: #cfd9f0;
}
.bd-hero-meta > span { display: inline-flex; align-items: center; gap: 7px; }
.bd-author { color: var(--white); font-weight: 600; }
.bd-author-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--white);
    padding: 3px;
    box-sizing: border-box;
    overflow: hidden;
    color: var(--dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
}

/* ---------- Cover ---------- */
.bd-cover {
    position: relative;
    margin: -110px auto 0;
    max-width: 1100px;
    aspect-ratio: 21 / 9;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 24px 50px rgba(4,26,87,0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.4);
    z-index: 2;
}
.bd-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.bd-cover.has-image .bd-cover-icon { display: none; }

/* ---------- Layout ---------- */
.bd-main { padding: 56px 0 40px; }

.bd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 56px;
    max-width: 1100px;
    margin: 0 auto;
    align-items: start;
}

/* ---------- Article typography ---------- */
.bd-article {
    max-width: 700px;
    color: var(--text-dark);
    font-size: 1.04rem;
    line-height: 1.8;
}
.bd-article p { margin: 0 0 1.2em; }
.bd-article .bd-lead {
    font-size: 1.18rem;
    line-height: 1.7;
    color: var(--dark);
}

.bd-section { scroll-margin-top: calc(var(--bd-header-h) + 24px); }
.bd-section h2 {
    font-size: 1.45rem;
    line-height: 1.3;
    color: var(--dark);
    margin: 2em 0 0.7em;
}
.bd-section ul {
    margin: 0 0 1.3em;
    padding: 0;
    list-style: none;
}
.bd-section li {
    position: relative;
    padding-left: 26px;
    margin-bottom: 0.6em;
}
.bd-section li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.72em;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

/* Key takeaways */
.bd-takeaways {
    background: #eaf2fb;
    border-left: 4px solid var(--primary);
    border-radius: 0 14px 14px 0;
    padding: 22px 26px;
    margin: 1.8em 0 0.5em;
}
.bd-takeaways h2 {
    font-size: 1rem;
    color: var(--primary);
    margin: 0 0 10px;
}
.bd-takeaways ul { margin: 0; padding-left: 20px; }
.bd-takeaways li { margin-bottom: 6px; font-size: 0.98rem; line-height: 1.6; }
.bd-takeaways li:last-child { margin-bottom: 0; }

/* Mobile TOC */
.bd-toc-mobile {
    display: none;
    border: 1px solid #d7e4f3;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 28px;
    background: var(--white);
}
.bd-toc-mobile summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--dark);
    font-size: 0.95rem;
}
.bd-toc-mobile ol { margin: 12px 0 0; padding-left: 20px; font-size: 0.92rem; line-height: 1.6; }
.bd-toc-mobile a { color: var(--primary); text-decoration: none; }

/* Inline CTA */
.bd-inline-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    background: linear-gradient(120deg, var(--dark), var(--primary));
    border-radius: 18px;
    padding: 26px 28px;
    margin: 2.6em 0 2em;
}
.bd-inline-cta h3 { color: var(--white); font-size: 1.15rem; margin: 0 0 4px; }
.bd-inline-cta p { color: #cfd9f0; font-size: 0.9rem; margin: 0; line-height: 1.5; }

.bd-btn-primary,
.bd-btn-light,
.bd-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.bd-btn-primary { background: var(--white); color: var(--primary); }
.bd-btn-primary:hover { color: var(--primary); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,0.2); }

/* Share */
.bd-share-row {
    display: none; /* desktop: share lives in the sidebar only */
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 20px 0;
    border-top: 1px solid #e6ecf5;
    border-bottom: 1px solid #e6ecf5;
}
.bd-share-row > span { font-weight: 700; color: var(--dark); font-size: 0.92rem; }

.bd-share { display: flex; flex-wrap: wrap; gap: 8px; }
.bd-share a,
.bd-copy-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid #d7e4f3;
    background: var(--white);
    color: var(--dark);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.bd-share a:hover,
.bd-copy-link:hover { border-color: var(--primary); color: var(--primary); }
.bd-copy-link.copied { border-color: #2e8b57; color: #2e8b57; }
.bd-share a.bd-share-wa { color: #25D366; }
.bd-share a.bd-share-wa:hover { border-color: #25D366; color: #1da851; }

/* Author box */
.bd-authorbox {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin: 28px 0;
}
.bd-authorbox-avatar {
    width: 110px; height: 62px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--white);
    border: 1px solid #d7e4f3;
    padding: 8px 10px;
    box-sizing: border-box;
    overflow: hidden;
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}
.bd-authorbox-avatar img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bd-author-avatar img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bd-authorbox { align-items: center; }
.bd-authorbox strong { display: block; color: var(--dark); margin-bottom: 4px; font-size: 1rem; }
.bd-authorbox p { margin: 0; font-size: 0.9rem; line-height: 1.6; color: var(--text-light); }

/* Prev / next */
.bd-prevnext {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 10px;
}
.bd-prevnext-link {
    display: block;
    padding: 18px 20px;
    border: 1px solid #d7e4f3;
    border-radius: 14px;
    text-decoration: none;
    transition: border-color 0.2s ease;
}
.bd-prevnext-link:hover { border-color: var(--primary); }
.bd-prevnext-link span { display: block; font-size: 0.76rem; color: var(--text-light); margin-bottom: 4px; }
.bd-prevnext-link strong { color: var(--dark); font-size: 0.92rem; line-height: 1.4; }
.bd-prevnext-next { text-align: right; }

/* ---------- Sidebar ---------- */
/* Sidebar column stretches to the full article height, so the inner
   box has room to stay stuck while the article scrolls. */
.bd-sidebar {
    align-self: stretch;
    position: relative;
}
.bd-sidebar-sticky {
    /* Native sticky = scrolled by the browser itself, so zero shake.
       blog-details.js removes any parent overflow that would block it. */
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--bd-header-h) + 24px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.bd-sidecard {
    background: var(--white);
    border: 1px solid #e6ecf5;
    border-radius: 16px;
    padding: 20px;
}
.bd-sidecard h2 { font-size: 0.95rem; color: var(--dark); margin: 0 0 12px; }

.bd-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.bd-toc li { margin: 0; }
.bd-toc a {
    display: block;
    padding: 7px 0 7px 14px;
    border-left: 2px solid #e4ecf3;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.bd-toc a:hover { color: var(--primary); }
.bd-toc a.active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }

.bd-sidecta {
    background: linear-gradient(160deg, var(--dark), var(--primary));
    border: none;
}
.bd-sidecta h2 { color: var(--white); }
.bd-sidecta p { color: #cfd9f0; font-size: 0.86rem; line-height: 1.5; margin: 0 0 14px; }
.bd-btn-light { width: 100%; background: var(--white); color: var(--primary); margin-bottom: 8px; box-sizing: border-box; }
.bd-btn-light:hover { color: var(--primary); transform: translateY(-2px); }
.bd-btn-ghost { width: 100%; border: 1.5px solid rgba(255,255,255,0.45); color: var(--white); box-sizing: border-box; }
.bd-btn-ghost:hover { background: rgba(255,255,255,0.12); color: var(--white); }

/* ---------- Related ---------- */
.bd-related { background: var(--light-bg); padding: 56px 0 64px; }
.bd-related-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.bd-related-head h2 { font-size: 1.5rem; color: var(--dark); margin: 0; }
.bd-related-head a { color: var(--primary); font-weight: 700; font-size: 0.9rem; text-decoration: none; }
.bd-related-head a:hover { text-decoration: underline; }

.bd-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}
.bd-rcard {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(20,40,70,0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.bd-rcard:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(20,40,70,0.14); }
.bd-rcard-media {
    position: relative;
    height: 150px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}
.bd-rcard-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bd-rcard-badge {
    position: absolute;
    top: 12px; left: 12px;
    z-index: 1;
    background: rgba(255,255,255,0.92);
    color: var(--dark);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 4px 10px;
    border-radius: 6px;
}
.bd-rcard-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.bd-rcard-body h3 { font-size: 0.98rem; line-height: 1.4; color: var(--dark); margin: 0 0 8px; }
.bd-rcard-body p { font-size: 0.84rem; line-height: 1.5; color: var(--text-light); margin: 0 0 14px; }
.bd-rcard-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}
.bd-rcard-meta { font-size: 0.74rem; color: var(--text-light); }
.bd-rcard-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    transition: gap 0.2s ease, color 0.2s ease;
}
.bd-rcard:hover .bd-rcard-more { color: var(--secondary); gap: 9px; }

/* ---------- Focus ---------- */
.bd-main a:focus-visible,
.bd-main button:focus-visible,
.bd-related a:focus-visible,
.bd-breadcrumb a:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .bd-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
    /* Tablet / mobile: sidebar is NOT hidden - it moves below the article
       (Share + Talk to a counsellor). TOC shows as the dropdown at the top. */
    .bd-sidebar { width: 100%; max-width: 760px; margin: 32px auto 0; }
    .bd-sidebar .bd-toc { display: none; }
    .bd-toc-mobile { display: block; }
    .bd-article { max-width: 760px; margin: 0 auto; }
    .bd-related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .bd-hero { padding: 32px 0 90px; }
    .bd-hero-sub { font-size: 0.96rem; }
    .bd-cover { margin-top: -64px; aspect-ratio: 16 / 9; border-radius: 14px; }
    .bd-main { padding-top: 36px; }
    .bd-article { font-size: 1rem; }
    .bd-article .bd-lead { font-size: 1.08rem; }
    .bd-section h2 { font-size: 1.25rem; }
    .bd-inline-cta { padding: 22px 20px; }
    .bd-inline-cta .bd-btn-primary { width: 100%; }
    .bd-prevnext { grid-template-columns: 1fr; }
    .bd-prevnext-next { text-align: left; }
    .bd-related-grid { grid-template-columns: 1fr; }
    .bd-copy-label { display: none; }
    .bd-authorbox-avatar { width: 92px; height: 52px; padding: 6px 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .bd-rcard, .bd-btn-primary, .bd-btn-light { transition: none; }
    .bd-rcard:hover { transform: none; }
    html { scroll-behavior: auto; }
}

@media (hover: none) {
    .bd-rcard:hover { transform: none; }
}


/* =========================================================
   RESPONSIVE POLISH — phones, tablets (iPad / Android),
   laptops (Mac / Windows), large monitors
   ========================================================= */

/* Stop iOS / Android from auto-inflating text in landscape */
.bd-hero, .bd-main, .bd-related { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Long words / links never push the page sideways */
.bd-hero-title, .bd-article, .bd-rcard-body h3, .bd-prevnext-link strong { overflow-wrap: anywhere; word-break: normal; }

/* Older Safari (no aspect-ratio): keep the cover from collapsing */
@supports not (aspect-ratio: 21 / 9) {
    .bd-cover { height: 0; padding-top: 42.85%; }
    .bd-cover-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
}

/* Sidebar taller than the screen (short laptop screens, e.g. 1366x768):
   let it scroll inside itself instead of cutting off the counsellor box */
.bd-sidebar-sticky {
    max-height: calc(100vh - var(--bd-header-h) - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d7e4f3 transparent;
}
.bd-sidebar-sticky::-webkit-scrollbar { width: 4px; }
.bd-sidebar-sticky::-webkit-scrollbar-thumb { background: #d7e4f3; border-radius: 4px; }

/* Large monitors (1600px+): a bit more room for reading */
@media (min-width: 1600px) {
    .bd-layout { max-width: 1200px; grid-template-columns: minmax(0, 1fr) 320px; gap: 72px; }
    .bd-cover { max-width: 1200px; }
    .bd-article { max-width: 760px; }
}

/* Small laptops / iPad landscape (1025px - 1200px) */
@media (max-width: 1200px) and (min-width: 1025px) {
    .bd-layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 36px; }
    .bd-sidecard { padding: 18px; }
}

/* Tablets (iPad portrait, Android tablets): sidebar under the article,
   Share + Talk to a counsellor side by side */
@media (max-width: 1024px) {
    .bd-sidebar-sticky { max-height: none; overflow: visible; position: static; transform: none !important; }
    .bd-hero { padding: 40px 0 120px; }
    .bd-cover { margin-top: -90px; }
}
@media (max-width: 1024px) and (min-width: 641px) {
    .bd-sidebar-sticky { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
    .bd-related-grid .bd-rcard:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Prev / next with only one link: don't leave an empty column */
.bd-prevnext > span:empty { display: none; }
.bd-prevnext:has(> span:empty) { grid-template-columns: 1fr; }

/* Phones */
@media (max-width: 640px) {
    .bd-hero-title { font-size: clamp(1.45rem, 6.4vw, 1.8rem); }
    .bd-hero-meta { gap: 8px 16px; font-size: 0.8rem; }
    .bd-breadcrumb { font-size: 0.74rem; margin-bottom: 18px; }
    .bd-takeaways { padding: 18px 18px; border-radius: 0 12px 12px 0; }
    .bd-sidecard { padding: 18px; }
    .bd-related { padding: 40px 0 48px; }
    .bd-related-head h2 { font-size: 1.25rem; }
    .bd-rcard-media { height: 170px; }
}

/* Very small phones (iPhone SE, small Android) */
@media (max-width: 380px) {
    .bd-authorbox { flex-direction: column; align-items: flex-start; }
    .bd-inline-cta h3 { font-size: 1.05rem; }
    .bd-share { gap: 6px; }
}

/* Phones in landscape: shorter hero */
@media (max-height: 500px) and (orientation: landscape) {
    .bd-hero { padding: 24px 0 80px; }
    .bd-cover { margin-top: -56px; aspect-ratio: 21 / 9; }
}

/* Touch screens: bigger tap targets (Apple / Android guideline ~44px) */
@media (pointer: coarse) {
    .bd-share a, .bd-copy-link { min-width: 44px; height: 44px; }
    .bd-toc-mobile summary { padding: 4px 0; }
    .bd-toc-mobile a { display: inline-block; padding: 4px 0; }
}