/* ExamPrepWay article system.
   Scoped to article pages/content so global layout, header, footer, and dashboards are not affected. */

.article-shell {
    --article-system-bg: #f4f7fc;
    --article-system-card: #ffffff;
    --article-system-text: #1f2937;
    --article-system-muted: #64748b;
    --article-system-border: #e2e8f0;
    --article-system-primary: #2c6e9e;
    --article-system-primary-dark: #2d3e50;
    --article-system-accent: #e6b12e;
    --article-system-success: #2c8c5a;
    --article-system-danger: #d9534f;
    --article-system-radius-lg: 20px;
    --article-system-radius-xl: 28px;
    --article-system-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
    color: var(--article-system-text);
}

.article-shell .article-container,
.article-container {
    max-width: 900px;
    margin-inline: auto;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--article-system-radius-xl, 28px);
    background: var(--article-system-card, #fff);
    box-shadow: var(--article-system-shadow, 0 14px 34px rgba(15, 23, 42, 0.08));
    padding: clamp(18px, 3vw, 28px);
}

.article-shell .article-container > *:first-child,
.article-container > *:first-child {
    margin-top: 0;
}

.article-shell .article-container p,
.article-container p,
.article-shell .article-container li,
.article-container li {
    color: #334155;
    font-size: 1rem;
    line-height: 1.75;
}

.article-shell .article-container h2,
.article-container h2 {
    color: #1e2a3a;
    font-size: clamp(1.32rem, 2vw, 1.65rem);
    line-height: 1.32;
    margin: 1.65rem 0 0.7rem;
}

.article-shell .article-container h3,
.article-container h3 {
    color: #1f2937;
    font-size: clamp(1.08rem, 1.5vw, 1.26rem);
    line-height: 1.35;
    margin: 1.25rem 0 0.55rem;
}

.article-shell .article-container ul,
.article-shell .article-container ol,
.article-container ul,
.article-container ol {
    margin: 0 0 1.1rem;
    padding-left: 1.45rem;
}

.article-shell .article-container li,
.article-container li {
    margin: 0.36rem 0;
}

.article-shell .article-container li::marker,
.article-container li::marker {
    color: var(--article-system-primary, #2c6e9e);
    font-weight: 800;
}

.article-shell .article-container a,
.article-container a {
    color: var(--article-system-primary, #2c6e9e);
    font-weight: 700;
    text-decoration-color: rgba(44, 110, 158, 0.3);
    text-underline-offset: 3px;
}

.article-shell .article-container a:hover,
.article-container a:hover {
    color: #1e5c87;
    text-decoration-color: currentColor;
}

.article-shell .article-container hr,
.article-container hr {
    height: 1px;
    margin: 22px 0;
    border: 0;
    background: var(--article-system-border, #e2e8f0);
}

.article-shell .article-hero,
.article-container .article-hero {
    margin: 0 0 22px;
    border: 1px solid #dbe5f1;
    border-radius: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #eef5ff 100%);
    padding: clamp(20px, 3vw, 30px);
}

.article-shell .article-hero__eyebrow,
.article-container .article-hero__eyebrow,
.article-shell .article-badge,
.article-container .article-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 28px;
    border-radius: 999px;
    background: #e7edf3;
    color: #2d3e50;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
    padding: 7px 12px;
}

.article-shell .article-hero__title,
.article-container .article-hero__title,
.article-shell .article-hero h1,
.article-container .article-hero h1 {
    color: #111827;
    font-size: clamp(1.85rem, 3.8vw, 2.9rem);
    line-height: 1.12;
    margin: 14px 0 10px;
}

.article-shell .article-hero__intro,
.article-container .article-hero__intro,
.article-shell .article-hero p,
.article-container .article-hero p {
    max-width: 760px;
    color: #334155;
    font-size: clamp(1rem, 1.3vw, 1.08rem);
    line-height: 1.7;
    margin: 0;
}

.article-shell .article-meta-pills,
.article-container .article-meta-pills,
.article-shell .article-pills,
.article-container .article-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 14px 0;
}

.article-shell .article-pill,
.article-container .article-pill,
.article-shell .article-meta-pills span,
.article-container .article-meta-pills span,
.article-shell .article-pills span,
.article-container .article-pills span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border: 1px solid #d8e2ee;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 750;
    padding: 7px 11px;
}

.article-shell .formula-card,
.article-container .formula-card,
.article-shell .tip-box,
.article-container .tip-box,
.article-shell .callout,
.article-container .callout,
.article-shell .teacher-note,
.article-container .teacher-note,
.article-shell .exam-tip,
.article-container .exam-tip,
.article-shell .shortcut-box,
.article-container .shortcut-box,
.article-shell .pyq-box,
.article-container .pyq-box,
.article-shell .solution-box,
.article-container .solution-box,
.article-shell .revision-box,
.article-container .revision-box,
.article-shell .key-point-box,
.article-container .key-point-box,
.article-shell .warning-box,
.article-container .warning-box,
.article-shell .mistake-box,
.article-container .mistake-box,
.article-shell .practice-box,
.article-container .practice-box,
.article-shell .faq-box,
.article-container .faq-box,
.article-shell .eeat-box,
.article-container .eeat-box,
.article-shell .premium-lock-box,
.article-container .premium-lock-box,
.article-shell .soft-cta-box,
.article-container .soft-cta-box,
.article-shell .final-cta,
.article-container .final-cta {
    border-radius: var(--article-system-radius-lg, 20px);
    margin: 18px 0;
    padding: clamp(14px, 2vw, 20px);
}

.article-shell .formula-card,
.article-container .formula-card,
.article-shell .solution-box,
.article-container .solution-box {
    border: 1px solid #d8e2f0;
    border-left: 5px solid var(--article-system-primary, #2c6e9e);
    background: #f0f4fa;
}

.article-shell .tip-box,
.article-container .tip-box,
.article-shell .exam-tip,
.article-container .exam-tip {
    border: 1px solid #cfe9d7;
    border-left: 5px solid var(--article-system-success, #2c8c5a);
    background: #e6f4ea;
}

.article-shell .callout,
.article-container .callout,
.article-shell .teacher-note,
.article-container .teacher-note,
.article-shell .key-point-box,
.article-container .key-point-box {
    border: 1px solid #f5df9c;
    border-left: 5px solid var(--article-system-accent, #e6b12e);
    background: #fffae6;
}

.article-shell .shortcut-box,
.article-container .shortcut-box,
.article-shell .revision-box,
.article-container .revision-box {
    border: 1px solid #dbeafe;
    border-left: 5px solid #4f46e5;
    background: #eef2ff;
}

.article-shell .pyq-box,
.article-container .pyq-box,
.article-shell .practice-box,
.article-container .practice-box {
    border: 1px solid #e2e8f0;
    background: #fafcff;
}

.article-shell .warning-box,
.article-container .warning-box,
.article-shell .mistake-box,
.article-container .mistake-box {
    border: 1px solid #f4c7c4;
    border-left: 5px solid var(--article-system-danger, #d9534f);
    background: #fef3f2;
}

.article-shell .faq-box,
.article-container .faq-box {
    border: 1px solid #f5e2ad;
    background: #fefaf0;
}

.article-shell .faq-item,
.article-container .faq-item {
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    padding: 12px 0;
}

.article-shell .faq-item:first-child,
.article-container .faq-item:first-child {
    padding-top: 0;
}

.article-shell .faq-item:last-child,
.article-container .faq-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.article-shell .eeat-box,
.article-container .eeat-box {
    border: 1px solid #eef2f8;
    background: #f8f9fc;
    color: #4b5565;
    font-size: 0.82rem;
    text-align: center;
}

.article-shell .premium-lock-box,
.article-container .premium-lock-box {
    border: 1px solid #f2d394;
    background: linear-gradient(135deg, #fff7e6 0%, #fffdf6 100%);
}

.article-shell .soft-cta-box,
.article-container .soft-cta-box {
    border: 1px solid #dbeafe;
    background: #f4f7fc;
}

.article-shell .final-cta,
.article-container .final-cta {
    border: 1px solid var(--article-system-primary-dark, #2d3e50);
    background: var(--article-system-primary-dark, #2d3e50);
    color: #ffffff;
    text-align: center;
}

.article-shell .final-cta p,
.article-container .final-cta p,
.article-shell .final-cta h2,
.article-container .final-cta h2,
.article-shell .final-cta h3,
.article-container .final-cta h3 {
    color: #ffffff;
}

.article-shell .article-btn,
.article-container .article-btn,
.article-shell .article-btn-secondary,
.article-container .article-btn-secondary,
.article-shell .final-cta-btn,
.article-container .final-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
    padding: 10px 20px;
    text-decoration: none;
}

.article-shell .article-btn,
.article-container .article-btn {
    border: 1px solid var(--article-system-primary, #2c6e9e);
    background: var(--article-system-primary, #2c6e9e);
    color: #ffffff;
}

.article-shell .article-btn-secondary,
.article-container .article-btn-secondary {
    border: 1px solid #d8e2ee;
    background: #eef2f5;
    color: #2d3e50;
}

.article-shell .final-cta-btn,
.article-container .final-cta-btn {
    border: 1px solid var(--article-system-accent, #e6b12e);
    background: var(--article-system-accent, #e6b12e);
    color: #2d3e50;
}

.article-shell .article-btn:hover,
.article-container .article-btn:hover,
.article-shell .article-btn-secondary:hover,
.article-container .article-btn-secondary:hover,
.article-shell .final-cta-btn:hover,
.article-container .final-cta-btn:hover {
    filter: brightness(0.96);
    text-decoration: none;
}

.article-shell .progress-bar,
.article-container .progress-bar {
    overflow: hidden;
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    margin: 18px 0;
}

.article-shell .progress-fill,
.article-container .progress-fill {
    display: block;
    width: var(--article-progress, 25%);
    height: 100%;
    border-radius: inherit;
    background: var(--article-system-primary, #2c6e9e);
}

.article-shell .cluster-nav,
.article-container .cluster-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin: 18px 0;
}

.article-shell .cluster-btn,
.article-container .cluster-btn {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    border-radius: 999px;
    background: #eef2f5;
    color: #2d3e50;
    font-size: 0.82rem;
    font-weight: 750;
    padding: 8px 16px;
    text-decoration: none;
}

.article-shell .cluster-btn:hover,
.article-container .cluster-btn:hover {
    background: #dfe6ed;
    color: #1e2a3a;
    text-decoration: none;
}

.article-shell .next-article-card,
.article-container .next-article-card {
    display: block;
    border: 1px solid #dbe5f1;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    margin: 18px 0;
    padding: 16px;
    text-decoration: none;
}

.article-shell .related-cluster-grid,
.article-container .related-cluster-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.article-shell .related-cluster-card,
.article-container .related-cluster-card {
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #f8fafc;
    color: #263a55;
    font-weight: 750;
    padding: 14px;
    text-decoration: none;
}

.article-shell .related-cluster-card:hover,
.article-container .related-cluster-card:hover,
.article-shell .next-article-card:hover,
.article-container .next-article-card:hover {
    border-color: #b8ccee;
    background: #eef6ff;
}

.article-shell .rev-table,
.article-container .rev-table,
.article-shell .comparison-table,
.article-container .comparison-table {
    width: 100%;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #dbe5f1;
    border-radius: 16px;
    background: #f8fafc;
    margin: 16px 0;
}

.article-shell .rev-table th,
.article-container .rev-table th,
.article-shell .comparison-table th,
.article-container .comparison-table th {
    background: var(--article-system-primary-dark, #2d3e50);
    color: #ffffff;
    font-size: 0.86rem;
    padding: 11px 12px;
    text-align: left;
}

.article-shell .rev-table td,
.article-container .rev-table td,
.article-shell .comparison-table td,
.article-container .comparison-table td {
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.94rem;
    padding: 11px 12px;
    vertical-align: top;
}

.article-shell .rev-table tr:last-child td,
.article-container .rev-table tr:last-child td,
.article-shell .comparison-table tr:last-child td,
.article-container .comparison-table tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 760px) {
    .article-shell {
        padding-inline: 0;
    }

    .article-shell .article-container,
    .article-container {
        border-radius: 20px;
        padding: 18px 16px;
    }

    .article-shell .article-container p,
    .article-container p,
    .article-shell .article-container li,
    .article-container li {
        font-size: 0.98rem;
        line-height: 1.72;
    }

    .article-shell .article-hero,
    .article-container .article-hero {
        border-radius: 18px;
        padding: 18px;
    }

    .article-shell .article-meta-pills,
    .article-container .article-meta-pills,
    .article-shell .article-pills,
    .article-container .article-pills,
    .article-shell .cluster-nav,
    .article-container .cluster-nav {
        align-items: stretch;
        flex-direction: column;
    }

    .article-shell .cluster-btn,
    .article-container .cluster-btn,
    .article-shell .article-btn,
    .article-container .article-btn,
    .article-shell .article-btn-secondary,
    .article-container .article-btn-secondary,
    .article-shell .final-cta-btn,
    .article-container .final-cta-btn {
        width: 100%;
    }

    .article-shell .related-cluster-grid,
    .article-container .related-cluster-grid {
        grid-template-columns: 1fr;
    }

    .article-shell .rev-table,
    .article-container .rev-table,
    .article-shell .comparison-table,
    .article-container .comparison-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Article page health patch: scoped defensive layout and text-flow rules.
   Keeps admin content horizontal/readable without changing stored article HTML. */
.article-page,
.article-page *,
.article-v2-shell,
.article-v2-shell * {
    box-sizing: border-box;
}

.article-page {
    background: #f8fafc;
    color: #0f172a;
}

.article-page > .article-container {
    width: min(100% - 32px, 1180px);
    max-width: 1180px;
    margin-inline: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.article-learning-board {
    display: grid;
    grid-template-columns: minmax(0, 820px) minmax(280px, 320px);
    justify-content: center;
    align-items: start;
    gap: 24px;
    width: 100%;
    min-width: 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 24px 70px -56px rgba(15, 23, 42, 0.42);
}

.article-main,
.article-reader-pane,
.article-reader-card,
.article-learning-surface,
.article-sidebar,
.article-learning-rail,
.article-side-panel,
.article-rail-card,
.article-body,
.article-body > *,
.article-auto-section,
.formula-card,
.tip-box,
.practice-box,
.mistake-box,
.callout,
.soft-cta {
    min-width: 0;
}

.article-reader-card,
.article-learning-surface {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 44px -40px rgba(15, 23, 42, 0.38);
}

.article-reader-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fbff;
}

.article-reader-header h2,
.article-side-panel h2 {
    width: 100%;
    min-width: 0;
    color: #0f172a;
    line-height: 1.25;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
}

.article-body {
    width: 100%;
    max-width: 100%;
    padding: clamp(24px, 3.2vw, 40px);
    color: #334155;
    font-size: 1.035rem;
    line-height: 1.84;
    word-break: normal;
    overflow-wrap: break-word;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6,
.article-body p,
.article-body li,
.article-body a,
.article-body span,
.article-body strong,
.article-body em,
.article-body summary,
.article-body blockquote,
.article-side-panel,
.article-side-panel *,
.article-reader-header,
.article-reader-header * {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    word-break: normal;
    white-space: normal;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: normal;
    text-wrap: pretty;
}

.article-body h2 {
    position: relative;
    grid-template-columns: none;
    margin: 2rem 0 0.8rem;
    padding: 0 0 0 16px;
    border-left: 5px solid #2563eb;
    color: #0f172a;
    font-size: clamp(1.45rem, 2vw, 1.9rem);
    line-height: 1.22;
}

.article-body h2::before {
    display: none;
}

.article-body h3 {
    margin: 1.55rem 0 0.62rem;
    color: #172338;
    font-size: clamp(1.16rem, 1.45vw, 1.34rem);
    line-height: 1.3;
}

.article-body p,
.article-body li {
    color: #334155;
    line-height: 1.78;
}

.article-body ul,
.article-body ol {
    display: block;
    margin: 0 0 1.2rem;
    padding-left: 1.45rem;
}

.article-body li + li {
    margin-top: 0.5rem;
}

.article-body a,
.article-body code,
.article-body pre,
.article-body kbd,
.article-body samp {
    overflow-wrap: anywhere;
}

.article-body img,
.article-body iframe,
.article-body video,
.article-body svg {
    max-width: 100%;
    height: auto;
}

.article-body pre {
    overflow-x: auto;
    max-width: 100%;
    white-space: pre;
}

.article-body table,
.article-body .rev-table,
.article-body .quick-revision-table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: separate;
    -webkit-overflow-scrolling: touch;
}

.article-body th,
.article-body td {
    min-width: 120px;
    white-space: normal;
}

.article-learning-rail {
    position: sticky;
    top: 96px;
    display: grid;
    align-self: start;
    gap: 16px;
    min-width: 0;
}

.article-side-panel {
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 46px -42px rgba(15, 23, 42, 0.38);
}

.article-study-nav,
.article-related-links {
    display: grid;
    gap: 10px;
}

.article-study-nav a,
.article-related-links a {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    width: 100%;
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.35;
    text-decoration: none;
    overflow-wrap: break-word;
}

.article-related-links a {
    color: #0f766e;
}

.article-study-nav a:hover,
.article-related-links a:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.article-study-nav__toc {
    min-height: 38px !important;
    padding: 9px 12px !important;
    border-color: #e2e8f0 !important;
    background: #ffffff !important;
    color: #334155 !important;
    font-size: 0.86rem !important;
    font-weight: 750 !important;
}

.article-study-nav__toc--level-3 {
    margin-left: 10px;
    width: calc(100% - 10px) !important;
}

@media (max-width: 1060px) {
    .article-learning-board {
        grid-template-columns: minmax(0, 1fr);
    }

    .article-learning-rail {
        position: static;
    }
}

@media (max-width: 760px) {
    .article-page > .article-container {
        width: min(100% - 22px, 1180px);
    }

    .article-learning-board {
        padding: 8px;
        gap: 14px;
    }

    .article-reader-header,
    .article-side-panel {
        padding: 16px;
    }

    .article-body {
        padding: 20px 16px;
        font-size: 1rem;
        line-height: 1.76;
    }

    .article-body h2 {
        margin-top: 1.7rem;
        font-size: 1.3rem;
    }

    .article-body h3 {
        font-size: 1.12rem;
    }
}

/* Desktop article-system density pass for templates that load this file last. */
@media (min-width: 1200px) {
    .article-page {
        padding-top: 28px;
        padding-bottom: 48px;
    }

    .article-page > .article-container {
        width: min(100% - 40px, 1120px);
    }

    .article-learning-board {
        gap: 20px;
        padding: 10px;
    }

    .article-reader-header,
    .article-side-panel {
        padding: 16px;
    }

    .article-body {
        padding: 24px 28px;
        font-size: 0.98rem;
        line-height: 1.72;
    }

    .article-body h2 {
        margin-top: 1.65rem;
        font-size: 1.35rem;
    }

    .article-body h3 {
        margin-top: 1.25rem;
        font-size: 1.14rem;
    }

    .article-learning-rail {
        top: 86px;
        gap: 12px;
    }

    .article-study-nav,
    .article-related-links {
        gap: 8px;
    }

    .article-study-nav a,
    .article-related-links a {
        min-height: 40px;
        padding: 9px 12px;
        font-size: 0.86rem;
    }
}
