/**
 * Single Post — Pure CSS
 */

/* ── Layout ── */
.sh-single {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

@media (min-width: 768px) {
    .sh-single { padding: 4rem 1rem; }
}

.sh-single__layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .sh-single__layout {
        grid-template-columns: 2fr 1fr;
        gap: 3rem;
    }
}

.sh-single__main {
    width: 100%;
    min-width: 0;
}

/* ── Post Header ── */
.sh-single__header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--pi-border-light, #f1f5f9);
}

@media (min-width: 768px) {
    .sh-single__header {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

.sh-single__title {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--pi-text, #1e293b);
    margin: 0 0 1rem;
    line-height: 1.2;
}

@media (min-width: 768px) { .sh-single__title { font-size: 1.875rem; } }
@media (min-width: 1024px) { .sh-single__title { font-size: 2.25rem; } }

/* ── Meta ── */
.sh-single__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--pi-text-3, #94a3b8);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.sh-single__meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sh-single__meta-item--pill {
    background: var(--pi-bg-alt, #f3f4f6);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.sh-single__meta-item--accent {
    color: var(--pi-primary, #007d3d);
}

.sh-single__meta-icon {
    width: 1rem;
    height: 1rem;
}

/* ── Excerpt ── */
.sh-single__excerpt {
    font-size: 1rem;
    font-weight: 500;
    color: var(--pi-text-2, #475569);
    font-style: italic;
    border-left: 4px solid var(--pi-primary, #007d3d);
    padding-left: 1rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

/* ── Featured Image ── */
.sh-single__featured-img {
    overflow: hidden;
    border-radius: var(--pi-radius, 0.75rem);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--pi-border-light, #f1f5f9);
    background: var(--pi-bg-alt, #f3f4f6);
    aspect-ratio: 4 / 3;
    position: relative;
}

@media (min-width: 1024px) {
    .sh-single__featured-img { aspect-ratio: 16 / 9; }
}

.sh-single__thumbnail {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Table of Contents ── */
.sh-single__toc {
    background: var(--pi-bg-alt, #f3f4f6);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    border: 1px solid var(--pi-border, #e2e8f0);
}

.sh-single__toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.sh-single__toc-title {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--pi-text, #1e293b);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.sh-single__toc-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--pi-primary, #007d3d);
}

.sh-single__toc-toggle {
    color: var(--pi-text-3, #94a3b8);
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.sh-single__toc-toggle:hover {
    color: var(--pi-primary, #007d3d);
}

.sh-single__toc-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--pi-text-2, #475569);
    font-size: 0.875rem;
    font-weight: 500;
    list-style: disc;
    padding-left: 1.25rem;
    margin: 0;
}

/* ── Content Area ── */
.sh-single__content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--pi-text-2, #475569);
}

@media (min-width: 768px) {
    .sh-single__content { font-size: 1.125rem; }
}

.sh-single__content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 3rem;
    border-left: 4px solid var(--pi-primary, #007d3d);
    padding-left: 1rem;
    scroll-margin-top: 6rem;
}

@media (min-width: 768px) { .sh-single__content h2 { font-size: 1.875rem; } }

.sh-single__content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    scroll-margin-top: 6rem;
}

@media (min-width: 768px) { .sh-single__content h3 { font-size: 1.5rem; } }

.sh-single__content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--pi-radius, 0.75rem);
    margin: 1rem auto;
    display: block;
}

/* WordPress emoji images — keep inline at text size */
.sh-single__content img.emoji {
    display: inline !important;
    width: 1em !important;
    height: 1em !important;
    margin: 0 0.07em !important;
    vertical-align: -0.1em;
    border-radius: 0;
    box-shadow: none;
}

/* Prevent unsized SVGs in post content from expanding to fill container */
.sh-single__content svg:not([width]):not([class]) {
    max-width: 3rem;
    max-height: 3rem;
}

.sh-single__content svg {
    max-width: 100%;
    height: auto;
}

.sh-single__content figure {
    margin: 1.5rem auto;
    text-align: center;
}

.sh-single__content a {
    color: var(--pi-primary, #007d3d);
    text-decoration: underline;
}

.sh-single__content a:hover {
    color: var(--pi-secondary, #ffb703);
}

/* ── Tags ── */
.sh-single__tags {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--pi-border-light, #f1f5f9);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sh-single__tags-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--pi-text-muted, #64748b);
}

.sh-single__tag {
    background: var(--pi-bg-alt, #f3f4f6);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: var(--pi-text-2, #475569);
    text-decoration: none;
    transition: all 0.2s;
}

.sh-single__tag:hover {
    background: var(--pi-primary, #007d3d);
    color: #fff;
}

/* ── Author Box ── */
.sh-single__author {
    margin-top: 3rem;
    background: var(--pi-bg-alt, #f3f4f6);
    border: 1px solid transparent;
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

@media (min-width: 768px) {
    .sh-single__author {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        padding: 2rem;
    }
}

.sh-single__author-avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 4px solid var(--pi-bg-card, #ffffff);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.sh-single__author-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sh-single__author-name {
    font-weight: 700;
    color: var(--pi-text, #1e293b);
    font-size: 1.125rem;
    margin: 0 0 0.5rem;
}

.sh-single__author-bio {
    font-size: 0.875rem;
    color: var(--pi-text-2, #475569);
    margin: 0 0 1rem;
}

.sh-single__author-link {
    color: var(--pi-secondary, #ffb703);
    font-weight: 700;
    font-size: 0.875rem;
    text-decoration: none;
}

.sh-single__author-link:hover {
    text-decoration: underline;
}

/* ── Related Posts ── */
.sh-single__related {
    margin-top: 4rem;
}

.sh-single__related-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--pi-text, #1e293b);
    margin: 0 0 2rem;
    border-left: 4px solid var(--pi-secondary, #ffb703);
    padding-left: 1rem;
}

.sh-single__related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .sh-single__related-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* ── Lightbox ── */
.sh-single__lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.sh-single__lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: rgba(255, 255, 255, 0.8);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 10;
}

.sh-single__lightbox-close:hover {
    color: #fff;
}

.sh-single__lightbox-icon {
    width: 2rem;
    height: 2rem;
}

.sh-single__lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ── Reading Progress (from old single.css) ── */
#sh-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--pi-primary, #007d3d), var(--pi-primary-light, #00a84d));
    z-index: 9999;
    transition: width 0.12s linear;
    border-radius: 0 2px 2px 0;
    pointer-events: none;
}

/* ── TOC Active Link ── */
#toc-list a.toc-active {
    color: var(--pi-primary, #007d3d) !important;
    font-weight: 700;
    padding-left: 8px;
    border-left: 2px solid var(--pi-primary, #007d3d);
    margin-left: -10px;
}

#toc-list a {
    transition: color 0.2s, padding-left 0.2s;
}

/* ── Copy Button ── */
.sh-copy-btn.copied {
    background-color: var(--pi-primary, #007d3d) !important;
    color: #fff !important;
}

/* ── Dark Mode ── */
.dark .sh-single__header { border-bottom-color: transparent; }
.dark .sh-single__title { color: var(--pi-text, #f1f5f9); }
.dark .sh-single__meta { color: var(--pi-text-3, #94a3b8); }
.dark .sh-single__meta-item--pill { background: var(--pi-bg-elevated, #334155); }
.dark .sh-single__excerpt { color: var(--pi-text-2, #e2e8f0); }
.dark .sh-single__featured-img { background: var(--pi-bg-elevated, #334155); border-color: var(--pi-border, #334155); }
.dark .sh-single__toc { background: var(--pi-bg-card, #1e293b); border-color: var(--pi-border, #334155); }
.dark .sh-single__toc-title { color: var(--pi-text, #f1f5f9); }
.dark .sh-single__toc-list { color: var(--pi-text-2, #e2e8f0); }
.dark .sh-single__content { color: var(--pi-text-2, #e2e8f0); }
.dark .sh-single__content h2,
.dark .sh-single__content h3,
.dark .sh-single__content h4 { color: var(--pi-text, #f1f5f9); }
.dark .sh-single__content a { color: var(--pi-primary, #007d3d); }
.dark .sh-single__content a:hover { color: var(--pi-secondary, #fcd34d); }
.dark .sh-single__content blockquote { border-left-color: var(--pi-primary, #007d3d); color: var(--pi-text-2, #e2e8f0); }
.dark .sh-single__content strong { color: var(--pi-text, #f1f5f9); }
.dark .sh-single__content table th { background: var(--pi-bg-elevated, #334155); color: var(--pi-text, #f1f5f9); }
.dark .sh-single__content table td { border-color: var(--pi-border, #334155); }
.dark .sh-single__content code { background: var(--pi-bg-elevated, #334155); color: var(--pi-text-2, #e2e8f0); }
.dark .sh-single__content hr { border-color: var(--pi-border, #334155); }
.dark .sh-single__content svg { color: var(--pi-text, #f1f5f9); fill: currentColor; stroke: currentColor; }
.dark .sh-single__content svg[fill="none"] { fill: none; }
.dark .sh-single__tags { border-top-color: var(--pi-border, #334155); }
.dark .sh-single__tag { background: var(--pi-bg-elevated, #334155); color: var(--pi-text-2, #e2e8f0); }
.dark .sh-single__author { background: var(--pi-bg-card, #1e293b); border-color: var(--pi-border, #334155); }
.dark .sh-single__author-name { color: var(--pi-text, #f1f5f9); }
.dark .sh-single__author-bio { color: var(--pi-text-2, #e2e8f0); }
.dark .sh-single__author-avatar { border-color: var(--pi-bg-elevated, #334155); }
.dark .sh-single__related-title { color: var(--pi-text, #f1f5f9); }
