/* Import Lato and Open Sans fonts from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&family=Open+Sans:wght@400;600&display=swap');

:root {
    /* Base colors - Darker theme */
    --bg-primary: #121212;
    --bg-secondary: #1E1E1E;
    --bg-tertiary: #2D2D2D;
    
    /* Text colors */
    --text-primary: #E0E0E0;
    --text-secondary: #B0B0B0;
    --text-muted: #808080;
    
    /* Accent colors */
    --accent-primary: #5F87AB;  /* Muted blue */
    --accent-secondary: #C2A86B; /* Muted gold */
    --accent-tertiary: #7AAC65; /* Muted green */
    --accent-quaternary: #A878A0; /* Muted purple */
    
    /* Alert colors */
    --alert-warning: #C78F6E;
    --alert-danger: #AF5F68;
    
    /* Legacy accent names (for backward compatibility) */
    --accent-gold: #C2A86B;
    --accent-teal: #5F87AB;
    
    /* Breakpoints */
    --mobile-breakpoint: 767px;
    --tablet-breakpoint: 991px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 400;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography enhancements */
h1 {
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    font-size: 2.2rem;
    margin-top: 1em;
    margin-bottom: 0.7em;
    color: var(--accent-secondary);
    letter-spacing: -0.02em;
}

h2 {
    font-family: 'Lato', sans-serif;
    font-weight: 600;
    font-size: 1.8rem;
    margin-top: 1.5em;
    margin-bottom: 0.7em;
    color: var(--accent-primary);
    letter-spacing: -0.01em;
}

h3 { 
    font-family: 'Lato', sans-serif;
    font-weight: 500;
    font-size: 1.3rem;
    margin-top: 1.5em;
    margin-bottom: 0.7em;
    color: var(--text-primary);
}

/* Article text styling */
p, li {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.7;
    margin-bottom: 1em;
    color: var(--text-primary);
    font-size: 1rem;
}

/* Links styling */
a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* Make images responsive by default */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.global-nav {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    max-width: 100%;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .global-nav {
        padding: 1rem 0;
        max-width: 850px;
    }
}

.global-nav .home-link {
    margin-left: 10px;
}

.global-nav .right-links {
    margin-right: 10px;
}

.global-nav a {
    color: var(--accent-secondary);
    text-decoration: none;
    margin: 0 5px;
    transition: color 0.2s ease;
    font-size: 1rem;
    padding: 6px 8px;
}

@media (min-width: 768px) {
    .global-nav a {
        margin: 0 20px;
        font-size: 1.2rem;
        padding: 8px 12px;
    }
    .global-nav .home-link {
        margin-left: 20px;
    }
    .global-nav .right-links {
        margin-right: 20px;
    }
}

.global-nav a:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

main, .post-header, .post-content, .post-footer { 
    padding: 15px 25px; 
    margin: 15px auto 0; 
    max-width: 100%;
    width: 100%;
    background-color: var(--bg-secondary);
}

@media (min-width: 768px) {
    main, .post-header, .post-content, .post-footer {
        padding: 20px 30px;
        max-width: 850px; 
    }
}

@media (min-width: 992px) {
    main, .post-header, .post-content, .post-footer {
        padding: 25px 40px;
        max-width: 850px; 
    }
}

.global-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-primary);
    margin-top: 30px;
    font-family: 'Lato', sans-serif;
    margin-top: auto;
}

/* Blog posts list - used across blog index and homepage (featured posts) */
.featured-posts { 
    list-style: none; 
    padding: 0; 
}

/* Featured posts section */
.featured-posts {
    list-style: none;
    padding: 0;
    margin: 0;
}

.featured-post {
    display: flex;
    margin-bottom: 30px;
    background-color: var(--bg-secondary);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: opacity 0.3s ease;
}

/* Add styles for [toc] from Python-Markdown if needed */
.toc { 
    padding: 15px 0; 
    margin-bottom: 20px; 
    border-left: 3px solid var(--accent-primary);
    padding-left: 15px;
    background-color: var(--bg-tertiary);
}

.toc ul { 
    list-style-type: none; 
    padding-left: 15px;
}

/* Simplified styling for code blocks */
pre {
    background-color: #1C1C1C; /* Slightly lighter than bg-primary for contrast */
    margin: 0;
    border-radius: 10px;
    position: relative;
    padding: 0;
    border: none;
    overflow-x: auto;
}

code {
    font-family: monospace;
    font-size: inherit;
    padding: 0;
}

/* Copy to clipboard button */
.copy-code-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--accent-primary); /* Nord blue */
    color: var(--text-primary); /* Nord snow storm (light text) */
    border: none;
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

/* Show copy button on hover */
pre:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background-color: var(--accent-secondary); /* Nord frost (lighter blue) */
    color: var(--bg-primary); /* Nord polar night (dark background) */
}

/* Line number styling if enabled */
.codehilite .linenos {
    color: var(--text-muted);
    background-color: var(--bg-tertiary);
    padding: 0 8px;
    border-right: 1px solid var(--bg-secondary);
    border-radius: 0;
    user-select: none;
}

/* Code block with line numbers */
.codehilite pre {
    margin: 0;
    border: none;
    box-shadow: none;
    padding: 0;
}

/* Additional styles for navigation lists */
.navigation ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

@media (min-width: 768px) {
    .navigation ul {
        flex-direction: row;
        justify-content: center;
        gap: 25px;
    }
}

.navigation li {
    display: block;
}

@media (min-width: 768px) {
    .navigation li {
        display: inline-block;
    }
}

.navigation a {
    text-decoration: none;
    color: var(--accent-gold);
    font-weight: 500;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
    display: block;
    padding: 8px 0;
}

.navigation a:hover {
    color: var(--accent-primary);
    text-decoration: none;
}

/* Featured posts on homepage */
.featured-posts {
    list-style: none;
    padding: 0;
}

.featured-post {
    padding: 20px 0;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    overflow: hidden;
}

.featured-post .post-image {
    margin-bottom: 15px;
    padding: 0 15px;
    text-align: center;
}

.featured-post .post-info {
    flex: 1;
    padding: 0 15px 15px;
}

.featured-post .post-info h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.featured-post .post-date {
    margin-bottom: 10px;
}

.featured-post img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    background-color: var(--bg-tertiary);
}

@media (min-width: 768px) {
    .featured-post {
        flex-direction: row;
        align-items: flex-start;
        padding: 25px;
    }
    
    .featured-post .post-image {
        margin-right: 25px;
        margin-bottom: 0;
        flex: 0 0 180px;
        padding: 0;
        text-align: left;
    }
    
    .featured-post .post-info {
        padding: 0;
    }

    .featured-post img {
        width: 180px;
        height: 180px;
        aspect-ratio: 1/1;
        object-fit: contain;
    }
}

/* Dark theme specific adjustments */
input[type="text"], input[type="email"], textarea, select {
    background-color: var(--bg-tertiary);
    border: none;
    border-bottom: 1px solid var(--accent-primary);
    color: var(--text-primary);
    padding: 10px 0;
    border-radius: 0;
    width: 100%;
}

input[type="text"]:focus, input[type="email"]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: none;
}

/* Button styling */
button, input[type="submit"], input[type="button"] {
    background-color: var(--bg-tertiary);
    color: var(--accent-secondary);
    border: 1px solid var(--accent-secondary);
    padding: 8px 15px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    letter-spacing: 0.5px;
}

button:hover, input[type="submit"]:hover, input[type="button"]:hover {
    background-color: var(--accent-secondary);
    color: #000000;
}

/* Tag styling */
.tag {
    display: inline-block;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--accent-secondary);
    border-radius: 3px;
    padding: 4px 10px;
    font-size: 0.85rem;
    margin-right: 6px;
    margin-bottom: 5px;
    text-transform: lowercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag:hover {
    background-color: var(--accent-secondary);
    color: #000000;
    transition: all 0.2s ease;
}

.active-tag {
    background-color: var(--accent-secondary);
    color: #000000;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Post tag styling - more subtle version */
.post-tags .tag {
    background-color: transparent;
    border: 1px solid var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 2px 8px;
    cursor: default; /* Remove pointer cursor for non-clickable tags */
}

.post-tags .tag:hover {
    background-color: transparent;
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.tags-section {
    margin-bottom: 30px;
    background-color: var(--bg-secondary);
    padding: 15px;
    border-radius: 5px;
}

.tags-label {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 5px;
}

.post-tags {
    margin-top: -10px;
    margin-bottom: 10px;
}

/* Post description styling */
.post-description {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Post date styling */
.post-date {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* Post item styles are now consolidated with featured-post classes */

/* Additional responsive improvements */
@media (max-width: 767px) {
    body {
        font-size: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    .global-nav {
        padding: 0.8rem;
    }
    
    .global-nav a {
        margin: 0 5px;
        font-size: 1rem;
        padding: 6px 8px;
    }
    
    .featured-post {
        margin: 0 12px 20px;
    }
    
    .featured-post img {
        max-width: 350px;
        max-height: 350px;
        width: 100%;
        height: 100%;
        margin: 0 auto;
    }
}

/* Tablet responsiveness */
@media (min-width: 768px) and (max-width: 991px) {
    .featured-post {
        margin: 0 15px 25px;
    }
}

/* Tools grid layout */
.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    margin-bottom: 10px;
}

.tools-list {
    margin: 20px 0;
}

.tools-grid {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

@media (min-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tools-grid li {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 25px;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tools-grid li:hover {
    background-color: var(--bg-tertiary);
}

.tools-grid a {
    display: block;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 500;
}

.tools-grid .tool-item a {
    color: var(--accent-secondary);
    text-decoration: none;
}

.tools-grid .tool-item h3 {
    margin-top: 0.5em;
    color: var(--accent-secondary);
}

.tools-grid .tool-description {
    color: var(--text-secondary);
    margin-top: 10px;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .global-nav {
        padding: 0.5rem;
    }
    
    .global-nav a {
        font-size: 0.9rem;
        padding: 4px 5px;
        margin: 0 3px;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    main, .post-header, .post-content, .post-footer {
        padding: 10px 12px;
    }
    
    .featured-post {
        margin: 0 8px 20px;
    }
    
    .featured-post img {
        max-width: 250px;
        max-height: 250px;
    }
}

/* Style for horizontal rules in content */
hr {
    border: none;
    height: 1px;
    background-color: var(--bg-tertiary);
    margin: 30px 0;
}

/* Header and content separation fixes */
main {
    margin-top: 30px; /* Add space for the fixed navigation */
}

/* Legacy post-header and post-content selectors kept for compatibility */
.post-header, .post-content {
    background: none;
    margin: 0;
    padding: 0;
}

main article header {
    margin-bottom: 30px;
}