/*
Theme Name: Jonathan Moo — Fieldnotes
Theme URI: https://jonathanmoo.com/
Author: Jonathan Moo
Description: An editorial Bootstrap 6 block theme for writing about data, practical AI, leadership, and a career that lasts. Includes native Site Editor templates and patterns.
Version: 2.10.18
Requires at least: 7.1.4
Requires PHP: 8.3.36
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: jonathan-moo
Tags: blog, portfolio, block-patterns, full-site-editing, custom-colors, editor-style, wide-blocks
*/
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

body {
    margin: 0;
}

a {
    text-underline-offset: .2em;
}

a:hover {
    color: var(--jm-teal);
}

a:focus-visible,button:focus-visible,input:focus-visible {
    outline: 3px solid var(--jm-focus);
    outline-offset: 5px;
}

.wp-site-blocks {
    overflow-wrap: anywhere;
}

.jm-shell {
    padding-inline: clamp(22px,4vw,56px);
    width: 100%;
    max-width: none;
    margin-inline: auto;
}

.jm-header {
    max-width: none!important;
    margin-inline: auto!important;
    padding-block: 28px;
    border-bottom: 1px solid var(--jm-line);
}

.jm-header .wp-block-site-title {
    font-family: Georgia,serif;
    font-size: 26px!important;
    letter-spacing: -1px;
}

.jm-header .wp-block-site-title a {
    text-decoration: none;
}

.jm-nav {
    font-size: 14px;
}

.jm-eyebrow {
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: 12px;
    font-weight: 700;
    color: var(--jm-teal);
}

.jm-hero {
    padding-block: clamp(56px,8vw,110px);
    max-width: none!important;
}

.jm-hero h1 {
    font-size: clamp(46px,6.5vw,84px);
    line-height: 1.04;
    letter-spacing: -.055em;
    font-weight: 400;
    max-width: 820px!important;
}

.jm-deck {
    font-size: clamp(18px,2vw,22px);
    line-height: 1.65;
    color: var(--jm-muted);
    max-width: 640px!important;
}

.jm-hero .wp-block-buttons {
    margin-top: 30px;
}

.jm-rule {
    height: 1px;
    background: var(--jm-line);
    border: 0;
}

.jm-section {
    padding-block: 64px;
    max-width: none!important;
    border-top: 1px solid var(--jm-line);
}

.jm-section h1,
.jm-section h2 {
    font-size: clamp(32px,4vw,46px);
    letter-spacing: -.04em;
    font-weight: 400;
}

.jm-section .jm-kicker {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--jm-muted);
}

.jm-topics {
    margin-top: 38px!important;
}

.jm-topic {
    padding-top: 22px;
}

.jm-topic h3 {
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -.025em;
}

.jm-topic p {
    color: var(--jm-muted);
    font-size: 16px;
    line-height: 1.7;
}

.jm-posts .wp-block-post-template {
    gap: 34px!important;
}

.jm-posts .wp-block-post {
    border-top: 1px solid var(--jm-line);
    padding-top: 24px;
}

.jm-posts .wp-block-post-title {
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -.025em;
    font-weight: 400;
}

.jm-posts .wp-block-post-title a {
    text-decoration: none;
}

.jm-posts .wp-block-post-date,.jm-posts .wp-block-post-terms {
    font-size: 14px;
    color: var(--jm-muted);
}

.jm-posts .wp-block-post-excerpt {
    font-size: 16px;
    color: var(--jm-muted);
    line-height: 1.7;
}

.jm-projects {
    background: var(--jm-surface);
    padding: clamp(24px,4vw,48px);
    border-radius: 3px;
}

.jm-projects h3 {
    font-size: 25px;
    font-weight: 400;
}

.jm-projects a {
    font-weight: 600;
}

.jm-about {
    max-width: 720px!important;
    margin-inline: 0!important;
    font-size: 20px;
    line-height: 1.75;
}

.jm-footer {
    max-width: none!important;
    padding-block: 32px;
    border-top: 1px solid var(--jm-line);
    font-size: 13px;
    color: var(--jm-muted);
}

.jm-footer a {
    color: inherit;
}

.jm-article {
    padding-block: 64px;
}

.jm-article .wp-block-post-title {
    font-size: clamp(38px,5vw,64px);
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: -.045em;
}

.wp-block-post-content {
    line-height: 1.85;
}

.wp-block-post-content h2,.wp-block-post-content h3 {
    line-height: 1.25;
    margin-top: 1.8em;
}

.wp-block-post-content pre {
    overflow: auto;
    padding: 24px;
    background: var(--jm-surface);
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.6;
}

.wp-block-post-content :not(pre)>code {
    background: var(--jm-surface);
    padding: .12em .3em;
}

.wp-block-post-content blockquote {
    border-left: 3px solid var(--jm-teal);
    padding-left: 24px;
    margin-inline: 0;
    font-family: Georgia,serif;
    font-size: 1.2em;
}

.wp-block-post-content img {
    height: auto;
    max-width: 100%;
}

.wp-block-post-content table {
    border-collapse: collapse;
    font-size: 16px;
}

.wp-block-post-content td,.wp-block-post-content th {
    border: 1px solid var(--jm-line);
    padding: 12px;
}

.wp-block-button__link {
    font-size: 14px;
    font-weight: 600;
    padding: 14px 23px;
    border-radius: 3px;
}

.is-style-outline .wp-block-button__link {
    border-width: 1px;
}

.jm-empty {
    padding: 24px;
    background: var(--jm-surface);
}

.jm-search {
    margin-block: 32px;
}

.wp-block-query-pagination {
    margin-top: 36px;
}

@media(max-width:700px) {
    .jm-section {
        padding-block: 42px;
    }

    .jm-header {
        padding-block: 20px;
    }

    .jm-posts .wp-block-post-template {
        grid-template-columns: 1fr!important;
    }



    .jm-footer .wp-block-group {
        gap: 16px;
    }

    .wp-block-post-content table {
        display: block;
        overflow: auto;
    }

}

@media(prefers-reduced-motion:reduce) {
    html {
        scroll-behavior: auto;
    }

}

/* 10. Bootstrap grid inside native WordPress Group blocks. */
.jm-topics.row {
    max-width: none;
}

.jm-topics.row > .jm-topic {
    margin-block-start: var(--bs-gutter-y);
    margin-inline: 0;
}

.jm-topic > .jm-eyebrow {
    border-top: 2px solid var(--jm-teal);
    padding-top: 22px;
}

.jm-project-card {
    --bs-card-bg: var(--wp--preset--color--paper, #f7f5ef);
    --bs-card-border-color: var(--jm-line);
    --bs-card-border-radius: 6px;
    height: 100%;
}

.jm-project-card .card-body {
    padding: 24px;
}

/* 11. Native WordPress buttons use the same component tokens in the editor. */
.jm-button-primary .wp-block-button__link {
    background: var(--bs-primary-bg);
    color: var(--bs-primary-contrast);
    border: 1px solid var(--bs-primary-bg);
}

.jm-button-outline .wp-block-button__link {
    background: transparent;
    color: var(--bs-primary-fg);
    border: 1px solid var(--bs-primary-border);
}

.jm-button-primary .wp-block-button__link:hover {
    background: color-mix(in srgb, var(--bs-primary-bg) 85%, black);
}

.jm-button-outline .wp-block-button__link:hover {
    background: var(--bs-primary-bg-subtle);
}

/* 12. Homepage sections use the available width, including on saved templates.
 * WordPress can retain old constrained layouts in the database after an update.
 * Limit these overrides to the theme's sections; article prose stays readable.
 */
.jm-shell main > .jm-hero,
.jm-shell main > .jm-section {
    width: 100%;
    max-width: none;
}

.jm-hero > :where(:not(.alignleft):not(.alignright)),
.jm-section > :where(:not(.alignleft):not(.alignright)) {
    margin-inline: 0;
}

.jm-section > .wp-block-query,
.jm-section > .jm-project-track,
.jm-section > .jm-topics {
    max-width: none;
}

/* Hide the old ornament even when a saved template still contains its block. */
.jm-orbit {
    display: none;
}

/* 13. Native editable project cards with horizontal scroll and snap points. */
.jm-project-help {
    color: var(--jm-muted);
    font-size: 14px;
}

.jm-project-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 24px;
    width: 100%;
    max-width: none;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 4px;
    scrollbar-color: var(--jm-teal) transparent;
    padding: 8px 4px 20px;
}

.jm-project-track > .jm-project-slide {
    flex: 0 0 calc((100% - 48px) / 3);
    min-width: 0;
    margin: 0;
    scroll-snap-align: start;
}

.jm-project-card .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 20px;
}

.jm-project-card .card-body > * {
    margin: 0;
}

.jm-project-card .card-body > :last-child {
    margin-top: auto;
}

.jm-project-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-block: 16px;
}

.jm-project-controls button {
    border: 1px solid var(--jm-teal);
    border-radius: 4px;
    background: var(--jm-paper);
    color: var(--jm-teal);
    padding: 8px 16px;
    font: inherit;
    cursor: pointer;
}

.jm-project-controls[hidden] {
    display: none;
}

.jm-project-controls button:disabled {
    opacity: .4;
    cursor: default;
}

.jm-project-track:focus-visible {
    outline: 3px solid var(--jm-focus);
    outline-offset: 4px;
}

/* Keep every card visible and editable in the Site Editor's List View. */
.editor-styles-wrapper .jm-project-track {
    display: block;
    overflow: visible;
}

.editor-styles-wrapper .jm-project-slide {
    margin-block: 16px;
}

@media (max-width: 1000px) {
    .jm-project-track > .jm-project-slide {
        flex-basis: 46%;
    }
}

@media (max-width: 600px) {
    .jm-project-track > .jm-project-slide {
        flex-basis: 86%;
    }
}

/* 14. Posts and pages share the homepage's fluid shell and outer gutters.
 * These selectors also cover older constrained templates saved in WordPress.
 */
.jm-shell main > .jm-article,
.jm-article > :where(:not(.alignleft):not(.alignright)),
.jm-article .wp-block-post-content,
.jm-article .wp-block-post-content > :where(:not(.alignleft):not(.alignright)) {
    max-width: none;
    margin-inline: 0;
}

.jm-shell main > .jm-article,
.jm-article .wp-block-post-content {
    width: 100%;
    min-width: 0;
}

.wp-block-post-content {
    font-family: var(--wp--preset--font-family--sans);
    font-size: clamp(18px, 1.2vw, 20px);
    line-height: 1.75;
    color: var(--jm-ink);
}

.jm-article .wp-block-post-title {
    letter-spacing: -.025em;
}

.wp-block-post-content :where(h2, h3, h4, h5, h6) {
    line-height: 1.3;
    letter-spacing: -.015em;
    text-wrap: balance;
}

.wp-block-post-content :where(p, li) {
    text-wrap: pretty;
}

.wp-block-post-content :where(code, pre, kbd, samp) {
    font-family: var(--wp--preset--font-family--mono, ui-monospace, Consolas, monospace);
    font-variant-ligatures: none;
    tab-size: 4;
}

.wp-block-post-content pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
    padding: clamp(16px, 2vw, 28px);
    color: var(--jm-code-fg);
    background: var(--jm-code-bg);
    border: 1px solid var(--jm-line-strong);
    border-left: 3px solid var(--jm-teal);
    line-height: 1.65;
}

.wp-block-post-content pre code {
    color: inherit;
    background: transparent;
    font-size: inherit;
    padding: 0;
}

.wp-block-post-content :not(pre) > code {
    color: var(--jm-code-fg);
    background: var(--jm-code-bg);
    border-radius: 3px;
    font-size: .9em;
}

.wp-block-post-content :where(figure, .wp-block-table) {
    max-width: 100%;
    margin-block: 2rem;
}

.wp-block-post-content .wp-block-table {
    overflow-x: auto;
}

.wp-block-post-content :where(figcaption, .wp-element-caption) {
    color: var(--jm-muted);
    font-family: var(--wp--preset--font-family--sans);
    font-size: 15px;
    line-height: 1.6;
    text-align: left;
    margin-top: 12px;
}

.wp-block-post-content :where(svg, iframe, video) {
    max-width: 100%;
}

/* An explicit opt-in for authors who want shorter prose lines in one block. */
.jm-article .wp-block-post-content > .jm-reading {
    max-width: 78ch;
}

/* 15. Small editorial accents, never overlaid on text or diagram content. */
.jm-header {
    border-bottom: 2px solid var(--jm-teal);
}

.jm-hero > .jm-eyebrow::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 3px;
    margin-right: 12px;
    vertical-align: middle;
    background: var(--jm-teal);
}

.jm-project-card {
    border-top: 3px solid var(--jm-teal);
    box-shadow: 0 3px 12px rgb(34 41 36 / 4%);
}

.wp-block-image.is-style-diagram-frame {
    background: #fff;
    border: 1px solid var(--jm-line-strong);
    border-radius: 6px;
    padding: clamp(16px, 2vw, 28px);
    overflow-x: auto;
}

/* Pan detailed figures on phones instead of shrinking labels to tiny text. */
.wp-block-image.is-style-diagram-frame :where(img, svg) {
    display: block;
    width: 100%;
    min-width: var(--jm-diagram-min-width, 640px);
    max-width: none;
    height: auto;
}

/* Bootstrap's variable-width carousel retains our editable card dimensions. */
.jm-projects.carousel {
    --bs-carousel-items-gap: 24px;
    --bs-carousel-item-width: auto;
}

.jm-project-track.carousel-inner {
    padding: 8px 4px 20px;
    scrollbar-width: auto;
}

.jm-project-track > .jm-project-slide.carousel-item {
    display: block;
    height: auto;
}


/* 16. Compact connection icons and a keyboard-accessible color-mode control. */
.jm-site-controls,
.jm-social-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.jm-site-controls {
    margin-block: 8px;
}

.jm-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 1px solid var(--jm-line);
    border-radius: 50%;
    color: var(--jm-teal);
    background: var(--jm-paper);
    text-decoration: none;
    cursor: pointer;
}

.jm-icon-link:hover {
    background: var(--jm-surface);
    border-color: var(--jm-teal);
}

.jm-icon {
    flex-shrink: 0;
}

.jm-mode-toggle[hidden] {
    display: none;
}

.jm-mode-toggle .jm-icon-sun,
:root[data-bs-theme="dark"] .jm-mode-toggle .jm-icon-moon {
    display: none;
}

:root[data-bs-theme="dark"] .jm-mode-toggle .jm-icon-sun {
    display: block;
}

.jm-article-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
    padding-block: 24px;
    border-top: 1px solid var(--jm-line);
    font-family: var(--wp--preset--font-family--sans);
    font-size: 16px;
}

.jm-article-share > span {
    margin-right: 8px;
    color: var(--jm-muted);
}

/* Preserve source-image colors on their white diagram surface in both modes. */
.wp-block-image.is-style-diagram-frame figcaption {
    color: #526059;
}

/* 17. About page: a compact headshot supports the introduction. */
.jm-about-intro {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    margin-block: 32px 56px;
}

.jm-about-intro > .jm-about-portrait {
    width: 120px;
    height: 120px;
    margin: 6px 0 0;
    border: 1px solid var(--jm-line);
    border-radius: 50%;
    overflow: hidden;
    background: var(--jm-surface);
}

.jm-about-intro .jm-about-portrait img {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: center;
}

.jm-about-intro-copy h2 {
    font-size: clamp(28px, 3vw, 40px);
    line-height: 1.2;
    letter-spacing: -.025em;
    margin: 0 0 20px;
}

.jm-about-intro-copy p {
    font-size: clamp(18px, 1.3vw, 21px);
    line-height: 1.75;
    max-width: 78ch;
    margin: 0;
}

.jm-about-connect {
    border-top: 1px solid var(--jm-line);
    padding-top: 24px;
}

.jm-about-connect h2 {
    font-size: clamp(25px, 2.5vw, 32px);
    margin: 0 0 16px;
}

.jm-about-connect p {
    margin: 0 0 16px;
    color: var(--jm-muted);
    line-height: 1.75;
}

.jm-about-additional-content:not(:empty) {
    margin-top: 40px;
}

@media (max-width: 600px) {
    .jm-about-intro {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 36px;
    }

    .jm-about-intro > .jm-about-portrait {
        width: 96px;
        height: 96px;
        margin-top: 0;
    }

}

.jm-about-intro > .jm-about-intro-copy {
    margin: 0;
}

/* Stack editable Groups in the editor; the front end uses the compact grid. */
.editor-styles-wrapper .jm-about-intro {
    display: block;
}

/* Keep page-owned containers open to arbitrary WordPress blocks and layouts. */
.jm-about-page-content,
.jm-about-additional-content {
    min-width: 0;
    width: 100%;
}

.jm-about-additional-content:has(> p:only-child:empty) {
    margin: 0;
}

.jm-about-page-content > .jm-about-connect {
    margin-top: 40px;
}

/* 18. Discoverability: native search and navigation, with no JavaScript required. */
.jm-discovery-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    vertical-align: middle;
}

.jm-header > .jm-site-search {
    order: 10;
    flex: 0 0 100%;
    width: 100%;
    max-width: none;
    margin: 0;
}

.jm-site-search .wp-block-search__inside-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 650px;
    padding: 7px 8px 7px 16px;
    border: 1px solid var(--jm-line-strong);
    border-radius: 6px;
    background: var(--jm-paper);
    color: var(--jm-ink);
    box-sizing: border-box;
}

.jm-site-search .jm-discovery-icon {
    color: var(--jm-muted);
}

.jm-site-search .wp-block-search__input {
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 7px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--jm-ink);
    font: inherit;
    font-size: 16px;
}

.jm-site-search .wp-block-search__input::placeholder {
    color: var(--jm-muted);
    opacity: 1;
}

.jm-site-search .wp-block-search__button {
    flex: 0 0 auto;
    min-height: 44px;
    margin: 0;
    padding: 9px 16px;
    border: 1px solid var(--jm-teal);
    border-radius: 4px;
    background: var(--jm-teal);
    color: var(--jm-paper);
    font: inherit;
    font-size: 14px;
}

.jm-site-search .wp-block-search__button:hover {
    filter: brightness(.92);
}

.wp-block-query-pagination.jm-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 24px;
    border-top: 1px solid var(--jm-line);
}

.jm-pagination .jm-pagination-status {
    margin: 0 auto 0 0;
    color: var(--jm-muted);
    font-size: 13px;
}

.jm-pagination .wp-block-query-pagination-numbers {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 0;
}

.jm-pagination .jm-pagination-arrow,
.jm-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--jm-line-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--jm-teal);
    font-size: 15px;
    line-height: 1;
    text-decoration: none;
    box-sizing: border-box;
}

.jm-pagination .page-numbers.current {
    border-color: var(--jm-teal);
    background: var(--jm-teal);
    color: var(--jm-paper);
}

.jm-pagination a:hover {
    border-color: var(--jm-teal);
    background: var(--jm-surface);
}

.jm-pagination .page-numbers.dots {
    min-width: 22px;
    padding-inline: 0;
    border: 0;
    color: var(--jm-muted);
}

.jm-article-navigation {
    margin-block: 42px 0;
}

.jm-article-navigation .jm-navigation-heading {
    margin: 0 0 16px;
    font-family: var(--wp--preset--font-family--sans);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--jm-muted);
}

.jm-article-navigation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.jm-article-navigation-grid:has(> .wp-block-post-navigation-link:only-child) {
    grid-template-columns: minmax(0, 1fr);
}

.jm-article-navigation-grid.jm-section {
    padding: 0;
    margin-block: 42px 0;
}

.jm-article .wp-block-post-navigation-link {
    display: flex;
    min-width: 0;
    margin: 0;
}

.jm-article .wp-block-post-navigation-link a {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: clamp(19px, 2vw, 25px);
    border: 1px solid var(--jm-line-strong);
    border-radius: 6px;
    background: var(--jm-paper);
    color: var(--jm-teal);
    text-align: start;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.jm-article .wp-block-post-navigation-link a:hover {
    border-color: var(--jm-teal);
    background: var(--jm-surface);
}

.jm-article .post-navigation-link__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--wp--preset--font-family--sans);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--jm-muted);
}

.jm-article .post-navigation-link__title {
    font-family: var(--wp--preset--font-family--serif, Georgia, serif);
    font-size: clamp(22px, 2vw, 28px);
    line-height: 1.3;
}

@media (max-width: 480px) {
    /* Keep first/current/last page links alongside the two arrow targets. */
    .jm-pagination .wp-block-query-pagination-numbers .page-numbers:not(.current):not(:first-child):not(:last-child),
    .jm-pagination .wp-block-query-pagination-numbers .page-numbers.dots {
        display: none;
    }

    .wp-block-query-pagination.jm-pagination,
    .jm-pagination .wp-block-query-pagination-numbers {
        gap: 6px;
    }
}

@media (max-width: 700px) {
    .jm-pagination .jm-pagination-status {
        flex-basis: 100%;
        margin: 0 0 6px;
        text-align: center;
    }

    .wp-block-query-pagination.jm-pagination {
        justify-content: center;
    }

    .jm-article-navigation-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .jm-site-search .wp-block-search__inside-wrapper {
        gap: 8px;
        padding-left: 10px;
    }

    .jm-site-search .wp-block-search__button {
        padding-inline: 12px;
    }
}

/* 19. Editorial balance: compact header, useful first screen, and author teaser. */
.jm-header.jm-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding-block: 20px;
}

.jm-header .wp-block-site-title {
    order: 0;
    flex: 1 1 145px;
    min-width: 0;
    margin: 0;
}

.jm-header > .jm-nav {
    order: 1;
    flex: 0 1 auto;
    margin: 0;
}

.jm-header > .jm-site-search {
    order: 2;
    flex: 0 1 220px;
    width: 220px;
    min-width: 170px;
    max-width: 240px;
    margin: 0;
}

.jm-header .jm-site-search .wp-block-search__inside-wrapper {
    max-width: none;
    gap: 4px;
    padding: 0 0 0 11px;
}

.jm-header .jm-site-search .wp-block-search__button {
    min-width: 44px;
    padding: 9px;
    border: 0;
    background: transparent;
    color: var(--jm-teal);
}

.jm-header .jm-site-search .wp-block-search__button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.jm-header > .jm-site-controls {
    order: 3;
    flex: 0 0 auto;
    margin: 0;
}

.jm-header-search-toggle {
    order: 2;
    flex: 0 0 44px;
}

.jm-header-search-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.jm-editorial-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: clamp(28px, 4vw, 60px);
    padding-block: clamp(30px, 3vw, 46px);
}

.jm-editorial-hero > * {
    min-width: 0;
    margin: 0;
}

.jm-editorial-hero > .jm-hero-copy,
.jm-editorial-hero > .jm-featured-writing,
.jm-home-author > .jm-home-author-copy,
.jm-home-author > .jm-home-author-action {
    margin: 0;
}

.jm-editorial-hero h1 {
    max-width: 21ch!important;
    margin: 12px 0 18px;
    font-size: clamp(32px, 3.2vw, 48px);
    line-height: 1.15;
    letter-spacing: -.035em;
}

.jm-editorial-hero .jm-deck {
    max-width: 53ch!important;
    font-size: clamp(16px, 1.2vw, 19px);
    line-height: 1.7;
}

.jm-editorial-hero .wp-block-buttons {
    margin-top: 20px;
}

.jm-featured-writing {
    padding-left: clamp(24px, 3vw, 40px);
    border-left: 1px solid var(--jm-line);
}

.jm-featured-writing .wp-block-post-template {
    margin: 0;
    padding: 0;
    list-style: none;
}

.jm-featured-writing .wp-block-post-title {
    margin: 12px 0 14px;
    font-family: var(--wp--preset--font-family--serif, Georgia, serif);
    font-size: clamp(25px, 2.2vw, 34px);
    line-height: 1.25;
    letter-spacing: -.025em;
}

.jm-featured-writing .wp-block-post-title a {
    text-decoration: none;
}

.jm-featured-writing .wp-block-post-excerpt {
    font-size: 15px;
    line-height: 1.75;
    color: var(--jm-muted);
}

.jm-featured-writing .wp-block-post-excerpt__more-link {
    display: inline-block;
    padding-block: 7px;
    color: var(--jm-teal);
    font-size: 14px;
}

.jm-home-author {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(24px, 4vw, 50px);
    margin-block: 26px;
    padding: clamp(22px, 2.5vw, 32px);
    border-block: 1px solid var(--jm-line);
    background: var(--jm-surface);
    width: 100%;
    max-width: none!important;
}

.jm-home-author > * {
    min-width: 0;
    margin: 0;
}

.jm-home-author h2 {
    margin: 10px 0 12px;
    font-size: clamp(25px, 2.5vw, 32px);
    line-height: 1.25;
    letter-spacing: -.025em;
}

.jm-home-author p:not(.jm-eyebrow) {
    max-width: 62ch;
    margin-bottom: 0;
    font-size: 15px;
    line-height: 1.75;
    color: var(--jm-muted);
}

.jm-home-author .jm-about {
    max-width: none;
    margin: 0;
}

.jm-home-author-action {
    justify-self: end;
}

.jm-home-author-action p {
    margin-top: 10px;
    font-size: 12px!important;
}

.jm-home-about-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 12px 18px;
    border: 1px solid var(--jm-line-strong);
    border-radius: 3px;
    text-decoration: none;
}

.jm-shell:has(.jm-editorial-hero) .jm-section {
    padding-block: 30px;
}

.jm-shell:has(.jm-editorial-hero) .jm-section > h2 {
    font-size: clamp(26px, 2.4vw, 34px);
}

.jm-shell:has(.jm-editorial-hero) .jm-topics {
    margin-top: 22px!important;
}

.jm-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 20px;
}

.jm-footer > p {
    grid-column: 1;
    margin: 0;
}

.jm-footer > .jm-site-controls {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
}

@media (min-width: 701px) and (max-width: 1100px) {
    .jm-header.jm-header {
        gap: 12px;
    }

    .jm-header .wp-block-site-title {
        font-size: 23px!important;
    }

    .jm-header > .jm-site-search {
        flex-basis: 180px;
        width: 180px;
    }

    .jm-header .wp-block-navigation__container {
        column-gap: 16px;
    }
}

@media (max-width: 700px) {
    .jm-header.jm-header {
        gap: 8px;
    }

    .jm-header .wp-block-site-title {
        flex: 1 1 0;
        font-size: clamp(18px, 5vw, 22px)!important;
        white-space: nowrap;
    }

    .jm-header > .jm-nav {
        flex: 0 0 auto;
    }

    .jm-header > .jm-site-search {
        order: 4;
        flex: 0 0 100%;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .jm-editorial-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 26px;
    }

    .jm-featured-writing {
        padding: 24px 0 0;
        border-left: 0;
        border-top: 1px solid var(--jm-line);
    }

    .jm-home-author {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .jm-home-author-action {
        justify-self: start;
    }

    .jm-footer {
        grid-template-columns: minmax(0, 1fr);
    }

    .jm-footer > .jm-site-controls {
        grid-column: 1;
        grid-row: auto;
    }
}

/* The phone disclosure shares the same native links as desktop navigation. */
.jm-header > .jm-header-menu-toggle {
    display: none;
}

.jm-header > .jm-inline-nav.collapse {
    display: flex;
    block-size: auto;
    overflow: visible;
    transition: none;
}

@media (max-width: 700px) {
    .jm-header:has(> .jm-inline-nav) .wp-block-site-title {
        white-space: normal;
    }

    .jm-header > .jm-header-menu-toggle:not([hidden]) {
        display: inline-flex;
        order: 1;
        align-items: center;
        gap: 5px;
        min-height: 44px;
        padding-inline: 8px;
        border: 1px solid var(--jm-line-strong);
        border-radius: 6px;
        background: var(--jm-paper);
        color: var(--jm-control-accent);
        font: inherit;
        font-size: .875rem;
    }

    .jm-header > .jm-header-menu-toggle[aria-expanded="true"]:not([hidden]),
    .jm-header > .jm-header-menu-toggle:not([hidden]):hover {
        background: var(--jm-surface);
        border-color: var(--jm-control-accent);
    }

    .jm-header-menu-toggle[aria-expanded="false"] .jm-menu-close-icon,
    .jm-header-menu-toggle[aria-expanded="true"] .jm-menu-open-icon {
        display: none;
    }

    .jm-header > .jm-inline-nav {
        order: 4;
        flex: 0 0 100%;
        min-width: 0;
        display: block;
    }

    .jm-header > .jm-inline-nav.collapse {
        display: block;
    }

    .jm-header > .jm-inline-nav.collapse:not(.show) {
        display: none;
    }

    nav.jm-inline-nav > :is(.wp-block-navigation__container, .wp-block-page-list) {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        box-sizing: border-box;
        width: 100%;
        padding: 4px;
        border: 1px solid var(--jm-line-strong);
        border-radius: 8px;
        background: var(--jm-surface);
    }

    nav.jm-inline-nav > .wp-block-navigation__container > .wp-block-page-list {
        display: flex;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    nav.jm-inline-nav :is(.wp-block-navigation__container, .wp-block-page-list) > .wp-block-navigation-item {
        min-width: 0;
    }

    nav.jm-inline-nav :is(.wp-block-navigation__container, .wp-block-page-list) > .wp-block-navigation-item > .wp-block-navigation-item__content {
        display: flex;
        flex: 1 1 auto;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        min-height: 48px;
        padding: 6px 10px;
        border-radius: 5px;
        color: var(--jm-control-accent);
        font: 1.25rem/1.3 Georgia, serif;
        text-decoration: none;
        overflow-wrap: anywhere;
    }

    nav.jm-inline-nav :is(.wp-block-navigation__container, .wp-block-page-list) > .wp-block-navigation-item:not(.has-child) > a::after {
        content: "";
        flex: 0 0 auto;
        inline-size: 8px;
        block-size: 8px;
        border-block-start: 1px solid;
        border-inline-end: 1px solid;
        transform: rotate(45deg);
        margin-inline-end: 3px;
    }

    nav.jm-inline-nav:dir(rtl) :is(.wp-block-navigation__container, .wp-block-page-list) > .wp-block-navigation-item:not(.has-child) > a::after {
        transform: rotate(-45deg);
    }

    nav.jm-inline-nav :is(.wp-block-navigation__container, .wp-block-page-list) > .wp-block-navigation-item > a:hover {
        background: var(--jm-paper);
        text-decoration: underline;
    }

    .jm-header-menu-toggle:focus-visible,
    .jm-inline-nav :is(a, button):focus-visible {
        outline: 2px solid var(--jm-focus);
        outline-offset: -2px;
    }

    .jm-header:has(> .jm-inline-nav) > .jm-site-search {
        order: 5;
    }
}

/* Optional featured artwork preserves embedded titles, diagrams, and full edges. */
.jm-query-image { margin: 0 0 20px; }
.jm-query-image a { display: block; }
.jm-query-image img,
.jm-article > .wp-block-post-featured-image img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 6px;
}
.jm-query-image--list { max-width: 420px; }
.jm-featured-writing .jm-query-image { margin-top: 18px; }
.jm-article > .wp-block-post-featured-image { margin: 24px 0 32px; }

.jm-article-byline {
    margin-block: .5rem;
    font-size: .95rem;
}

/* Align input focus with the outer search box; the button has its own ring. */
.jm-header .jm-site-search .wp-block-search__input {
    padding-inline: 8px;
    border-radius: 4px;
}

.jm-header .jm-site-search :is(.wp-block-search__input, .wp-block-search__button):focus-visible {
    outline: 3px solid var(--jm-control-accent);
    outline-offset: -3px;
}

@supports selector(:has(*)) {
    .jm-header .jm-site-search .wp-block-search__inside-wrapper:has(.wp-block-search__input:focus-visible) {
        outline: 3px solid var(--jm-control-accent);
        outline-offset: -3px;
    }

    .jm-header .jm-site-search .wp-block-search__inside-wrapper .wp-block-search__input:focus-visible {
        outline: none;
    }
}

/* Cover both saved homepage layouts and the native outline button pattern. */
.jm-home-author :is(.jm-home-about-link, .jm-button-outline .wp-block-button__link) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    background: transparent;
    color: var(--jm-control-accent);
    border: 1px solid var(--jm-control-accent);
    text-decoration: none;
}

.jm-home-author :is(.jm-home-about-link, .jm-button-outline .wp-block-button__link):hover {
    background-color: var(--jm-control-accent);
    color: var(--jm-surface);
}

.jm-home-author :is(.jm-home-about-link, .jm-button-outline .wp-block-button__link):focus-visible {
    outline: 2px solid var(--jm-control-accent);
    outline-offset: 4px;
}

@media (prefers-reduced-motion: no-preference) {
    .jm-home-author :is(.jm-home-about-link, .jm-button-outline .wp-block-button__link) {
        transition: background-color .15s ease, color .15s ease;
    }
}

/* Article section links and the native WordPress discussion. */
.jm-article-reading {
    min-width: 0;
}

.jm-article-outline {
    font: 0.9375rem/1.45 var(--wp--preset--font-family--sans);
    margin-block: 0 24px;
}

.jm-outline-desktop {
    display: none;
}

.jm-outline-mobile {
    padding-inline: 12px;
    border: 1px solid var(--jm-line-strong);
    border-radius: 6px;
    background: var(--jm-surface);
}

.jm-outline-mobile summary {
    padding-block: 12px;
    color: var(--jm-teal);
    cursor: pointer;
}

.jm-article-outline ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.jm-article-outline li a,
.jm-article-outline .jm-jump-discussion {
    display: block;
    padding: 8px 9px;
    border-radius: 4px;
    color: var(--jm-teal);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.jm-article-outline li a:hover,
.jm-article-outline .jm-jump-discussion:hover {
    text-decoration: underline;
    background: var(--jm-paper);
}

.jm-article-outline .jm-outline-subheading a {
    padding-inline-start: 20px;
}

.jm-article-outline .jm-jump-discussion {
    display: none;
}

.jm-article:has(.jm-article-discussion :is(.comment-respond, .wp-block-comment-template)) .jm-jump-discussion {
    display: block;
    border-top: 1px solid var(--jm-line);
}

.jm-article-reading :is(h2, h3)[id],
.jm-article-discussion {
    scroll-margin-top: 24px;
}

@media (min-width: 1100px) {
    .jm-article:has(> .jm-article-reading) {
        --jm-outline-width: 190px;
        --jm-outline-gap: clamp(24px, 3vw, 44px);
    }

    .jm-article:has(> .jm-article-reading) > :is(.wp-block-post-terms, .wp-block-post-title, .wp-block-post-date, .jm-article-byline, .wp-block-post-featured-image, .jm-article-share, .jm-article-discussion, .jm-article-navigation) {
        margin-inline-start: calc(var(--jm-outline-width) + var(--jm-outline-gap));
        width: auto;
    }

    .jm-article-reading {
        display: grid;
        grid-template-columns: minmax(0, var(--jm-outline-width, 190px)) minmax(0, 1fr);
        align-items: start;
        gap: var(--jm-outline-gap, 32px);
    }

    .jm-article-outline {
        border-inline-start: 1px solid var(--jm-line);
        padding-inline-start: 10px;
        margin: 0;
    }

    .jm-outline-desktop {
        display: block;
    }

    .jm-outline-desktop > p {
        margin: 0 9px 7px;
        color: var(--jm-muted);
        font-size: 0.8125rem;
        letter-spacing: 0.12em;
        text-transform: uppercase;
    }

    .jm-outline-mobile {
        display: none;
    }

    @media (min-height: 700px) {
        .jm-article-outline {
            position: sticky;
            top: 52px;
            max-height: calc(100vh - 76px);
            overflow: auto;
            padding-inline: 10px 5px;
        }
    }

    .jm-outline-desktop a:hover {
        background: var(--jm-surface);
    }
}

@media (pointer: coarse) {
    .jm-article-outline li a,
    .jm-article-outline .jm-jump-discussion {
        min-block-size: 44px;
    }
}

.jm-article-discussion {
    max-inline-size: 54rem;
    margin-block: clamp(40px, 5vw, 68px);
    padding-block-start: 24px;
    border-top: 1px solid var(--jm-line);
}

.jm-article-discussion :is(.wp-block-comments-title, .comment-reply-title) {
    font-family: var(--wp--preset--font-family--serif);
    color: var(--jm-ink);
}

.jm-article-discussion .wp-block-comments-title {
    margin-block: 0 16px;
    padding-block-end: 12px;
    border-bottom: 1px solid var(--jm-line);
}

.jm-discussion-count {
    display: inline-block;
    margin-inline-start: 0.35em;
    color: var(--jm-muted);
    font: 400 0.875rem/1.4 var(--wp--preset--font-family--sans);
    white-space: nowrap;
}

.jm-article-discussion :is(.wp-block-comment-template, .wp-block-comment-template ol) {
    padding-inline-start: 0;
    list-style: none;
}

.jm-article-discussion .wp-block-comment-template {
    margin-block: 0 24px;
}

.jm-article-discussion .wp-block-comment-template ol {
    border-inline-start: 2px solid var(--jm-line-strong);
    margin-block: 6px 0;
    margin-inline-start: clamp(4px, 1vw, 14px);
    padding-inline-start: clamp(8px, 1.5vw, 16px);
}

.jm-article-discussion .wp-block-comment-template li + li {
    margin-block-start: 16px;
}

.jm-article-discussion .wp-block-comment-template > li + li {
    border-top: 1px solid var(--jm-line);
    padding-block-start: 16px;
}

.jm-article-discussion .wp-block-comment-template :is(.wp-block-comment-author-name, .wp-block-comment-date) {
    display: inline-block;
    margin-block: 0;
    overflow-wrap: anywhere;
}

.jm-article-discussion .wp-block-comment-author-name {
    font-weight: 650;
    margin-inline-end: 10px;
}

.jm-article-discussion .wp-block-comment-author-name a {
    color: inherit;
}

.jm-discussion-author {
    color: var(--jm-teal);
    font-size: 0.75rem;
    font-weight: 500;
    margin-inline-start: 0.3em;
}

.jm-article-discussion :is(.wp-block-comment-date, .wp-block-comment-date a, .comment-notes, .logged-in-as, .jm-discussion-moderation) {
    color: var(--jm-muted);
    font-size: 0.875rem;
}

.jm-article-discussion .wp-block-comment-content {
    margin-block: 6px 0;
    overflow-wrap: anywhere;
}

.jm-article-discussion .wp-block-comment-content > p {
    margin-block: 0 0.55em;
}

.jm-article-discussion .wp-block-comment-reply-link a,
.jm-article-discussion #cancel-comment-reply-link {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    color: var(--jm-teal);
    font: 400 0.875rem/1.4 var(--wp--preset--font-family--sans);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Core toggles the cancel link's inline display when replying. */
.jm-article-discussion #cancel-comment-reply-link {
    margin-inline-start: 0.6em;
}

.jm-article-discussion .comment-respond {
    padding: clamp(14px, 3vw, 26px);
    border: 1px solid var(--jm-line-strong);
    border-radius: 8px;
    background: var(--jm-surface);
    color: var(--jm-ink);
}

.jm-article-discussion .comment-reply-title {
    margin-block: 0 8px;
}

.jm-article-discussion .comment-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.jm-article-discussion .comment-form > * {
    grid-column: 1 / -1;
    min-width: 0;
    margin: 0;
}

.jm-article-discussion .comment-form :is(.comment-form-author, .comment-form-email) {
    grid-column: auto;
}

.jm-article-discussion .comment-form label {
    font-weight: 600;
}

.jm-article-discussion .comment-form :is(textarea, input[type="text"], input[type="email"], input[type="url"]) {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    margin-block-start: 4px;
    padding: 9px 10px;
    border: 1px solid var(--jm-muted);
    border-radius: 5px;
    background: var(--jm-paper);
    color: var(--jm-ink);
    font: inherit;
    font-size: 1rem;
}

.jm-article-discussion .comment-form textarea {
    min-height: 5.5rem;
    resize: vertical;
}

.jm-article-discussion .comment-form input[type="submit"] {
    min-height: 44px;
    background: var(--jm-teal);
    color: var(--jm-paper);
    border: 1px solid var(--jm-teal);
    border-radius: 5px;
}

.jm-article-discussion .comment-form input[type="submit"]:hover {
    background: var(--jm-paper);
    color: var(--jm-teal);
}

@media (max-width: 520px) {
    .jm-article-discussion .comment-form {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* Footer links are a separate, wrapping Navigation block. */
.jm-footer > .jm-footer-nav {
    min-width: 0;
    margin: 0;
}

.jm-footer-nav .wp-block-navigation-item__content {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    overflow-wrap: anywhere;
}

@media (min-width: 701px) {
    .jm-footer:has(> .jm-footer-nav) {
        grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto;
    }

    .jm-footer > .jm-footer-nav {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .jm-footer:has(> .jm-footer-nav) > .jm-site-controls {
        grid-column: 3;
    }
}
