/**
 * Blog Post Styles - Antikythera Technologies
 * Individual blog post page styling with Tokyo Night theme
 */

/* Breadcrumb Navigation */
.breadcrumb {
    padding: 2rem 0 1rem;
}

.breadcrumb__nav {
    display: flex;
    align-items: center;
}

.breadcrumb__link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.breadcrumb__link:hover {
    color: var(--primary);
    transform: translateX(-5px);
}

.breadcrumb__link i {
    font-size: 0.8rem;
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 1.5rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--bg-secondary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Error State */
.error-container {
    max-width: 600px;
    margin: 4rem auto;
    padding: 3rem;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    color: var(--danger);
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Post Layout */
.post {
    padding: 2rem 0 4rem;
}

.post .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.post-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Post Header */
.post__header {
    margin-bottom: 3rem;
}

.post__title {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.2;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

/* Post Meta Information */
.post__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
}

.post__meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.post__meta-item i {
    color: var(--primary);
    font-size: 0.8rem;
}

/* Tags */
.post__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--tag-bg, rgba(123, 162, 247, 0.1));
    color: var(--primary);
    border: 1px solid rgba(123, 162, 247, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.tag:hover {
    background: rgba(123, 162, 247, 0.2);
    transform: translateY(-2px);
}

.tag--small {
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
}

/* Featured Image */
.post__featured-image {
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.post__image {
    width: 100%;
    height: auto;
    display: block;
}

/* Post Content */
.post__content {
    padding: 2rem;
    margin-bottom: 3rem;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

/* Typography within post content */
.post__content h1,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.post__content h1 { font-size: 2rem; }
.post__content h2 { font-size: 1.75rem; }
.post__content h3 { font-size: 1.5rem; }
.post__content h4 { font-size: 1.25rem; }
.post__content h5 { font-size: 1.1rem; }
.post__content h6 { font-size: 1rem; }

.post__content p {
    margin-bottom: 1.5rem;
}

.post__content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: all 0.3s ease;
}

.post__content a:hover {
    color: var(--secondary);
    text-decoration-thickness: 2px;
}

.post__content ul,
.post__content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.post__content li {
    margin-bottom: 0.5rem;
}

.post__content blockquote {
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--primary);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-style: italic;
    color: var(--text-secondary);
}

/* Images within content */
.post__content img,
.post__content-image {
    max-width: 100%;
    height: auto;
    margin: 2rem 0;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Code blocks */
.post__content pre {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
}

.post__content code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
    padding: 0.2rem 0.4rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--accent);
}

.post__content pre code {
    padding: 0;
    background: none;
}

/* Tables */
.post__content table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
}

.post__content th,
.post__content td {
    padding: 0.75rem 1rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.post__content th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.post__content tr:hover {
    background: rgba(123, 162, 247, 0.05);
}

/* Key Takeaways Box */
.post__content .key-takeaways {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, rgba(123, 162, 247, 0.08) 0%, rgba(187, 154, 247, 0.08) 100%);
    border: 1px solid rgba(123, 162, 247, 0.25);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
}

.post__content .key-takeaways h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--primary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 700;
}

.post__content .key-takeaways ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.post__content .key-takeaways li {
    margin-bottom: 0.6rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.post__content .key-takeaways li:last-child {
    margin-bottom: 0;
}

/* Table of Contents */
.post__content .table-of-contents {
    margin: 2rem 0 2.5rem;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.post__content .table-of-contents h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.post__content .table-of-contents ul {
    margin-bottom: 0;
    padding-left: 0;
    list-style: none;
    counter-reset: toc-counter;
}

.post__content .table-of-contents li {
    counter-increment: toc-counter;
    margin-bottom: 0.5rem;
    padding-left: 0;
}

.post__content .table-of-contents li::before {
    content: counter(toc-counter) ".";
    color: var(--primary);
    font-weight: 600;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.post__content .table-of-contents li:last-child {
    margin-bottom: 0;
}

.post__content .table-of-contents a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.post__content .table-of-contents a:hover {
    color: var(--primary);
    text-decoration: none;
    padding-left: 4px;
}

/* Mobile adjustments for new components */
@media (max-width: 768px) {
    .post__content .key-takeaways {
        padding: 1.25rem 1.5rem;
        margin: 1.5rem 0;
    }

    .post__content .table-of-contents {
        padding: 1.25rem 1.5rem;
        margin: 1.5rem 0 2rem;
    }
}

/* Share Section */
.post__share {
    padding: 2rem;
    margin-bottom: 3rem;
    text-align: center;
}

.post__share-title {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

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

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.share-button i {
    font-size: 1.1rem;
}

.share-button--twitter {
    background: #1DA1F2;
}

.share-button--twitter:hover {
    background: #1a91da;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(29, 161, 242, 0.3);
}

.share-button--linkedin {
    background: #0077B5;
}

.share-button--linkedin:hover {
    background: #006ba1;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 119, 181, 0.3);
}

.share-button--copy {
    background: var(--primary);
}

.share-button--copy:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(123, 162, 247, 0.3);
}

.share-feedback {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--success);
    color: white;
    border-radius: var(--radius-md);
    display: inline-block;
    animation: fadeInOut 0.3s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Post Navigation (Previous/Next) */
.post-navigation {
    margin: 4rem auto 3rem;
    padding: 0;
    max-width: 1000px;
}

.post-nav-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    position: relative;
}

.post-nav-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 220px;
    
    /* Glassmorphism effect */
    background: rgba(26, 27, 38, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(123, 162, 247, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.post-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(123, 162, 247, 0.1) 0%,
        rgba(187, 154, 247, 0.1) 50%,
        rgba(125, 207, 255, 0.1) 100%
    );
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 1;
}

.post-nav-link:hover::before {
    opacity: 1;
}

.post-nav-link:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(123, 162, 247, 0.5),
        0 0 20px rgba(123, 162, 247, 0.3);
    border-color: rgba(123, 162, 247, 0.6);
}

.post-nav-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(135deg, #1a1b26 0%, #24283b 100%);
    overflow: hidden;
}

.post-nav-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s ease;
    opacity: 0.8;
}

.post-nav-link:hover .post-nav-image img {
    transform: scale(1.1);
    opacity: 1;
}

.post-nav-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(26, 27, 38, 0.9));
}

.post-nav-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    z-index: 2;
}

.post-nav-direction {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.post-nav-direction i {
    font-size: 0.7rem;
    color: var(--primary);
}

.post-nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.3;
    
    /* Text truncation for long titles */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.post-nav-link:hover .post-nav-title {
    color: var(--primary);
}

.post-nav-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    
    /* Truncate to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0.9;
}

.post-nav-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.6;
    font-weight: 500;
}

/* Navigation positioning */
.post-nav-link--prev {
    /* Previous article on the left */
}

.post-nav-link--next {
    /* Next article on the right */
}

.post-nav-link--prev .post-nav-direction {
    justify-content: flex-start;
}

.post-nav-link--next .post-nav-direction {
    justify-content: flex-end;
}

/* Single navigation item */
.post-nav-container:has(.post-nav-link:only-child) {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
}

/* Placeholder for posts without images */
.post-nav-image--placeholder {
    background: linear-gradient(
        135deg,
        rgba(123, 162, 247, 0.2) 0%,
        rgba(187, 154, 247, 0.2) 50%,
        rgba(125, 207, 255, 0.2) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-nav-image--placeholder i {
    font-size: 2rem;
    color: var(--primary);
    opacity: 0.5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .post-navigation {
        margin: 3rem auto 2rem;
        max-width: 100%;
    }
    
    .post-nav-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .post-nav-link {
        height: 180px;
    }
    
    .post-nav-image {
        height: 100px;
    }
    
    .post-nav-content {
        padding: 1rem;
    }
    
    .post-nav-title {
        font-size: 1rem;
    }
    
    .post-nav-direction {
        font-size: 0.7rem;
    }
    
    .post-nav-excerpt {
        font-size: 0.8rem;
    }
    
    .post-nav-container:has(.post-nav-link:only-child) {
        max-width: 100%;
    }
    
    .post-nav-link:hover {
        transform: translateY(-4px) scale(1.01);
    }
}

/* Related Posts */
.related-posts {
    margin-top: 4rem;
}

.related-posts__title {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.related-posts__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .post .container {
        padding: 0 1rem;
    }
    
    .post-container {
        max-width: 100%;
    }
    
    .post__title {
        font-size: 1.75rem;
    }
    
    .post__meta {
        gap: 1rem;
        font-size: 0.85rem;
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .post__meta-item {
        width: 100%;
        justify-content: flex-start;
    }
    
    .post__content {
        padding: 1.5rem;
        font-size: 1rem;
    }
    
    .post__content h1 { font-size: 1.5rem; }
    .post__content h2 { font-size: 1.3rem; }
    .post__content h3 { font-size: 1.2rem; }
    
    .share-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .post__share-buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .share-button {
        width: 200px;
        justify-content: center;
    }
    
    .related-posts__grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Tablet Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .post .container {
        padding: 0 1.5rem;
    }
    
    .post-container {
        max-width: 700px;
    }
    
    .post__meta {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .post__content {
        padding: 1.75rem;
    }
    
    .post-navigation {
        max-width: 900px;
    }
    
    .post-nav-link {
        height: 200px;
    }
    
    .post-nav-image {
        height: 110px;
    }
}

/* Large Desktop Responsive */
@media (min-width: 1440px) {
    .post .container {
        max-width: 1400px;
    }
    
    .post-navigation {
        max-width: 1200px;
    }
    
    .post-nav-link {
        height: 240px;
    }
    
    .post-nav-image {
        height: 130px;
    }
    
    .post-nav-title {
        font-size: 1.2rem;
    }
    
    .post-nav-excerpt {
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    .breadcrumb,
    .post__share,
    .related-posts,
    .footer,
    .header {
        display: none;
    }
    
    .post__content {
        background: white;
        color: black;
        box-shadow: none;
        padding: 0;
    }
    
    .post__title {
        color: black;
    }
}

/* Accessibility */
.share-button:focus,
.breadcrumb__link:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Dark mode adjustments (already built into Tokyo Night theme) */
.post__content pre {
    background: #0d1117;
    border-color: #30363d;
}

.post__content code {
    background: #161b22;
    color: #79c0ff;
}