:root {
    /* Color Palette - HSL for easier manipulation */
    --primary-hue: 215;
    --primary-sat: 90%;
    --primary-light: 52%;
    --primary-color: hsl(var(--primary-hue), var(--primary-sat), var(--primary-light));
    
    --text-main: #2c3e50;
    --text-secondary: #596775;
    --text-muted: #86909c;
    
    --bg-body: #fdfdfd;
    --bg-card: #ffffff;
    --bg-subtle: #f8f9fa;
    
    --border-color: #eef2f6;
    --border-color-dark: #dce3e9;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Dark mode overrides for article pages */
[data-theme='dark'] {
    --text-main: #d6e2f7;
    --text-secondary: #a8b8d1;
    --text-muted: #8b9ac0;
    --bg-body: #0f1419;
    --bg-card: #161c2b;
    --bg-subtle: #111827;
    --border-color: #27324a;
    --border-color-dark: #394867;
}

[data-theme='dark'] body {
    background-color: var(--bg-body);
    color: var(--text-main);
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.75;
    font-size: 1.125rem; /* 18px base size for better reading */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: #111827;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.025em;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.75rem;
    position: relative;
    padding-left: 0;
    border-bottom: none; /* Remove old border */
    margin-top: 3rem;
    display: flex;
    align-items: center;
}

/* Decorative element for H2 */
h2::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 1.2em;
    background: var(--primary-color);
    margin-right: 0.75rem;
    border-radius: 2px;
}

h3 {
    font-size: 1.35rem;
    font-weight: 600;
    color: #374151;
    margin-top: 2rem;
}

p {
    margin-bottom: 1.5rem;
    color: #374151;
}

[data-theme='dark'] h1,
[data-theme='dark'] h2,
[data-theme='dark'] h3,
[data-theme='dark'] h4,
[data-theme='dark'] h5,
[data-theme='dark'] h6 {
    color: #e2ecff;
}

[data-theme='dark'] p {
    color: var(--text-secondary);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
}

a:hover {
    color: #0046b0;
    border-bottom-color: currentColor;
    text-decoration: none;
}

/* Layout Containers */
.page {
    max-width: 100%;
    background: var(--bg-body);
}

.page-body {
    width: min(1100px, 92vw);
    max-width: 1100px; /* comfortable desktop reading width */
    margin: 0 auto;
    padding: clamp(1.5rem, 2vw + 1rem, 2.75rem) clamp(1.25rem, 2vw, 2.25rem);
}

.navbar .container-fluid {
    max-width: min(1100px, 94vw) !important;
    margin: 0 auto !important;
    padding: 0.75rem 1.5rem !important;
}

/* Navbar - Cleaner look */
.navbar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
}

[data-theme='dark'] .navbar {
    background: rgba(15, 23, 42, 0.9) !important;
    border-bottom-color: var(--border-color);
    box-shadow: 0 10px 30px -22px rgba(0, 0, 0, 0.8);
}

.navbar-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.01em;
}

[data-theme='dark'] .navbar-brand span {
    color: var(--text-secondary) !important;
}

/* Article Card - Remove "Card" look for editorial feel */
.card {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
}

.card-body {
    padding: 0;
}

[data-theme='dark'] .card {
    box-shadow: 0 18px 42px -24px rgba(0, 0, 0, 0.8);
    border-color: var(--border-color);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.03);
    color: #0f172a;
    transition: all 0.2s ease;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    font-size: 1rem;
    line-height: 1;
}

.theme-toggle .icon-moon {
    display: none;
}

.theme-toggle:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

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

[data-theme='dark'] .theme-toggle {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border-color: var(--border-color-dark);
}

[data-theme='dark'] .theme-toggle .icon-sun {
    display: none;
}

[data-theme='dark'] .theme-toggle .icon-moon {
    display: inline-block;
}

/* Images */
.img-fluid {
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    margin: 2rem 0;
    width: 100%;
    height: auto;
    display: block;
}

/* Lists - More breathing room */
ul, ol {
    padding-left: 1.5rem;
    margin-bottom: 2rem;
}

li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

/* Custom list markers */
ul li::marker {
    color: var(--primary-color);
}

ol li::marker {
    color: var(--primary-color);
    font-weight: 600;
    font-family: var(--font-heading);
}

/* Alerts - Modern Glassy/Flat Style */
.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    line-height: 1.6;
}

.alert-info {
    background-color: #eff6ff;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.alert-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border-left: 4px solid #9ca3af;
}

[data-theme='dark'] .alert-info {
    background-color: rgba(37, 99, 235, 0.16);
    color: #cbdcff;
    border-left-color: #4a9eff;
}

[data-theme='dark'] .alert-secondary {
    background-color: #111827;
    color: var(--text-secondary);
    border-left-color: #4b5563;
}

/* Blockquotes */
blockquote {
    border: none;
    background: #f8fafc;
    padding: 1.5rem 2rem;
    margin: 2.5rem 0;
    border-radius: 0.75rem;
    font-style: italic;
    color: #475569;
    position: relative;
    box-shadow: inset 4px 0 0 var(--primary-color);
}

[data-theme='dark'] blockquote {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    box-shadow: inset 4px 0 0 var(--primary-color);
}

blockquote::before {
    content: '“';
    font-family: serif;
    font-size: 4rem;
    line-height: 1;
    color: rgba(0,0,0,0.05);
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    pointer-events: none;
}

/* Tables */
table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

th {
    background: #f9fafb;
    color: #111827;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
    color: #4b5563;
    font-size: 1rem;
}

[data-theme='dark'] table {
    border-color: var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

[data-theme='dark'] th {
    background: #1f2937;
    color: #e5edff;
    border-bottom: 1px solid var(--border-color);
}

[data-theme='dark'] td {
    background: #111827;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: #0f766e;
    background-color: #f0fdfa;
    padding: 0.2em 0.4em;
    border-radius: 0.25em;
    border: 1px solid rgba(15, 118, 110, 0.1);
}

/* Feature Grid (Satellite Page) */
.feature-grid {
    display: grid;
    gap: 2rem;
    margin: 2.5rem 0;
}

.feature-grid.vertical .feature-img {
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
}

.feature-grid.vertical .feature-img:hover {
    transform: translateY(-4px);
}

.points {
    display: grid;
    gap: 1.5rem;
}

.point {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    padding-left: 2rem;
    box-shadow: var(--shadow-sm);
}

.point:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.point .dot {
    position: absolute;
    left: -6px;
    top: 1.75rem;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* Hide the old dot inside if we use the absolute one, or style it */
.point > .dot {
    display: none; /* Using pseudo-element or absolute positioning approach */
}

/* Re-implementing dot logic based on HTML structure */
.point {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding-left: 1.5rem; /* Reset padding */
}

.point .dot {
    position: static; /* Reset */
    margin-top: 0.4rem;
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(var(--primary-hue), var(--primary-sat), var(--primary-light), 0.2);
    border: none;
}

.point-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.point-desc {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

[data-theme='dark'] .point {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 14px 40px -20px rgba(0, 0, 0, 0.85);
}

[data-theme='dark'] .point-title {
    color: #e5edff;
}

[data-theme='dark'] .point-desc {
    color: var(--text-secondary);
}

/* Utilities */
.text-muted {
    color: var(--text-muted) !important;
}

.small {
    font-size: 0.9rem;
}

/* Lightbox overlay for article images */
.img-lightbox {
    cursor: zoom-in;
}

.lb-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.lb-mask img {
    max-width: 96vw;
    max-height: 96vh;
    border-radius: 8px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.6);
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .page-body {
        width: 98vw;
        max-width: none;
        padding: 1.25rem 0.75rem;
    }

    .navbar .container-fluid {
        max-width: 100% !important;
        padding: 0.4rem 0.65rem !important;
    }

    blockquote {
        padding: 1.25rem;
        font-size: 1rem;
    }
}

@media (min-width: 1200px) {
    .page-body {
        width: min(1180px, 88vw);
        padding: 3rem 2.5rem;
    }

    .navbar .container-fluid {
        max-width: min(1180px, 88vw) !important;
    }
}
