/*
 * Shared article body typography + spacing.
 * Used on the public blog AND in the Filament Tiptap editor so WYSIWYG matches.
 */

@font-face {
    font-family: 'Futura Bk BT';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/Futura-Bk-BT.woff2') format('woff2'),
        url('../fonts/Futura-Bk-BT.woff') format('woff');
}

@font-face {
    font-family: 'Futura Md BT';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/Futura-Md-BT-Bold.woff2') format('woff2'),
        url('../fonts/Futura-Md-BT-Bold.woff') format('woff');
}

.blog-article-content {
    word-break: break-word;
    overflow-wrap: break-word;
    font-family: var(--blog-content-font-family, 'Futura Bk BT', sans-serif);
    font-size: 1rem;
    line-height: 1.5;
    color: #111111;
}

.tiptap-editor .ProseMirror {
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 1rem;
    line-height: 1.5;
    color: #111111;
}

.blog-article-content[data-content-font="futura-body"] {
    --blog-content-font-family: 'Futura Bk BT', sans-serif;
    font-family: 'Futura Bk BT', sans-serif;
}

.blog-article-content[data-content-font="serif"] {
    --blog-content-font-family: Georgia, 'Times New Roman', serif;
    font-family: Georgia, 'Times New Roman', serif;
}

.blog-article-content[data-content-font="sans"] {
    --blog-content-font-family: Arial, Helvetica, sans-serif;
    font-family: Arial, Helvetica, sans-serif;
}

/* Match editor: force article font on text nodes (overrides inline styles from saved HTML) */
.blog-article-content :where(
    p, h1, h2, h3, h4, h5, h6, li, blockquote, td, th, span, div, a
) {
    font-family: var(--blog-content-font-family) !important;
}

/* Normal body weight — editor applies the same via Filament; home.css / inline styles can bleed here */
.blog-article-content :where(p, li, blockquote, td, span) {
    font-weight: 400 !important;
}

.blog-article-content :where(h1, h2, h3, h4, h5, h6, th, strong, b) {
    font-weight: 700 !important;
}

/* Block spacing — frontend uses sibling selectors; editor uses explicit h/p margins below */
.blog-article-content > * + * {
    margin-top: 1rem !important;
}

.blog-article-content > * + h1,
.blog-article-content > * + h2,
.blog-article-content > * + h3,
.blog-article-content > * + h4,
.blog-article-content > * + h5,
.blog-article-content > * + h6 {
    margin-top: 2rem !important;
}

.blog-article-content h1,
.blog-article-content h2,
.blog-article-content h3,
.blog-article-content h4,
.blog-article-content h5,
.blog-article-content h6 {
    font-family: inherit;
    font-weight: bold;
    color: #111111;
    margin-bottom: 0;
}

.tiptap-editor .ProseMirror h1,
.tiptap-editor .ProseMirror h2,
.tiptap-editor .ProseMirror h3,
.tiptap-editor .ProseMirror h4,
.tiptap-editor .ProseMirror h5,
.tiptap-editor .ProseMirror h6 {
    font-weight: bold;
    color: #111111;
    margin-top: 2rem !important;
    margin-bottom: 0 !important;
}

.tiptap-editor .ProseMirror > :first-child {
    margin-top: 0 !important;
}

.blog-article-content h1,
.tiptap-editor .ProseMirror h1 {
    font-size: 1.75rem;
    line-height: 1.1;
}

.blog-article-content h2,
.tiptap-editor .ProseMirror h2 {
    font-size: 1.5rem;
    line-height: 1.1;
}

.blog-article-content h3,
.tiptap-editor .ProseMirror h3 {
    font-size: 1.25rem;
    line-height: 1.25;
}

.blog-article-content h4,
.tiptap-editor .ProseMirror h4 {
    font-size: 1.125rem;
}

.blog-article-content p {
    font-size: inherit !important;
    line-height: inherit !important;
    margin-bottom: 0;
}

.tiptap-editor .ProseMirror p {
    font-size: inherit;
    line-height: inherit;
    margin-top: 1rem !important;
    margin-bottom: 0 !important;
}

.tiptap-editor .ProseMirror > p:first-child {
    margin-top: 0 !important;
}

.blog-article-content .lead,
.tiptap-editor .ProseMirror .lead {
    font-size: 1.375rem;
    line-height: 1.3;
}

.blog-article-content small,
.tiptap-editor .ProseMirror small {
    font-size: 0.75rem;
}

.blog-article-content strong,
.blog-article-content b,
.tiptap-editor .ProseMirror strong,
.tiptap-editor .ProseMirror b {
    font-weight: bold;
}

.blog-article-content img,
.tiptap-editor .ProseMirror img {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

/* Lists — space-y-2 equivalent + Tiptap wraps items in <p> */
.blog-article-content ul,
.blog-article-content ol,
.tiptap-editor .ProseMirror ul,
.tiptap-editor .ProseMirror ol {
    padding-inline-start: 1rem;
    margin-inline-start: 1rem;
    margin-top: 0;
    margin-bottom: 0;
    list-style-position: outside;
}

.blog-article-content ul,
.tiptap-editor .ProseMirror ul {
    list-style-type: disc;
}

.blog-article-content ol,
.tiptap-editor .ProseMirror ol {
    list-style-type: decimal;
}

.blog-article-content ul > li + li,
.blog-article-content ol > li + li,
.tiptap-editor .ProseMirror ul > li + li,
.tiptap-editor .ProseMirror ol > li + li {
    margin-top: 0.5rem;
}

.blog-article-content li > p,
.tiptap-editor .ProseMirror li > p {
    margin: 0;
}

.blog-article-content li > ul,
.blog-article-content li > ol,
.tiptap-editor .ProseMirror li > ul,
.tiptap-editor .ProseMirror li > ol {
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.blog-article-content ul.checked-list,
.tiptap-editor .ProseMirror ul.checked-list {
    list-style-type: none;
    margin-inline-start: 0;
}

.blog-article-content ul.checked-list li,
.tiptap-editor .ProseMirror ul.checked-list li {
    display: flex;
    align-items: baseline;
    gap: 0.375em;
}

.blog-article-content ul.checked-list li::before,
.tiptap-editor .ProseMirror ul.checked-list li::before {
    content: '✓';
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.blog-article-content blockquote,
.tiptap-editor .ProseMirror blockquote {
    border-left: 0.25rem solid #9ca3af;
    padding-inline-start: 0.5rem;
    margin-inline-start: 1rem;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.25rem;
    font-style: normal;
    background: transparent;
    border-radius: 0;
    color: inherit;
}

.blog-article-content hr,
.tiptap-editor .ProseMirror hr {
    margin-top: 1rem;
    margin-bottom: 1rem;
    border: 0;
    border-top: 1px solid #9ca3af;
}

.blog-article-content a,
.tiptap-editor .ProseMirror a {
    color: #2563eb;
    text-decoration: underline;
}

.blog-article-content a[id],
.tiptap-editor .ProseMirror a[id] {
    color: #111111;
    text-decoration: none;
}

.blog-article-content a[id]::before,
.tiptap-editor .ProseMirror a[id]::before {
    content: '# ';
    color: #6b7280;
    opacity: 0.5;
}

.blog-article-content a[data-as-button="true"],
.tiptap-editor .ProseMirror a[data-as-button="true"] {
    background-color: #111827;
    color: #ffffff !important;
    text-decoration: none;
    display: inline-block;
    border-radius: 0.375rem;
    padding: 0.5rem 1.25rem;
}

.blog-article-content a[data-as-button-theme="primary"],
.tiptap-editor .ProseMirror a[data-as-button-theme="primary"] {
    background-color: var(--bs-primary, #d97706);
}

.blog-article-content a[data-as-button-theme="secondary"],
.tiptap-editor .ProseMirror a[data-as-button-theme="secondary"] {
    background-color: #d97706;
}

.blog-article-content a[data-as-button-theme="tertiary"],
.tiptap-editor .ProseMirror a[data-as-button-theme="tertiary"] {
    background-color: #16a34a;
}

.blog-article-content a[data-as-button-theme="accent"],
.tiptap-editor .ProseMirror a[data-as-button-theme="accent"] {
    background-color: #dc2626;
}

.blog-article-content sup,
.tiptap-editor .ProseMirror sup {
    font-size: 65%;
}

.blog-article-content table,
.tiptap-editor .ProseMirror table {
    border-collapse: collapse;
    margin: 0;
    overflow: hidden;
    table-layout: fixed;
    width: 100%;
    position: relative;
    font-size: inherit;
}

.blog-article-content table td,
.blog-article-content table th,
.tiptap-editor .ProseMirror table td,
.tiptap-editor .ProseMirror table th {
    border: 1px solid #9ca3af;
    min-width: 1em;
    padding: 3px 5px;
    vertical-align: top;
    background-clip: padding-box;
}

.blog-article-content table td > *,
.blog-article-content table th > *,
.tiptap-editor .ProseMirror table td > *,
.tiptap-editor .ProseMirror table th > * {
    margin-bottom: 0;
}

.blog-article-content table th,
.tiptap-editor .ProseMirror table th {
    background-color: #e5e7eb;
    color: #374151;
    font-weight: 700;
    text-align: left;
}

.blog-article-content table p,
.tiptap-editor .ProseMirror table p {
    margin: 0;
}

.blog-article-content .tableWrapper,
.tiptap-editor .ProseMirror .tableWrapper {
    padding: 1rem 0;
    overflow-x: auto;
}

.blog-article-content pre,
.tiptap-editor .ProseMirror pre {
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.blog-article-content code,
.tiptap-editor .ProseMirror code {
    background-color: #d1d5db;
    border-radius: 0.25rem;
    padding-inline: 0.25rem;
}

.blog-article-content pre code,
.tiptap-editor .ProseMirror pre code {
    background-color: transparent;
    padding-inline: 0;
}

.blog-article-content .responsive-embed,
.blog-article-content div[data-youtube-video],
.blog-article-content div[data-vimeo-video],
.blog-article-content div[data-native-video],
.blog-article-content .tiptap-oembed,
.tiptap-editor .ProseMirror div[data-youtube-video],
.tiptap-editor .ProseMirror div[data-vimeo-video],
.tiptap-editor .ProseMirror div[data-native-video] {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin-block: 1rem;
}

.blog-article-content .responsive-embed iframe,
.blog-article-content div[data-youtube-video] iframe,
.blog-article-content div[data-vimeo-video] iframe,
.blog-article-content div[data-native-video] iframe,
.blog-article-content .tiptap-oembed iframe,
.tiptap-editor .ProseMirror div[data-youtube-video] iframe,
.tiptap-editor .ProseMirror div[data-vimeo-video] iframe,
.tiptap-editor .ProseMirror div[data-native-video] iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.blog-article-content div[data-type="details"],
.tiptap-editor .ProseMirror div[data-type="details"] {
    box-sizing: border-box;
    border: 1px dashed #9ca3af;
    border-radius: 0.375rem;
    position: relative;
}

.blog-article-content div[data-type="details"] summary,
.tiptap-editor .ProseMirror div[data-type="details"] summary {
    padding: 0.375rem 0.5rem;
    font-weight: 700;
    border-bottom: 1px solid #e5e7eb;
    list-style: none;
}

.blog-article-content div[data-type="details"] summary::-webkit-details-marker,
.tiptap-editor .ProseMirror div[data-type="details"] summary::-webkit-details-marker {
    display: none;
}

.blog-article-content div[data-type="details"] div[data-type="details-content"],
.tiptap-editor .ProseMirror div[data-type="details"] div[data-type="details-content"] {
    padding: 0.5rem;
}

.blog-article-content div[data-type="details"] div[data-type="details-content"] > * + *,
.tiptap-editor .ProseMirror div[data-type="details"] div[data-type="details-content"] > * + * {
    margin-top: 1rem;
}

/* Reset Bootstrap / home.css default block margins so sibling spacing applies */
.blog-article-content :where(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, pre, table),
.tiptap-editor .ProseMirror :where(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, pre, table) {
    margin-bottom: 0;
}

.blog-article-content > :first-child,
.tiptap-editor .ProseMirror > :first-child {
    margin-top: 0;
}

@media (max-width: 767.98px) {
    .blog-article-content {
        font-size: 1rem;
        line-height: 1.6;
        max-width: 100%;
        overflow-x: clip;
    }

    .blog-article-content h1 {
        font-size: 1.5rem;
    }

    .blog-article-content h2 {
        font-size: 1.3rem;
    }

    .blog-article-content h3 {
        font-size: 1.15rem;
    }

    .blog-article-content h4 {
        font-size: 1.05rem;
    }

    .blog-article-content .lead {
        font-size: 1.125rem;
    }

    .blog-article-content pre,
    .blog-article-content .tableWrapper {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .blog-article-content a[data-as-button="true"] {
        display: inline-block;
        max-width: 100%;
        text-align: center;
        white-space: normal;
    }

    .blog-article-content img,
    .blog-article-content iframe,
    .blog-article-content video {
        max-width: 100%;
        height: auto;
    }
}
