/**
 * Nebula Theme - Single Article Page Styles
 * Modern Design v3.0 - 2024/2025 Consumer Web Standards
 */

/* ============================
   Reading Progress Bar
   ============================ */

.nebula-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: var(--z-toast, 800);
}

.nebula-reading-progress__bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-400), var(--primary-600));
    transition: width 0.1s ease-out;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.6);
}

/* ============================
   Article Header - Modern Style
   ============================ */

.nebula-article-header {
    position: relative;
    padding: 64px 0 56px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-primary);
}

.nebula-article-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-400), var(--primary-600), var(--primary-400));
    background-size: 200% 100%;
    animation: gradient-slide 3s ease-in-out infinite;
}

@keyframes gradient-slide {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.nebula-article-header__cats {
    margin-bottom: 20px;
}

.nebula-article-header__cat {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: #fff;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.nebula-article-header__cat:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.4);
    color: #fff;
}

.nebula-article-header__title {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 24px;
    max-width: 900px;
    letter-spacing: var(--tracking-tight);
}

.nebula-article-header__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--border-primary);
    border-bottom: 1px solid var(--border-primary);
}

.nebula-article-header__author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nebula-article-header__avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 2px solid var(--primary-200);
    transition: border-color var(--duration-fast) var(--ease-out);
}

.nebula-article-header__author:hover .nebula-article-header__avatar {
    border-color: var(--primary-500);
}

.nebula-article-header__author-info {
    display: flex;
    flex-direction: column;
}

.nebula-article-header__author-name {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

.nebula-article-header__author-name:hover {
    color: var(--primary-500);
}

.nebula-article-header__date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.nebula-article-header__stats {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nebula-article-header__views,
.nebula-article-header__comments {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.nebula-article-header__share {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nebula-article-header__share-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.nebula-article-header__share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.nebula-article-header__share-btn:hover {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* ============================
   Featured Image - Modern Style
   ============================ */

.nebula-article-featured-image {
    padding: 40px 0;
    background: var(--bg-primary);
}

.nebula-article-featured-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    transition: transform var(--duration-slow) var(--ease-out), box-shadow var(--duration-slow) var(--ease-out);
}

.nebula-article-featured-image img:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-2xl);
}

/* ============================
   Article Content - Modern Typography
   ============================ */

.nebula-article-content-wrapper {
    padding: 56px 0;
}

.nebula-article-layout {
    display: flex;
    gap: 48px;
    align-items: flex-start;
}

.nebula-article-main {
    flex: 1;
    min-width: 0;
}

.nebula-article-content {
    font-size: var(--text-lg);
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: var(--content-max-width);
}

.nebula-article-content h2 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 48px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-primary);
    letter-spacing: var(--tracking-tight);
}

.nebula-article-content h3 {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 36px 0 16px;
}

.nebula-article-content p {
    margin-bottom: 24px;
}

.nebula-article-content a {
    color: var(--primary-500);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--duration-fast) var(--ease-out);
}

.nebula-article-content a:hover {
    color: var(--primary-600);
}

.nebula-article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-xl);
    margin: 32px 0;
    box-shadow: var(--shadow-lg);
}

.nebula-article-content blockquote {
    position: relative;
    margin: 40px 0;
    padding: 28px 32px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary-500);
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    font-style: italic;
    font-size: var(--text-lg);
}

.nebula-article-content blockquote::before {
    content: '"';
    position: absolute;
    top: 8px;
    left: 16px;
    font-size: 48px;
    color: var(--primary-300);
    font-family: Georgia, serif;
    line-height: 1;
}

.nebula-article-content blockquote p:last-child {
    margin-bottom: 0;
}

.nebula-article-content pre,
.nebula-article-content code {
    font-family: var(--nebula-font-mono, "JetBrains Mono", monospace);
}

.nebula-article-content pre {
    background: var(--neutral-900);
    color: var(--neutral-100);
    padding: 24px 28px;
    border-radius: var(--radius-xl);
    overflow-x: auto;
    margin: 32px 0;
    font-size: var(--text-sm);
    line-height: 1.6;
    box-shadow: var(--shadow-inner);
}

.nebula-article-content code {
    background: var(--bg-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--primary-600);
}

.nebula-article-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.nebula-article-content ul,
.nebula-article-content ol {
    margin: 24px 0;
    padding-left: 28px;
}

.nebula-article-content li {
    margin-bottom: 10px;
}

.nebula-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.nebula-article-content th,
.nebula-article-content td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-primary);
}

.nebula-article-content th {
    background: var(--bg-secondary);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
}

.nebula-article-content tr:last-child td {
    border-bottom: none;
}

.nebula-article-content tr:hover td {
    background: var(--bg-secondary);
}

/* ============================
   Alert Boxes - Modern Style
   ============================ */

.nebula-article-content .wp-block-alert,
.nebula-article-content .alert,
.nebula-article-content [class*="alert-"] {
    position: relative;
    margin: 32px 0;
    padding: 20px 24px 20px 60px;
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
}

.nebula-article-content .wp-block-alert::before,
.nebula-article-content .alert::before,
.nebula-article-content [class*="alert-"]::before {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
}

.nebula-article-content .alert-info {
    background: var(--primary-50);
    color: var(--primary-700);
    border-left: 4px solid var(--primary-500);
}

.nebula-article-content .alert-info::before { content: "💡"; }

.nebula-article-content .alert-success,
.nebula-article-content .alert-tip {
    background: var(--success-50);
    color: var(--success-700);
    border-left: 4px solid var(--success-500);
}

.nebula-article-content .alert-success::before { content: "✅"; }
.nebula-article-content .alert-tip::before { content: "👍"; }

.nebula-article-content .alert-warning {
    background: var(--warning-50);
    color: var(--warning-700);
    border-left: 4px solid var(--warning-500);
}

.nebula-article-content .alert-warning::before { content: "⚠️"; }

.nebula-article-content .alert-error {
    background: var(--error-50);
    color: var(--error-700);
    border-left: 4px solid var(--error-500);
}

.nebula-article-content .alert-error::before { content: "❌"; }

/* ============================
   Article Footer
   ============================ */

.nebula-article-footer {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-primary);
}

/* Tags */
.nebula-article-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

.nebula-article-tags__label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-muted);
}

.nebula-article-tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.nebula-article-tag:hover {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

/* Author Bio */
.nebula-article-author-bio {
    display: flex;
    gap: 24px;
    padding: 28px;
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
    margin-bottom: 32px;
}

.nebula-article-author-bio__avatar {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    border: 3px solid var(--primary-200);
    flex-shrink: 0;
}

.nebula-article-author-bio__content {
    flex: 1;
}

.nebula-article-author-bio__name {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: 8px;
}

.nebula-article-author-bio__desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.nebula-article-author-bio__link {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--primary-500);
    text-decoration: none;
}

.nebula-article-author-bio__link:hover {
    color: var(--primary-600);
    text-decoration: underline;
}

/* Related Posts */
.nebula-related-posts {
    margin-top: 48px;
}

.nebula-related-posts__title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary-500);
}

/* ============================
   Like Button - Modern Style
   ============================ */

.nebula-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.nebula-like-btn:hover {
    border-color: var(--error-400);
    color: var(--error-500);
}

.nebula-like-btn.liked {
    background: var(--error-50);
    border-color: var(--error-400);
    color: var(--error-500);
}

.nebula-like-btn__icon {
    transition: transform var(--duration-fast) var(--ease-spring);
}

.nebula-like-btn:hover .nebula-like-btn__icon {
    transform: scale(1.2);
}

.nebula-like-btn.liked .nebula-like-btn__icon {
    animation: heart-beat 0.6s ease-in-out;
}

@keyframes heart-beat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1); }
    75% { transform: scale(1.2); }
}

/* ============================
   Article Navigation
   ============================ */

.nebula-article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-primary);
}

.nebula-article-nav__item {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.nebula-article-nav__item:hover {
    background: var(--primary-50);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nebula-article-nav__label {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    margin-bottom: 8px;
}

.nebula-article-nav__title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    line-height: 1.4;
    transition: color var(--duration-fast) var(--ease-out);
}

.nebula-article-nav__item:hover .nebula-article-nav__title {
    color: var(--primary-600);
}

.nebula-article-nav__item--next {
    text-align: right;
}

/* ============================
   Responsive Design
   ============================ */

@media (max-width: 768px) {
    .nebula-article-header {
        padding: 48px 0 40px;
    }

    .nebula-article-header__title {
        font-size: var(--text-2xl);
    }

    .nebula-article-header__meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .nebula-article-header__stats {
        width: 100%;
        justify-content: flex-start;
    }

    .nebula-article-featured-image {
        padding: 24px 0;
    }

    .nebula-article-featured-image img {
        border-radius: var(--radius-xl);
    }

    .nebula-article-content-wrapper {
        padding: 32px 0;
    }

    .nebula-article-content {
        font-size: var(--text-base);
    }

    .nebula-article-content h2 {
        font-size: var(--text-xl);
    }

    .nebula-article-content blockquote {
        padding: 20px 24px 20px 48px;
        margin: 24px 0;
    }

    .nebula-article-author-bio {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .nebula-article-nav {
        grid-template-columns: 1fr;
    }

    .nebula-article-nav__item--next {
        text-align: left;
    }

    .nebula-toc-sidebar {
        display: none;
    }
}

/* ============================
   TOC Sidebar - Right Sidebar Style
   ============================ */

.nebula-toc-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 24px);
    max-height: calc(100vh - var(--header-height) - 48px);
    overflow-y: auto;
    align-self: flex-start;
}

.nebula-toc-sidebar__inner {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.nebula-toc-sidebar__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-50), var(--bg-secondary));
    border-bottom: 1px solid var(--border-primary);
}

.nebula-toc-sidebar__icon {
    color: var(--primary-500);
    flex-shrink: 0;
}

.nebula-toc-sidebar__title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.nebula-toc-sidebar__nav {
    padding: 16px 20px;
    max-height: 400px;
    overflow-y: auto;
}

.nebula-toc-sidebar__nav::-webkit-scrollbar {
    width: 4px;
}

.nebula-toc-sidebar__nav::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 2px;
}

.nebula-toc-sidebar__nav::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}

/* TOC Items */
.nebula-toc-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 12px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-out);
    border-left: 2px solid transparent;
    margin-bottom: 4px;
    line-height: 1.5;
}

.nebula-toc-item::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--neutral-300);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
    margin-right: 10px;
    transition: all var(--duration-fast) var(--ease-out);
}

.nebula-toc-item:hover {
    color: var(--primary-600);
    background: var(--primary-50);
}

.nebula-toc-item:hover::before {
    background: var(--primary-500);
}

.nebula-toc-item.active {
    color: var(--primary-600);
    background: var(--primary-50);
    border-left-color: var(--primary-500);
    font-weight: var(--font-medium);
}

.nebula-toc-item.active::before {
    background: var(--primary-500);
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.4);
}

/* H3 items (nested) */
.nebula-toc-item--h3 {
    padding-left: 28px;
    font-size: var(--text-xs);
}

.nebula-toc-item--h3::before {
    width: 5px;
    height: 5px;
    margin-right: 8px;
}

/* TOC Progress */
.nebula-toc-sidebar__progress {
    height: 3px;
    background: var(--border-primary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    overflow: hidden;
}

.nebula-toc-sidebar__progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-400), var(--primary-600));
    transition: width 0.15s ease-out;
}

/* TOC Mobile - Hidden by default */
@media (max-width: 1200px) {
    .nebula-toc-sidebar {
        display: none;
    }
}

/* TOC Mobile Toggle Button (optional enhancement) */
.nebula-toc-mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.nebula-toc-mobile-toggle:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    color: var(--primary-600);
}

@media (max-width: 1200px) {
    .nebula-toc-mobile-toggle {
        display: flex;
    }
}

/* ============================
   Dark Mode
   ============================ */

[data-theme="dark"] .nebula-article-header {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

[data-theme="dark"] .nebula-article-content blockquote {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .nebula-article-content pre {
    background: var(--neutral-800);
    color: var(--neutral-200);
}

[data-theme="dark"] .nebula-article-author-bio {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .nebula-article-nav__item {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .nebula-article-nav__item:hover {
    background: var(--primary-900);
}

/* TOC Sidebar Dark Mode */
[data-theme="dark"] .nebula-toc-sidebar__inner {
    background: var(--bg-secondary);
    border-color: var(--border-primary);
}

[data-theme="dark"] .nebula-toc-sidebar__header {
    background: linear-gradient(135deg, var(--neutral-800), var(--bg-tertiary));
    border-color: var(--border-primary);
}

[data-theme="dark"] .nebula-toc-sidebar__title {
    color: var(--text-primary);
}

[data-theme="dark"] .nebula-toc-item {
    color: var(--text-secondary);
}

[data-theme="dark"] .nebula-toc-item:hover {
    color: var(--primary-400);
    background: rgba(14, 165, 233, 0.1);
}

[data-theme="dark"] .nebula-toc-item.active {
    color: var(--primary-400);
    background: rgba(14, 165, 233, 0.15);
    border-left-color: var(--primary-400);
}

[data-theme="dark"] .nebula-toc-sidebar__progress {
    background: var(--border-primary);
}
