body.route-learn-show {
    background: #fcfcfd;
    color: #1e293b;
}

body.route-learn-show .site-main {
    padding-top: 0;
    padding-bottom: 0;
    background: #fcfcfd;
}

.learn-article-page {
    --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: Lora, Georgia, serif;
    --color-bg: #fcfcfd;
    --color-surface: #ffffff;
    --color-primary: #0f2537;
    --color-primary-hover: #1a3a54;
    --color-text-main: #1e293b;
    --color-text-muted: #64748b;
    --color-text-soft: #94a3b8;
    --color-border: #e7ebf0;
    --color-border-strong: #cbd5e1;
    --color-accent: #2e68b5;
    --color-accent-light: #ebf2fc;
    --shadow-sm: 0 1px 2px rgba(15, 37, 55, 0.04);
    --shadow-md: 0 4px 16px -4px rgba(15, 37, 55, 0.08);
    --shadow-lg: 0 12px 32px -8px rgba(15, 37, 55, 0.12);
    --radius: 14px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 75vh;
    background: var(--color-bg);
    color: var(--color-text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.learn-article-page *,
.learn-article-page *::before,
.learn-article-page *::after {
    box-sizing: border-box;
}

.learn-article-page a {
    color: inherit;
    text-decoration: none;
}

.learn-article-page a:focus-visible,
.learn-article-page button:focus-visible {
    border-radius: 4px;
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

.learn-article-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    width: 0%;
    height: 2px;
    background: var(--color-accent);
    pointer-events: none;
    transition: width 0.1s linear;
}

.article-shell {
    width: min(100% - 48px, 1340px);
    margin: 0 auto;
    padding: 0 0 72px;
}

.article-header {
    max-width: 740px;
    margin: 0 auto;
    padding: 32px 0 0;
    text-align: center;
}

.article-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--color-accent);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.article-title {
    margin: 0 auto 20px;
    color: var(--color-primary);
    font-family: var(--font-serif);
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 500;
    letter-spacing: -0.018em;
    line-height: 1.13;
}

.article-deck {
    max-width: 620px;
    margin: 0 auto 28px;
    color: var(--color-text-muted);
    font-size: 1.15rem;
    line-height: 1.6;
}

.article-byline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    row-gap: 10px;
    padding: 20px 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.byline-avatar {
    display: flex;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #c3d0de 0%, #96b3d0 100%);
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
}

.byline-text,
.byline-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.byline-name {
    color: var(--color-primary);
    font-size: 0.88rem;
    font-weight: 600;
}

.byline-date {
    color: var(--color-text-soft);
    font-size: 0.78rem;
}

.byline-divider {
    width: 1px;
    height: 28px;
    flex: 0 0 auto;
    background: var(--color-border-strong);
}

.byline-meta {
    display: flex;
    gap: 16px;
}

.byline-stat-label {
    color: var(--color-text-soft);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.byline-stat-value {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.learn-article-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.learn-article-actions form {
    margin: 0;
}

.learn-article-bookmark {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 9px;
    background: var(--color-surface);
    color: var(--color-text-soft);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.learn-article-bookmark svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
}

.learn-article-bookmark:hover,
.learn-article-bookmark:focus-visible {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.learn-article-bookmark.is-bookmarked {
    border-color: color-mix(in srgb, var(--color-accent) 35%, var(--color-border));
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.learn-article-bookmark.is-bookmarked svg {
    fill: currentColor;
}

.learn-article-share {
    margin-left: 0;
}

.learn-article-share .site-share-main {
    width: 38px;
    height: 38px;
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
}

.learn-article-share .site-share-main:hover,
.learn-article-share .site-share-main:focus-visible {
    border-color: var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-primary);
}

.article-figure {
    margin: 0;
}

.article-figure img,
.article-prose img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.article-figure figcaption,
.article-prose figcaption {
    margin-top: 10px;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.article-figure--wide {
    width: 100%;
    margin-top: 36px;
}

.article-main-column > .article-figure--prose {
    width: min(100%, 740px);
    margin-bottom: 36px;
    margin-inline: auto;
}

.article-prose figure {
    margin: 36px 0;
}

.article-body {
    display: grid;
    /* Reversible centred layout: equal outer rails keep the article on the page axis. */
    grid-template-columns: minmax(0, 820px);
    grid-template-areas:
        "sidebar"
        "article";
    gap: 40px;
    align-items: start;
    justify-content: center;
    padding: 48px 0 80px;
}

.article-main-column {
    grid-area: article;
    min-width: 0;
    max-width: 820px;
}

.article-prose {
    width: 100%;
    min-width: 0;
    max-width: 740px;
    margin-inline: auto;
}

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

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

.article-prose h2 {
    margin: 48px 0 16px;
    scroll-margin-top: 2rem;
    color: var(--color-primary);
    font-family: var(--font-serif);
    font-size: 1.65rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.22;
}

.article-prose h2:first-child {
    margin-top: 0;
}

.article-prose h3 {
    margin: 32px 0 10px;
    color: var(--color-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.005em;
}

.article-prose p,
.article-prose li {
    color: var(--color-text-main);
    font-size: 1rem;
    line-height: 1.78;
}

.article-prose p,
.article-prose ul,
.article-prose ol,
.article-prose pre,
.article-prose blockquote,
.article-prose figure,
.article-prose .learn-article-table-wrap,
.article-prose .learn-python-code-panel,
.article-prose .learn-pair-grid-panel {
    margin: 0 0 20px;
}

.article-prose strong {
    color: var(--color-primary);
    font-weight: 600;
}

.article-prose a {
    color: var(--color-accent);
    text-decoration: underline;
    text-decoration-color: rgba(46, 104, 181, 0.35);
    text-underline-offset: 2px;
}

.article-prose a:hover {
    text-decoration-color: currentColor;
}

.article-prose ul,
.article-prose ol {
    display: flex;
    flex-direction: column;
    gap: 0.65em;
    padding-left: 1.35em;
}

.article-prose li::marker {
    color: var(--color-text-soft);
}

.article-prose blockquote,
.pull-quote {
    margin: 40px 0;
    padding: 32px 36px;
    border-left: 2.5px solid var(--color-accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--color-accent-light);
}

.article-prose blockquote p,
.pull-quote blockquote {
    margin: 0;
    color: var(--color-primary);
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-style: italic;
    letter-spacing: -0.008em;
    line-height: 1.5;
}

.pull-quote cite {
    display: block;
    margin-top: 14px;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-style: normal;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.learn-article-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.learn-article-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.learn-article-table th,
.learn-article-table td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-main);
    text-align: left;
    vertical-align: top;
}

.learn-article-table th {
    background: #f7f9fb;
    color: var(--color-primary);
    font-weight: 600;
}

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

.article-prose pre {
    padding: 20px;
    overflow-x: auto;
    border-radius: 10px;
    background: #111827;
    color: #e6edf7;
    font-size: 0.86rem;
    line-height: 1.65;
}

.article-prose code:not(pre code) {
    padding: 0.12em 0.35em;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: #f8fafc;
    font-size: 0.88em;
}

.learn-python-code-panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.learn-python-code-summary {
    display: flex;
    justify-content: space-between;
    padding: 13px 16px;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.learn-python-code-panel pre {
    margin: 0;
    border-radius: 0 0 var(--radius) var(--radius);
}

.learn-pair-grid-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.learn-pair-grid-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.research-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: start;
    margin: 32px 0;
    padding: 24px 28px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.research-card-icon {
    display: flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.research-card-label {
    margin-bottom: 6px;
    color: var(--color-accent);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.research-card-title {
    margin-bottom: 6px;
    color: var(--color-primary);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.research-card-body {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    line-height: 1.6;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 36px 0;
}

.stat-tile {
    padding: 20px 22px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.stat-tile-value {
    margin-bottom: 6px;
    color: var(--color-primary);
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-tile-label {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.prose-divider {
    margin: 40px 0;
    border: 0;
    border-top: 1px solid var(--color-border);
}

.trait-spectrum {
    margin: 32px 0;
}

.spectrum-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.spectrum-item-label {
    margin-bottom: 8px;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 600;
}

.spectrum-track {
    position: relative;
    height: 6px;
    overflow: visible;
    border-radius: 99px;
    background: var(--color-border);
}

.spectrum-fill {
    position: relative;
    width: 0;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--color-accent-light), var(--color-accent));
    transition: width 1.2s var(--ease);
}

.spectrum-fill.animated {
    width: var(--target-width, 0%);
}

.spectrum-tick {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border: 2px solid var(--color-accent);
    border-radius: 50%;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    transform: translate(-50%, -50%);
}

.spectrum-name-row,
.spectrum-label-row {
    display: flex;
    justify-content: space-between;
}

.spectrum-name-row {
    margin-top: 6px;
}

.spectrum-label-row {
    margin-bottom: 8px;
}

.spectrum-name {
    color: var(--color-text-soft);
    font-size: 0.72rem;
}

.spectrum-label {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 28px 0;
}

.tag {
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.article-sidebar {
    grid-area: sidebar;
    position: static;
}

@media (min-width: 1200px) {
    .article-body {
        grid-template-columns: 190px minmax(0, 720px) 190px;
        grid-template-areas: "sidebar article .";
        gap: 20px;
    }

    .article-sidebar {
        display: flex;
        flex-direction: column;
        align-self: stretch;
    }

    .article-sidebar .sidebar-related {
        order: 1;
    }

    .article-sidebar .toc-card {
        position: sticky;
        top: 32px;
        order: 2;
    }
}

@media (min-width: 1356px) {
    .article-body {
        grid-template-columns: 220px minmax(0, 820px) 220px;
        gap: 24px;
    }
}

.article-assessment-card,
.toc-card,
.sidebar-related {
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.article-assessment-card {
    display: flex;
    width: min(100%, 560px);
    flex-direction: column;
    gap: 12px;
    margin: 48px auto 0;
    padding: 26px 28px;
    background: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.sidebar-cta-title {
    margin: 0;
    color: #ffffff;
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.35;
}

.sidebar-cta-label {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sidebar-cta-desc {
    margin: 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.8rem;
    line-height: 1.5;
}

.article-assessment-card .sidebar-cta-btn {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.article-assessment-card .sidebar-cta-btn:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.article-assessment-card .sidebar-cta-btn svg {
    color: inherit;
    stroke: currentColor;
}

.toc-card,
.sidebar-related {
    margin-bottom: 16px;
    padding: 22px 24px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.toc-label,
.sidebar-related-label,
.related-bottom-label {
    color: var(--color-text-soft);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.toc-label,
.sidebar-related-label {
    margin-bottom: 14px;
}

.toc-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.toc-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 7px;
    color: var(--color-text-muted);
    font-size: 0.83rem;
    font-weight: 500;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.toc-item a::before {
    display: block;
    width: 3px;
    height: 3px;
    flex-shrink: 0;
    border-radius: 50%;
    background: currentColor;
    content: "";
    opacity: 0.45;
}

.toc-item a:hover,
.toc-item a.is-active {
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.toc-item a.is-active::before {
    opacity: 1;
}

.related-list {
    display: flex;
    flex-direction: column;
}

.related-item {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.related-item:first-child {
    padding-top: 0;
}

.related-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.related-eyebrow {
    margin-bottom: 4px;
    color: var(--color-accent);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.related-title {
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    transition: color 0.15s var(--ease);
}

.related-item:hover .related-title {
    color: var(--color-accent);
}

.article-related-bottom {
    padding: 48px 0 0;
    border-top: 1px solid var(--color-border);
}

.related-bottom-label {
    margin-bottom: 24px;
}

.related-bottom-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.related-bottom-card {
    display: flex;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
}

.related-bottom-card:hover {
    border-color: var(--color-border-strong);
    background: #fafbfd;
    box-shadow: var(--shadow-lg);
}

.related-bottom-visual {
    height: 100px;
    background: linear-gradient(135deg, #dce3ec 0%, #a8c0d6 100%);
}

.related-bottom-visual.v2 {
    background: linear-gradient(135deg, #ebf2fc 0%, #bfd2e9 100%);
}

.related-bottom-visual.v3 {
    background: linear-gradient(135deg, #f7f9fb 0%, #c3d0de 100%);
}

.related-bottom-content {
    display: flex;
    min-height: 150px;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    padding: 20px;
}

.related-bottom-eyebrow {
    margin-bottom: 7px;
    color: var(--color-accent);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.related-bottom-title {
    margin: 0;
    color: var(--color-primary);
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}

.related-bottom-content p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.article-back-link {
    margin-top: 35px;
    text-align: center;
}

.article-back-link a {
    color: var(--color-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.article-back-link a:hover {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 1199px) {
    .article-body {
        grid-template-columns: 1fr;
        grid-template-areas:
            "sidebar"
            "article";
        gap: 40px;
        justify-content: stretch;
    }

    .article-sidebar {
        position: static;
        order: -1;
    }

    .related-bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .article-shell {
        width: min(100% - 30px, 1180px);
        padding-bottom: 56px;
    }

    .article-header {
        padding-top: 26px;
    }

    .article-deck {
        font-size: 1rem;
    }

    .article-byline {
        align-items: flex-start;
    }

    .byline-divider {
        display: none;
    }

    .byline-meta {
        width: 100%;
    }

    .learn-article-share {
        margin-left: 0;
    }

    .article-figure--wide {
        margin-top: 28px;
    }

    .article-assessment-card {
        margin-top: 40px;
        padding: 22px 24px;
    }

    .article-body {
        padding: 36px 0 58px;
    }

    .article-prose h2 {
        margin-top: 38px;
        font-size: 1.45rem;
    }

    .article-prose blockquote,
    .pull-quote {
        padding: 24px;
    }

    .article-prose blockquote p,
    .pull-quote blockquote {
        font-size: 1.15rem;
    }

    .research-card {
        grid-template-columns: 1fr;
        padding: 22px;
    }

    .stat-row {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .learn-article-page *,
    .learn-article-progress {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
