/* Shared code block presentation for public article and news detail pages. */
.article-content .article-code-block {
    --code-bg: #18202d;
    --code-surface: #202a39;
    --code-border: #2d3a4d;
    --code-text: #d9e2ef;
    --code-muted: #93a6bd;
    position: relative;
    max-width: 100%;
    margin: 18px 0 22px;
    overflow: hidden;
    border: 1px solid var(--code-border);
    border-radius: 8px;
    background: var(--code-bg);
    box-shadow: none;
    isolation: isolate;
}

.article-content .article-code-block::before {
    display: none;
}

.article-code-toolbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 30px;
    padding: 0 8px 0 17px;
    border-bottom: 1px solid var(--code-border);
    background: var(--code-surface);
}

.article-code-language {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    min-width: 0;
    color: var(--code-muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
}

.article-code-language::before {
    display: none;
}

.article-code-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex: 0 0 auto;
    height: 26px;
    min-height: 26px;
    width: 26px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #7f91a8;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    line-height: 1;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.article-code-copy:hover,
.article-code-copy:focus-visible {
    background: #2d3a4d;
    color: var(--code-text);
    outline: none;
}

.article-code-copy.is-copied {
    background: transparent;
    color: #c3e88d;
}

.article-code-copy-label {
    display: none;
}

.article-content .article-code-block > pre {
    position: relative;
    max-width: 100%;
    margin: 0;
    padding: 12px 18px 17px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 0;
    border-radius: 0;
    background: var(--code-bg);
    color: var(--code-text);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    font-variant-ligatures: none;
    line-height: 1.5;
    tab-size: 4;
    white-space: pre;
    -webkit-overflow-scrolling: touch;
}

.article-content .article-code-block > pre > code {
    display: block;
    min-width: max-content;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    white-space: inherit;
}

/* Keep syntax tokens from existing prettify output legible in the new shell. */
.article-content .article-code-block .pln { color: #d9e2ef; }
.article-content .article-code-block .pun { color: #89ddff; }
.article-content .article-code-block .kwd,
.article-content .article-code-block .tag { color: #c792ea; }
.article-content .article-code-block .typ,
.article-content .article-code-block .atn { color: #82aaff; }
.article-content .article-code-block .lit,
.article-content .article-code-block .num { color: #f78c6c; }
.article-content .article-code-block .str,
.article-content .article-code-block .atv { color: #c3e88d; }
.article-content .article-code-block .com,
.article-content .article-code-block .dec { color: #7f91a8; }

/* Also support token class names when content is produced by a modern highlighter. */
.article-content .article-code-block .token.comment,
.article-content .article-code-block .token.prolog,
.article-content .article-code-block .token.doctype,
.article-content .article-code-block .token.cdata { color: #7f91a8; }
.article-content .article-code-block .token.punctuation { color: #d9e2ef; }
.article-content .article-code-block .token.property,
.article-content .article-code-block .token.tag,
.article-content .article-code-block .token.constant,
.article-content .article-code-block .token.symbol,
.article-content .article-code-block .token.deleted { color: #f07178; }
.article-content .article-code-block .token.boolean,
.article-content .article-code-block .token.number { color: #f78c6c; }
.article-content .article-code-block .token.selector,
.article-content .article-code-block .token.attr-name,
.article-content .article-code-block .token.string,
.article-content .article-code-block .token.char,
.article-content .article-code-block .token.builtin,
.article-content .article-code-block .token.inserted { color: #c3e88d; }
.article-content .article-code-block .token.operator,
.article-content .article-code-block .token.entity,
.article-content .article-code-block .token.url,
.article-content .article-code-block .language-css .token.string,
.article-content .article-code-block .style .token.string { color: #89ddff; }
.article-content .article-code-block .token.atrule,
.article-content .article-code-block .token.keyword { color: #c792ea; }
.article-content .article-code-block .token.attr-value { color: #c3e88d; }
.article-content .article-code-block .token.function,
.article-content .article-code-block .token.class-name { color: #82aaff; }
.article-content .article-code-block .token.regex,
.article-content .article-code-block .token.important,
.article-content .article-code-block .token.variable { color: #f07178; }
.article-content .article-code-block .token.namespace { opacity: 0.8; }

/* Rich article content ----------------------------------------------------- */
/*
 * The editor stores semantic HTML (headings, links, quotes, tables and code)
 * without presentation classes. Keep the reading experience consistent on
 * both the help and news detail pages by styling those elements here.
 */
.article-content {
    --article-accent-soft: rgba(0, 82, 217, 0.08);
    --article-accent-faint: rgba(0, 82, 217, 0.045);
    --article-surface: var(--white, #ffffff);
    --article-border: var(--border-color, #e5e7eb);
    --article-ink: var(--text-main, #1d2129);
    --article-muted: var(--text-regular, #4e5969);
    color: var(--article-ink);
    overflow-wrap: anywhere;
}

.article-content > :first-child {
    margin-top: 0;
}

.article-content > :last-child {
    margin-bottom: 0;
}

.article-content p {
    margin: 0 0 1.35em;
    color: var(--article-muted);
    line-height: 1.9;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    position: relative;
    margin: 2em 0 0.8em;
    color: var(--article-ink);
    font-weight: 750;
    line-height: 1.35;
    letter-spacing: -0.015em;
    scroll-margin-top: 88px;
}

.article-content h1 {
    padding-bottom: 0.55em;
    border-bottom: 1px solid var(--article-border);
    font-size: clamp(1.75rem, 3vw, 2.2rem);
}

.article-content h1::after {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 72px;
    height: 3px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary-color, #0052d9), rgba(0, 82, 217, 0.15));
    content: "";
}

.article-content h2 {
    display: flex;
    align-items: flex-start;
    gap: 0.65em;
    padding: 0.15em 0 0.15em 0.05em;
    border: 0;
    font-size: clamp(1.4rem, 2.2vw, 1.7rem);
}

.article-content h2::before {
    flex: 0 0 auto;
    width: 5px;
    min-height: 1.35em;
    margin-top: 0.05em;
    border-radius: 99px;
    background: linear-gradient(180deg, var(--primary-color, #0052d9), rgba(0, 82, 217, 0.25));
    content: "";
}

.article-content h3 {
    padding-bottom: 0.45em;
    border-bottom: 1px solid var(--article-border);
    font-size: clamp(1.2rem, 2vw, 1.4rem);
}

.article-content h4 {
    color: var(--primary-hover, #003cab);
    font-size: 1.15rem;
}

.article-content h5,
.article-content h6 {
    color: var(--article-muted);
    font-size: 1rem;
}

.article-content a {
    color: var(--primary-color, #0052d9);
    font-weight: 600;
    text-decoration-color: rgba(0, 82, 217, 0.45);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    transition: color 0.2s ease, background-color 0.2s ease, text-decoration-color 0.2s ease;
}

.article-content a:hover,
.article-content a:focus-visible {
    color: var(--primary-hover, #003cab);
    text-decoration-color: currentColor;
}

.article-content a:not(.article-code-copy)::after {
    display: inline;
    margin-left: 0;
    color: currentColor;
    content: "\202F↗";
    font-size: 0.72em;
    font-weight: 700;
    line-height: inherit;
    text-decoration: none;
    vertical-align: baseline;
}

.article-content blockquote {
    position: relative;
    margin: 1.7em 0;
    padding: 1.15em 1.4em 1.15em 3.6em;
    border: 1px solid rgba(0, 82, 217, 0.14);
    border-left: 4px solid var(--primary-color, #0052d9);
    border-radius: 0 12px 12px 0;
    background: linear-gradient(135deg, var(--article-accent-soft), var(--article-surface));
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    color: var(--article-muted);
}

.article-content blockquote::before {
    position: absolute;
    top: 0.36em;
    left: 0.56em;
    color: var(--primary-color, #0052d9);
    content: "“";
    font-family: Georgia, "Times New Roman", serif;
    font-size: 3.2em;
    font-weight: 700;
    line-height: 1;
    opacity: 0.7;
}

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

.article-content ul,
.article-content ol {
    margin: 0 0 1.35em;
    padding-left: 1.8em;
    color: var(--article-muted);
}

.article-content li {
    padding-left: 0.35em;
    line-height: 1.85;
}

.article-content li + li {
    margin-top: 0.35em;
}

.article-content li::marker {
    color: var(--primary-color, #0052d9);
    font-weight: 700;
}

.article-content hr {
    height: 1px;
    margin: 2em 0;
    border: 0;
    background: linear-gradient(90deg, transparent, var(--article-border), transparent);
}

.article-content figure {
    margin: 1.7em 0;
}

.article-content figcaption {
    margin-top: -0.8em;
    color: var(--text-light, #86909c);
    font-size: 0.86em;
    text-align: center;
}

.article-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 1.7em 0;
    border: 1px solid var(--article-border);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    background: var(--article-surface);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
    color: var(--article-muted);
    font-size: 0.95em;
    overflow: hidden;
    overflow-x: auto;
}

.article-content table > thead,
.article-content table > tbody {
    display: table;
    width: 100%;
    min-width: 560px;
    table-layout: fixed;
}

.article-content th,
.article-content td {
    padding: 0.85em 1em;
    border-right: 1px solid var(--article-border);
    border-bottom: 1px solid var(--article-border);
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}

.article-content th:last-child,
.article-content td:last-child {
    border-right: 0;
}

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

.article-content thead th {
    background: linear-gradient(180deg, var(--article-accent-soft), var(--article-accent-faint));
    color: var(--article-ink);
    font-weight: 700;
    white-space: nowrap;
}

.article-content tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.018);
}

.article-content tbody tr:hover {
    background: var(--article-accent-faint);
}

.article-content pre {
    margin: 1.7em 0;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.article-content :not(pre) > code,
.article-content > code {
    padding: 0.18em 0.45em;
    border: 1px solid rgba(0, 82, 217, 0.14);
    border-radius: 5px;
    background: var(--article-accent-soft);
    color: var(--primary-hover, #003cab);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.88em;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.article-content mark {
    padding: 0.05em 0.25em;
    border-radius: 4px;
    background: #fff1b8;
    color: #7a4d00;
}

@media (max-width: 768px) {
    .article-content h1,
    .article-content h2,
    .article-content h3,
    .article-content h4,
    .article-content h5,
    .article-content h6 {
        margin-top: 1.65em;
    }

    .article-content blockquote {
        padding: 1em 1em 1em 3em;
        border-radius: 0 10px 10px 0;
    }

    .article-content table {
        font-size: 0.9em;
    }

    .article-content table > thead,
    .article-content table > tbody {
        min-width: 520px;
    }

    .article-content th,
    .article-content td {
        padding: 0.72em 0.8em;
    }
}

@media (max-width: 768px) {
    .article-content .article-code-block {
        margin: 16px 0 20px;
        border-radius: 8px;
    }

    .article-code-toolbar {
        min-height: 30px;
        padding: 0 6px 0 14px;
    }

    .article-content .article-code-block > pre {
        padding: 10px 14px 13px;
        font-size: 12.5px;
        line-height: 1.5;
    }

    .article-code-copy {
        height: 26px;
        min-height: 26px;
        width: 26px;
        padding: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .article-code-copy {
        transition: none;
    }
}
