/**
 * Article CPT styles. Loaded on single-article.php only.
 * Uses .cw-article-head and .cw-article-body styles from design-tokens.css.
 */

/* Mobile overflow protection. Tables in article bodies were overflowing
   the viewport on narrow screens (every cluster article uses one or more
   <table> blocks). Long URLs in citations also wouldn't wrap. */
.cw-article-body table,
.cw-glossary-layout table,
.cw-article-archive table,
.cw-glossary-archive table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.cw-article-body,
.cw-article-archive,
.cw-glossary-layout,
.cw-glossary-archive,
.cw-article-cta,
.cw-faq__a {
    overflow-wrap: anywhere;
    word-break: break-word;
}
/* Defensive global: prevents any single overflowing element from
   forcing the whole page wider than the viewport on mobile. */
html, body { overflow-x: hidden; }

/* FAQ block — bolder titles and visual separation from body content.
   Mirrors calculator.css so styles apply on both article and calculator pages. */
.cw-faq {
    margin: 3rem 0 2rem;
    padding: 1.75rem 1.75rem 1.5rem;
    background: #f5f7fb;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
}
.cw-faq__title {
    margin: 0 0 1.25rem;
    font-size: 1.45rem;
    font-weight: 700;
    color: #0a2540;
    letter-spacing: -0.01em;
}
.cw-faq__list { margin: 0; padding: 0; }
.cw-faq__item {
    padding: 1.1rem 0;
    border-bottom: 1px solid #e4e7ec;
}
.cw-faq__item:last-child { border-bottom: 0; padding-bottom: 0; }
.cw-faq__q {
    font-weight: 700;
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
    color: #0a2540;
    letter-spacing: -0.005em;
}
.cw-faq__a {
    margin: 0;
    color: #2b2f36;
    line-height: 1.65;
    font-size: 0.97rem;
}
@media (max-width: 640px) {
    .cw-faq { padding: 1.25rem 1.25rem 1rem; }
    .cw-faq__title { font-size: 1.25rem; }
    .cw-faq__q { font-size: 1.05rem; }
}


.cw-article-layout {
    display: block;
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 16px 56px;
}

.cw-article-layout__main {
    width: 100%;
}

/* CTA block linking to the calculator the article anchors to */
.cw-article-cta {
    margin: 40px 0 32px;
    padding: 24px 24px 22px;
    background: #f5f7fb;
    border: 1px solid #e4e7ec;
    border-left: 4px solid #c99a3b;
    border-radius: 6px;
}

.cw-article-cta__title {
    margin: 0 0 8px;
    font-size: 1.15rem;
    color: #0a2540;
    letter-spacing: -0.01em;
}

.cw-article-cta__lede {
    margin: 0 0 14px;
    color: #2b2f36;
    font-size: 0.97rem;
    line-height: 1.5;
}

.cw-article-cta__link {
    display: inline-block;
    padding: 10px 18px;
    background: #0a2540;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.15s ease-out;
}

.cw-article-cta__link:hover,
.cw-article-cta__link:focus-visible {
    background: #1a3a5c;
    color: #fff;
}

@media (max-width: 640px) {
    .cw-article-layout { padding: 16px 12px 40px; }
    .cw-article-cta { padding: 18px 18px 16px; }
    .cw-article-cta__title { font-size: 1.05rem; }
}

/* Archive listing at /articles/ */
.cw-article-archive {
    max-width: 760px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}

.cw-article-archive__head h1 {
    margin: 12px 0 8px;
    font-size: 2rem;
    color: #0a2540;
    letter-spacing: -0.02em;
}

.cw-article-archive__lede {
    margin: 0 0 20px;
    color: #52607a;
    font-size: 1.05rem;
    line-height: 1.5;
}

/* Category filter chips at the top of the articles archive */
.cw-cat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 28px;
    padding: 0;
}
.cw-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 999px;
    color: #0a2540;
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.cw-cat-chip span {
    color: #52607a;
    font-weight: 400;
    font-size: 0.85rem;
}
.cw-cat-chip:hover,
.cw-cat-chip:focus-visible {
    border-color: #c99a3b;
    color: #0a2540;
    background: #fafbfd;
}
.cw-cat-chip--active {
    background: #0a2540;
    border-color: #0a2540;
    color: #fff;
}
.cw-cat-chip--active span { color: rgba(255,255,255,0.75); }
.cw-cat-chip--active:hover,
.cw-cat-chip--active:focus-visible {
    background: #1a3a5c;
    border-color: #1a3a5c;
    color: #fff;
}

/* Inline category label on each archive list row */
.cw-article-archive__cat {
    color: #c99a3b;
    text-decoration: none;
    font-weight: 600;
}
.cw-article-archive__cat:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .cw-cat-chips { gap: 6px; margin-bottom: 20px; }
    .cw-cat-chip { padding: 6px 12px; font-size: 0.88rem; }
}

.cw-article-archive__list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: cw-article-counter;
}

.cw-article-archive__item {
    padding: 24px 0;
    border-bottom: 1px solid #e4e7ec;
}

.cw-article-archive__item:last-child {
    border-bottom: none;
}

.cw-article-archive__title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    color: #0a2540;
    letter-spacing: -0.01em;
}

.cw-article-archive__title a {
    color: inherit;
    text-decoration: none;
}

.cw-article-archive__title a:hover,
.cw-article-archive__title a:focus-visible {
    color: #c99a3b;
    text-decoration: underline;
}

.cw-article-archive__dek {
    margin: 0 0 8px;
    color: #2b2f36;
    font-size: 0.97rem;
    line-height: 1.55;
}

.cw-article-archive__meta {
    margin: 0;
    color: #52607a;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
    .cw-article-archive { padding: 20px 12px 40px; }
    .cw-article-archive__head h1 { font-size: 1.6rem; }
    .cw-article-archive__title { font-size: 1.1rem; }
}

/* Related-articles block on calculator pages */
.cw-calc-related-articles {
    margin: 40px 0 8px;
    padding: 22px 24px 18px;
    background: #fafbfd;
    border: 1px solid #e4e7ec;
    border-radius: 6px;
}

.cw-calc-related-articles__title {
    margin: 0 0 12px;
    font-size: 1.05rem;
    color: #0a2540;
    letter-spacing: -0.01em;
}

.cw-calc-related-articles__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cw-calc-related-articles__list li {
    padding: 10px 0;
    border-top: 1px solid #eef0f4;
}

.cw-calc-related-articles__list li:first-child {
    border-top: none;
    padding-top: 0;
}

.cw-calc-related-articles__list a {
    display: block;
    font-weight: 600;
    color: #0a2540;
    text-decoration: none;
    line-height: 1.35;
}

.cw-calc-related-articles__list a:hover,
.cw-calc-related-articles__list a:focus-visible {
    color: #c99a3b;
    text-decoration: underline;
}

.cw-calc-related-articles__dek {
    display: block;
    margin-top: 4px;
    color: #52607a;
    font-size: 0.88rem;
    line-height: 1.5;
    font-weight: 400;
}

/* Glossary single entry */
.cw-glossary-layout {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 56px;
}

.cw-glossary-shortdef {
    margin: 18px 0 28px;
    padding: 16px 20px;
    background: #f5f7fb;
    border-left: 4px solid #c99a3b;
    border-radius: 4px;
    font-size: 1.05rem;
    line-height: 1.55;
    color: #0a2540;
    font-weight: 500;
}

/* Glossary archive */
.cw-glossary-archive {
    max-width: 760px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}

.cw-glossary-archive__head h1 {
    margin: 12px 0 8px;
    font-size: 2rem;
    color: #0a2540;
    letter-spacing: -0.02em;
}

.cw-glossary-archive__lede {
    margin: 0 0 32px;
    color: #52607a;
    font-size: 1.05rem;
    line-height: 1.5;
}

.cw-glossary-archive__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cw-glossary-archive__item {
    padding: 18px 0;
    border-bottom: 1px solid #e4e7ec;
}

.cw-glossary-archive__item:last-child { border-bottom: none; }

.cw-glossary-archive__title {
    margin: 0 0 6px;
    font-size: 1.15rem;
    color: #0a2540;
    letter-spacing: -0.01em;
}

.cw-glossary-archive__title a {
    color: inherit;
    text-decoration: none;
}

.cw-glossary-archive__title a:hover,
.cw-glossary-archive__title a:focus-visible {
    color: #c99a3b;
    text-decoration: underline;
}

.cw-glossary-archive__def {
    margin: 0;
    color: #52607a;
    font-size: 0.93rem;
    line-height: 1.55;
}

/* A-Z index bar at the top of the glossary archive */
.cw-az-index {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 18px 0 12px;
    padding: 12px 14px;
    background: #fafbfd;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
}
.cw-az-index__letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.92rem;
    color: #0a2540;
    background: transparent;
    transition: background 0.15s, color 0.15s;
}
.cw-az-index__letter:hover,
.cw-az-index__letter:focus-visible {
    background: #0a2540;
    color: #fff;
}
.cw-az-index__letter--empty {
    color: #c4c9d2;
    cursor: default;
}
.cw-az-index__letter--empty:hover {
    background: transparent;
    color: #c4c9d2;
}

/* Letter section grouping */
.cw-glossary-section {
    margin: 32px 0 0;
    scroll-margin-top: 80px;  /* clears sticky header on jump */
}
.cw-glossary-section__heading {
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #c99a3b;
    font-size: 1.5rem;
    color: #0a2540;
    letter-spacing: -0.01em;
}

@media (max-width: 640px) {
    .cw-glossary-layout { padding: 16px 12px 40px; }
    .cw-glossary-archive { padding: 20px 12px 40px; }
    .cw-glossary-archive__head h1 { font-size: 1.6rem; }
    .cw-az-index { padding: 10px 8px; gap: 4px; }
    .cw-az-index__letter { min-width: 24px; height: 24px; font-size: 0.85rem; }
}
