/* ========================================
   Blog Post Styling
   fr3akazo1d Personal Website
   ======================================== */

/* === BLOG POST CONTAINER === */
.blog-post {
    max-width: 1200px;
    margin: 100px auto 50px;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 255, 247, 0.2);
    border-radius: 8px;
    animation: fadeIn 1s ease;
}

/* === POST HEADER === */
.post-header {
    margin-bottom: 3rem;
    text-align: center;
    padding-bottom: 2rem;
    border-bottom: 2px solid rgba(0, 255, 247, 0.2);
}

.post-title {
    font-size: 3rem;
    color: var(--accent-cyan);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.post-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    color: var(--text-main);
    font-size: 0.95rem;
    flex-wrap: wrap;
}

.post-date {
    color: var(--accent-red);
    font-weight: 600;
}

.post-tag {
    background: rgba(0, 255, 247, 0.1);
    color: var(--accent-cyan);
    padding: 0.3rem 1rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 255, 247, 0.3);
}

.post-reading-time {
    color: var(--text-main);
    opacity: 0.7;
}

.post-author {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    color: var(--text-main);
}

.post-author img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-cyan);
}

/* === POST CONTENT === */
.post-content {
    line-height: 1.9;
    color: var(--text-main);
    font-size: 1.1rem;
}

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

.post-content h2 {
    font-size: 2rem;
    color: var(--accent-cyan);
    margin: 3rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 255, 247, 0.2);
}

.post-content h3 {
    font-size: 1.5rem;
    color: var(--accent-red);
    margin: 2rem 0 1rem;
}

.post-content h4 {
    font-size: 1.2rem;
    color: var(--text-bright);
    margin: 1.5rem 0 0.75rem;
}

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

.post-content li {
    margin-bottom: 0.75rem;
}

.post-content a {
    color: var(--accent-cyan);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-cyan);
    transition: all 0.3s ease;
}

.post-content a:hover {
    text-shadow: 0 0 10px var(--accent-cyan);
    border-bottom-color: transparent;
}

.post-content strong {
    color: var(--text-bright);
    font-weight: 600;
}

.post-content em {
    color: var(--accent-cyan);
    font-style: italic;
}

.post-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-main);
    border-left: 4px solid var(--accent-cyan);
    border-radius: 4px;
    font-style: italic;
    color: var(--text-main);
}

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

/* === CODE BLOCKS === */
.post-content pre {
    background: var(--bg-main);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid rgba(0, 255, 247, 0.3);
    margin: 2rem 0;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.6;
}

.post-content pre code {
    color: var(--text-main);
}

.post-content p code,
.post-content li code {
    background: rgba(0, 255, 247, 0.1);
    color: var(--accent-red);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Code syntax highlighting classes (for manual highlighting) */
.post-content .keyword {
    color: var(--accent-red);
}

.post-content .string {
    color: #98c379;
}

.post-content .comment {
    color: #5c6370;
    font-style: italic;
}

.post-content .function {
    color: var(--accent-cyan);
}

/* === IMAGES === */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
    border: 1px solid rgba(0, 255, 247, 0.2);
}

.post-content figure {
    margin: 2rem 0;
}

.post-content figcaption {
    text-align: center;
    color: var(--text-main);
    opacity: 0.7;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* === TABLES === */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
}

.post-content th,
.post-content td {
    padding: 0.75rem;
    border: 1px solid rgba(0, 255, 247, 0.2);
    text-align: left;
}

.post-content th {
    background: var(--bg-main);
    color: var(--accent-cyan);
    font-weight: 600;
}

.post-content tr:hover {
    background: rgba(0, 255, 247, 0.05);
}

/* === TERMINAL-STYLE CODE === */
.terminal-code {
    background: var(--bg-main);
    border: 1px solid rgba(0, 255, 247, 0.3);
    border-radius: 8px;
    overflow: hidden;
    margin: 2rem 0;
}

.terminal-code-header {
    background: #0a0e14;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(0, 255, 247, 0.2);
}

.terminal-code-header .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-code-header .dot.red { background: #ff5f56; }
.terminal-code-header .dot.yellow { background: #ffbd2e; }
.terminal-code-header .dot.green { background: #27c93f; }

.terminal-code-body {
    padding: 1.5rem;
}

.terminal-code-body .line {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.terminal-code-body .line-prompt {
    color: var(--accent-red);
}

.terminal-code-body .line-command {
    color: var(--accent-cyan);
}

.terminal-code-body .line-output {
    color: var(--text-main);
}

/* === POST FOOTER === */
.post-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid rgba(0, 255, 247, 0.2);
    text-align: center;
}

.post-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.post-tags .tag {
    background: rgba(255, 0, 60, 0.1);
    color: var(--accent-red);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 0, 60, 0.3);
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.post-tags .tag:hover {
    background: rgba(255, 0, 60, 0.2);
    transform: translateY(-2px);
}

.post-share {
    margin: 2rem 0;
}

.post-share h3 {
    color: var(--text-bright);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.share-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(0, 255, 247, 0.1);
    border: 1px solid var(--accent-cyan);
    border-radius: 4px;
    color: var(--accent-cyan);
    text-decoration: none;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: rgba(0, 255, 247, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 247, 0.3);
}

/* === BACK TO BLOG LINK === */
.back-to-blog {
    display: inline-block;
    margin: 2rem 0;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-cyan);
    border-radius: 4px;
    color: var(--accent-cyan);
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-to-blog:hover {
    transform: translateX(-10px);
    box-shadow: 0 0 20px rgba(0, 255, 247, 0.3);
}

/* === RELATED POSTS === */
.related-posts {
    margin-top: 4rem;
}

.related-posts h3 {
    color: var(--accent-cyan);
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.related-post-card {
    background: var(--bg-main);
    border: 1px solid rgba(0, 255, 247, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.related-post-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-cyan);
    box-shadow: 0 10px 30px rgba(0, 255, 247, 0.2);
}

.related-post-card h4 {
    color: var(--text-bright);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.related-post-card p {
    color: var(--text-main);
    font-size: 0.9rem;
    margin: 0;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .blog-post {
        margin: 80px 1rem 2rem;
        padding: 1.5rem;
    }
    
    .post-title {
        font-size: 2rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
    
    .post-content h2 {
        font-size: 1.5rem;
    }
    
    .post-content h3 {
        font-size: 1.25rem;
    }
    
    .post-meta {
        gap: 1rem;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
}

/* === PRINT STYLES === */
@media print {
    .nav-menu,
    .post-share,
    .related-posts,
    .back-to-blog {
        display: none;
    }
    
    .blog-post {
        max-width: 100%;
        border: none;
        box-shadow: none;
    }
    
    .post-content a {
        color: inherit;
        text-decoration: underline;
    }
}

/* === ENSURE CUSTOM CURSOR ON BLOG POSTS === */
body, body * {
    cursor: none !important;
}

.cursor {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.cursor-follower {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* === HIDE CUSTOM CURSOR ON TOUCH/MOBILE DEVICES === */
@media (hover: none), (pointer: coarse) {
    body, body * {
        cursor: auto !important;
    }
    .cursor,
    .cursor-follower {
        display: none !important;
        visibility: hidden !important;
    }
}

/* ==========================================
   TABLE OF CONTENTS SIDEBAR
   ========================================== */
.post-layout {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 2.5rem;
    align-items: start;
}

.post-layout .post-content {
    min-width: 0;
}

.toc-sidebar {
    position: sticky;
    top: 70px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    background: rgba(10, 14, 20, 0.7);
    border: 1px solid rgba(0, 255, 247, 0.15);
    border-radius: 6px;
    font-family: var(--font-mono);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 247, 0.15) transparent;
}

/* --- TOC prompt header --- */
.toc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid rgba(0, 255, 247, 0.12);
    background: rgba(0, 255, 247, 0.05);
    position: sticky;
    top: 0;
    z-index: 1;
    cursor: pointer;
    user-select: none;
}

.toc-header:hover { background: rgba(0, 255, 247, 0.09); }

.toc-prompt-wrap {
    flex: 1;
    min-width: 0;
}

.toc-prompt {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    white-space: normal;
    word-break: break-all;
    line-height: 1.5;
    display: block;
}

.toc-p-user   { color: var(--accent-cyan); }
.toc-p-at     { color: rgba(192,192,192,0.4); }
.toc-p-host   { color: var(--accent-red); }
.toc-p-suffix { color: rgba(192,192,192,0.4); }
.toc-p-cmd    { color: rgba(192,192,192,0.7); }
.toc-p-file   { color: var(--accent-cyan); opacity: 0.9; }

.toc-collapse {
    background: none;
    border: none;
    color: rgba(192, 192, 192, 0.5);
    font-family: var(--font-mono);
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.2rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: color 0.2s;
}
.toc-collapse:hover { color: var(--accent-cyan); }

/* --- collapsible nav panel --- */
.toc-nav {
    display: block;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.toc-sidebar.collapsed .toc-nav {
    max-height: 0;
}

/* --- ls -la total line --- */
.ls-total {
    padding: 0.3rem 0.6rem 0.15rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: rgba(192,192,192,0.3);
    user-select: none;
}

/* --- row structure --- */
.toc-list {
    list-style: none;
    margin: 0;
    padding: 0.15rem 0 0.4rem;
}

.toc-item {
    display: block;
    padding: 0.08rem 0.5rem;
    line-height: 1.5;
    border-left: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.toc-item.active {
    border-left-color: var(--accent-cyan);
    background: rgba(0,255,247,0.04);
}

.toc-item--h3 {
    padding-left: 1rem;
}

/* --- permissions + owner --- */
.ls-meta {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    user-select: none;
    white-space: nowrap;
}

.ls-perm  { color: rgba(192,192,192,0.22); }
.ls-owner { color: rgba(0,255,247,0.3); }

/* --- the clickable name --- */
.toc-link {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-decoration: none;
    transition: color 0.15s, text-shadow 0.15s;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* h2 = directory → cyan */
.toc-item--h2 .toc-link {
    color: var(--accent-cyan);
}

/* h3 = file → muted */
.toc-item--h3 .toc-link {
    color: rgba(192,192,192,0.5);
    font-size: 0.64rem;
}

/* hover */
.toc-item:hover .toc-link {
    color: #ffffff;
}

/* active / current section */
.toc-item.active .toc-link,
.toc-link.active {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(0,255,247,0.55);
}

/* Collapse to top bar on mobile */
@media (max-width: 1000px) {
    .post-layout {
        grid-template-columns: 1fr;
    }

    .toc-sidebar {
        position: static;
        max-height: none;
        margin-bottom: 1.5rem;
    }

    .toc-list {
        max-height: 220px;
        overflow-y: auto;
    }
}
