/* ══════════════════════════════════════════════
   Single Post Styles — thrivemattic
   ══════════════════════════════════════════════ */

/* ─── Brand Tokens ─── */
:root {
    --tm-charcoal: #1c2529;
    --tm-olive: #808000;
    --tm-olive-dim: rgba(128, 128, 0, 0.10);
    --tm-olive-medium: rgba(128, 128, 0, 0.20);
    --tm-cream: #faf7f2;
    --tm-white: #ffffff;
    --tm-text: #333333;
    --tm-text-dim: #777777;
    --tm-text-light: #999999;
    --tm-border: rgba(0,0,0,0.06);
    --tm-shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --tm-shadow-md: 0 4px 20px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --tm-shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
    --tm-radius: 8px;
    --tm-radius-lg: 12px;
    --tm-content-width: 720px;
}

/* ─── Reading Progress Bar ─── */
.tm-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--tm-olive), #9a9a00);
    z-index: 10000;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* ─── Page Background Override ─── */
.single-post .site-content,
.single-post #content {
    background: var(--tm-cream) !important;
    padding: 0 !important;
    margin: 0 !important;
}

.single-post .inside-article {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.single-post .container.grid-container {
    max-width: 100% !important;
    padding: 0 !important;
    background: var(--tm-cream) !important;
}

.single-post #primary {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin: 0 !important;
}

.single-post #right-sidebar,
.single-post .widget-area,
.single-post aside#right-sidebar {
    display: none !important;
}

/* Hide GeneratePress default entry header/meta/footer */
.single-post .entry-header,
.single-post .entry-meta,
.single-post footer.entry-meta,
.single-post .post-image,
.single-post .post-image-above-header,
.single-post .cat-links,
.single-post .tags-links,
.single-post .nav-links,
.single-post .post-navigation,
.single-post .paging-navigation,
.single-post .comments-area,
.single-post header#sss {
    display: none !important;
}

/* Hide Divi wrappers */
.single-post #et-boc,
.single-post #et_builder_outer_content {
    display: contents !important;
}

.single-post .et_pb_section {
    display: none !important;
}

/* Hide breadcrumbs from old single.php */
.single-post .breadcrumbs,
.single-post .entry-title-blog {
    display: none !important;
}

body.single.single-post main {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Article Wrapper ─── */
.tm-article-wrapper {
    max-width: calc(var(--tm-content-width) + 96px);
    margin: 80px auto 0;
    padding: 0 24px;
    position: relative;
}

.tm-article-card {
    background: var(--tm-white);
    border-radius: var(--tm-radius-lg);
    box-shadow: var(--tm-shadow-md);
    overflow: hidden;
}

/* ─── Article Header ─── */
.tm-article-header {
    padding: 48px 48px 0;
    animation: tmFadeUp 0.6s ease both;
}

.tm-category-badge {
    display: inline-block;
    color: var(--tm-white) !important;
    font-family: 'Lato', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 20px;
    text-decoration: none !important;
    transition: opacity 0.2s;
}

.tm-article-header .tm-category-badge:hover {
    opacity: 0.85;
}

/* Default badge color (olive) */
.tm-category-badge {
    background: var(--tm-olive);
}

.tm-article-title {
    font-family: 'Oswald', sans-serif !important;
    font-size: 44px !important;
    font-weight: 600 !important;
    color: var(--tm-charcoal) !important;
    line-height: 1.15 !important;
    margin-bottom: 24px !important;
    letter-spacing: 0.5px;
    padding: 0 !important;
}

.tm-article-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--tm-border);
    margin-bottom: 0;
}

.tm-author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tm-charcoal), #2d3a40);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tm-white);
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.tm-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tm-meta-text {
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    color: var(--tm-text-dim);
    line-height: 1.6;
}

.tm-author-link {
    color: var(--tm-charcoal) !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    text-decoration: none !important;
    transition: color 0.2s;
}

.tm-author-link:hover {
    color: var(--tm-olive) !important;
    text-decoration: underline !important;
}

.tm-meta-details {
    color: var(--tm-text-dim);
    font-size: 13px;
}

.tm-separator {
    margin: 0 6px;
    opacity: 0.4;
}

/* ─── Featured Image ─── */
.tm-featured-image {
    margin: 32px 48px;
    border-radius: var(--tm-radius);
    overflow: hidden;
    animation: tmFadeUp 0.6s 0.1s ease both;
}

.tm-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ─── Article Body ─── */
.tm-article-body {
    padding: 45px;
    animation: tmFadeUp 0.6s 0.2s ease both;
    overflow: hidden;
}

/* Constrain all child containers to article body width */
.tm-article-body > * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Constrain inline infographic containers that have their own max-width/padding */
.tm-article-body .ig-container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.tm-article-body p {
    margin-bottom: 1.5em !important;
    font-family: 'Lato', sans-serif !important;
    font-size: 18px !important;
    line-height: 1.78 !important;
    color: var(--tm-text) !important;
}

.tm-article-body h2 {
    font-family: 'Oswald', sans-serif !important;
    font-size: 28px !important;
    font-weight: 500 !important;
    color: var(--tm-charcoal) !important;
    margin: 2.2em 0 0.8em !important;
    padding: 0 0 0 18px !important;
    border-left: 4px solid var(--tm-olive) !important;
    line-height: 1.3 !important;
    letter-spacing: 0.5px;
}

.tm-article-body h3 {
    font-family: 'Oswald', sans-serif !important;
    font-size: 22px !important;
    font-weight: 500 !important;
    color: var(--tm-charcoal) !important;
    margin: 1.8em 0 0.6em !important;
    line-height: 1.35 !important;
    letter-spacing: 0.3px;
    padding: 0 !important;
}

.tm-article-body h4 {
    font-family: 'Oswald', sans-serif !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    color: var(--tm-charcoal) !important;
    margin: 1.5em 0 0.5em !important;
    line-height: 1.35 !important;
    padding: 0 !important;
}

.tm-article-body a {
    color: var(--tm-olive) !important;
    text-decoration: underline !important;
    text-decoration-color: var(--tm-olive-medium) !important;
    text-underline-offset: 3px;
    transition: all 0.2s;
}

.tm-article-body a:hover {
    color: var(--tm-charcoal) !important;
    text-decoration-color: var(--tm-charcoal) !important;
}

.tm-article-body ul,
.tm-article-body ol {
    margin: 0 0 1.5em 0 !important;
    padding-left: 0 !important;
    list-style: none !important;
    list-style-type: none !important;
}

.tm-article-body li {
    position: relative;
    padding-left: 24px !important;
    margin-bottom: 0.6em !important;
    line-height: 1.7 !important;
    font-family: 'Lato', sans-serif;
    font-size: 18px;
    color: var(--tm-text);
}

.tm-article-body ul > li::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 11px;
    width: 7px;
    height: 7px;
    background: var(--tm-olive);
    border-radius: 2px;
    transform: rotate(45deg);
}

.tm-article-body ol {
    counter-reset: ol-counter;
}

.tm-article-body ol > li {
    counter-increment: ol-counter;
}

.tm-article-body ol > li::before {
    content: counter(ol-counter);
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
    font-size: 14px;
    color: var(--tm-olive);
}

/* ─── Blockquote ─── */
.tm-article-body blockquote {
    border-left: 4px solid var(--tm-olive) !important;
    background: var(--tm-cream) !important;
    margin: 2em 0 !important;
    padding: 24px 28px !important;
    border-radius: 0 var(--tm-radius) var(--tm-radius) 0;
    font-style: italic;
}

.tm-article-body blockquote p {
    margin-bottom: 0 !important;
    color: #555 !important;
    font-size: 17px !important;
    line-height: 1.7 !important;
}

/* ─── Inline Code ─── */
.tm-article-body code {
    background: var(--tm-cream);
    color: var(--tm-charcoal);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: 'Fira Code', 'Consolas', monospace;
}

/* ─── Images inside content ─── */
.tm-article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--tm-radius);
    margin: 1em 0;
}

.tm-article-body figure {
    margin: 2em 0;
}

.tm-article-body figcaption {
    font-size: 14px;
    color: var(--tm-text-light);
    text-align: center;
    margin-top: 8px;
}

/* ─── Tables ─── */
.tm-article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 16px;
}

.tm-article-body th,
.tm-article-body td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--tm-border);
}

.tm-article-body th {
    background: var(--tm-cream);
    font-weight: 700;
    color: var(--tm-charcoal);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Article Tags ─── */
.tm-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--tm-border);
}

.tm-article-tags a {
    background: var(--tm-cream) !important;
    color: var(--tm-text-dim) !important;
    font-size: 13px !important;
    padding: 5px 14px !important;
    border-radius: 20px !important;
    font-weight: 500;
    text-decoration: none !important;
    transition: all 0.2s;
}

.tm-article-tags a:hover {
    background: var(--tm-olive-dim) !important;
    color: var(--tm-charcoal) !important;
}

/* ─── Author Box ─── */
.tm-author-box {
    background: var(--tm-charcoal);
    border-radius: var(--tm-radius-lg);
    padding: 40px;
    margin: 0 48px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.tm-author-box-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3a4a52, #4a5a62);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tm-white);
    font-weight: 700;
    font-size: 24px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.1);
    overflow: hidden;
}

.tm-author-box-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tm-author-box .tm-author-box-info h4 {
    color: #ffffff !important;
    font-family: 'Lato', sans-serif !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
}

.tm-author-box-info p {
    color: rgba(255,255,255,0.65);
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.tm-author-socials {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.tm-author-socials a {
    color: var(--tm-olive) !important;
    font-size: 13px !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: color 0.2s;
}

.tm-author-socials a:hover {
    color: #9a9a00 !important;
}

.tm-article-card-bottom {
    padding-bottom: 48px;
}

/* ─── CTA Banner ─── */
.tm-cta-banner {
    background: var(--tm-charcoal);
    border-radius: var(--tm-radius-lg);
    margin: 80px auto;
    padding: 56px 48px;
    max-width: calc(var(--tm-content-width) + 96px);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tm-cta-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--tm-olive), #9a9a00, var(--tm-olive));
}

.tm-cta-banner h3 {
    font-family: 'Oswald', sans-serif !important;
    font-size: 34px !important;
    color: var(--tm-white) !important;
    margin-bottom: 12px !important;
    font-weight: 500 !important;
    letter-spacing: 0.5px;
}

.tm-cta-banner > p {
    color: rgba(255,255,255,0.6) !important;
    font-family: 'Lato', sans-serif;
    font-size: 16px;
    margin-bottom: 28px;
}

/* CF7 form in CTA banner */
.tm-cta-form {
    max-width: 460px;
    margin: 0 auto;
}

.tm-cta-form .wpcf7-form {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.tm-cta-form .wpcf7-form > p {
    margin: 0 !important;
}

.tm-cta-form .wpcf7-form > p:first-child {
    flex: 1;
    min-width: 0;
}

.tm-cta-form .wpcf7-form br {
    display: none;
}

.tm-cta-form .wpcf7-form input[type="email"],
.tm-cta-form .wpcf7-form .wpcf7-email {
    width: 100% !important;
    padding: 14px 20px !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 8px !important;
    background: rgba(255,255,255,0.06) !important;
    color: var(--tm-white) !important;
    font-size: 15px !important;
    font-family: 'Lato', sans-serif !important;
    outline: none !important;
    transition: border-color 0.2s;
    box-shadow: none !important;
    height: auto !important;
}

.tm-cta-form .wpcf7-form input[type="email"]::placeholder {
    color: rgba(255,255,255,0.35);
}

.tm-cta-form .wpcf7-form input[type="email"]:focus {
    border-color: var(--tm-olive) !important;
}

.tm-cta-form .wpcf7-form input[type="submit"],
.tm-cta-form .wpcf7-form .wpcf7-submit {
    background: var(--tm-olive) !important;
    color: var(--tm-white) !important;
    border: none !important;
    padding: 14px 28px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    cursor: pointer;
    font-family: 'Lato', sans-serif !important;
    transition: background 0.2s;
    white-space: nowrap;
    width: auto !important;
    height: auto !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tm-cta-form .wpcf7-form input[type="submit"]:hover {
    background: #6d6d00 !important;
}

.tm-cta-form .wpcf7-form p[style*="height: 0px"] {
    display: none !important;
}

.tm-cta-form .wpcf7-form div[style*="margin-top: -20px"] {
    margin-top: 0 !important;
    width: 100%;
    display: flex;
    justify-content: center;
}

.tm-cta-form .wpcf7-response-output {
    color: var(--tm-white) !important;
    border-color: rgba(255,255,255,0.2) !important;
    margin: 12px 0 0 !important;
    font-size: 14px;
    width: 100%;
}

/* ─── Related Posts ─── */
.tm-related-section {
    max-width: calc(var(--tm-content-width) + 96px);
    margin: 0 auto 80px;
    padding: 0 24px;
}

.tm-related-section > h3 {
    font-family: 'Oswald', sans-serif !important;
    font-size: 28px !important;
    color: var(--tm-charcoal) !important;
    margin-bottom: 24px !important;
    font-weight: 500 !important;
    letter-spacing: 0.5px;
}

.tm-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.tm-related-card {
    background: var(--tm-white);
    border-radius: var(--tm-radius-lg);
    box-shadow: var(--tm-shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.3s, transform 0.3s;
    text-decoration: none !important;
    color: inherit !important;
    display: block;
}

.tm-related-card:hover {
    box-shadow: var(--tm-shadow-lg);
    transform: translateY(-2px);
    text-decoration: none !important;
    color: inherit !important;
}

.tm-related-card-image {
    aspect-ratio: 16/10;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #e2ded6, #d0cbc2);
}

.tm-related-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tm-related-card-image .tm-category-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 10px;
    padding: 3px 10px;
    margin: 0;
}

.tm-related-card-body {
    padding: 18px 20px 22px;
}

.tm-related-card-body h4 {
    font-family: 'Oswald', sans-serif !important;
    font-size: 18px !important;
    color: var(--tm-charcoal) !important;
    margin-bottom: 8px !important;
    line-height: 1.3 !important;
    font-weight: 500 !important;
    letter-spacing: 0.3px;
    padding: 0 !important;
}

.tm-related-date {
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    color: var(--tm-text-light);
}

/* ─── TOC Sidebar ─── */
.tm-toc-sidebar {
    position: fixed;
    right: calc((100vw - 960px) / 2 - 250px);
    top: 120px;
    width: 220px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.4s ease;
    pointer-events: none;
    z-index: 50;
    display: none;
}

/* Only show TOC on screens wide enough to not overlap */
@media (min-width: 1440px) {
    .tm-toc-sidebar {
        display: block;
    }
}

.tm-toc-sidebar.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.tm-toc-label {
    font-family: 'Lato', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--tm-text-light);
    margin-bottom: 14px;
}

.tm-toc-links a {
    display: block;
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    color: var(--tm-text-dim);
    text-decoration: none !important;
    padding: 6px 0 6px 14px;
    border-left: 2px solid var(--tm-border);
    transition: all 0.2s;
    line-height: 1.4;
}

.tm-toc-links a:hover,
.tm-toc-links a.active {
    color: var(--tm-charcoal) !important;
    border-left-color: var(--tm-olive);
}

/* ─── Category badge colors (reuse from archive) ─── */
.tm-badge--marketing-research { background: #e94560 !important; }
.tm-badge--marketing-strategy { background: #00d2d3 !important; color: #000 !important; }
.tm-badge--campaign-management { background: #f5a623 !important; color: #000 !important; }
.tm-badge--website-optimisation { background: #8b5cf6 !important; }
.tm-badge--artificial-intelligence { background: #3b82f6 !important; }

/* Gradient backgrounds for related card placeholders */
.tm-related-card-image.tm-gradient--marketing-research { background: linear-gradient(135deg, #1a1a2e 0%, #e94560 100%); }
.tm-related-card-image.tm-gradient--marketing-strategy { background: linear-gradient(135deg, #0f3460 0%, #00d2d3 100%); }
.tm-related-card-image.tm-gradient--campaign-management { background: linear-gradient(135deg, #1a1a2e 0%, #f5a623 100%); }
.tm-related-card-image.tm-gradient--website-optimisation { background: linear-gradient(135deg, #16213e 0%, #8b5cf6 100%); }
.tm-related-card-image.tm-gradient--artificial-intelligence { background: linear-gradient(135deg, #16213e 0%, #3b82f6 100%); }

/* ─── Animations ─── */
@keyframes tmFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ─── */

@media (max-width: 768px) {
    .tm-article-header,
    .tm-article-body {
        padding-left: 24px !important;
        padding-right: 24px !important;
    }
    .tm-featured-image {
        margin: 24px 24px;
    }
    .tm-article-title {
        font-size: 32px !important;
    }
    .tm-author-box {
        margin: 0 24px;
        padding: 28px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .tm-related-grid {
        grid-template-columns: 1fr;
    }
    .tm-cta-form .wpcf7-form {
        flex-direction: column;
    }
    .tm-cta-form .wpcf7-form input[type="submit"] {
        width: 100% !important;
    }
    .tm-cta-banner {
        margin: 48px 16px;
        padding: 40px 24px;
    }
    .tm-cta-banner h3 {
        font-size: 26px !important;
    }
}

@media (max-width: 480px) {
    .tm-article-header {
        padding-top: 32px !important;
    }
    .tm-article-title {
        font-size: 28px !important;
    }
    .tm-article-body h2 {
        font-size: 24px !important;
    }
    .tm-article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─── Divi content rendering overrides ─── */
.tm-article-body .et_pb_section,
.tm-article-body .et_pb_row,
.tm-article-body .et_pb_column,
.tm-article-body .et_pb_module,
.tm-article-body .et_pb_text_inner,
.tm-article-body .et_pb_row_inner,
.tm-article-body .et_pb_column_inner {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
    float: none !important;
}

.tm-article-body .et_pb_section {
    display: block !important;
}

.tm-article-body .et_pb_row {
    width: 100% !important;
    max-width: 100% !important;
}

.tm-article-body .et_pb_column {
    width: 100% !important;
}

.tm-article-body .et_pb_text {
    word-wrap: break-word;
    padding: 0 !important;
    margin: 0 !important;
}

/* Force Divi rendered lists to have no native numbers/bullets */
.tm-article-body .et_pb_text_inner ol,
.tm-article-body .et_pb_text_inner ul {
    list-style: none !important;
    list-style-type: none !important;
    padding-left: 0 !important;
}

.tm-article-body .et_pb_text_inner ol li,
.tm-article-body .et_pb_text_inner ul li {
    list-style: none !important;
    list-style-type: none !important;
}

/* Ensure all Divi image modules respect container width */
.tm-article-body .et_pb_image {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}

.tm-article-body .et_pb_image img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
}
