/* Single post — aligned with Kerato/Laser dark UI; complements Tailwind utilities */
body.single-post-theme {
    background-color: #111621;
}

.single-post-page {
    font-family: "Vazirmatn", sans-serif !important;
    background-color: #111621;
    color: #cbd5e1;
    min-height: 60vh;
}

.single-post-page .bg-grid-pattern {
    background-image: linear-gradient(to right, #1e293b 1px, transparent 1px),
        linear-gradient(to bottom, #1e293b 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Breadcrumb — RTL: فلش‌ها به سمت «قدم بعدی» (سمت چپِ بصری) */
.single-post-breadcrumb {
    direction: rtl;
}

.single-post-breadcrumb__link {
    font-weight: 500;
}

.single-post-breadcrumb__sep {
    font-size: 1.125rem !important;
    width: 1.125rem !important;
    height: 1.125rem !important;
    line-height: 1.125rem !important;
    color: #64748b;
    opacity: 0.85;
    flex-shrink: 0;
    /* chevron_left در مسیر راست‌به‌چپ: از مقصد قبلی به بعدی */
    transform: none;
}

.single-post-breadcrumb__current {
    font-weight: 500;
}

/* Prose inside article — readable long-form */
.single-post-prose {
    font-size: 1.0625rem;
    line-height: 1.95;
    color: #cbd5e1;
}

.single-post-prose--body {
    position: relative;
    overflow: hidden;
}

.single-post-prose--body::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(23, 84, 207, 0.35) 35%,
        rgba(96, 165, 250, 0.25) 65%,
        transparent 100%
    );
    pointer-events: none;
}

.single-post-prose > *:first-child {
    margin-top: 0;
}

.single-post-prose > h2:first-of-type {
    margin-top: 0;
}

.single-post-prose h2,
.single-post-prose h3,
.single-post-prose h4 {
    scroll-margin-top: 6.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: right;
}

.single-post-prose h2 {
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    margin-top: 2.75rem;
    margin-bottom: 1.125rem;
    padding: 0 0 0.875rem 0;
    color: #f8fafc;
    position: relative;
    border-bottom: none;
    background: linear-gradient(90deg, rgba(23, 84, 207, 0.12) 0%, transparent 100%);
    border-radius: 0 0.5rem 0.5rem 0;
    padding-right: 1rem;
    padding-top: 0.35rem;
    padding-bottom: 0.75rem;
    border-right: 4px solid #1754cf;
    box-shadow: inset 0 -1px 0 rgba(51, 65, 85, 0.45);
}

.single-post-prose h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(23, 84, 207, 0.45), transparent);
}

.single-post-prose h3 {
    font-size: clamp(1.2rem, 2vw, 1.4rem);
    margin-top: 2.25rem;
    margin-bottom: 0.875rem;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.single-post-prose h3::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #3b82f6, #1754cf);
    box-shadow: 0 0 12px rgba(23, 84, 207, 0.55);
    flex-shrink: 0;
}

.single-post-prose h4 {
    font-size: 1.125rem;
    margin-top: 1.75rem;
    margin-bottom: 0.625rem;
    color: #e2e8f0;
    padding-right: 0.75rem;
    border-right: 2px solid rgba(100, 116, 139, 0.7);
}

.single-post-prose p {
    margin-bottom: 1.35rem;
    text-align: justify;
    color: #cbd5e1;
    font-size: 1.0625rem;
    line-height: 2.05;
}

.single-post-prose p.lead,
.single-post-prose .excerpt {
    font-size: 1.125rem;
    color: #e2e8f0;
}

.single-post-prose a {
    color: #7dd3fc;
    text-decoration: none;
    border-bottom: 1px solid rgba(125, 211, 252, 0.35);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    padding-bottom: 1px;
}

.single-post-prose a:hover {
    color: #bae6fd;
    border-bottom-color: rgba(186, 230, 253, 0.65);
    background: rgba(23, 84, 207, 0.12);
    border-radius: 0.15rem;
}

.single-post-prose ul,
.single-post-prose ol {
    margin: 1.25rem 0 1.5rem;
    padding-right: 1.35rem;
}

.single-post-prose ul {
    list-style: none;
}

.single-post-prose ul > li {
    position: relative;
    padding-right: 1.1rem;
}

.single-post-prose ul > li::before {
    content: "";
    position: absolute;
    right: 0;
    top: 0.65em;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: linear-gradient(135deg, #1754cf, #2563eb);
    opacity: 0.9;
}

.single-post-prose ol {
    list-style-type: decimal;
    padding-right: 1.5rem;
    margin: 1.25rem 0 1.5rem;
}

.single-post-prose ol > li {
    padding-right: 0.35rem;
    margin-bottom: 0.55rem;
}

.single-post-prose li {
    margin-bottom: 0.5rem;
    line-height: 1.95;
}

.single-post-prose blockquote {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    border-right: 4px solid #1754cf;
    border-left: none;
    background: linear-gradient(270deg, rgba(23, 84, 207, 0.12) 0%, rgba(15, 23, 42, 0.35) 100%);
    border-radius: 0.75rem 0 0 0.75rem;
    color: #e2e8f0;
    font-style: normal;
    box-shadow: 0 8px 32px -12px rgba(0, 0, 0, 0.35);
}

.single-post-prose blockquote p {
    margin-bottom: 0.75rem;
}

.single-post-prose blockquote p:last-child {
    margin-bottom: 0;
}

/* تصاویر داخل بدنه — کارت، سایه، حاشیه نرم */
.single-post-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
    display: block;
}

.single-post-prose p > img,
.single-post-prose .wp-block-image img,
.single-post-prose figure img {
    margin-right: auto;
    margin-left: auto;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.25),
        0 20px 40px -12px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.06);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

@media (hover: hover) {
    .single-post-prose p > img:hover,
    .single-post-prose .wp-block-image img:hover,
    .single-post-prose figure:hover img {
        transform: translateY(-2px) scale(1.01);
        box-shadow:
            0 8px 16px -4px rgba(0, 0, 0, 0.35),
            0 24px 48px -16px rgba(23, 84, 207, 0.15),
            0 0 0 1px rgba(255, 255, 255, 0.08);
    }
}

/*
 * Figures: avoid overflow:hidden + WP core display:table/table-caption on .wp-block-image,
 * which can draw the caption on top of the image. Use flex column so caption stays below.
 */
.single-post-prose figure {
    margin: 2rem auto;
    max-width: 100%;
    border-radius: 1rem;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.45);
    padding: 0.5rem;
    box-sizing: border-box;
    box-shadow: 0 12px 40px -16px rgba(0, 0, 0, 0.4);
}

.single-post-prose figure:has(figcaption),
.single-post-prose figure:has(.wp-caption-text) {
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.single-post-prose .wp-block-image,
.single-post-prose figure.wp-block-image,
.single-post-prose .wp-block-image figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.single-post-prose figure.wp-block-image.alignwide,
.single-post-prose figure.wp-block-image.alignfull,
.single-post-prose .wp-block-image.alignwide,
.single-post-prose .wp-block-image.alignfull {
    width: 100%;
    align-items: stretch;
}

.single-post-prose figure.wp-block-image.alignleft,
.single-post-prose .wp-block-image.alignleft {
    float: left;
    align-items: flex-start;
    margin: 0.5rem 0 0.5rem 1rem;
}

.single-post-prose figure.wp-block-image.alignright,
.single-post-prose .wp-block-image.alignright {
    float: right;
    align-items: flex-end;
    margin: 0.5rem 1rem 0.5rem 0;
}

[dir="rtl"] .single-post-prose figure.wp-block-image.alignleft,
[dir="rtl"] .single-post-prose .wp-block-image.alignleft {
    float: right;
    margin: 0.5rem 1rem 0.5rem 0;
}

[dir="rtl"] .single-post-prose figure.wp-block-image.alignright,
[dir="rtl"] .single-post-prose .wp-block-image.alignright {
    float: left;
    margin: 0.5rem 0 0.5rem 1rem;
}

.single-post-prose figure img {
    border-radius: 0.75rem;
    margin: 0 auto;
}

.single-post-prose .wp-block-image,
.single-post-prose .aligncenter {
    text-align: center;
}

.single-post-prose .alignwide {
    margin-right: auto;
    margin-left: auto;
    max-width: min(100%, 52rem);
}

/* Override WP block-library table-caption so text is normal flow under the image */
.single-post-prose .wp-block-image :where(figcaption),
.single-post-prose figure.wp-block-image :where(figcaption) {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    caption-side: unset;
    position: static;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.single-post-prose figcaption,
.single-post-prose .wp-caption-text {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-top: 0.75rem;
    padding: 0 0.5rem;
    line-height: 1.65;
    text-align: center;
    font-style: normal;
}

.single-post-prose .wp-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
    box-sizing: border-box;
    max-width: 100% !important;
    margin: 2rem auto;
}

.single-post-prose .wp-caption .wp-caption-text {
    width: 100%;
    max-width: 100%;
    position: static;
}

.single-post-prose pre,
.single-post-prose code {
    font-family: ui-monospace, monospace;
    font-size: 0.9em;
}

.single-post-prose pre {
    padding: 1rem;
    border-radius: 0.75rem;
    background: #0f172a;
    border: 1px solid #334155;
    overflow-x: auto;
}

.single-post-prose code {
    padding: 0.15em 0.4em;
    border-radius: 0.35rem;
    background: rgba(30, 41, 59, 0.9);
}

.single-post-prose pre code {
    padding: 0;
    background: none;
}

.single-post-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.single-post-prose th,
.single-post-prose td {
    border: 1px solid #334155;
    padding: 0.65rem 0.85rem;
    text-align: right;
}

.single-post-prose th {
    background: rgba(23, 84, 207, 0.15);
    color: #f1f5f9;
}

.single-post-prose tbody tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.35);
}

.single-post-prose hr {
    margin: 2.5rem 0;
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(51, 65, 85, 0.8), transparent);
}

/* TOC nav */
.single-post-toc {
    border: 1px solid rgba(51, 65, 85, 0.7);
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.65) 100%);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.single-post-toc__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.6);
    background: rgba(23, 84, 207, 0.06);
}

.single-post-toc__icon {
    font-size: 1.25rem;
    color: #1754cf;
}

.single-post-toc__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
}

.single-post-toc__list {
    list-style: none;
    margin: 0;
    padding: 0.75rem 0.5rem 1rem;
    max-height: min(60vh, 28rem);
    overflow-y: auto;
}

.single-post-toc__list::-webkit-scrollbar {
    width: 6px;
}

.single-post-toc__list::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.single-post-toc__item {
    margin: 0;
}

.single-post-toc__link {
    display: block;
    padding: 0.45rem 0.75rem 0.45rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #94a3b8;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    border-right: 2px solid transparent;
}

.single-post-toc__link:hover {
    color: #e2e8f0;
    background: rgba(23, 84, 207, 0.1);
}

.single-post-toc__link.is-active {
    color: #93c5fd;
    background: rgba(23, 84, 207, 0.15);
    border-right-color: #1754cf;
}

.single-post-toc__link--h2 {
    font-weight: 600;
    color: #cbd5e1;
}

.single-post-toc__link--h3 {
    padding-right: 1.25rem;
    font-size: 0.82rem;
}

.single-post-toc__link--h4 {
    padding-right: 2rem;
    font-size: 0.8rem;
    opacity: 0.95;
}

@media (max-width: 1023px) {
    .single-post-toc {
        margin-bottom: 0.5rem;
    }

    .single-post-toc__list {
        max-height: 14rem;
    }
}
