/* ============================================================
   YouAreWelcom Child Theme - Main Styles
   SRE/DevOps Technical Blog Optimized
   ============================================================ */

/* ============================================================
   CSS Variables
   ============================================================ */

:root {
    /* Brand Colors */
    --color-primary: #667eea;
    --color-secondary: #764ba2;
    --color-accent: #f093fb;
    --color-dark: #1a202c;
    --color-light: #f7fafc;
    
    /* Code Colors */
    --color-code-bg: #2d3748;
    --color-code-text: #e2e8f0;
    --color-inline-code: #e53e3e;
    
    /* Status Colors */
    --color-success: #48bb78;
    --color-warning: #ed8936;
    --color-danger: #f56565;
    --color-info: #3182ce;
    
    /* Neutral Colors */
    --color-gray-50: #f7fafc;
    --color-gray-100: #edf2f7;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e0;
    --color-gray-400: #a0aec0;
    --color-gray-500: #718096;
    --color-gray-600: #4a5568;
    --color-gray-700: #2d3748;
    --color-gray-800: #1a202c;
    --color-gray-900: #171923;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Typography */
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;
}

/* ============================================================
   Base Typography
   ============================================================ */

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--color-gray-800);
    background: var(--color-gray-50);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-dark);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2em;
    margin-bottom: 0.75em;
}

h1 { font-size: 2.5em; }
h2 { 
    font-size: 2em;
    padding-bottom: 0.3em;
    border-bottom: 2px solid var(--color-gray-200);
}
h3 { font-size: 1.5em; }
h4 { font-size: 1.25em; }
h5 { font-size: 1.1em; }
h6 { font-size: 1em; }

/* First heading has no top margin */
.entry-content > h1:first-child,
.entry-content > h2:first-child,
.entry-content > h3:first-child {
    margin-top: 0;
}

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

a:hover {
    color: var(--color-secondary);
}

/* Paragraphs */
p {
    margin-bottom: 1.5em;
    line-height: 1.8;
}

/* Lists */
ul, ol {
    margin-bottom: 1.5em;
    padding-left: 2em;
}

li {
    margin-bottom: 0.5em;
}

/* Nested lists */
ul ul, ol ol, ul ol, ol ul {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* Blockquotes */
blockquote {
    margin: 2em 0;
    padding: 1em 1.5em;
    border-left: 4px solid var(--color-primary);
    background: var(--color-gray-100);
    font-style: italic;
    color: var(--color-gray-700);
}

blockquote p:last-child {
    margin-bottom: 0;
}

blockquote cite {
    display: block;
    margin-top: 1em;
    font-size: 0.9em;
    color: var(--color-gray-600);
    font-style: normal;
}

/* ============================================================
   Code Styling
   ============================================================ */

/* Inline Code */
code:not(pre code) {
    background: var(--color-gray-100);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--color-inline-code);
    font-family: var(--font-mono);
    font-size: 0.88em;
    font-weight: 600;
}

/* Code Blocks */
pre {
    background: var(--color-code-bg);
    color: var(--color-code-text);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    overflow-x: auto;
    box-shadow: var(--shadow-lg);
    margin: 2rem 0;
    line-height: 1.6;
}

pre code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: none;
    padding: 0;
    color: inherit;
    font-weight: normal;
}

/* Scrollbar for code blocks */
pre::-webkit-scrollbar {
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   Tables
   ============================================================ */

table {
    border-collapse: collapse;
    width: 100%;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table th {
    background: var(--color-primary);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--color-gray-200);
    background: white;
}

table tr:hover td {
    background: var(--color-gray-50);
}

table tr:last-child td {
    border-bottom: none;
}

/* Responsive tables */
@media (max-width: 768px) {
    table {
        font-size: 0.9em;
    }
    
    table th,
    table td {
        padding: 0.75rem 0.5rem;
    }
}

/* ============================================================
   Images & Media
   ============================================================ */

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

figure {
    margin: 2rem 0;
}

figcaption {
    text-align: center;
    font-style: italic;
    color: var(--color-gray-600);
    margin-top: 0.5rem;
    font-size: 0.9em;
}

/* ============================================================
   Article Styling
   ============================================================ */

/* Article containers */
.site-main article {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    margin-bottom: 2rem;
    overflow: hidden;
}

.site-main article:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

/* Entry header */
.entry-header {
    padding: 2rem;
}

.entry-title {
    margin: 0 0 1rem;
    font-size: 2.5em;
    line-height: 1.2;
}

.entry-meta {
    font-size: 0.9em;
    color: var(--color-gray-600);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.entry-meta a {
    color: var(--color-gray-600);
}

.entry-meta a:hover {
    color: var(--color-primary);
}

/* Entry content */
.entry-content,
.entry-summary {
    padding: 0 2rem 2rem;
}

/* Single post spacing */
.single .entry-content {
    font-size: 1.05em;
    max-width: 75ch;
    margin: 0 auto;
}

/* Entry footer */
.entry-footer {
    padding: 1.5rem 2rem;
    background: var(--color-gray-50);
    border-top: 1px solid var(--color-gray-200);
}

/* ============================================================
   Category-specific Styling
   ============================================================ */

/* SRE Category */
.category-sre .entry-header,
.single.category-sre .entry-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    padding: 2rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.category-sre .entry-title,
.single.category-sre .entry-title {
    color: white;
}

.category-sre .entry-meta,
.single.category-sre .entry-meta {
    color: rgba(255, 255, 255, 0.9);
}

.category-sre .entry-meta a {
    color: rgba(255, 255, 255, 0.9);
}

/* Observability Category */
.category-observability .entry-header {
    background: linear-gradient(135deg, #3182ce, #2c5282);
    color: white;
}

.category-observability .entry-title {
    color: white;
}

/* Reliability Patterns */
.category-reliability-patterns .entry-header {
    background: linear-gradient(135deg, #48bb78, #2f855a);
    color: white;
}

.category-reliability-patterns .entry-title {
    color: white;
}

/* IaC */
.category-iac .entry-header {
    background: linear-gradient(135deg, #805ad5, #6b46c1);
    color: white;
}

.category-iac .entry-title {
    color: white;
}

/* Performance */
.category-performance .entry-header {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
}

.category-performance .entry-title {
    color: white;
}

/* ============================================================
   Tags
   ============================================================ */

.entry-tags,
.tagcloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.entry-tags a,
.tagcloud a {
    background: var(--color-primary);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 0.85em;
    display: inline-block;
    transition: all 0.2s ease;
    border: none;
}

.entry-tags a:hover,
.tagcloud a:hover {
    background: var(--color-secondary);
    transform: scale(1.05);
}

/* ============================================================
   Post Meta Badges
   ============================================================ */

.difficulty-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-gray-100);
    border-radius: var(--radius-full);
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 1rem;
}

.difficulty-stars {
    color: #fbbf24;
}

.reading-time {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-gray-600);
    font-size: 0.9em;
}

.reading-time::before {
    content: "🕐";
}

/* Post level badges */
.post-level {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-level.beginner {
    background: #c6f6d5;
    color: #22543d;
}

.post-level.intermediate {
    background: #bee3f8;
    color: #2c5282;
}

.post-level.advanced {
    background: #feebc8;
    color: #7c2d12;
}

.post-level.expert {
    background: #fbb6ce;
    color: #702459;
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar .widget {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.sidebar .widget-title {
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar ul li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-gray-200);
}

.sidebar ul li:last-child {
    border-bottom: none;
}

/* ============================================================
   Navigation
   ============================================================ */

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.pagination a:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination .current {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Post navigation */
.post-navigation {
    margin: 2rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.post-navigation a {
    display: block;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

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

.post-navigation .nav-previous {
    text-align: left;
}

.post-navigation .nav-next {
    text-align: right;
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
    background: var(--color-gray-900);
    color: var(--color-gray-400);
    padding: 2rem 0 1rem;
    margin-top: 4rem;
}

.site-footer a {
    color: var(--color-gray-300);
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: white;
}

.site-info {
    text-align: center;
    padding: 1rem 0;
    border-top: 1px solid var(--color-gray-700);
    margin-top: 2rem;
}

/* ============================================================
   Buttons
   ============================================================ */

.button,
button,
input[type="submit"],
input[type="button"],
.wp-block-button__link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.wp-block-button__link:hover {
    background: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================================
   Forms
   ============================================================ */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1em;
    transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================================
   Responsive Design
   ============================================================ */

@media (max-width: 768px) {
    :root {
        font-size: 14px;
    }
    
    h1 { font-size: 2em; }
    h2 { font-size: 1.75em; }
    h3 { font-size: 1.5em; }
    
    .entry-header {
        padding: 1.5rem;
    }
    
    .entry-content,
    .entry-summary {
        padding: 0 1.5rem 1.5rem;
    }
    
    .entry-footer {
        padding: 1rem 1.5rem;
    }
    
    pre {
        padding: 1rem;
        font-size: 0.85em;
    }
    
    .post-navigation {
        grid-template-columns: 1fr;
    }
    
    .sidebar .widget {
        padding: 1rem;
    }
}

/* ============================================================
   Print Styles
   ============================================================ */

@media print {
    .site-header,
    .site-footer,
    .sidebar,
    .entry-tags,
    .social-share,
    .post-navigation {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        background: white;
    }
    
    .site-main article {
        box-shadow: none;
        background: white;
    }
    
    pre {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
}

/* ============================================================
   Accessibility
   ============================================================ */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================================
   Utilities
   ============================================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }
