.post-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: calc(var(--nav-height) + 40px) 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: auto;
    display: flex;
    align-items: center;
}

.post-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(50deg, var(--accent), var(--primary), var(--accent));
    z-index: 0;
}

.post-hero::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
    z-index: 1;
}

.post-hero .container {
    position: relative;
    z-index: 1;
    max-width: 900px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 24px;
    transition: all 0.2s ease;
    opacity: 0.9;
}

.back-link:hover {
    gap: 12px;
    opacity: 1;
}

.post-header {
    margin-bottom: 0;
}

.post-meta-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.post-meta {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 0;
}

.post-title {
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.2;
    margin-bottom: 20px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post-subtitle {
    font-size: clamp(18px, 2.5vw, 22px);
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
    opacity: 0.9;
}

.post-wrapper {
    max-width: 750px;
    margin: 60px auto;
    padding: 0 24px;
}

.post-content {
    line-height: 1.7;
    color: var(--text-color);
}

.post-content p {
    margin-bottom: 24px;
    font-size: 18px;
}

.post-content h2 {
    font-size: 32px;
    margin: 48px 0 20px;
    color: var(--text-color);
}

.post-content h3 {
    font-size: 24px;
    margin: 36px 0 16px;
    color: var(--text-color);
}

.post-content ul {
    margin: 24px 0;
    padding-left: 24px;
}

.post-content li {
    margin-bottom: 12px;
    font-size: 18px;
}

.post-content blockquote {
    margin: 32px 0;
    padding: 24px;
    border-left: 3px solid var(--primary);
    background: var(--section-alt-bg);
    border-radius: 8px;
}

.post-content blockquote p {
    margin: 0;
    font-style: italic;
}

.post-content a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid var(--primary);
}

.post-content a:hover {
    opacity: 0.8;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 32px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-image-wrapper {
    margin: 32px 0;
}

.post-image-caption {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 8px;
    padding: 0 16px;
}

.callout {
    margin: 32px 0;
    padding: 24px;
    background: var(--section-alt-bg);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.callout strong {
    color: var(--primary);
}

.post-footer {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--section-alt-bg);
}

.share-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 24px;
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--section-alt-bg);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.share-button:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share-button svg {
    width: 18px;
    height: 18px;
}

.share-button.copy-link {
    cursor: pointer;
    border: none;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast-icon {
    width: 20px;
    height: 20px;
}

.post-views {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 16px;
    padding: 8px 0;
}

.post-views-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.post-views-hero {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.post-views-hero .post-views-icon {
    opacity: 0.9;
}

.post-footer-top {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 24px;
}

.post-reference {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
    transition: all 0.2s ease;
    cursor: pointer;
}

.post-reference:hover {
    opacity: 0.8;
    border-bottom-color: var(--accent);
}

.related-posts {
    margin-top: 80px;
    padding-top: 60px;
    border-top: 2px solid var(--section-alt-bg);
}

.related-posts h2 {
    font-size: 28px;
    margin-bottom: 32px;
    color: var(--primary);
    text-align: center;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.related-post-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--section-alt-bg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.related-post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.related-post-card:hover::before {
    transform: scaleX(1);
}

.related-post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.related-post-card.left-card {
    grid-column: 1;
}

.related-post-card.right-card {
    grid-column: -1;
}

.related-post-card-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    width: fit-content;
}

.related-post-card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-color);
    line-height: 1.3;
}

.related-post-card-excerpt {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    flex: 1;
}

.related-post-card-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--section-alt-bg);
}

@media (max-width: 768px) {
    .related-posts {
        margin-top: 60px;
        padding-top: 40px;
    }

    .related-posts h2 {
        font-size: 24px;
        margin-bottom: 24px;
    }

    .related-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .related-post-card.left-card,
    .related-post-card.right-card {
        grid-column: 1;
    }

    .post-hero {
        padding: calc(var(--nav-height) + 40px) 0 60px;
        min-height: 40vh;
    }

    .post-wrapper {
        margin: 40px auto;
    }

    .post-title {
        font-size: 32px;
    }

    .post-subtitle {
        font-size: 18px;
    }

    .post-content p,
    .post-content li {
        font-size: 16px;
    }

    .post-content h2 {
        font-size: 26px;
        margin: 36px 0 16px;
    }

    .post-content h3 {
        font-size: 22px;
    }
}

.reading-progress {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    z-index: 999;
    transition: width 0.1s ease;
}
.toc {
    background: var(--section-alt-bg);
    border-radius: 16px;
    padding: 28px;
    margin: 40px 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.toc-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
    opacity: 0.7;
}

.toc-title svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
    opacity: 0.8;
}

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

.toc-list li {
    margin-bottom: 6px;
    position: relative;
}

.toc-list a {
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 16px;
    display: block;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    padding-left: 24px;
}

.toc-list a::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.4;
    transition: all 0.2s ease;
}

.toc-list a:hover {
    background: var(--card-bg);
    color: var(--primary);
    padding-left: 28px;
}

.toc-list a:hover::before {
    background: var(--primary);
    opacity: 1;
    width: 6px;
    height: 6px;
}

.toc-list .toc-level-2 {
    padding-left: 32px;
    font-weight: 500;
}

.toc-list .toc-level-2::before {
    left: 16px;
}

.toc-list .toc-level-3 {
    padding-left: 48px;
    font-size: 14px;
    color: var(--text-secondary);
}

.toc-list .toc-level-3::before {
    left: 32px;
}

.toc-list a.active {
    background: var(--card-bg) !important;
    color: var(--primary) !important;
    font-weight: 600;
}

.toc-list a.active::before {
    background: var(--primary) !important;
    opacity: 1 !important;
    width: 6px !important;
    height: 6px !important;
}

.scroll-to-top-post {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--section-alt-bg);
    color: var(--text-secondary);
    border: 1px solid var(--section-alt-bg);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
}

.scroll-to-top-post svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.scroll-to-top-post.show {
    display: flex;
    opacity: 0.7;
    transform: translateY(0);
}

.scroll-to-top-post:hover {
    background: var(--section-alt-bg);
    color: var(--text-color);
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.scroll-to-top-post:hover svg {
    opacity: 1;
}

.code-block-wrapper {
    position: relative;
    margin: 24px 0;
}

.copy-code-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.code-block-wrapper:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.copy-code-btn.copied {
    background: var(--primary);
}

.post-content img.loaded {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media print {

    header,
    .post-footer,
    .related-posts,
    .scroll-to-top-post,
    .reading-progress {
        display: none !important;
    }

    .post-wrapper {
        max-width: 100%;
    }

    .post-content {
        font-size: 12pt;
        line-height: 1.6;
    }

    .post-content a {
        color: #000;
        text-decoration: underline;
    }

    .toc {
        page-break-inside: avoid;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-content>* {
    animation: fadeInUp 0.6s ease-out;
}

@media (max-width: 768px) {
    .toc {
        padding: 16px;
    }

    .toc-list .toc-level-2 {
        padding-left: 20px;
    }

    .toc-list .toc-level-3 {
        padding-left: 32px;
    }

    .share-buttons {
        position: static;
    }
}