/* ==========================================================================
   Blog article  (/blogs/{slug}.html)
   --------------------------------------------------------------------------
   Article header, sticky contents rail, and typography for the rich text the
   admin editor produces. Post cards in the "Keep reading" block come from
   blog-page.css; tokens from mega-menu.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reading progress
   -------------------------------------------------------------------------- */

.sd-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1200;
    background: transparent;
    pointer-events: none;
}

.sd-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--sd-orange);
    transition: width .1s linear;
}

/* --------------------------------------------------------------------------
   Article header
   -------------------------------------------------------------------------- */

.sd-article__head {
    padding: 46px 0 34px;
    background: linear-gradient(120deg, #EBF5FF 0%, #F6FAFF 55%, #FFFFFF 100%);
    border-bottom: 1px solid var(--sd-line);
}

.sd-article__head-inner {
    max-width: 820px;
}

.sd-article__back {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
    color: var(--sd-blue);
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
}

.sd-article__back i {
    font-size: 12px;
    transition: transform .25s ease;
}

.sd-article__back:hover {
    color: var(--sd-orange);
}

.sd-article__back:hover i {
    transform: translateX(-4px);
}

.sd-article__head h1 {
    margin: 0 0 16px;
    font-size: 38px;
    font-weight: 800;
    line-height: 1.22;
    color: var(--sd-navy);
}

.sd-article__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin: 0;
    font-size: 14px;
    color: var(--sd-muted);
}

.sd-article__meta i {
    margin-right: 7px;
    color: var(--sd-orange);
}

.sd-article__hero {
    margin: 34px 0 0;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(16, 38, 73, .13);
    line-height: 0;
}

.sd-article__hero img {
    width: 100%;
    height: auto;
    display: block;
}

/* --------------------------------------------------------------------------
   Layout: contents rail beside the body
   -------------------------------------------------------------------------- */

.sd-article__layout {
    display: grid;
    grid-template-columns: 262px minmax(0, 1fr);
    gap: 46px;
    align-items: start;
    padding: 46px 0 60px;
}

.sd-article__side {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ---- contents ---- */

.sd-toc {
    padding: 22px 20px;
    border: 1px solid var(--sd-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 22px rgba(16, 38, 73, .06);
}

.sd-toc[hidden] {
    display: none;
}

.sd-toc__title {
    margin: 0 0 14px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--sd-muted);
}

.sd-toc__list {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: min(56vh, 520px);
    overflow-y: auto;
}

.sd-toc__item a {
    display: block;
    padding: 7px 0 7px 14px;
    border-left: 2px solid var(--sd-line);
    color: var(--sd-muted);
    font-size: 13.5px;
    line-height: 1.5;
    text-decoration: none;
    transition: color .2s ease, border-color .2s ease;
}

.sd-toc__item--h3 a {
    padding-left: 26px;
    font-size: 13px;
}

.sd-toc__item a:hover {
    color: var(--sd-blue);
    border-color: rgba(18, 74, 154, .4);
}

.sd-toc__item a.is-current {
    color: var(--sd-orange-ink);
    border-color: var(--sd-orange);
    font-weight: 700;
}

/* ---- share ---- */

.sd-share {
    padding: 20px;
    border: 1px solid var(--sd-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 22px rgba(16, 38, 73, .06);
}

.sd-share__title {
    margin: 0 0 12px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--sd-muted);
}

.sd-share__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sd-share__links a,
.sd-share__copy {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--sd-line);
    border-radius: 10px;
    background: #fff;
    color: var(--sd-blue);
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.sd-share__links a:hover,
.sd-share__copy:hover {
    background: var(--sd-orange);
    border-color: var(--sd-orange);
    color: #fff;
}

.sd-share__done {
    display: inline-block;
    margin-top: 11px;
    font-size: 12.5px;
    font-weight: 700;
    color: #2E9E5B;
}

.sd-share__done[hidden] {
    display: none;
}

/* --------------------------------------------------------------------------
   Keep reading
   -------------------------------------------------------------------------- */

.sd-related {
    padding: 56px 0;
    background: var(--sd-tint);
    border-top: 1px solid var(--sd-line);
}

.sd-related__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.sd-related .sd-post {
    width: auto;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1199.98px) {
    .sd-article__layout {
        grid-template-columns: 226px minmax(0, 1fr);
        gap: 34px;
    }
}

@media (max-width: 991.98px) {
    .sd-article__layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 26px;
        padding: 32px 0 46px;
    }

    /* Contents sits above the article and stops sticking once it is in flow. */
    .sd-article__side {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
    }

    .sd-toc {
        flex: 1 1 320px;
    }

    .sd-toc__list {
        max-height: 220px;
    }

    .sd-share {
        flex: 1 1 220px;
    }

    .sd-article__head h1 {
        font-size: 30px;
    }

    .sd-related__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .sd-article__head {
        padding: 30px 0 26px;
    }

    .sd-article__head h1 {
        font-size: 25px;
    }

    .sd-article__hero {
        margin-top: 24px;
        border-radius: 12px;
    }

    .sd-article__body {
        font-size: 16px;
    }

    .sd-article__body h2 {
        font-size: 22px;
        margin-top: 34px;
    }

    .sd-article__body h3 {
        font-size: 18.5px;
    }

    .sd-related {
        padding: 40px 0;
    }

    .sd-related__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {

    .sd-progress span,
    .sd-article__back i,
    .sd-toc__item a,
    .sd-share__links a,
    .sd-share__copy {
        transition: none !important;
    }

    .sd-article__back:hover i {
        transform: none;
    }
}
