/* Design tokens and global defaults */
:root {
    /* Colors */
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #1f2937; /* High-contrast neutral */
    --color-muted: #4b5563; /* Muted text */
    --color-border: #e5e7eb;
    --color-primary: #2563eb; /* Accessible blue */
    --color-primary-600: #1d4ed8; /* Darker for focus/hover */
    --color-primary-50: #e8f1ff; /* Subtle surface tint */
    --color-focus: var(--color-primary-600);
    --color-footer-bg: #111827;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --leading-normal: 1.6;
    --leading-tight: 1.3;

    /* Radius */
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-md: 0 8px 25px rgba(0,0,0,0.15);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    color-scheme: light;
}

/* Base */
body {
    font-family: var(--font-sans);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    margin: 0;
    padding: 0;
}

* {
    box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    line-height: var(--leading-tight);
    color: var(--color-text);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--color-primary-600);
}

/* Accessible focus styles */
:where(a, button, [role="button"], .read-more, .pagination a, .nav-links a, .language-links a, .cta-button, .post-card .card-overlay):focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
    border-radius: var(--radius-md);
}

/* Breadcrumbs */
.breadcrumb {
    margin: 1rem 0 2rem 0;
    padding: 0;
}

.breadcrumb ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-muted);
}

.breadcrumb li {
    display: flex;
    align-items: center;
}

.breadcrumb li:not(:last-child)::after {
    content: "/";
    margin-left: 0.5rem;
    color: var(--color-border);
}

.breadcrumb a {
    color: var(--color-primary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.breadcrumb a:hover {
    background-color: var(--color-primary-50);
    color: var(--color-primary-600);
}

.breadcrumb a:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.breadcrumb [aria-current="page"] {
    color: var(--color-text);
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    background-color: var(--color-primary-50);
    border-radius: var(--radius-md);
}

/* Breadcrumb section for home page */
.breadcrumb-section {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
}

img {
    max-width: 100%;
    height: auto;
}

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

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
}

/* Header */
header {
    background: var(--gradient-primary);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    margin: 1rem 0;
}

@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-links {
        justify-content: center;
    }
    
    .language-switcher {
        justify-content: center;
    }
}

.logo {
    display: flex;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.logo a:hover {
    transform: translateY(-1px);
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.logo-icon {
    width: 40px;
    height: 40px;
    margin-right: 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.logo a:hover .logo-icon {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .logo a {
        font-size: 1.2rem;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        margin-right: 0.8rem;
    }
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Language Switcher */
.language-switcher {
    display: flex;
    align-items: center;
}

.language-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.language-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.language-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.language-links a.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
    .language-links {
        gap: 0.3rem;
    }
    
    .language-links a {
        padding: 0.2rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* Hero Section */
.hero {
    background: var(--gradient-primary);
    color: white;
    text-align: center;
    padding: 4rem 0;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Blog Intro */
.blog-intro {
    padding: 3rem 0;
    background-color: #f8f9fa;
    text-align: center;
    margin-bottom: 2rem;
}

.blog-intro h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2rem;
    color: var(--color-text);
    font-weight: 600;
}

.blog-intro p {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    color: var(--color-muted);
    line-height: 1.6;
}

@media (max-width: 768px) {
    .blog-intro {
        padding: 2rem 0;
        margin-bottom: 1rem;
    }
    
    .blog-intro h2 {
        font-size: 1.5rem;
    }
    
    .blog-intro p {
        font-size: 1rem;
    }
}

/* Posts Grid */
.featured-posts {
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.featured-posts h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--color-text);
    font-weight: 600;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.post-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    cursor: pointer;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

/* Make entire post-card clickable via overlay link */
.post-card .card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: pointer;
    background: transparent;
    transition: background-color 0.2s ease;
}

.post-card .card-overlay:hover {
    background: rgba(37, 99, 235, 0.06);
}

.post-card .post-content {
    position: relative;
    z-index: 2;
}

/* Fix: Prevent paragraph elements from blocking overlay link clicks */
.post-card .post-content p {
    pointer-events: none;
}

/* Ensure links within post-content still work */
.post-card .post-content a {
    pointer-events: auto;
    position: relative;
    z-index: 3;
}

.post-content {
    padding: 1.5rem;
    position: relative;
    z-index: 2;
}

.post-content h3 {
    margin-bottom: 0.5rem;
    color: var(--color-text);
    font-size: 1.2rem;
    line-height: 1.4;
    font-weight: 600;
}

.post-content h3 a {
    color: var(--color-text);
    text-decoration: none;
    font-size: 1.2rem;
}

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

.post-meta {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.badge {
    display: inline-block;
    background: var(--color-primary-50);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.3rem;
    transition: all 0.2s ease;
}

.badge:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.pagination {
    text-align: center;
    margin: 3rem 0;
}

.pagination a {
    margin: 0 0.5rem;
    color: var(--color-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    background: var(--color-surface);
}

.pagination a:hover {
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.pagination span {
    display: inline-block;
    margin: 0 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--color-muted);
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.read-more {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    background: var(--color-surface);
    position: relative;
    z-index: 3;
}

.read-more:hover {
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Blog Post */
.blog-post {
    padding: 3rem 0;
    max-width: 800px;
    margin: 0 auto;
}

.post-hero {
    margin: 0 0 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.post-hero img {
    display: block;
    width: 100%;
    height: auto;
}

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

.post-header h1 {
    font-size: 2.5rem;
    color: var(--color-text);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-meta {
    color: var(--color-muted);
    font-size: 1rem;
}

.post-content {
    line-height: 1.8;
    color: var(--color-text);
}

.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--color-text);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 0; /* Fallback reset */
    padding-inline-start: 2rem; /* Logical for RTL/LTR */
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--color-muted);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 2rem 0;
}

/* Post table of contents */
.post-toc {
    max-width: 800px;
    margin: 0 auto 2rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.post-toc :where(ul, ol) {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-toc > :where(ul, ol) {
    padding: 1rem 1.25rem;
}

.post-toc li + li { margin-top: 0.5rem; }

.post-toc a {
    display: inline-block;
    color: var(--color-primary);
    text-decoration: none;
    padding: 0.25rem 0.125rem;
    border-radius: var(--radius-md);
}

.post-toc a:hover { color: var(--color-primary-600); text-decoration: underline; text-underline-offset: 2px; }

.post-toc li ul { margin-top: 0.25rem; padding-inline-start: 1rem; }

@media (max-width: 768px) {
    .blog-post {
        padding: 2rem 0;
    }
    
    .post-header h1 {
        font-size: 2rem;
    }
    
    .post-header {
        margin-bottom: 2rem;
    }
}

/* Call to Action Section */
.cta-section {
    background: var(--gradient-primary);
    color: white;
    text-align: center;
    padding: 3rem 0;
    margin-top: 2rem;
}

.cta-content h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.cta-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    opacity: 0.9;
}

.cta-button {
    display: inline-block;
    background: white;
    color: #667eea;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border: 2px solid white;
}

.cta-button:hover {
    background: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .cta-section {
        padding: 2rem 0;
        margin-top: 1rem;
    }
    
    .cta-content h3 {
        font-size: 1.5rem;
    }
    
    .cta-content p {
        font-size: 1rem;
    }
    
    .cta-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}

/* Footer */
footer {
    background: var(--color-footer-bg);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

footer a {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}

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

@media (max-width: 768px) {
    footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .post-card {
        margin: 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero .subtitle {
        font-size: 1rem;
    }
    
    .blog-intro h2 {
        font-size: 1.5rem;
    }
    
    .featured-posts h2 {
        font-size: 1.5rem;
    }
    
    .cta-content h3 {
        font-size: 1.5rem;
    }
    
    .post-header h1 {
        font-size: 2rem;
    }
    
    nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        justify-content: center;
        gap: 1rem;
    }
    
    .language-switcher {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .hero .subtitle {
        font-size: 0.9rem;
    }
    
    .post-content {
        padding: 1rem;
    }
    
    .post-header h1 {
        font-size: 1.8rem;
    }
} 

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Visually hidden utility for skip links and a11y helpers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}