/*!
 * StaticPress theme "Blocksy" - reader.css
 *
 * Layer 6: the reading comfort kit of the single screens.
 *
 * Loaded only while the article is on a page that has one of these modules
 * enabled (base.html: `wants_reader`), so an archive visit never downloads it.
 * Everything here is progressive: without reader.js the progress bar stays at
 * zero, the TOC stays `hidden`, and the share buttons fall back to the plain
 * Weibo link / the copy action does nothing.
 *
 *   .ct-progress    阅读进度  the fixed bar base.html prints under the header
 *   .ct-toc         文章目录  built by reader.js from the h2 / h3 headings
 *   .ct-share       分享      copy link / native share / Weibo
 *   .ct-related     相关文章  the siblings of the same category
 *   .ct-post-nav    上下篇    previous / next links
 *   .ct-lightbox    图片灯箱  the full screen view of a body image
 *   .ct-code-copy   代码复制  the copy button of a code block
 */

/* ============================================================= progress */
.ct-progress {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 99998;
    height: 3px;
    background-color: transparent;
    pointer-events: none;
}

.ct-progress span {
    display: block;
    width: 0;
    height: 100%;
    background-color: var(--theme-palette-color-1);
    transition: width 0.12s linear;
}

/* While the header is transparent the bar would sit on the dark band; the
   accent colour keeps enough contrast there, so no variant is needed. */

/* ================================================================== toc */
.ct-toc {
    margin: 0 0 28px;
    border: var(--card-border);
    border-radius: var(--theme-border-radius);
    background-color: var(--theme-palette-color-8);
    overflow: hidden;
}

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

.ct-toc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--theme-border-color);
    background-color: var(--theme-palette-color-7);
}

.ct-toc-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--theme-palette-color-4);
    font-size: 14px;
    font-weight: 600;
}

.ct-toc-toggle {
    color: var(--theme-palette-color-1);
    font-size: 12.5px;
}

.ct-toc-list {
    margin: 0;
    padding: 10px 18px 14px;
    list-style: none;
    counter-reset: ct-toc;
}

.ct-toc-list li {
    padding: 6px 0;
}

.ct-toc-list li.is-level-3 {
    padding-inline-start: 18px;
    font-size: 14px;
}

.ct-toc-list a {
    color: var(--theme-text-color);
    font-size: 14.5px;
    line-height: 1.5;
}

.ct-toc-list a:hover,
.ct-toc-list a:focus,
.ct-toc-list a.is-active {
    color: var(--theme-palette-color-1);
}

.ct-toc-list a.is-active {
    font-weight: 600;
}

.ct-toc.is-collapsed .ct-toc-list {
    display: none;
}

/* ================================================================ share */
.ct-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 34px;
    padding-top: 24px;
    border-top: 1px solid var(--theme-border-color);
}

.ct-share-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-inline-end: 4px;
    color: var(--theme-palette-color-4);
    font-size: 14px;
    font-weight: 600;
}

.ct-share-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 4px 15px;
    border: var(--card-border);
    border-radius: 999px;
    background-color: var(--theme-palette-color-8);
    color: var(--theme-palette-color-3);
    font-size: 13.5px;
    line-height: 1;
}

/* `display: inline-flex` above would otherwise win over the `hidden`
   attribute the "系统分享" button ships with on desktops. */
.ct-share-button[hidden] {
    display: none;
}

.ct-share-button:hover,
.ct-share-button:focus {
    border-color: var(--theme-palette-color-1);
    color: var(--theme-palette-color-1);
}

.ct-share-button.is-done {
    border-color: var(--theme-palette-color-1);
    background-color: var(--theme-palette-color-1);
    color: #ffffff;
}

.ct-share-status {
    color: var(--theme-palette-color-1);
    font-size: 12.5px;
}

/* ============================================================== related */
.ct-related {
    margin-top: 42px;
}

.ct-related-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ct-related-list li + li {
    border-top: 1px solid var(--theme-border-color);
}

.ct-related-list a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 0;
}

.ct-related-title {
    color: var(--theme-palette-color-4);
    font-size: 15px;
    line-height: 1.55;
}

.ct-related-list a:hover .ct-related-title,
.ct-related-list a:focus .ct-related-title {
    color: var(--theme-palette-color-1);
}

.ct-related-list time {
    flex: 0 0 auto;
    color: var(--theme-text-color);
    font-size: 12.5px;
}

/* ============================================================ post nav */
.ct-post-nav {
    display: grid;
    gap: 16px;
    margin-top: 36px;
    padding-top: 30px;
    border-top: 1px solid var(--theme-border-color);
}

@media (min-width: 690px) {
    .ct-post-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ct-post-nav-item {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 18px 20px;
    border: var(--card-border);
    border-radius: var(--theme-border-radius);
    background-color: var(--theme-palette-color-8);
}

.ct-post-nav-item.is-empty {
    border-color: transparent;
    background: none;
}

a.ct-post-nav-item:hover,
a.ct-post-nav-item:focus {
    border-color: var(--theme-palette-color-1);
}

.ct-post-nav-next {
    text-align: end;
}

.ct-post-nav-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--theme-palette-color-1);
    font-size: 12.5px;
    font-weight: 600;
}

.ct-post-nav-next .ct-post-nav-label {
    justify-content: flex-end;
}

.ct-post-nav-title {
    color: var(--theme-palette-color-4);
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.45;
}

a.ct-post-nav-item:hover .ct-post-nav-title,
a.ct-post-nav-item:focus .ct-post-nav-title {
    color: var(--theme-palette-color-1);
}

/* ============================================================ lightbox */
.ct-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 24px 24px;
    background-color: rgba(8, 15, 26, 0.92);
}

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

.ct-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--theme-image-border-radius);
    box-shadow: var(--theme-box-shadow-strong);
}

.ct-lightbox-close {
    position: absolute;
    top: 18px;
    inset-inline-end: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 100%;
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.ct-lightbox-close:hover,
.ct-lightbox-close:focus {
    background-color: var(--theme-palette-color-1);
}

body.ct-lightbox-open {
    overflow: hidden;
}

.entry-content img.is-lightboxable {
    cursor: zoom-in;
}

/* =========================================================== code copy */
.ct-code-wrap {
    position: relative;
}

.ct-code-copy {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    height: 28px;
    padding: 0 11px;
    border-radius: 3px;
    background-color: rgba(8, 15, 26, 0.08);
    color: var(--theme-palette-color-3);
    font-size: 12px;
    opacity: 0;
    transition: var(--theme-transition);
}

.ct-code-wrap:hover .ct-code-copy,
.ct-code-copy:focus-visible {
    opacity: 1;
}

.ct-code-copy:hover {
    background-color: rgba(8, 15, 26, 0.16);
}

.ct-code-copy.is-done {
    background-color: var(--theme-palette-color-1);
    color: #ffffff;
    opacity: 1;
}

/* ========================================================== responsive */
@media (max-width: 689.98px) {
    .ct-toc-list,
    .ct-toc-head {
        padding-inline: 14px;
    }

    .ct-share-button {
        min-height: 34px;
        padding-inline: 12px;
        font-size: 13px;
    }

    .ct-related-list a,
    .ct-cat-block-item a {
        flex-direction: column;
        gap: 4px;
    }

    .ct-post-nav-item {
        padding: 15px 16px;
    }
}

/* The progress bar is the only animation of the kit; the scroll handler
   itself is what the reduced-motion media query cannot switch off, so only
   the smoothing is dropped here. */
@media (prefers-reduced-motion: reduce) {
    .ct-progress span {
        transition: none;
    }
}
