/* Use existing local faces only within the article table. */
@font-face {
    font-family: "Buildern Article Table Open Sans";
    src: url("fonts/Open_Sans/OpenSans-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Buildern Article Table Open Sans";
    src: url("fonts/Open_Sans/OpenSans-Bold.ttf") format("truetype");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

/* Use the real body-text faces for editor-authored emphasis. */
@font-face {
    font-family: "Open Sans";
    src: url("fonts/Open_Sans/OpenSans-Italic.ttf") format("truetype");
    font-style: italic;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Open Sans";
    src: url("fonts/Open_Sans/OpenSans-Bold.ttf") format("truetype");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: "Open Sans";
    src: url("fonts/Open_Sans/OpenSans-BoldItalic.ttf") format("truetype");
    font-style: italic;
    font-weight: 700;
    font-display: swap;
}

/* The article, hero and related articles share the design's 1024px width. */
.article-container {
    width: calc(100% - 40px);
    max-width: 1024px;
    margin: 0 auto;
}

.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 34px;
    align-items: stretch;
}

.article-layout__body,
.article-sidebar {
    min-width: 0;
}

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

.article-layout .post-content {
    margin-bottom: 0;
}

.article-layout .post-content p:where(:not(.article-banner p, .article-faq p)) {
    /* Avoid the browser's serif default while Open Sans is loading. */
    font-family: "Open Sans", Arial, sans-serif;
    margin-top: 16px;
    margin-bottom: 16px;
}

.article-layout .post-content > h2,
.article-layout .post-content h2.wp-block-heading {
    font-family: "Hanken Grotesk", sans-serif;
    font-size: 32px;
    font-weight: 700;
    line-height: 42px;
}

.article-layout .post-content > h3,
.article-layout .post-content h3.wp-block-heading {
    font-family: "Hanken Grotesk", sans-serif;
    font-weight: 700;
    margin-top: 60px;
    margin-bottom: 24px;
}

.article-layout .post-content > :is(h2, h3) :is(strong, b),
.article-layout .post-content :is(h2, h3).wp-block-heading :is(strong, b) {
    font-weight: 700;
}

.article-layout .post-content ul:not(.article-banner ul, .article-faq ul) > li + li {
    margin-top: 8px;
}

/* Style the native Table block without changing its editor or article layout. */
.article-layout .post-content .wp-block-table {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    overflow-x: auto;
    border: 2px solid #e3e4ee;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

.article-layout .post-content .wp-block-table > table {
    width: 100%;
    table-layout: auto;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    border-spacing: 0;
    color: #4a4e7a;
    font-family: "Buildern Article Table Open Sans", "Open Sans", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 22px;
}

.article-layout .post-content .wp-block-table.has-text-color > table {
    color: inherit;
}

/* Four-column and wider tables scroll within the block on narrow screens. */
.article-layout .post-content .wp-block-table > table:has(tr > :nth-child(4)) {
    min-width: 726px;
}

.article-layout .post-content .wp-block-table > table > thead,
.article-layout .post-content .wp-block-table > table > tfoot {
    border: 0;
}

.article-layout .post-content .wp-block-table > table > :is(thead, tbody, tfoot) > tr {
    background-color: transparent;
}

.article-layout .post-content .wp-block-table > table > :is(thead, tbody, tfoot) > tr > :is(th, td) {
    padding: 14px;
    border: 0;
    vertical-align: top;
    color: inherit;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 22px;
    word-break: normal;
    overflow-wrap: normal;
    white-space: normal;
    hyphens: none;
}

.article-layout .post-content .wp-block-table > table > thead > tr > :is(th, td) {
    border-bottom: 2px solid #e3e4ee;
    font-family: "Hanken Grotesk", sans-serif;
    font-weight: 600;
    line-height: 20px;
}

.article-layout .post-content .wp-block-table:not(.has-text-color) > table:not(.has-text-color) > :is(tbody, tfoot) > tr > :first-child {
    color: #232968;
}

/* Author-selected block colors and inline cell colors remain available. */
.article-layout .post-content .wp-block-table.has-text-color > table:not(.has-text-color) {
    color: inherit;
}

.article-layout .post-content .wp-block-table:not(.has-background) > table:not(.has-background) > thead {
    background-color: #232968;
}

.article-layout .post-content .wp-block-table:not(.has-background):not(.has-text-color) > table:not(.has-background):not(.has-text-color) > thead {
    color: #fff;
}

.article-layout .post-content .wp-block-table:not(.has-background) > table:not(.has-background) > tbody > tr:nth-child(odd),
.article-layout .post-content .wp-block-table:not(.has-background) > table:not(.has-background) > tfoot > tr {
    background-color: #fff;
}

.article-layout .post-content .wp-block-table:not(.has-background) > table:not(.has-background) > tbody > tr:nth-child(even) {
    background-color: #f7faff;
}

/* Let writers choose bold text rather than forcing weight on every quote. */
.article-layout .post-content blockquote:not(.wp-embedded-content) {
    font-weight: 400;
}

.article-layout .post-content blockquote:not(.wp-embedded-content) :is(strong, b) {
    font-weight: 700;
}

/* Keep quote spacing inside the paragraph-width box on every screen. */
.article-layout .post-content > blockquote:not(.wp-embedded-content),
.article-layout .post-content blockquote.wp-block-quote {
    box-sizing: border-box;
    left: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    padding-left: 30px;
    padding-right: 0;
}

.article-layout .post-content > blockquote:not(.wp-embedded-content)::before,
.article-layout .post-content blockquote.wp-block-quote::before {
    left: 0;
    height: auto;
    bottom: 20px;
}

/* Anchor paragraph quotes to the quoted text, not following review notes. */
.article-layout .post-content > blockquote:not(.wp-embedded-content):has(> p:first-child)::before,
.article-layout .post-content blockquote.wp-block-quote:has(> p:first-child)::before {
    display: none;
}

.article-layout .post-content > blockquote:not(.wp-embedded-content) > p:first-child,
.article-layout .post-content blockquote.wp-block-quote > p:first-child {
    position: relative;
}

.article-layout .post-content > blockquote:not(.wp-embedded-content) > p:first-child::before,
.article-layout .post-content blockquote.wp-block-quote > p:first-child::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -30px;
    width: 8px;
    height: auto;
    display: block;
    content: "";
    background: #2855ff;
}

.article-toc {
    --article-sticky-top: 28px;
    position: sticky;
    top: var(--article-sticky-top);
    display: flex;
    flex-direction: column;
    max-height: min(312px, calc(100dvh - var(--article-sticky-top) - 20px));
    color: #232968;
    font-family: "Hanken Grotesk", sans-serif;
}

.article-toc[hidden],
.post-content [data-replaced-toc] {
    display: none !important;
}

.article-toc__title {
    flex: 0 0 auto;
    margin: 0 0 10px 13px;
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
}

.article-toc__scroll {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d6d8e7 transparent;
}

.article-toc__list {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

.article-toc__list::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 1px;
    width: 1px;
    background: #d6d8e7;
}

.article-toc__item + .article-toc__item {
    margin-top: 14px;
}

.article-toc__link {
    position: relative;
    display: block;
    padding-left: 12px;
    color: #656995;
    font-size: 16px;
    font-weight: 400;
    line-height: 20px;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.article-toc__link:hover {
    color: #656995;
    text-decoration: underline;
}

.article-toc__link:focus-visible {
    outline: 2px solid #2855ff;
    outline-offset: -2px;
}

.article-toc__link[aria-current="location"] {
    color: #232968;
    font-weight: 600;
}

.article-toc__link[aria-current="location"]::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 1px;
    width: 5px;
    background: #232968;
}

.article-layout .post-content h2 {
    scroll-margin-top: var(--article-anchor-offset, 28px);
}

.article-related .blog-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.article-related .blog-grid {
    width: auto;
    min-width: 0;
    margin: 0;
}

@media (max-width: 1023px) {
    .article-layout { gap: 24px; }
}

@media (max-width: 767px) {
    .article-container { width: calc(100% - 32px); }
    .article-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .article-sidebar { grid-row: 1; }
    .article-toc { position: static; }
    .article-layout .post-content > h2,
    .article-layout .post-content h2.wp-block-heading {
        font-size: 24px;
        line-height: 32px;
    }
    .article-layout .post-content > h3,
    .article-layout .post-content h3.wp-block-heading {
        font-size: 20px;
        line-height: 28px;
    }
    .article-layout .post-content > blockquote:not(.wp-embedded-content)::before,
    .article-layout .post-content blockquote.wp-block-quote::before {
        bottom: 0;
    }
    .article-related .blog-list { grid-template-columns: minmax(0, 1fr); }
}
