/* ===== Hugo Theme Daemon - Main CSS =====
 * Modular CSS with component imports
 */

/* Core Styles */
@import "components/variables.css";
@import "components/base.css";
@import "components/layout.css";

/* ===== Header ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--color-border-light);
    z-index: 1000;
    transition: all var(--transition-base);
}

.site-header .container {
    height: 100%;
}

.header-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-branding {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.site-logo img {
    height: 32px;
    width: auto;
}

.site-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--color-text);
}

.site-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    margin: 0;
}

.site-nav .nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-sm);
    align-items: center;
}

.site-nav .nav-menu a,
.site-nav .nav-menu button {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--font-sans);
}

.site-nav .nav-menu a:hover,
.site-nav .nav-menu button:hover {
    color: var(--color-text);
    background: var(--color-bg-secondary);
}

.site-nav .nav-menu a.active {
    color: var(--color-accent);
    background: rgba(0, 122, 255, 0.05);
}

.site-nav .icon {
    flex-shrink: 0;
}

/* ===== Footer ===== */
.site-footer {
    margin-top: var(--spacing-3xl);
    padding: var(--spacing-2xl) 0;
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border-light);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.footer-info p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
}

.social-links {
    display: flex;
    gap: var(--spacing-md);
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-full);
    color: var(--color-text-secondary);
    background: var(--color-bg);
    transition: all var(--transition-fast);
}

.social-links a:hover {
    color: var(--color-accent);
    background: var(--color-bg-secondary);
    transform: translateY(-2px);
}

/* ===== Home Page & Post Cards ===== */
.home-container {
    padding: var(--spacing-3xl) 0;
}

.section-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.posts-list {
    display: grid;
    gap: var(--spacing-lg);
}

.post-card {
    background: var(--color-bg);
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    padding: var(--spacing-xl);
    transition: all var(--transition-base);
    position: relative;
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border: 1px solid var(--color-border-light);
    background: var(--color-bg-tertiary);
}

.post-card *:focus {
    outline: none !important;
}

.post-card a:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.post-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.post-title a {
    color: var(--color-text);
    transition: color var(--transition-fast);
}

.post-title a:hover {
    color: var(--color-accent);
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    margin-bottom: var(--spacing-md);
}

.post-meta > * {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.post-summary {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--spacing-md);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-full);
    transition: all var(--transition-fast);
}

.tag:hover {
    color: var(--color-accent);
    background: rgba(0, 122, 255, 0.08);
}

/* ===== Post Single Page ===== */
.post-container {
    padding: var(--spacing-3xl) 0;
}

.post-content {
    max-width: 1000px;
    margin: 0 auto;
}

.post-header {
    margin-bottom: var(--spacing-3xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--color-border-light);
}

.post-header .post-title {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--spacing-lg);
}

.post-header .post-meta {
    margin-bottom: var(--spacing-lg);
}

.post-header .post-tags {
    margin-top: var(--spacing-lg);
}

.post-body {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-secondary);
}

.post-body h2 {
    margin-top: var(--spacing-3xl);
    margin-bottom: var(--spacing-lg);
    padding-top: 0;
}

.post-body h3 {
    margin-top: var(--spacing-2xl);
    margin-bottom: var(--spacing-md);
}

.post-body h4,
.post-body h5,
.post-body h6 {
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
}

.post-body ul,
.post-body ol {
    margin-bottom: var(--spacing-lg);
    padding-left: var(--spacing-xl);
}

.post-body li {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-secondary);
}

.post-body blockquote {
    margin: var(--spacing-xl) 0;
    padding-left: var(--spacing-lg);
    border-left: 3px solid var(--color-accent);
    color: var(--color-text-tertiary);
    font-style: italic;
}

.post-body table {
    width: 100%;
    margin: var(--spacing-xl) 0;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.post-body thead {
    background: var(--color-bg-secondary);
}

.post-body thead th {
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
}

.post-body tbody tr {
    border-bottom: 1px solid var(--color-border-light);
    transition: background-color var(--transition-fast);
}

.post-body tbody tr:last-child {
    border-bottom: none;
}

.post-body tbody tr:hover {
    background: var(--color-bg-tertiary);
}

.post-body tbody td {
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--color-text-secondary);
}

.post-body table code {
    font-size: 0.85em;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius-md);
    margin: var(--spacing-xl) 0;
    box-shadow: var(--shadow-sm);
}

.post-body code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: var(--border-radius-sm);
    color: var(--code-text);
}

.post-body pre {
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-lg);
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: var(--border-radius-md);
    overflow-x: auto;
    box-shadow: var(--shadow-xs);
}

.post-body pre code {
    padding: 0;
    background: transparent;
    border: none;
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.post-body .highlight {
    margin: var(--spacing-xl) 0;
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.post-body .highlight pre {
    margin: 0;
    border: none;
}

.post-footer {
    margin-top: var(--spacing-3xl);
    padding-top: var(--spacing-2xl);
    border-top: 1px solid var(--color-border-light);
}

.post-license {
    padding: var(--spacing-lg);
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-xl);
}

.post-license p {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.post-license p:last-child {
    margin-bottom: 0;
}

.post-navigation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

.post-navigation a {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-base);
}

.post-navigation a:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--color-accent);
}

.post-navigation .nav-next {
    justify-content: flex-end;
    text-align: right;
}

.post-navigation .nav-label {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-navigation .nav-title {
    display: block;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--color-text);
}

.post-comments {
    margin-top: var(--spacing-3xl);
    padding-top: var(--spacing-2xl);
    border-top: 1px solid var(--color-border-light);
}

/* ===== Tags & Categories Pages ===== */
.taxonomy-container {
    padding: var(--spacing-3xl) 0;
}

.page-header {
    text-align: center;
    margin-bottom: var(--spacing-3xl);
}

.page-title {
    font-size: var(--font-size-4xl);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--color-text);
}

.page-description {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
}

/* Modern Categories Grid */
.categories-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-3xl);
}

.category-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-xl);
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-lg);
    text-decoration: none;
    transition: all var(--transition-base);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent);
}

.category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #f5f5f7;
    border-radius: var(--border-radius-lg);
    flex-shrink: 0;
}

.category-icon svg {
    color: var(--color-accent);
}

.category-info {
    flex: 1;
    min-width: 0;
}

.category-card .category-name {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 var(--spacing-xs) 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-card .category-count {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    margin: 0;
}

/* Legacy taxonomy styles */
.tags-cloud,
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-3xl);
}

.tag-item,
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-base);
}

.tag-item:hover,
.category-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--color-accent);
}

.tag-name,
.category-name {
    font-weight: 500;
    color: var(--color-text);
}

.tag-count,
.category-count {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    background: var(--color-bg-secondary);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--border-radius-full);
}

/* ===== Archive Page ===== */
.archives-container {
    padding: var(--spacing-3xl) 0;
}

.archives-count {
    color: var(--color-text-tertiary);
    font-size: var(--font-size-base);
}

.archives-list {
    margin-top: var(--spacing-3xl);
}

.archive-year {
    margin-bottom: var(--spacing-3xl);
}

.year-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--spacing-2xl);
    position: relative;
    padding-left: var(--spacing-md);
}

.year-title:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--color-accent);
    border-radius: 2px;
}

.archive-posts {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.archive-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
    border-bottom: 1px dashed var(--color-border-light);
    transition: all var(--transition-fast);
    position: relative;
}

.archive-item:last-child {
    border-bottom: none;
}

.archive-item:hover {
    padding-left: var(--spacing-md);
}

.archive-date {
    flex-shrink: 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    min-width: 60px;
    padding-top: 2px;
}

.archive-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.archive-title {
    font-size: var(--font-size-lg);
    font-weight: 500;
    margin: 0;
}

.archive-title a {
    color: var(--color-text);
    transition: color var(--transition-fast);
}

.archive-item:hover .archive-title a {
    color: var(--color-accent);
}

.archive-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    padding: 4px 10px;
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-full);
}

.archive-category .icon {
    width: 12px;
    height: 12px;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-3xl);
    padding: var(--spacing-lg) 0;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.pagination-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 var(--spacing-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
    background: transparent;
    border: none;
    border-radius: var(--border-radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.pagination-number:hover {
    background: #f5f5f7;
}

.pagination-number.active {
    color: var(--color-accent);
    background: rgba(0, 122, 255, 0.05);
    font-weight: 500;
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    color: var(--color-text-tertiary);
    font-weight: 500;
}

.pagination-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #666;
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.pagination-nav:hover {
    color: var(--color-accent);
    background: transparent !important;
}

.pagination-nav .icon {
    flex-shrink: 0;
}

/* Legacy pagination styles - keep for other list pages */
/* Only apply to pagination arrows that are NOT using the new .pagination-nav class */
.pagination-prev:not(.pagination-nav),
.pagination-next:not(.pagination-nav) {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--color-text);
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.pagination-prev:not(.pagination-nav):hover,
.pagination-next:not(.pagination-nav):hover {
    background: var(--color-accent);
    color: white;
    transform: translateX(-2px);
}

.pagination-next:not(.pagination-nav):hover {
    transform: translateX(2px);
}

.pagination-prev:not(.pagination-nav).disabled,
.pagination-next:not(.pagination-nav).disabled {
    opacity: 0.4;
    pointer-events: none;
}

.pagination-info {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .toc-panel {
        width: 300px;
    }
}

@media (max-width: 768px) {
    :root {
        --spacing-3xl: 2.5rem;
        --spacing-2xl: 2rem;
        --font-size-4xl: 2rem;
        --font-size-3xl: 1.75rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: var(--spacing-md);
        padding: var(--spacing-md) 0;
    }
    
    .site-header {
        height: auto;
        position: relative;
    }
    
    .main-content {
        padding-top: 0;
    }
    
    .site-nav .nav-menu {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .post-navigation {
        grid-template-columns: 1fr;
    }
    
    .categories-grid,
    .tags-cloud {
        grid-template-columns: 1fr;
    }
    
    .archive-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .archive-date {
        min-width: auto;
    }
    
    .year-title {
        font-size: var(--font-size-2xl);
    }
}

@media (max-width: 480px) {
    .container,
    .container-wide {
        padding: 0 var(--spacing-md);
    }
    
    .post-card {
        padding: var(--spacing-lg);
    }
}

/* Import interactive components */
@import "components/search.css";
@import "components/toc.css";
@import "components/image-preview.css";
@import "components/reading-progress.css";
