/* ============================================================
 * News reader styling — scoped to .ak-reader article + #post-content
 * Color palette uses the project primary teal (#0c4044) instead of amber.
 * ============================================================ */

:root {
    --ak-reader-font-sm: 17px;
    --ak-reader-font-md: 20px;
    --ak-reader-font-lg: 23px;
    --ak-reader-font-xl: 26px;
    --ak-reader-font-xxl: 29px;
}

/* Bump every reader size up on large screens — desktop readers want a chunkier baseline. */
@media (min-width: 1024px) {
    :root {
        --ak-reader-font-sm: 18px;
        --ak-reader-font-md: 21px;
        --ak-reader-font-lg: 24px;
        --ak-reader-font-xl: 27px;
        --ak-reader-font-xxl: 30px;
    }
}

:root {
    --ak-primary: #0c4044;
    --ak-primary-300: #37777C;
    --ak-primary-200: #4E9BA0;
    --ak-primary-100: #7FB9BD;
    --ak-primary-70: #b8e0e3;
    --ak-primary-50: #e4f6fa;
    --ak-primary-25: #edfcfc;
    --ak-link: #2563eb;   /* blue-600 */
    --ak-link-hover: #1d4ed8; /* blue-700 */
}

.ak-reader { color: #0f172a; }

/* ---- Sticky reading bar ---- */
.ak-readbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    transform: translateY(-110%);
    transition: transform .25s ease;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.ak-readbar.is-shown { transform: translateY(0); }
.ak-readbar__progress {
    position: absolute;
    left: 0; bottom: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(to right, var(--ak-primary-200), var(--ak-primary));
    transition: width .1s linear;
}

/* ---- Keep ShareThis under the site navbar (which uses z-40).
 *      ShareThis assigns z-index: 94034 on .st-inline-share-buttons via its own
 *      stylesheet. We need !important + matching specificity to win. ---- */
body .sharethis-inline-share-buttons,
body .sharethis-inline-reaction-buttons,
body .st-inline-share-buttons,
body .st-inline-reaction-buttons {
    z-index: 1 !important;
    position: relative !important;
    isolation: isolate;
}
body .sharethis-inline-share-buttons *,
body .sharethis-inline-reaction-buttons *,
body .st-inline-share-buttons *,
body .st-inline-reaction-buttons * {
    z-index: auto !important;
}
/* Sticky / floating share bars also stay below the navbar */
body .st-sticky-share-buttons,
body .st-mobile-sticky-share-buttons,
body [class*="st-sticky"],
body [class*="st-floating"] {
    z-index: 30 !important;
}

/* ---- Body typography (rich-text content) ---- */
#post-content {
    font-size: var(--ak-reader-font-lg);
    line-height: 1.7;
    color: #1e293b;
}
#post-content[data-reader-size="sm"]  { font-size: var(--ak-reader-font-sm); }
#post-content[data-reader-size="md"]  { font-size: var(--ak-reader-font-md); }
#post-content[data-reader-size="lg"]  { font-size: var(--ak-reader-font-lg); }
#post-content[data-reader-size="xl"]  { font-size: var(--ak-reader-font-xl); }
#post-content[data-reader-size="xxl"] { font-size: var(--ak-reader-font-xxl); }

#post-content p { margin: 0 0 0.65em; }
#post-content h2,
#post-content h3,
#post-content h4 {
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    margin-top: 1.1em;
    margin-bottom: 0.4em;
    scroll-margin-top: 96px;
}
#post-content h2 { font-size: 1.35em; }
#post-content h3 { font-size: 1.15em; }
#post-content h4 { font-size: 1.02em; }
#post-content ul,
#post-content ol {
    margin: 0 0 0.7em;
    padding-left: 1.4em;
}
#post-content ul { list-style: disc; }
#post-content ol { list-style: decimal; }
#post-content li { margin: 0.2em 0; }
#post-content a {
    color: var(--ak-link);
    text-decoration: none;
}
#post-content a:hover { color: var(--ak-link-hover); text-decoration: underline; }
#post-content blockquote {
    border-left: 4px solid var(--ak-primary);
    background: linear-gradient(to right, var(--ak-primary-25), transparent 70%);
    margin: 1em 0;
    padding: 0.6em 1em;
    color: #334155;
    font-style: italic;
    border-radius: 0 0.5rem 0.5rem 0;
}
#post-content blockquote p:last-child { margin-bottom: 0; }
#post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 1em auto;
    display: block;
    box-shadow: 0 10px 30px -15px rgba(15, 23, 42, 0.25);
}
#post-content iframe {
    max-width: 100%;
    border-radius: 0.75rem;
    margin: 1em 0;
}
#post-content hr {
    margin: 1.4em 0;
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(15, 23, 42, 0.18), transparent);
}
#post-content code:not(pre code) {
    background: #f1f5f9;
    color: var(--ak-primary);
    padding: 0.15em 0.4em;
    border-radius: 0.3rem;
    font-size: 0.9em;
}
#post-content pre {
    background: #0f172a;
    color: #f1f5f9;
    padding: 1em;
    border-radius: 0.6rem;
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 0.9em;
    line-height: 1.6;
}

/* ---- Tables: horizontal scroll inside their own wrapper ---- */
#post-content .ak-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5em 0;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #ffffff;
    box-shadow: 0 4px 14px -10px rgba(15, 23, 42, 0.18);
}
#post-content .ak-table-scroll table {
    margin: 0;
    border-collapse: collapse;
    width: 100%;
    min-width: 480px;
    font-size: 0.95em;
}
#post-content .ak-table-scroll th,
#post-content .ak-table-scroll td {
    padding: 0.7em 0.9em;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}
#post-content .ak-table-scroll th {
    background: linear-gradient(to bottom, var(--ak-primary-50), var(--ak-primary-70));
    color: var(--ak-primary);
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--ak-primary-200);
}
#post-content .ak-table-scroll tbody tr:hover { background: var(--ak-primary-25); }
#post-content .ak-table-scroll tbody tr:last-child td { border-bottom: 0; }

/* ---- TOC card ---- */
.ak-toc { font-size: 14px; }
.ak-toc__list { list-style: none; padding: 0; margin: 0; }
.ak-toc__list ul { list-style: none; padding-left: 1em; margin: 0.2em 0 0; }
.ak-toc__item { margin: 0.25em 0; }
.ak-toc__link {
    display: block;
    padding: 0.4em 0.7em;
    color: #475569;
    border-radius: 0.4rem;
    border-left: 2px solid transparent;
    text-decoration: none;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    line-height: 1.35;
}
.ak-toc__link:hover { background: var(--ak-primary-25); color: var(--ak-primary); }
.ak-toc__link.is-active {
    background: var(--ak-primary-25);
    color: var(--ak-primary);
    border-left-color: var(--ak-primary);
    font-weight: 600;
}
.ak-toc__list > .ak-toc__item > .ak-toc__link { font-weight: 600; color: #334155; }

/* ---- Reader toolbar (font controls) ---- */
.ak-fontbtn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.ak-fontbtn:hover { background: var(--ak-primary-25); color: var(--ak-primary); border-color: var(--ak-primary-100); }
.ak-fontbtn.is-active { background: var(--ak-primary-25); color: var(--ak-primary); border-color: var(--ak-primary); }
.ak-fontbtn[disabled] { opacity: 0.4; cursor: not-allowed; }
.ak-fontbtn--lg { font-size: 16px; }
.ak-fontbtn--xl { font-size: 19px; }

/* Smaller share + font controls on phones */
@media (max-width: 639px) {
    .ak-share-row .ak-fontbtn {
        width: 26px;
        height: 26px;
        font-size: 11px;
        border-radius: 6px;
    }
    .ak-share-row .ak-fontbtn--lg { font-size: 13px; }
    .ak-share-row .ak-fontbtn--xl { font-size: 15px; }
    .ak-share-row .sharethis-inline-share-buttons {
        transform: scale(0.85);
        transform-origin: left center;
    }
}

/* ---- Drop-cap (off by default; opt-in via attribute) ---- */
#post-content[data-dropcap="on"] > p:first-of-type::first-letter {
    float: left;
    font-size: 3.4em;
    line-height: 0.9;
    padding: 0.05em 0.12em 0 0;
    font-weight: 700;
    color: var(--ak-primary);
}

/* Print: hide noise */
@media print {
    .ak-readbar,
    .ak-toc-card,
    .ak-sidebar,
    .ak-share-row,
    .sharethis-inline-share-buttons,
    .sharethis-inline-reaction-buttons,
    .fb-comments { display: none !important; }
}