/* Article page typography and lists (CKEditor output). RTL-aware via logical properties. */

/* ---- type: one font, a step smaller than the site default ---- */
.art-title {
    font-size: 1.15rem;
    line-height: 1.9;
}

@media (min-width: 640px) {
    .art-title {
        font-size: 1.35rem;
    }
}

.article-body {
    font-size: 0.9375rem;
    line-height: 2;
}

/* content pasted from Word carries its own fonts and sizes inline; keep the site's */
.article-body *,
.article-body font {
    font-family: inherit !important;
}

.article-body :is(p, span, font, li, div, td)[style*="font-size"],
.article-body font[size] {
    font-size: inherit !important;
}

.article-body h2 {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-body h3 {
    font-size: 1rem;
    line-height: 1.8;
}

.article-body h4,
.article-body h5,
.article-body h6 {
    font-size: 0.95rem;
    line-height: 1.8;
}

/* ---- lists ---- */
.article-body ul,
.article-body ol {
    list-style: none;
    margin: 1.25rem 0;
    margin-inline: 0;
    padding: 0;
}

.article-body li {
    margin: 0;
    padding: 0;
}

.article-body li::marker {
    content: none;
}

/* ---- bulleted ---- */
.article-body ul > li {
    position: relative;
    margin-block: 0.45rem;
    padding-inline-start: 1.6rem;
}

.article-body ul > li::before {
    content: "";
    position: absolute;
    top: 0.72rem;
    top: calc(0.5lh - 0.3rem);
    inset-inline-start: 0.3rem;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 2px;
    background: linear-gradient(135deg, #00ad9c, #0c58a4);
    box-shadow: 0 0 0 3px rgba(0, 173, 156, 0.14);
    transform: rotate(45deg);
}

/* nested bullets: hollow ring */
.article-body li ul {
    margin-block: 0.4rem 0.2rem;
}

.article-body li ul > li::before {
    top: 0.78rem;
    top: calc(0.5lh - 0.25rem);
    width: 0.5rem;
    height: 0.5rem;
    border: 2px solid #00ad9c;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    transform: none;
}

/* ---- numbered: each item is a soft card with a number badge ---- */
.article-body ol {
    display: grid;
    gap: 0.75rem;
    counter-reset: article-ol;
}

.article-body ol > li {
    position: relative;
    counter-increment: article-ol;
    padding: 0.85rem 1rem;
    padding-inline-start: 3.4rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    background: linear-gradient(180deg, #f8fafc, #fff);
}

.article-body ol > li::before {
    content: counter(article-ol, persian);
    position: absolute;
    top: 0.95rem;
    top: calc(0.85rem + 0.5lh - 0.9rem);
    inset-inline-start: 0.85rem;
    display: grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 0.55rem;
    background: linear-gradient(135deg, #1a2a55, #0c58a4);
    box-shadow: 0 6px 14px -6px rgba(12, 88, 164, 0.6);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
}

/* an item that holds a sub-list reads as a heading for it */
.article-body ol > li:has(> ul, > ol) {
    color: #0f172a;
    font-weight: 700;
}

.article-body ol > li > ul,
.article-body ol > li > ol {
    color: #334155;
    font-weight: 400;
}

/* numbered list nested in a list: plain badge, no card */
.article-body li ol {
    gap: 0.35rem;
    margin-block: 0.5rem 0.2rem;
}

.article-body li ol > li {
    padding: 0;
    padding-inline-start: 2.2rem;
    border: 0;
    background: none;
}

.article-body li ol > li::before {
    top: 0.45rem;
    top: calc(0.5lh - 0.7rem);
    inset-inline-start: 0.1rem;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 0.45rem;
    font-size: 0.75rem;
}

@media (max-width: 640px) {
    /* justified text leaves wide gaps in narrow list items */
    .article-body li {
        text-align: start;
    }

    .article-body ol > li {
        padding: 0.75rem 0.85rem;
        padding-inline-start: 3rem;
    }

    .article-body ol > li::before {
        inset-inline-start: 0.7rem;
        top: 0.85rem;
        top: calc(0.75rem + 0.5lh - 0.9rem);
    }

    /* sub-lists use the card's full width, starting under the number badge */
    .article-body ol > li > ul,
    .article-body ol > li > ol {
        margin-inline-start: -2.2rem;
    }
}

/* =========================================================
   Article page decoration
   ========================================================= */

/* reading progress */
.art-progress {
    position: fixed;
    inset-inline: 0;
    top: 0;
    z-index: 90;
    height: 3px;
    pointer-events: none;
}

.art-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(270deg, #00ad9c, #0c58a4);
    box-shadow: 0 0 10px rgba(0, 173, 156, 0.6);
    transform: scaleX(0);
    transform-origin: right;
}

/* summary box */
.art-summary {
    box-shadow: inset -4px 0 0 #00ad9c;
}

.art-summary__title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.art-summary__icon {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.55rem;
    background: linear-gradient(135deg, #00ad9c, #0c58a4);
    color: #fff;
}

.art-summary__icon svg {
    width: 1rem;
    height: 1rem;
}

/* headings */
.article-body h2,
.article-body h3 {
    position: relative;
    border: 0;
    padding-inline-start: 1.1rem;
}

.article-body h2::before {
    content: "";
    position: absolute;
    top: 0.2em;
    bottom: 0.2em;
    inset-inline-start: 0;
    width: 5px;
    border-radius: 4px;
    background: linear-gradient(180deg, #00ad9c, #1a2a55);
}

.article-body h3::before {
    content: "";
    position: absolute;
    top: 0.55em;
    inset-inline-start: 0.15rem;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 2px;
    background: #00ad9c;
    transform: rotate(45deg);
}

/* quotes */
.article-body blockquote {
    position: relative;
    margin: 1.75rem 0;
    padding: 1.15rem 1.25rem;
    padding-inline-start: 3.4rem;
    border: 0;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(0, 173, 156, 0.08), rgba(12, 88, 164, 0.06));
    color: #334155;
    font-style: normal;
}

.article-body blockquote::before {
    content: "\201D";
    position: absolute;
    top: 0.1rem;
    inset-inline-start: 0.85rem;
    color: rgba(0, 173, 156, 0.45);
    font-family: Georgia, serif;
    font-size: 4rem;
    line-height: 1;
}

.article-body blockquote p::before,
.article-body blockquote p::after {
    content: none;
}

.article-body blockquote p:last-child {
    margin-bottom: 0;
}

/* divider */
.article-body hr {
    position: relative;
    height: 1px;
    margin: 2.5rem 0;
    border: 0;
    background: linear-gradient(90deg, transparent, #cbd5e1, transparent);
    overflow: visible;
}

.article-body hr::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.6rem;
    height: 0.6rem;
    background: linear-gradient(135deg, #00ad9c, #0c58a4);
    box-shadow: 0 0 0 6px #fff;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* links, emphasis, images */
.article-body a {
    color: #0c58a4;
    text-decoration: underline;
    text-decoration-color: rgba(0, 173, 156, 0.45);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.article-body a:hover {
    text-decoration-color: #00ad9c;
}

.article-body strong {
    color: #0f172a;
}

.article-body figure figcaption {
    margin-top: 0.6rem;
    color: #64748b;
    font-size: 0.8rem;
    text-align: center;
}

/* tables */
.article-body table {
    width: 100%;
    margin-block: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.article-body thead th {
    background: #1a2a55;
    color: #fff;
    font-weight: 700;
}

.article-body th,
.article-body td {
    padding: 0.65rem 0.9rem;
    border: 0;
    border-bottom: 1px solid #eef2f7;
    text-align: start;
}

.article-body tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.article-body tbody tr:last-child td {
    border-bottom: 0;
}

/* share bar */
.art-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px dashed #e2e8f0;
}

.art-share__label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #1a2a55;
    font-size: 0.85rem;
    font-weight: 700;
}

.art-share__label svg {
    width: 1.1rem;
    height: 1.1rem;
    color: #00ad9c;
}

.art-share__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.art-share__btn {
    --brand: #00ad9c;
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 0.8rem;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.art-share__btn svg {
    width: 1.15rem;
    height: 1.15rem;
}

.art-share__btn:hover,
.art-share__btn:focus-visible,
.art-share__btn.is-copied {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
    box-shadow: 0 8px 18px -10px var(--brand);
    transform: translateY(-2px);
}

.art-share__btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.art-share__btn--telegram { --brand: #229ed9; }
.art-share__btn--whatsapp { --brand: #25d366; }
.art-share__btn--linkedin { --brand: #0a66c2; }
.art-share__btn--x { --brand: #0f172a; }

.art-share__done-icon,
.art-share__btn.is-copied .art-share__copy-icon {
    display: none;
}

.art-share__btn.is-copied .art-share__done-icon {
    display: block;
}

/* related articles header */
.art-side-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.art-side-title__icon {
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 0.5rem;
    background: rgba(0, 173, 156, 0.12);
    color: #00ad9c;
}

.art-side-title__icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

@media (max-width: 640px) {
    /* wide tables scroll inside the card instead of the page */
    .article-body table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .art-share {
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .art-share__btn {
        transition: none;
    }
}
