/* Blog list and blog post pages. */
.blog-page {
    --blog-soft: #f6f2f9;
    --blog-line: #e4dcea;
    --blog-primary: var(--tg-theme-primary, #9116a1);
    padding-bottom: 64px;
    overflow-wrap: break-word;
}

.blog-page img { max-width: 100%; }

/* ---------- buttons */
.blog-page .blog-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border: 2px solid var(--blog-primary);
    border-radius: 8px;
    background: var(--blog-primary);
    color: #fff;
    font-family: var(--tg-body-font-family);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}
.blog-page .blog-btn:hover { background: #6a1076; border-color: #6a1076; color: #fff; }
.blog-page .blog-btn--outline { background: #fff; color: var(--blog-primary); }
.blog-page .blog-btn--outline:hover { background: var(--blog-soft); border-color: var(--blog-primary); color: #6a1076; }

.blog-page a:focus-visible,
.blog-page button:focus-visible,
.blog-page input:focus-visible,
.blog-page summary:focus-visible {
    outline: 3px solid #1b6ef3;
    outline-offset: 2px;
}

/* ---------- list: heading and search */
.blog-hero { background: var(--blog-soft); padding: 40px 0; }
.blog-hero__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.blog-hero h1 { margin: 0; font-size: 42px; }
.blog-hero p { margin: 6px 0 0; }
.blog-search { display: flex; gap: 8px; width: 100%; max-width: 460px; }
.blog-search input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 16px;
    border: 1px solid #8a7a96;
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
}
.blog-results { margin: 32px 0 0; font-size: 17px; }
.blog-results a { margin-left: 8px; font-weight: 600; text-decoration: underline; }

/* ---------- cards */
#articles { scroll-margin-top: 100px; }
.blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 32px; margin-top: 40px; }
.blog-card { display: flex; flex-direction: column; gap: 12px; }
.blog-card__image {
    display: block;
    border: 1px solid var(--blog-line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.blog-card__image img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; }
.blog-card__body { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.blog-page .blog-card__title { margin: 0; font-size: 20px; line-height: 1.4; }
.blog-card__title a { color: inherit; }
.blog-card__title a:hover { color: var(--blog-primary); }
.blog-card__excerpt { margin: 0; }
.blog-card__meta { margin: 0; font-size: 15px; font-weight: 600; color: var(--blog-primary); }
.blog-card__badge {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--blog-soft);
    color: var(--blog-primary);
    font-size: 14px;
    font-weight: 700;
}

.blog-card--featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 40px;
    align-items: center;
    margin-bottom: 8px;
}
.blog-card--featured .blog-card__image img { aspect-ratio: 4 / 3; }
.blog-card--featured .blog-card__body { gap: 16px; }
.blog-page .blog-card--featured .blog-card__title { font-size: 32px; line-height: 1.3; }

/* ---------- pagination */
.blog-pager { margin: 56px 0 0; }
.blog-pager__row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.blog-pager__numbers { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.blog-pager__numbers li { margin: 0; list-style: none; }
.blog-pager__number,
.blog-pager__step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    border: 1px solid var(--blog-line);
    border-radius: 10px;
    background: #fff;
    color: var(--tg-heading-color, #082a5e);
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
}
.blog-pager__number { min-width: 46px; padding: 0 10px; }
.blog-pager__step { padding: 0 20px; }
.blog-pager a:hover { border-color: var(--blog-primary); background: var(--blog-soft); color: var(--blog-primary); }
.blog-pager__number.is-current { border-color: var(--blog-primary); background: var(--blog-primary); color: #fff; }
.blog-pager__number.is-gap { border-color: transparent; background: transparent; min-width: 24px; padding: 0; }
.blog-pager__step.is-off { color: #8b8794; background: #f5f4f7; cursor: not-allowed; }
.blog-pager__status { margin: 14px 0 0; text-align: center; font-size: 15px; }

/* ---------- enquiry band */
.blog-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 56px;
    padding: 32px 40px;
    border-radius: 16px;
    background: var(--blog-soft);
}
.blog-page .blog-cta h2 { margin: 0; font-size: 26px; line-height: 1.35; }
.blog-cta p { margin: 6px 0 0; }
.blog-cta__buttons { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- post: heading */
.blog-post__head { max-width: 840px; padding: 32px 0; }
.blog-crumbs { margin-bottom: 18px; font-size: 15px; }
.blog-crumbs a { font-weight: 600; }
.blog-page .blog-post__head h1 { margin: 0 0 20px; font-size: 40px; line-height: 1.25; }
.blog-author { display: flex; align-items: center; gap: 12px; }
.blog-author__initial {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--blog-primary);
    color: #fff;
    font-weight: 700;
}
.blog-author__name { margin: 0; font-weight: 700; line-height: 1.4; color: var(--tg-heading-color, #082a5e); }
.blog-author__name a { text-decoration: underline; }
.blog-author__meta { margin: 0; font-size: 15px; line-height: 1.4; }

/* ---------- post: two columns */
.blog-post__layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; align-items: start; }
.blog-post__side { display: flex; flex-direction: column; gap: 24px; align-self: stretch; }

.blog-toc { border: 1px solid var(--blog-line); border-radius: 12px; }
.blog-toc ul { margin: 0; padding: 0; list-style: none; }
.blog-toc li { margin: 0; list-style: none; }
.blog-toc a { display: block; padding: 6px 0; font-size: 15px; line-height: 1.4; color: var(--tg-body-color, #39557e); }
.blog-toc a:hover { color: var(--blog-primary); }
.blog-toc--side { padding: 20px; }
.blog-toc__title { margin: 0 0 8px; font-weight: 700; color: var(--tg-heading-color, #082a5e); }
.blog-toc--phone { display: none; margin-bottom: 24px; padding: 0 16px; }
.blog-toc--phone summary { min-height: 52px; line-height: 52px; font-weight: 700; color: var(--tg-heading-color, #082a5e); cursor: pointer; }
.blog-toc--phone ul { padding-bottom: 12px; }

/* ---------- post: counsellor form */
/* The form follows the reader down the article. */
.blog-enquiry { position: sticky; top: 110px; display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: 12px; background: var(--blog-soft); }
.blog-enquiry__title { margin: 0 0 4px; font-family: var(--tg-heading-font-family); font-size: 18px; font-weight: 600; color: var(--tg-heading-color, #082a5e); }
.blog-enquiry label { margin: 0; font-size: 14px; font-weight: 600; color: var(--tg-heading-color, #082a5e); }
.blog-enquiry input { height: 46px; width: 100%; padding: 0 12px; border: 1px solid #8a7a96; border-radius: 8px; background: #fff; font-size: 16px; }
.blog-enquiry .g-recaptcha { transform: scale(0.9); transform-origin: left top; }
.blog-enquiry__error { margin: 0; color: #b00020; font-size: 14px; }
.blog-enquiry__terms { margin: 4px 0; font-size: 13px; line-height: 1.5; }
.blog-enquiry__terms a { text-decoration: underline; }

/* ---------- post: article text */
.blog-article { font-size: 18px; line-height: 1.75; color: #24344f; }
.blog-article p { margin: 0 0 18px; }
.blog-page .blog-article h2 { margin: 40px 0 16px; font-size: 27px; line-height: 1.35; scroll-margin-top: 100px; }
.blog-page .blog-article h3 { margin: 28px 0 10px; font-size: 21px; line-height: 1.4; }
.blog-article ul,
.blog-article ol { margin: 0 0 18px; padding-left: 24px; }
.blog-article ul li { list-style: disc; }
.blog-article ol li { list-style: decimal; }
.blog-article li { margin-bottom: 6px; }
.blog-article li p { margin: 0; }
.blog-article a { text-decoration: underline; }
.blog-article img { display: block; height: auto; margin: 8px auto 24px; border-radius: 12px; }
.blog-article blockquote { margin: 0 0 18px; padding: 18px 20px; border-radius: 12px; background: var(--blog-soft); }
.blog-article iframe { width: 100%; aspect-ratio: 16 / 9; margin-bottom: 18px; border: 0; border-radius: 12px; }
.blog-table { margin: 0 0 24px; overflow-x: auto; border: 1px solid var(--blog-line); border-radius: 12px; }
.blog-table table { width: 100%; margin: 0; border-collapse: collapse; font-size: 16px; line-height: 1.5; }
.blog-table td,
.blog-table th { min-width: 130px; padding: 10px 14px; border: 1px solid var(--blog-line); vertical-align: top; text-align: left; }
.blog-table tr:first-child td,
.blog-table th { background: var(--blog-soft); font-weight: 700; }
.blog-table p { margin: 0; }

/* ---------- post: share, tools, related */
.blog-share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--blog-line); }
.blog-share > span { margin-right: 4px; font-weight: 700; color: var(--tg-heading-color, #082a5e); }
.blog-tools { margin-top: 40px; }
.blog-page .blog-tools h2 { margin: 0 0 16px; font-size: 22px; }
.blog-tools__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.blog-tools__item { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 18px; border: 1px solid var(--blog-line); border-radius: 12px; }
.blog-page .blog-tools__item h3 { margin: 0; font-size: 17px; }
.blog-tools__item p { flex-grow: 1; margin: 0; font-size: 15px; }
.blog-related { margin-top: 56px; }
.blog-page .blog-related h2 { margin: 0; font-size: 26px; }
.blog-related .blog-grid { margin-top: 24px; }
.blog-page .blog-related .blog-card__title { font-size: 18px; }

/* ---------- phone bar */
.blog-bar { display: none; }

/* ---------- tablets and phones */
@media (max-width: 991.98px) {
    .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .blog-post__layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .blog-enquiry { position: static; }
    .blog-toc--side { display: none; }
    .blog-toc--phone { display: block; }
}

@media (max-width: 767.98px) {
    .blog-page { padding-bottom: 32px; }
    .blog-hero { padding: 24px 0; }
    .blog-hero h1 { font-size: 30px; }

    /* One compact row for each post, with the newest one kept large. */
    .blog-grid { grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 20px; }
    .blog-card { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--blog-line); }
    .blog-card__image { border-radius: 8px; }
    .blog-card__image img { aspect-ratio: 7 / 5; object-fit: cover; }
    .blog-page .blog-card .blog-card__title,
    .blog-page .blog-related .blog-card__title { font-size: 15px; }
    .blog-card__body { gap: 4px; }
    .blog-card__excerpt { display: none; }
    .blog-card__meta { font-size: 13px; }
    .blog-card--featured { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 0; margin: 0; }
    .blog-card--featured .blog-card__image img { object-fit: contain; }
    .blog-page .blog-card--featured .blog-card__title { font-size: 21px; }
    .blog-card--featured .blog-card__excerpt,
    .blog-card--featured .blog-btn { display: none; }

    /* Numbers on their own line, with two wide buttons under them. */
    .blog-pager { margin-top: 32px; }
    .blog-pager__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .blog-pager__numbers { grid-column: 1 / -1; grid-row: 1; justify-content: center; gap: 6px; }
    .blog-pager__number { min-width: 42px; padding: 0 6px; }
    .blog-pager__step--prev { grid-column: 1; grid-row: 2; }
    .blog-pager__step--next { grid-column: 2; grid-row: 2; }

    .blog-cta { flex-direction: column; align-items: stretch; margin-top: 32px; padding: 24px 20px; }
    .blog-page .blog-cta h2 { font-size: 21px; }
    .blog-cta__buttons { flex-direction: column; }

    .blog-post__head { padding: 20px 0; }
    .blog-crumbs__here, .blog-crumbs a:last-of-type + span { display: none; }
    .blog-page .blog-post__head h1 { font-size: 26px; line-height: 1.3; }
    .blog-article { font-size: 17px; }
    .blog-page .blog-article h2 { font-size: 23px; }
    .blog-page .blog-article h3 { font-size: 19px; }
    .blog-related { margin-top: 32px; }

    /* The bar replaces the floating buttons, which covered the text. */
    .blog-bar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1000;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--blog-line);
        background: #fff;
    }
    .blog-page .blog-bar .blog-btn { min-height: 46px; padding: 0 8px; }
    .blog-page .chat-buttons { display: none; }
    body:has(.blog-bar) { padding-bottom: 76px; }
    body:has(.blog-bar) .scroll__top { display: none; }
}
