/* ============================================================
   SINGLE POST — clean reading layout
   ============================================================ */

.single-post-page {
    --sp-primary: #0873ed;
    --sp-primary-dark: #075fd0;
    --sp-primary-light: #e8f3ff;
    --sp-navy: #092b50;
    --sp-body: #3a526c;
    --sp-muted: #52647d;
    --sp-border: #e8edf3;
    --sp-bg: #f8fafc;
    --sp-white: #ffffff;

    --sp-radius-sm: 8px;
    --sp-radius-md: 12px;
    --sp-radius-lg: 16px;

    --sp-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.03);
    --sp-shadow-md: 0 4px 15px rgba(29, 51, 80, 0.05);

    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--sp-bg);
    color: var(--sp-body);
    font-size: clamp(1.0625rem, 1rem + 0.2vw, 1.1875rem);
    line-height: 1.8;
    padding-bottom: clamp(40px, 6vw, 80px);
    -webkit-font-smoothing: antialiased;
}

.single-post-page *,
.single-post-page *::before,
.single-post-page *::after {
    box-sizing: border-box;
}

.single-post-page a { text-decoration: none; }
.single-post-page img { max-width: 100%; height: auto; display: block; }

/* Reading progress */
.sp-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: transparent;
    z-index: 9999;
    pointer-events: none;
}
.sp-progress-bar {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #0873ed, #2f9bff);
    transition: width 0.1s linear;
}

/* Container */
.sp-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: clamp(14px, 2.5vw, 28px) clamp(14px, 3vw, 40px);
    min-width: 0;
}

/* Breadcrumb */
.sp-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: clamp(14px, 2vw, 22px);
    font-size: 0.9375rem;
}
.sp-breadcrumb a {
    color: var(--sp-primary);
    font-weight: 500;
}
.sp-breadcrumb a:hover { color: var(--sp-primary-dark); }
.sp-breadcrumb-sep { color: #b5beca; }
.sp-breadcrumb-current {
    color: #111827;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ============================================================
   HEADER
   ============================================================ */
.sp-header {
    max-width: 900px;
    margin: 0 30px clamp(22px, 3vw, 36px);
    text-align: left;
}
.sp-category {
    display: inline-block;
    padding: 6px 14px;
    background: var(--sp-primary);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    border-radius: 4px;
    margin-bottom: 14px;
    transition: background 0.2s ease;
}
.sp-category:hover { background: var(--sp-primary-dark); color: #fff; }

.sp-title {
    color: var(--sp-navy);
    font-size: clamp(1.875rem, 1.5rem + 1.8vw, 2.875rem);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -1.1px;
    margin: 0 0 clamp(12px, 1.6vw, 18px);
}

.sp-excerpt {
    color: var(--sp-muted);
    font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
    line-height: 1.65;
    margin: 0 0 clamp(16px, 2vw, 24px);
    max-width: 780px;
}

.sp-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.sp-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #edf1f5;
    flex-shrink: 0;
}
.sp-meta-text { display: flex; flex-direction: column; gap: 2px; }
.sp-meta-author {
    color: #111a31;
    font-size: 1rem;
    font-weight: 700;
}
.sp-meta-detail {
    color: var(--sp-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}
.sp-meta-detail a { color: var(--sp-primary); font-weight: 500; }
.sp-meta-detail a:hover { color: var(--sp-primary-dark); }

/* ============================================================
   HERO IMAGE
   ============================================================ */
.sp-hero {
    max-width: 1100px;
    margin: 0 auto clamp(24px, 3vw, 40px);
    border-radius: var(--sp-radius-lg);
    overflow: hidden;
    box-shadow: var(--sp-shadow-md);
}
.sp-hero img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================================================
   MAIN GRID
   ============================================================ */
.sp-grid {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) clamp(260px, 26vw, 320px);
    gap: clamp(20px, 3vw, 44px);
    align-items: flex-start;
}

/* SHARE RAIL */
.sp-share {
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 6px;
}
.sp-share-label {
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--sp-muted);
    margin-bottom: 4px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    order: 2;
}
.sp-share-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--sp-white);
    border: 1px solid var(--sp-border);
    color: #52647d;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    position: relative;
}
.sp-share-btn:hover {
    transform: translateY(-2px);
    color: #ffffff;
    border-color: transparent;
}
.sp-share-btn.facebook:hover  { background: #1877f2; }
.sp-share-btn.x:hover         { background: #111111; }
.sp-share-btn.linkedin:hover  { background: #0a66c2; }
.sp-share-btn.whatsapp:hover  { background: #25d366; }
.sp-share-btn.copy:hover      { background: var(--sp-primary); }

.sp-share-toast {
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    background: #111;
    color: #fff;
    font-size: 0.8125rem;
    padding: 5px 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 5;
}
.sp-share-toast.visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ============================================================
   CONTENT
   ============================================================ */
.sp-content {
    min-width: 0;
    background: var(--sp-white);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius-lg);
    padding: clamp(24px, 3.5vw, 48px);
    box-shadow: var(--sp-shadow-sm);
}

.sp-content > * { max-width: 100%; }

.sp-content p {
    margin: 0 0 1.25em;
    color: var(--sp-body);
    line-height: 1.85;
}

.sp-content h2 {
    color: var(--sp-navy);
    font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
    font-weight: 800;
    line-height: 1.28;
    letter-spacing: -0.6px;
    margin: 2em 0 0.6em;
    scroll-margin-top: 90px;
}
.sp-content h3 {
    color: var(--sp-navy);
    font-size: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
    font-weight: 700;
    line-height: 1.35;
    margin: 1.8em 0 0.5em;
    scroll-margin-top: 90px;
}
.sp-content h4 {
    color: var(--sp-navy);
    font-size: 1.1875rem;
    font-weight: 700;
    margin: 1.6em 0 0.5em;
}

.sp-content a {
    color: var(--sp-primary);
    font-weight: 600;
    border-bottom: 1px solid rgba(8, 115, 237, 0.25);
    transition: color 0.2s ease, border-color 0.2s ease;
}
.sp-content a:hover {
    color: var(--sp-primary-dark);
    border-bottom-color: var(--sp-primary-dark);
}

.sp-content ul,
.sp-content ol {
    margin: 0 0 1.4em;
    padding-left: 1.5em;
}
.sp-content li {
    margin-bottom: 0.6em;
    line-height: 1.8;
}

.sp-content blockquote {
    margin: 1.8em 0;
    padding: 20px 24px;
    border-left: 4px solid var(--sp-primary);
    background: #f4f9ff;
    border-radius: 0 8px 8px 0;
    color: #1f3d61;
    font-size: 1.05em;
    line-height: 1.7;
    font-style: italic;
}

.sp-content code {
    background: #eef3f9;
    color: #c0392b;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 0.9375em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.sp-content pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 20px 22px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.9375rem;
    line-height: 1.7;
    margin: 1.6em 0;
}
.sp-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.sp-content img {
    border-radius: var(--sp-radius-md);
    margin: 1.4em 0;
}

.sp-content hr {
    border: 0;
    border-top: 1px solid var(--sp-border);
    margin: 2.2em 0;
}

.sp-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4em 0;
    font-size: 0.95em;
}
.sp-content th,
.sp-content td {
    padding: 12px 16px;
    border: 1px solid var(--sp-border);
    text-align: left;
}
.sp-content th {
    background: #f4f9ff;
    color: var(--sp-navy);
    font-weight: 700;
}

/* Tags */
.sp-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2em;
    padding-top: 1.4em;
    border-top: 1px solid var(--sp-border);
}
.sp-tag {
    display: inline-block;
    padding: 6px 14px;
    background: #f1f5fb;
    border: 1px solid #e3ebf5;
    color: var(--sp-muted);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 50px;
    transition: all 0.2s ease;
}
.sp-tag:hover {
    background: var(--sp-primary-light);
    border-color: #c9dffb;
    color: var(--sp-primary-dark);
}

/* Page links (multipage post) */
.sp-page-links {
    margin: 1.6em 0;
    padding: 14px 18px;
    background: #f4f9ff;
    border-radius: 8px;
    font-weight: 600;
}
.sp-page-links a {
    display: inline-block;
    margin: 0 6px;
    padding: 5px 12px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--sp-border);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sp-sidebar {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 2vw, 22px);
    min-width: 0;
    position: sticky;
    top: 90px;
    height: fit-content;
}

.sp-box {
    background: var(--sp-white);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius-lg);
    padding: clamp(18px, 2vw, 24px);
    box-shadow: var(--sp-shadow-sm);
}

.sp-box-title {
    color: var(--sp-navy);
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.3;
    margin: 0 0 14px;
}

/* Search */
.sp-search-form {
    display: flex;
    height: 42px;
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius-sm);
    overflow: hidden;
    background: #fbfdff;
}
.sp-search-form input {
    flex: 1;
    min-width: 0;
    padding: 0 12px;
    border: 0;
    outline: none;
    background: transparent;
    color: #1e293b;
    font-family: inherit;
    font-size: 0.9375rem;
}
.sp-search-form input::placeholder { color: #97a3b6; }
.sp-search-form button {
    width: 46px;
    flex: 0 0 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: var(--sp-primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}
.sp-search-form button:hover { background: var(--sp-primary-dark); }

/* Table of Contents */
.sp-toc {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sp-toc a {
    display: block;
    padding: 8px 10px 8px 12px;
    color: var(--sp-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: all 0.15s ease;
}
.sp-toc a:hover {
    background: #f4f9ff;
    color: var(--sp-primary);
}
.sp-toc a.active {
    background: #eef5ff;
    border-left-color: var(--sp-primary);
    color: var(--sp-primary);
    font-weight: 600;
}
.sp-toc a.toc-h3 {
    padding-left: 26px;
    font-size: 0.875rem;
}

/* Author box */
.sp-author-box { text-align: center; }
.sp-author-img {
    width: 76px;
    height: 76px;
    margin: 0 auto 12px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e8edf3;
}
.sp-author-name {
    color: var(--sp-navy);
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    margin: 0 0 3px;
}
.sp-author-role {
    color: var(--sp-primary);
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 10px;
}
.sp-author-bio {
    color: var(--sp-muted);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0 0 14px;
}
.sp-author-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 42px;
    border: 1.5px solid var(--sp-primary);
    border-radius: var(--sp-radius-sm);
    background: transparent;
    color: var(--sp-primary);
    font-size: 0.9375rem;
    font-weight: 700;
    transition: all 0.2s ease;
}
.sp-author-btn:hover {
    background: var(--sp-primary);
    color: #fff;
}

/* Newsletter */
.sp-newsletter-sub {
    color: var(--sp-muted);
    font-size: 0.9375rem;
    line-height: 1.55;
    margin: 0 0 12px;
}
.sp-newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sp-newsletter-form input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius-sm);
    background: #fbfdff;
    color: #1e293b;
    font-family: inherit;
    font-size: 0.9375rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.sp-newsletter-form input:focus {
    border-color: var(--sp-primary);
    box-shadow: 0 0 0 3px rgba(8, 115, 237, 0.12);
}
.sp-newsletter-form button {
    height: 44px;
    border: 0;
    border-radius: var(--sp-radius-sm);
    background: linear-gradient(135deg, #0866ee, #1763dc);
    color: #fff;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sp-newsletter-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(12, 88, 206, 0.22);
}
.sp-newsletter-note {
    color: #7c8491;
    font-size: 0.8125rem;
    margin: 10px 0 0;
    text-align: center;
}

/* Popular */
.sp-popular-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sp-popular-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.sp-popular-thumb {
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #eef2f7;
}
.sp-popular-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.sp-popular-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.sp-popular-title {
    color: #16294b;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}
.sp-popular-item:hover .sp-popular-title { color: var(--sp-primary); }
.sp-popular-date {
    color: #8a94a5;
    font-size: 0.8125rem;
}

/* ============================================================
   COMMENTS
   ============================================================ */
.sp-comments {
    max-width: 900px;
    margin: clamp(32px, 4vw, 56px) auto 0;
    padding: clamp(20px, 2.5vw, 32px);
    background: var(--sp-white);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius-lg);
    box-shadow: var(--sp-shadow-sm);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .sp-grid {
        grid-template-columns: 1fr;
    }
    .sp-share {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        padding: 10px 4px;
        order: -1;
    }
    .sp-share-label {
        writing-mode: horizontal-tb;
        transform: none;
        order: 0;
        margin-right: 4px;
    }
    .sp-sidebar {
        position: static;
    }
}

@media (max-width: 640px) {
    .sp-share-btn {
        width: 40px;
        height: 40px;
    }
    .sp-share-toast {
        left: 50%;
        top: calc(100% + 6px);
        transform: translateX(-50%) translateY(-4px);
    }
    .sp-share-toast.visible {
        transform: translateX(-50%) translateY(0);
    }
    .sp-content {
        padding: clamp(18px, 4vw, 26px);
    }
    .sp-title {
        letter-spacing: -0.6px;
    }
}