/* Single Post Header (Title) */
.single-header {
    margin-top: 2rem;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
}

/* Mobile-only category - hidden by default */
.single-header__categories--mobile {
    display: none;
}

.single-header__title {
    margin: 0;
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.25;
    color: #111827;
    letter-spacing: -0.025em;
    width: 100%;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Single Post Content */
.single-content {
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
}

/* Content Typography */
.single-content .entry-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #374151;
}

.single-content .entry-content > *:first-child {
    margin-top: 0;
}

.single-content .entry-content > *:last-child {
    margin-bottom: 0;
}

/* Constrain all injected content including ads */
.single-content .entry-content > * {
    max-width: 100%;
}

.single-content .entry-content > div,
.single-content .entry-content > ins,
.single-content .entry-content > iframe {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.single-content .entry-content p {
    margin-bottom: 1.5rem;
}

.single-content .entry-content a {
    color: var(--theme-secondary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.single-content .entry-content a:hover {
    color: var(--theme-primary);
}

.single-content .entry-content h2,
.single-content .entry-content h3,
.single-content .entry-content h4 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #374151;
    font-weight: 700;
    line-height: 1.3;
}

.single-content .entry-content h2 {
    font-size: 1.75rem;
}

.single-content .entry-content h3 {
    font-size: 1.375rem;
}

.single-content .entry-content h4 {
    font-size: 1.125rem;
}

.single-content .entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
}

.single-content .entry-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: #f9fafb;
    border-left: 4px solid var(--theme-primary);
    border-radius: 0 12px 12px 0;
    font-style: italic;
    color: #4b5563;
}

.single-content .entry-content blockquote p:last-child {
    margin-bottom: 0;
}

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

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

.single-content .entry-content pre {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #1f2937;
    color: #f9fafb;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 0.875rem;
}

.single-content .entry-content code {
    padding: 0.125rem 0.375rem;
    background: #f3f4f6;
    border-radius: 4px;
    font-size: 0.875em;
}

.single-content .entry-content pre code {
    padding: 0;
    background: transparent;
    border-radius: 0;
}

/* Page Links */
.single-content .page-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.single-content .page-links__label {
    font-weight: 600;
    color: #374151;
}

.single-content .page-links__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    background: #f3f4f6;
    border-radius: 6px;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s ease;
}

.single-content .page-links__item:hover {
    background: var(--theme-primary);
    color: #fff;
}

/* Entry Footer / Tags */
.single-content .entry-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.single-content .entry-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.single-content .entry-tags__label {
    font-weight: 600;
    color: #374151;
    margin-right: 0.25rem;
}

.single-content .entry-tags__tag {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    background: rgba(15, 76, 129, 0.08);
    color: var(--theme-primary);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.single-content .entry-tags__tag:hover {
    background: rgba(15, 76, 129, 0.15);
}

/* =============================================
   Back to Top Button (Mobile Only)
   ============================================= */
.back-to-top {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 1rem;
    width: 56px;
    height: 56px;
    background: var(--theme-secondary);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(100px);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--theme-primary);
    transform: translateY(-2px);
}

.back-to-top:active {
    transform: translateY(0);
}

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

/* =============================================
   MOBILE RESPONSIVE STYLES
   ============================================= */
@media (max-width: 768px) {
    /* Show back to top button on mobile */
    .back-to-top {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Ensure single wrapper doesn't overflow */
    .single-wrapper {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
    }

    /* Show mobile category above title */
    .single-header__categories--mobile {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .single-header__category {
        display: inline-block;
        padding: 0.25rem 0.6rem;
        background: rgba(15, 76, 129, 0.08);
        color: var(--theme-primary);
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-radius: 4px;
        transition: background 0.15s ease;
    }

    .single-header__category:hover {
        background: rgba(15, 76, 129, 0.15);
    }

    .single-header {
        margin-top: 1rem;
        margin-bottom: 0.75rem;
    }

    .single-header__title {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .single-content .entry-content {
        font-size: 1.0625rem;
        line-height: 1.7;
    }

    .single-content .entry-content h2 {
        font-size: 1.5rem;
        margin-top: 1.5rem;
        margin-bottom: 1rem;
    }

    .single-content .entry-content h3 {
        font-size: 1.25rem;
        margin-top: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .single-content .entry-content h4 {
        font-size: 1.125rem;
    }

    /* Ensure images don't overflow */
    .single-content .entry-content img {
        width: 100%;
        height: auto;
        max-width: 100%;
    }

    /* Ensure tables are scrollable on mobile */
    .single-content .entry-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
