:root {
    --primary-color: #005fcc;
    --background-color: #f6f6ef;
    --text-color: #1a1a1a;
    --secondary-text: #555555;
    --card-background: white;
    --border-color: #ced4da;
    --blockquote-background: #f0f0f0;
    --hot-gradient: linear-gradient(135deg, #f8f4ff 0%, #f0e6ff 50%, #e6d9ff 100%);
    --hot-border: #6f42c1;
    --hot-text: #1a1a1a;
}

[data-theme="dark"] {
    --primary-color: #8be9fd;
    --background-color: #1a1b26;
    --text-color: #f8f8f2;
    --secondary-text: #989aae;
    --card-background: #24283b;
    --border-color: #414868;
    --blockquote-background: #2f354e;
    --hot-gradient: linear-gradient(135deg, #1e1529 0%, #3b2a4f 50%, #4f3869 100%);
    --hot-border: #ff79c6;
    --hot-text: #f8f8f2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: var(--card-background);
    padding: 1.5rem 2rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    gap: 2rem;
}

.title-and-tagline {
    text-align: left;
}

.site-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: bold;
}

.tagline {
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
    opacity: 0.8;
}

header a {
    color: var(--text-color);
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: 500;
}

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

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

footer {
    text-align: center;
    padding: 2rem;
    background: var(--card-background);
    color: var(--secondary-text);
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

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

.posts {
    display: grid;
    gap: 1rem;
}

.post-card {
    background: var(--card-background);
    padding: 1rem;
    border-radius: 8px;
    transition: border-color 0.2s ease;
    border: 1px solid var(--border-color);
}

.post-card.hot {
    background: var(--hot-gradient);
    border-color: var(--hot-border);
    color: var(--hot-text);
}

[data-theme="dark"] .post-card.hot a {
    color: var(--hot-text);
}

[data-theme="dark"] .post-card.hot a:hover {
    color: #f8f8f2; /* Slightly brighter for hover */
}

.post-card.hot .post-meta {
    color: var(--secondary-text);
    filter: contrast(1.2);
}

.post-card:hover {
    border-color: var(--secondary-text);
}

.post-card h2 {
    margin: 0;
    font-size: 1.2rem;
}

.post-card a {
    color: var(--text-color);
    text-decoration: none;
}

.post-card a:hover {
    color: var(--primary-color);
}

.post-detail {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.original-link, .hn-link {
    margin-bottom: 1rem;
}

.original-link a, .hn-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.original-link a:hover, .hn-link a:hover {
    text-decoration: underline;
}

.summary {
    line-height: 1.8;
    margin-top: 2rem;
}

.markdown-content {
    line-height: 1.8;
    margin-top: 2rem;
}

.markdown-content blockquote {
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    border-left: 3px solid var(--primary-color);
    background: var(--blockquote-background);
}

[data-theme="dark"] .markdown-content blockquote a {
    color: var(--primary-color);
}

.markdown-content p {
    margin: 1rem 0;
}

.markdown-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.hot-indicator {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 1rem;
    vertical-align: middle;
}

.post-meta {
    font-size: 0.9rem;
    color: var(--secondary-text);
    margin-top: 0.5rem;
}

/* Footer styles */
.footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--secondary-text);
}

/* Style for the footer link */
.footer-link {
    color: var(--primary-color);
    text-decoration: none;
}

/* Hover effect */
.footer-link:hover {
    text-decoration: underline;  /* Add underline on hover */
}

.post-title {
    font-size: 1.8rem;
    margin: 0 0 1.5rem;
    color: var(--text-color);
}

.recommended-posts {
    margin-top: 2rem;
}

.recommended-posts h2 {
    font-size: 1.4rem;
    margin: 0 0 1.5rem;
    color: var(--text-color);
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.recommendations-list {
    margin: 0 -2rem -2rem -2rem;
}

.recommended-post {
    display: block;
    padding: 1rem 2rem;
    color: var(--text-color);
    text-decoration: none;
}

.recommended-post h3 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.4;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recommended-post .arrow {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-left: 1rem;
}

.error-page {
    text-align: center;
    padding: 2rem;
}

.error-page h1 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.error-page a {
    color: var(--primary-color);
    text-decoration: none;
}

.error-page a:hover {
    text-decoration: underline;
}

.theme-toggle {
    background: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.theme-toggle:hover {
    border-color: var(--secondary-text);
}

.theme-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.theme-icon {
    font-size: 1.1em;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle {
        transition: none;
    }
    
    .post-card {
        transition: none;
    }
}

/* Progress bar styles */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--hot-border));
    transition: width 0.3s ease;
    z-index: 9999;
    opacity: 0;
    box-shadow: 0 0 10px rgba(0, 95, 204, 0.5);
}

.progress-bar.active {
    opacity: 1;
}

/* Individual post progress bar styles */
.post-card {
    position: relative;
    overflow: hidden;
}

.post-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--hot-border));
    transition: width 0.3s ease;
    opacity: 0;
    z-index: 10;
}

.post-progress-bar.active {
    opacity: 1;
}

/* Topics page styles */
.topics-container {
    max-width: 100%;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-header h1 {
    font-size: 2.5rem;
    margin: 0 0 1rem;
    color: var(--text-color);
}

.page-description {
    font-size: 1.1rem;
    color: var(--secondary-text);
    margin: 0;
}

.week-section {
    margin-bottom: 3rem;
}

.week-header {
    font-size: 1.5rem;
    margin: 0 0 1.5rem;
    color: var(--text-color);
    padding: 1rem 0;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--background-color);
    z-index: 5;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.post-card h3 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.4;
    flex: 1;
}

.fire-meter {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}

.fire-display {
    font-size: 1.2rem;
    line-height: 1;
    filter: drop-shadow(0 0 4px rgba(255, 100, 0, 0.3));
    animation: flicker 2s ease-in-out infinite alternate;
}

@keyframes flicker {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.fire-meter-label {
    font-size: 0.75rem;
    color: var(--secondary-text);
    white-space: nowrap;
    font-weight: 500;
}

.post-card.hot-topic {
    background: linear-gradient(135deg, var(--card-background) 0%, rgba(255, 107, 53, 0.02) 100%);
}

.post-preview {
    font-size: 0.95rem;
    color: var(--secondary-text);
    margin: 0.5rem 0;
    line-height: 1.5;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--secondary-text);
}

.empty-state p {
    font-size: 1.1rem;
    margin: 0;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .title-and-tagline {
        text-align: center;
    }
    
    .main-nav {
        justify-content: center;
    }
    
    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .fire-meter {
        align-items: flex-start;
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .fire-meter-label {
        font-size: 0.8rem;
        order: -1;
    }
    
    .theme-toggle {
        font-size: 0.9rem;
        padding: 6px 10px;
    }
    
    main {
        padding: 1rem;
    }
    
    .post-detail {
        padding: 1.5rem;
    }
    
    /* Enhanced progress bar visibility on mobile */
    .progress-bar {
        height: 6px; /* Increased from 4px */
        box-shadow: 0 0 15px rgba(0, 95, 204, 0.7);
        z-index: 10000; /* Ensure it's above everything */
        background: linear-gradient(90deg, #005fcc, #8be9fd, #ff79c6); /* Enhanced gradient */
    }
    
    .post-progress-bar {
        height: 5px; /* Increased from 3px */
        box-shadow: 0 0 8px rgba(0, 95, 204, 0.6);
        z-index: 15; /* Higher than default */
        border-radius: 0 0 4px 0; /* Slight rounding for better visibility */
        background: linear-gradient(90deg, #005fcc, #8be9fd); /* Enhanced gradient for posts */
    }
    
    .post-progress-bar.active {
        opacity: 0.95; /* More visible */
    }
    
    /* Add a subtle background to post cards for better progress bar contrast */
    .post-card {
        border-bottom: 2px solid transparent; /* Reserve space for progress bar */
    }
}

/* Project Ideas */
.ideas-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.idea-card {
    background: transparent;
    border: none;
    padding: 0;
}

.idea-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: none;
    padding-bottom: 0;
}

.idea-header h3 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.3;
}

.vote-container {
    flex-shrink: 0;
}

.vote-btn {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-color);
    display: flex;
    flex-direction: row; /* Changed from column to row */
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    min-width: auto;
}

.vote-btn:hover {
    background: var(--border-color);
}

.vote-btn:active {
    transform: scale(0.95);
}

.idea-content h3 {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem;
}

.idea-content ul {
    margin: 0.5rem 0 1rem;
    padding-left: 1.5rem;
}

/* Summary Details */
.summary-details {
    margin-top: 2rem;
}

.summary-details .summary {
    margin-top: 0;
    padding: 1.5rem 0 0 0;
}

.summary-header {
    padding: 0.5rem 0;
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-color);
    background: transparent;
    list-style: none; /* Hide default triangle in some browsers */
    display: flex;
    align-items: center;
}

/* Custom indicator triangle */
.summary-header::-webkit-details-marker {
    display: none;
}

.summary-header::after {
    content: '▼';
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.summary-details[open] .summary-header::after {
    transform: rotate(180deg);
}
