/* Dark mode variables */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --accent: #2563eb;
    --border: #e5e7eb;
    --card-shadow: rgba(0, 0, 0, 0.03);
    --card-hover-shadow: rgba(0, 0, 0, 0.03);
    --profile-border: rgba(0, 0, 0, 0.08);
}

html.dark {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #60a5fa;
    --border: #404040;
    --card-shadow: rgba(0, 0, 0, 0.15);
    --card-hover-shadow: rgba(0, 0, 0, 0.15);
    --profile-border: rgba(255, 255, 255, 0.15);
}

/* Smooth scroll for anchor links */
html {
    scroll-behavior: smooth;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Geist","Geist Fallback",Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Navigation */
.nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 10;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

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

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

.nav svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
    color: var(--accent);
    background-color: var(--bg-secondary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
html.dark .theme-toggle .sun-icon { display: block; }
html.dark .theme-toggle .moon-icon { display: none; }

/* Hero section with profile */
.hero {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3.5rem;
    padding: 1rem 0;
}

.profile-container {
    position: relative;
    flex-shrink: 0;
    width: 160px;
    height: 160px;
}

.profile-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: left center;
}

.hero-content {
    flex: 1;
}

.hero h1 {
    font-family: 'Libre Baskerville', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    text-align: left;
}

.hero-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 0.75rem;
    text-align: left;
}

.hero-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    text-align: left;
}

.hero-desc a {
    color: var(--accent);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    justify-content: flex-start;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.social-links a:hover {
    background-color: var(--accent);
    color: white;
}

.social-links svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Content wrapper for flexbox reordering */
.content-wrapper {
    display: flex;
    flex-direction: column;
}

/* Mobile Quick Links - hidden on desktop */
.mobile-quick-links {
    display: none;
}

/* Search Box */
.search-container {
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-results-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    display: none;
}

.search-results-count.visible {
    display: block;
}

/* Categories */
.categories {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 3rem;
}

.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.category-tag {
    background: var(--bg-primary);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-tag .count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.25rem;
    opacity: 0.7;
}

.category-tag.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.category-tag.active .count {
    color: white;
    opacity: 0.9;
}

.category-tag:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.category-tag:hover .count {
    color: white;
}

/* Article List */
.article-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 2rem;
}

.article-list-item {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

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

.article-list-item:hover {
    background-color: var(--bg-secondary);
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-radius: 8px;
}

.article-list-item.hidden {
    display: none;
}

.article-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 100px;
}

.article-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    letter-spacing: -0.01em;
}

.article-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Year separator */
.year-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 2.5rem 0 1rem 0;
}

.year-separator:first-child {
    margin-top: 0;
}

.year-separator-line {
    display: none;
}

.year-separator-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.5rem;
}

.year-separator.hidden {
    display: none;
}

/* Footer */
.footer {
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

.footer a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    text-decoration: underline;
}

.heart {
    color: #e11d48;
    display: inline-block;
    margin: 0 0.25rem;
}

/* External link icon */
.external-link-icon {
    display: inline-block;
    margin-left: 0.25rem;
    vertical-align: middle;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1.25rem;
    }

    /* Reorder content on mobile: quick links, posts, then search and tags */
    .mobile-quick-links {
        display: flex;
        gap: 0.75rem;
        order: 0;
        margin-bottom: 1.5rem;
    }

    .quick-link {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.875rem;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .quick-link svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }

    .quick-link:hover,
    .quick-link:active {
        background: var(--accent);
        color: white;
        border-color: var(--accent);
    }

    .content-wrapper main {
        order: 1;
        margin-bottom: 2rem;
    }

    .content-wrapper .search-container {
        order: 2;
    }

    .content-wrapper .categories {
        order: 3;
    }

    .nav {
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        margin-bottom: 1.5rem;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 1.25rem;
        padding: 0 0.5rem;
        justify-content: flex-end;
    }

    .nav a {
        font-size: 0.875rem;
        gap: 0;
    }

    .nav a span {
        display: none;
    }

    .nav svg {
        display: block;
        width: 24px;
        height: 24px;
    }

    .hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 2.5rem;
        padding: 0.5rem 0;
        gap: 1.25rem;
    }

    .profile-container {
        width: 100px;
        height: 100px;
    }

    .hero h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
        text-align: center;
    }

    .hero-title {
        font-size: 1.1rem;
        text-align: center;
    }

    .hero-desc {
        font-size: 1rem;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    .categories {
        padding: 1.5rem;
    }

    .article-list-item {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem 0;
    }

    .article-list-item:hover {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .article-date {
        min-width: auto;
    }

    .article-title {
        font-size: 1rem;
    }
}
