/*
Theme Name: M&G Speed Marketing Theme
Author: Gemini
Description: A custom theme for M&G Speed Marketing.
Version: 1.0
*/

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --color-bg-dark: #1f2937;
    --color-bg-darker: #111827;
    --color-bg-footer: #0f0d0a;
    --color-text-body: #D1D5DB;
    --color-text-headings: #F9FAFB;
    --color-text-meta: #9ca3af;
    --color-accent-primary: #dd9933;
    --color-accent-primary-darker: #bf802b;
    --color-accent-secondary: #338AFF;
    --color-accent-tertiary: #8B5CF6;
    --color-card-border: #374151;
}

body {
    background-color: var(--color-bg-dark);
    color: var(--color-text-body);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Red Hat Display', sans-serif;
    font-weight: 800;
    color: var(--color-text-headings);
    text-transform: uppercase;
    letter-spacing: 2px;
}

a {
    color: var(--color-accent-primary);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-accent-primary-darker);
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Header */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--color-bg-darker);
    border-bottom: 1px solid var(--color-card-border);
}

/* Footer */
.site-footer {
    background-color: var(--color-bg-footer);
    color: #898989;
    padding-top: 4rem;
}

.sub-footer {
    background-color: #0f0c0c;
    border-top: 1px solid #2d3748;
}

/* Blog Hero */
.blog-hero {
    background: linear-gradient(135deg, var(--color-bg-darker), var(--color-bg-dark));
    padding: 6rem 0;
    text-align: center;
    border-bottom: 1px solid var(--color-card-border);
}

.blog-hero h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.blog-hero h2 {
    font-size: 1.5rem;
    color: var(--color-text-meta);
}

/* Blog List */
.blog-list {
    padding: 4rem 0;
}

/* General Blog Card Styles */
.blog-card .featured-image-link {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 0.5rem;
}

.blog-card .featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}

/* Blog Card Placeholder */
.blog-card .featured-image-placeholder {
    width: 100%;
    height: 100%;
    background-color: var(--color-card-border);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-meta);
    font-size: 0.875rem;
}

.blog-card .featured-image-placeholder::before {
    content: 'No Image';
}

.blog-list-item {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 2rem;
    margin-bottom: 3rem;
    padding: 2rem;
    border: 1px solid var(--color-card-border);
    border-radius: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    clear: both;
}

.blog-list-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
    .blog-list-item {
        grid-template-columns: 576px 1fr !important;
        gap: 3rem;
    }
}

.blog-list-item:last-child {
    margin-bottom: 0;
}

.blog-list-item-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

@media (min-width: 768px) {
    .blog-list-item-image {
        width: 576px;
        height: 324px;
        flex-shrink: 0;
    }
}

.blog-list-item-image .featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}

.featured-image-placeholder {
    width: 100%;
    height: 100%;
    background-color: var(--color-card-border);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-meta);
    font-size: 0.875rem;
}

.featured-image-placeholder::before {
    content: 'No Image';
}

.featured-image-link {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 0.5rem;
}

@media (min-width: 768px) {
    .blog-list-item-image .featured-image {
        width: 576px;
        height: 324px;
        object-fit: cover;
        border-radius: 0.5rem;
    }
    
    .featured-image-placeholder {
        width: 576px;
        height: 324px;
    }
    
    .blog-list-item .featured-image-link {
        width: 576px;
        height: 324px;
        aspect-ratio: unset;
    }
}

.blog-list-item-content {
    display: flex;
    flex-direction: column;
}

.blog-list-item-content .blog-card-categories a {
    background-color: var(--color-accent-secondary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    margin-right: 0.5rem;
    text-transform: uppercase;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.blog-list-item-content .blog-card-categories a:hover {
    background-color: var(--color-accent-tertiary);
}

.blog-list-item-content .blog-card-title {
    font-size: 2rem;
    line-height: 1.2;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.blog-list-item-content .blog-card-excerpt {
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.blog-list-item-content .read-more-link {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
}

.read-more-link .lucide-arrow-right {
    transition: transform 0.3s ease;
    margin-left: 0.5rem;
}

.read-more-link:hover .lucide-arrow-right {
    transform: translateX(4px);
}

/* Pagination */
.pagination {
    margin-top: 2rem;
    text-align: center;
}

.pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.pagination .page-numbers {
    border: 1px solid var(--color-card-border);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
}

.pagination .page-numbers.current {
    background-color: var(--color-accent-primary);
    color: white;
    border-color: var(--color-accent-primary);
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--color-accent-primary);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 100;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

#back-to-top:hover {
    opacity: 1;
}

#back-to-top svg {
    width: 24px;
    height: 24px;
}

/* Single Post Styling */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.entry-content p,
.entry-content li,
.entry-content strong,
.entry-content em,
.entry-content a {
    color: var(--color-text-body) !important;
}

.entry-content p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.entry-content ul,
.entry-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.entry-content ul {
    list-style: disc;
}

.entry-content ol {
    list-style: decimal;
}

.entry-content li {
    margin-bottom: 0.5rem;
}

.entry-content blockquote {
    border-left: 4px solid var(--color-accent-primary);
    padding-left: 1.5rem;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
    color: var(--color-text-meta);
}

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: var(--color-text-meta);
}

.breadcrumbs a {
    color: var(--color-text-meta);
}

.breadcrumbs a:hover {
    color: var(--color-accent-primary);
}

/* Author Box */
.author-box {
    margin-top: 3rem;
    padding: 2rem;
    background-color: var(--color-bg-darker);
    border: 1px solid var(--color-card-border);
    border-radius: 0.5rem;
    display: flex;
    align-items: flex-start; /* Align items to the top */
    gap: 1.5rem; /* Space between avatar and text */
}

.author-box .avatar {
    width: 100px; /* Larger avatar */
    height: 100px; /* Larger avatar */
    border-radius: 50%;
    flex-shrink: 0; /* Prevent avatar from shrinking */
}

.author-box h4 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem; /* Larger author name */
    color: var(--color-text-headings);
}

.author-box p {
    font-size: 1rem; /* Adjust bio font size */
    line-height: 1.6;
    margin-bottom: 1rem;
}

.author-social-links {
    display: flex;
    gap: 1rem; /* Space between social links */
    flex-wrap: wrap; /* Allow links to wrap on smaller screens */
}

.author-social-links a {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: var(--color-accent-primary);
    color: white;
    border-radius: 0.25rem;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.author-social-links a:hover {
    background-color: var(--color-accent-primary-darker);
}

/* Post Pagination */
.post-pagination {
    margin-top: 3rem;
    display: flex;
    justify-content: space-between;
}

.post-pagination a {
    display: block;
    padding: 1rem;
    background-color: var(--color-bg-darker);
    border: 1px solid var(--color-card-border);
    border-radius: 0.5rem;
    width: 48%;
}

.post-pagination .prev-post {
    text-align: left;
}

.post-pagination .next-post {
    text-align: right;
}

/* E-E-A-T Meta Block */
.entry-meta-block {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    color: #d1d5db;
    font-size: 0.9rem;
}

.entry-meta-block .author-byline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.entry-meta-block .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Main Content Area */
.post-layout-wrapper {
    display: flex !important;
    gap: 5px;
    align-items: flex-start;
    margin-top: 2rem;
}

.toc {
    flex: 0 0 320px !important; /* Fixed width for ToC */
    position: sticky !important;
    top: 5.6rem !important; /* Sticks 5.6rem from top of viewport when scrolling */
    margin-top: 2rem !important; /* Pushes initial position down to align with featured image */
    background-color: var(--color-bg-darker);
    border: 1px solid var(--color-card-border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.toc-list li {
    font-size: 0.9rem; /* Smaller font size for ToC items */
}

.main-content-area {
    flex-grow: 1;
    max-width: 100%; /* Allow main content to take available space */
}

.entry-content {
    max-width: 1100px; /* Wider post body */
    margin: 0 auto;
}

/* Responsive adjustments */
@media (max-width: 1024px) { /* For tablets and smaller */
    .post-layout-wrapper {
        flex-direction: column !important;
        align-items: center;
    }

    .toc {
        position: static !important;
        width: 100% !important;
        max-width: 600px !important; /* Limit ToC width on tablets */
    }
}

@media (max-width: 768px) { /* For mobile */
    .toc {
        display: none !important; /* Hide ToC on mobile */
    }

    .entry-content {
        max-width: 100%; /* Full width on mobile */
        padding: 0 1rem; /* Add some padding */
    }
}

/* Table of Contents */
.toc-title {
    font-weight: bold;
    margin-bottom: 1rem;
    cursor: pointer;
}

.toc-list {
    list-style: none;
    padding-left: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    text-decoration: none;
}

/* Related Posts */
.related-posts {
    margin-top: 4rem;
}

.related-posts h3 {
    margin-bottom: 2rem;
}

.related-posts .blog-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem;
}

.related-posts .blog-card {
    display: grid !important;
    grid-template-columns: 200px 1fr !important;
    gap: 1.5rem;
    align-items: start;
    background-color: var(--color-bg-darker);
    padding: 1.5rem;
    border-radius: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    clear: both;
}

.related-posts .blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 7px 12px -3px rgba(0, 0, 0, 0.1);
}

.related-posts .featured-image-link {
    display: block;
    width: 200px;
    height: 112.5px;
    overflow: hidden;
    border-radius: 0.5rem;
}

.related-posts .featured-image {
    width: 200px;
    height: 112.5px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.related-posts .blog-card-content {
    padding: 0;
}

.related-posts .blog-card-title {
    font-size: 1.25rem;
    margin-top: 0;
}

.related-posts .blog-card-excerpt {
    display: none;
}

.related-posts .read-more-link {
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
}

/* Comments */
.comments-area {
    margin-top: 4rem;
    background-color: var(--color-bg-darker);
    border: 1px solid var(--color-card-border);
    border-radius: 0.5rem;
    padding: 2rem;
}

.comments-area .comment-form input,
.comments-area .comment-form textarea {
    background-color: var(--color-bg-dark);
    border: 1px solid var(--color-card-border);
    color: var(--color-text-body);
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.25rem;
}

.comments-area .comment-form .submit {
    background-color: var(--color-accent-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
}

/* Post Content Enhancements */
.entry-content hr {
    border: 0;
    height: 1px;
    background-color: var(--color-card-border);
    margin: 3rem 0;
}

.entry-content img {
    margin: 2rem 0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.entry-content a {
    text-decoration: underline;
    text-decoration-color: var(--color-accent-primary);
    text-underline-offset: 4px;
    transition: all 0.3s ease;
}

.entry-content a:hover {
    background-color: var(--color-accent-primary);
    color: var(--color-bg-darker) !important;
    text-decoration-color: var(--color-bg-darker);
}

/* Table Styles */
.entry-content .table-container {
    overflow-x: auto;
    margin: 2rem 0;
    border: 1px solid var(--color-card-border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem; /* Slightly larger font */
}

.entry-content th,
.entry-content td {
    padding: 1rem 1.25rem; /* More padding */
    text-align: left;
    border-bottom: 1px solid var(--color-card-border);
}

.entry-content td {
    color: var(--color-text-body);
}

.entry-content th {
    background-color: var(--color-bg-darker);
    font-weight: 700; /* Bolder */
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-headings);
    border-top: none;
    border-bottom-width: 2px; /* Thicker bottom border for header */
}

.entry-content tr {
    transition: background-color 0.2s ease-in-out;
}

.entry-content tr:last-child th,
.entry-content tr:last-child td {
    border-bottom: none;
}

.entry-content tr:hover {
    background-color: #2a3b50; /* A subtle hover effect */
}

.entry-content tr:nth-child(even) {
    background-color: transparent; /* Removing the zebra striping for a cleaner look with hover */
}

.entry-content table caption {
    caption-side: bottom;
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-meta);
    text-align: center;
}