/**
 * Blog article reading comfort — sepia, measure, line-height, dyslexia, search, print
 */

:root {
    --np-reading-measure: 720px;
}

html[data-reading-width="narrow"] {
    --np-reading-measure: 620px;
}

html[data-reading-width="normal"] {
    --np-reading-measure: 720px;
}

html[data-reading-width="wide"] {
    --np-reading-measure: 100%;
}

html[data-reading-line="compact"] {
    --np-reading-line-custom: 1.6;
}

html[data-reading-line="normal"] {
    --np-reading-line-custom: 1.78;
}

html[data-reading-line="relaxed"] {
    --np-reading-line-custom: 2;
}

.np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer,
.np-single-post-wrap .np-reading-column .tnews-ai-summary-mothership-card,
.np-single-post-wrap .np-reading-column .tnews-toc-mothership-container,
.np-single-post-wrap .np-reading-column .newsroom-voice-blocks-stack,
.np-single-post-wrap .np-reader-chrome,
.np-single-post-wrap .np-read-indicator--inline {
    max-width: var(--np-reading-measure);
    margin-left: auto;
    margin-right: auto;
}

.np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer {
    line-height: var(--np-reading-line-custom, var(--reading-line-height, 1.78));
}

/* Sepia reading surface */
html.np-reading-sepia .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer,
html.np-reading-sepia .np-single-post-wrap .np-reader-chrome .np-reading-toolbar,
html.np-reading-sepia .np-single-post-wrap .tnews-ai-summary-mothership-card,
html.np-reading-sepia .np-single-post-wrap .tnews-toc-mothership-container {
    background-color: #faf3e8;
    color: #3d3429;
}

html.np-reading-sepia .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer a {
    color: #8b4513;
}

html.dark-theme.np-reading-sepia .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer,
html.dark-theme.np-reading-sepia .np-single-post-wrap .np-reader-chrome .np-reading-toolbar {
    background-color: #2a241c;
    color: #f3e8d7;
}

/* Dyslexia-friendly type */
html.np-reading-dyslexia .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer,
html.np-reading-dyslexia .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer p,
html.np-reading-dyslexia .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer li {
    font-family: "Atkinson Hyperlegible", "Segoe UI", sans-serif !important;
    letter-spacing: 0.02em;
    word-spacing: 0.05em;
}

/* High-contrast links inside article */
html.visitor-high-contrast .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer a,
html.np-reading-high-links .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer a {
    text-decoration: underline !important;
    text-underline-offset: 0.15em;
    font-weight: 600;
}

html.visitor-high-contrast .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer a:visited {
    color: #c4b5fd !important;
}

/* Image captions */
.np-single-post-wrap .np-media-caption-text {
    font-size: 0.92rem !important;
    line-height: 1.6 !important;
    color: #334155 !important;
}

html.dark-theme .np-single-post-wrap .np-media-caption-text {
    color: #cbd5e1 !important;
}

/* Toolbar extras */
.np-reading-toolbar__divider {
    width: 1px;
    height: 1.5rem;
    background: var(--np-border, #e2e8f0);
    margin: 0 0.15rem;
}

.np-reading-search {
    display: none;
    width: 100%;
    max-width: 36rem;
}

.np-reading-search[hidden] {
    display: none !important;
}

.np-reading-search.is-open {
    display: block;
    animation: npReadingSearchIn 0.22s ease-out;
}

@keyframes npReadingSearchIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.np-reading-search__panel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem 0.45rem 0.65rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--np-border, #e2e8f0);
    border-radius: 14px;
    box-shadow:
        0 4px 6px -1px rgba(15, 23, 42, 0.05),
        0 12px 28px -8px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
}

.np-reading-search__field {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    cursor: text;
}

.np-reading-search__icon {
    color: #94a3b8;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.np-reading-search__field:focus-within .np-reading-search__icon {
    color: #6366f1;
}

.np-reading-search input,
.np-reading-search input[type="search"],
.np-reading-search input:hover,
.np-reading-search input:focus,
.np-reading-search input:active {
    display: block;
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    color: inherit !important;
    font-size: 0.92rem !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    padding: 0.2rem 0 !important;
    -webkit-appearance: none;
    appearance: none;
}

.np-reading-search input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.np-reading-search__count {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    white-space: nowrap;
}

.np-reading-search__count[hidden] {
    display: none !important;
}

.np-reading-search__hint {
    display: none;
    flex-shrink: 0;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #94a3b8;
    background: #f8fafc;
    border: 1px solid var(--np-border, #e2e8f0);
    border-radius: 6px;
    padding: 0.15rem 0.35rem;
    line-height: 1.2;
}

.np-reading-search__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.np-reading-search__close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.np-reading-search mark.np-in-article-hit {
    background: #fde68a;
    color: inherit;
    padding: 0 0.12em;
    border-radius: 3px;
    box-decoration-break: clone;
}

html.dark-theme .np-reading-search mark.np-in-article-hit {
    background: #854d0e;
    color: #fef3c7;
}

html.dark-theme .np-reading-search__panel {
    background: rgba(24, 24, 27, 0.96);
    border-color: #3f3f46;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.25),
        0 12px 28px -8px rgba(0, 0, 0, 0.45);
}

html.dark-theme .np-reading-search input,
html.dark-theme .np-reading-search input[type="search"],
html.dark-theme .np-reading-search input:focus {
    color: #f4f4f5 !important;
    background: transparent !important;
}

html.dark-theme .np-reading-search input::placeholder {
    color: #71717a;
}

html.dark-theme .np-reading-search__icon {
    color: #71717a;
}

html.dark-theme .np-reading-search__field:focus-within .np-reading-search__icon {
    color: #a5b4fc;
}

html.dark-theme .np-reading-search__count {
    background: #27272a;
    color: #a1a1aa;
}

html.dark-theme .np-reading-search__hint {
    background: #27272a;
    border-color: #3f3f46;
    color: #71717a;
}

html.dark-theme .np-reading-search__close {
    color: #a1a1aa;
}

html.dark-theme .np-reading-search__close:hover {
    background: #27272a;
    color: #fafafa;
}

@media (min-width: 576px) {
    .np-reading-search__hint {
        display: inline-block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .np-reading-search.is-open {
        animation: none;
    }
}

/* Text-only mode */
html.np-text-only-mode .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer img,
html.np-text-only-mode .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer video,
html.np-text-only-mode .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer iframe,
html.np-text-only-mode .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer figure {
    display: none !important;
}

/* Global continue reading strip → see continue-reading-global.css (loaded site-wide) */

/* Mobile touch targets */
@media (max-width: 767.98px) {
    .np-reading-toolbar .tnews-tool-btn {
        min-width: 2.75rem !important;
        height: 2.75rem !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .np-single-post-wrap .np-read-indicator,
    .np-read-progress-top__fill,
    .np-single-post-wrap .np-author-more__card,
    .np-single-post-wrap .np-post-nav .nav-btn {
        transition: none !important;
    }
}

/* Print */
@media print {
    .th-header,
    .th-footer,
    .breadcumb-wrapper,
    .sidebar-area,
    .np-reading-toolbar,
    .np-reading-search,
    .np-read-indicator,
    .np-read-progress-top,
    .np-global-continue,
    .switcher-fixed,
    .reader-rail,
    .np-share-rail,
    .np-share-footer,
    .np-comments,
    .np-related,
    .np-engagement-bar,
    .ad-wrapper,
    .np-resume-bar {
        display: none !important;
    }

    .np-single-post-wrap .np-reading-column #tnewsTargetArticleBodyContainer {
        max-width: 100% !important;
        font-size: 12pt !important;
        line-height: 1.55 !important;
        color: #000 !important;
    }

    .np-single-post-wrap .np-article-title {
        font-size: 22pt !important;
        color: #000 !important;
    }

    .np-single-post-wrap a {
        color: #000 !important;
        text-decoration: underline !important;
    }
}
