/*
 Theme Name:   MoatAlpha Theme
 Theme URI:    https://moatalpha.com
 Description:  GeneratePress child theme for MoatAlpha — Deep Value Investment Research
 Author:       MoatAlpha
 Template:     generatepress
Version:      2.3.1
*/

/* ===== CSS Custom Properties ===== */
:root {
    color-scheme: light dark;
    --ma-slate-50: #f8fafc;
    --ma-slate-100: #f1f5f9;
    --ma-slate-200: #e2e8f0;
    --ma-slate-300: #cbd5e1;
    --ma-slate-400: #94a3b8;
    --ma-slate-500: #64748b;
    --ma-slate-600: #475569;
    --ma-slate-700: #334155;
    --ma-slate-800: #1e293b;
    --ma-slate-900: #0f172a;
    --ma-slate-950: #020617;

    --ma-blue-50: #eff6ff;
    --ma-blue-100: #dbeafe;
    --ma-blue-600: #2563eb;
    --ma-blue-700: #1d4ed8;
    --ma-blue-800: #1e40af;

    --ma-amber-50: #fffbeb;
    --ma-amber-500: #f59e0b;
    --ma-amber-600: #d97706;

    --ma-emerald-50: #ecfdf5;
    --ma-emerald-600: #059669;

    --ma-red-50: #fef2f2;
    --ma-red-600: #dc2626;

    --ma-primary: var(--ma-blue-700);
    --ma-primary-hover: var(--ma-blue-800);
    --ma-accent: var(--ma-amber-600);
    --ma-text: var(--ma-slate-800);
    --ma-text-secondary: var(--ma-slate-500);
    --ma-text-muted: var(--ma-slate-400);
    --ma-bg: #ffffff;
    --ma-bg-soft: var(--ma-slate-50);
    --ma-bg-muted: var(--ma-slate-100);
    --ma-border: var(--ma-slate-200);

    --ma-font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ma-font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --ma-font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --ma-content-width: 720px;
    --ma-wide-width: 1200px;
    --ma-container-width: 1200px;
    --ma-sidebar-width: 300px;
    --ma-content-gap: 40px;
    --ma-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --ma-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --ma-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --ma-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
    --ma-text: #e2e8f0;
    --ma-text-secondary: #94a3b8;
    --ma-text-muted: #64748b;
    --ma-bg: #0f172a;
    --ma-bg-soft: #1e293b;
    --ma-bg-muted: #334155;
    --ma-border: #334155;
    --ma-primary: #60a5fa;
    --ma-primary-hover: #93c5fd;
    --ma-accent: #fbbf24;
    --ma-shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --ma-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --ma-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
}

/* ===== Progress Bar ===== */
#ma-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--ma-primary), var(--ma-accent));
    z-index: 10000;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* ===== Global Base ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--ma-font-body) !important;
    font-size: 17px;
    line-height: 1.8;
    color: var(--ma-text);
    background: var(--ma-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-wrap: break-word;
    transition: background var(--ma-transition), color var(--ma-transition);
}

::selection {
    background: var(--ma-blue-100);
    color: var(--ma-slate-900);
}
[data-theme="dark"] ::selection {
    background: var(--ma-blue-800);
    color: #fff;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--ma-font-heading) !important;
    font-weight: 700;
    color: var(--ma-text);
    line-height: 1.3;
    margin-bottom: 0.5em;
    transition: color var(--ma-transition);
}

p {
    margin-bottom: 1.5em;
    letter-spacing: -0.011em;
}

a {
    color: var(--ma-primary);
    text-decoration: none;
    transition: color var(--ma-transition);
}
a:hover {
    color: var(--ma-primary-hover);
}

/* ===== Header ===== */
.site-header {
    background: var(--ma-bg) !important;
    border-bottom: 1px solid var(--ma-border) !important;
    box-shadow: none !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all var(--ma-transition);
}

.site-header.scrolled {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.88) !important;
    box-shadow: var(--ma-shadow-md) !important;
}
[data-theme="dark"] .site-header.scrolled {
    background: rgba(15,23,42,0.88) !important;
}

.site-header .inside-header {
    max-width: var(--ma-wide-width) !important;
    margin: 0 auto;
    padding: 18px 32px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.main-title {
    margin: 0 !important;
}

.main-title a {
    font-family: var(--ma-font-heading) !important;
    font-size: 1.45em !important;
    font-weight: 800 !important;
    color: var(--ma-text) !important;
    letter-spacing: -0.03em;
}
.main-title a:hover {
    color: var(--ma-primary) !important;
    text-decoration: none !important;
}

.site-description {
    font-size: 0.78em !important;
    color: var(--ma-text-secondary) !important;
    margin-top: 2px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 500;
    font-family: var(--ma-font-body) !important;
}

/* ===== Navigation ===== */
.main-navigation {
    background: var(--ma-bg) !important;
    border-bottom: 1px solid var(--ma-border) !important;
    transition: background var(--ma-transition), border var(--ma-transition);
}

.main-navigation .inside-navigation {
    max-width: var(--ma-wide-width) !important;
    margin: 0 auto;
    padding: 0 32px !important;
}

.main-navigation a {
    font-family: var(--ma-font-body) !important;
    font-size: 0.88em !important;
    font-weight: 500 !important;
    color: var(--ma-text-secondary) !important;
    padding: 14px 18px !important;
    transition: color var(--ma-transition);
    position: relative;
}

.main-navigation a:hover,
.main-navigation .current-menu-item > a {
    color: var(--ma-text) !important;
}

.main-navigation .current-menu-item > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 18px;
    right: 18px;
    height: 2px;
    background: var(--ma-primary);
    border-radius: 1px;
}

/* ===== Content Container ===== */
.site-content {
    max-width: var(--ma-container-width) !important;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Home Hub ===== */
.home .site-main {
    position: relative;
}

.ma-home-hub {
    max-width: var(--ma-wide-width);
    margin: 0 auto;
    padding: 36px 24px 8px;
}

.ma-home-hub-inner {
    display: grid;
    gap: 20px;
}

.ma-home-hero,
.ma-home-theme-card {
    border: 1px solid var(--ma-border);
    border-radius: 18px;
    background: var(--ma-bg-soft);
    box-shadow: var(--ma-shadow-sm);
}

.ma-home-hero {
    padding: 32px 32px 28px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.14), transparent 32%),
        radial-gradient(circle at bottom left, rgba(217, 119, 6, 0.10), transparent 28%),
        var(--ma-bg-soft);
}

.ma-home-eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 0.76em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ma-text-secondary);
}

.ma-home-hero h2,
.ma-home-theme-card h3 {
    margin: 0 0 10px;
}

.ma-home-hero h2 {
    font-size: 2em;
    line-height: 1.2;
}

.ma-home-hero p,
.ma-home-theme-card p {
    margin-bottom: 0;
    color: var(--ma-text-secondary);
}

.ma-home-hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.ma-home-hero-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 999px;
    border: 1px solid var(--ma-border);
    background: var(--ma-bg);
    color: var(--ma-text);
    font-size: 0.9em;
    font-weight: 600;
}

.ma-home-hero-links a:hover {
    background: var(--ma-primary);
    border-color: var(--ma-primary);
    color: #fff;
    text-decoration: none;
}

.ma-home-theme-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.ma-home-theme-card {
    padding: 24px;
}

.ma-home-theme-links {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
}

.ma-home-theme-links li + li {
    margin-top: 10px;
}

.ma-home-theme-links a {
    font-weight: 600;
    line-height: 1.5;
}

#ma-home-latest {
    scroll-margin-top: 120px;
}

.inside-article {
    padding: 48px 0 32px;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Entry Title ===== */
.entry-title {
    font-family: var(--ma-font-heading) !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

.entry-title a {
    color: var(--ma-text) !important;
}
.entry-title a:hover {
    color: var(--ma-primary) !important;
    text-decoration: none !important;
}

h1.entry-title {
    font-size: 2.4em !important;
    margin-bottom: 0.2em !important;
    letter-spacing: -0.025em;
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

h2.entry-title {
    font-size: 1.55em !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    letter-spacing: -0.02em;
}

/* ===== Post Meta ===== */
.entry-meta {
    font-size: 0.88em !important;
    color: var(--ma-text-secondary) !important;
    margin-bottom: 2em !important;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    padding-bottom: 1.5em;
    border-bottom: 1px solid var(--ma-border);
}

.entry-meta a {
    color: var(--ma-text-secondary) !important;
    font-weight: 500;
}
.entry-meta a:hover {
    color: var(--ma-primary) !important;
}

.ma-reading-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    color: var(--ma-text-secondary);
}

.ma-reading-time svg {
    width: 15px;
    height: 15px;
    opacity: 0.7;
}

/* ===== Entry Content ===== */
.entry-content {
    font-size: 17.5px !important;
    line-height: 1.85 !important;
}

.entry-content h2 {
    font-size: 1.65em !important;
    margin-top: 2.5em !important;
    padding-bottom: 0.35em !important;
    border-bottom: 2px solid var(--ma-border) !important;
}

.entry-content h3 {
    font-size: 1.25em !important;
    margin-top: 2em !important;
    padding-bottom: 0.4em !important;
    border-bottom: 1px solid var(--ma-border) !important;
    border-color: var(--ma-border) !important;
}

.entry-content h4 {
    font-size: 1.08em !important;
    margin-top: 1.5em;
    font-family: var(--ma-font-body) !important;
    font-weight: 600;
}

/* ===== Blockquotes ===== */
.entry-content blockquote {
    border-left: 4px solid var(--ma-primary) !important;
    background: var(--ma-bg-soft) !important;
    margin: 2em 0 !important;
    padding: 1.5em 2em !important;
    border-radius: 0 12px 12px 0 !important;
    font-style: italic;
    color: var(--ma-text) !important;
    font-size: 1.02em !important;
    line-height: 1.75 !important;
    position: relative;
}

.entry-content blockquote::before {
    content: '\201C';
    font-family: var(--ma-font-heading);
    position: absolute;
    top: -8px;
    left: 16px;
    font-size: 3em;
    color: var(--ma-primary);
    opacity: 0.15;
    line-height: 1;
}

.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content blockquote strong { font-style: normal; }

/* ===== Key Takeaway / Info Boxes ===== */
.entry-content div[style*="background:#f8f9fa"],
.entry-content div[style*="background: #f8f9fa"] {
    background: var(--ma-bg-soft) !important;
    border-left: 4px solid var(--ma-accent) !important;
    border-radius: 0 12px 12px 0 !important;
    padding: 24px 28px !important;
    margin: 2em 0 !important;
    line-height: 2 !important;
    color: var(--ma-text) !important;
}

/* Image placeholders */
.entry-content div[style*="background:#e3f2fd"],
.entry-content div[style*="background: #e3f2fd"] {
    background: var(--ma-bg-soft) !important;
    border: 2px dashed var(--ma-border) !important;
    border-radius: 12px !important;
    padding: 24px !important;
    color: var(--ma-text-secondary) !important;
    font-size: 0.88em !important;
    text-align: center;
}

/* ===== Images ===== */
.entry-content img {
    border-radius: 12px;
    height: auto;
    max-width: 100%;
    box-shadow: var(--ma-shadow-md);
}

.post-image {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--ma-shadow-sm);
    transition: transform var(--ma-transition), box-shadow var(--ma-transition);
}

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

.featured-image {
    margin-bottom: 2em;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--ma-shadow-lg);
}
.single .featured-image {
    display: none;
}

/* ===== Auto-inserted Images (Image Picker) ===== */
.ma-auto-image {
    margin: 1.8em auto;
    max-width: 100%;
    text-align: center;
}
.ma-auto-image img {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}
.ma-auto-image figcaption {
    font-size: 0.75em;
    color: var(--ma-text-muted);
    text-align: center;
    margin-top: 6px;
    line-height: 1.4;
}

.ma-image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 1.8em auto;
    max-width: 100%;
}
.ma-image-grid[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.ma-image-grid[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
.ma-image-grid .ma-auto-image {
    margin: 0;
}
.ma-image-grid .ma-auto-image img {
    max-height: 260px;
    width: 100%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .ma-image-grid,
    .ma-image-grid[data-cols="3"],
    .ma-image-grid[data-cols="4"] {
        grid-template-columns: 1fr;
    }
    .ma-auto-image img {
        max-height: 320px;
    }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .ma-image-grid[data-cols="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== Lists ===== */
.entry-content ul, .entry-content ol {
    margin-bottom: 1.5em;
    padding-left: 1.4em;
}

.entry-content li {
    margin-bottom: 0.6em;
    line-height: 1.75;
}

.entry-content li a {
    font-weight: 500;
}

/* ===== Tables ===== */
.entry-content table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 2em 0 !important;
    font-size: 0.92em !important;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--ma-border) !important;
    box-shadow: var(--ma-shadow-sm);
}

.entry-content th {
    background: var(--ma-slate-800) !important;
    color: #fff !important;
    font-weight: 600 !important;
    text-align: left;
    padding: 14px 18px !important;
    border-bottom: none !important;
    font-size: 0.88em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

[data-theme="dark"] .entry-content th {
    background: var(--ma-slate-700) !important;
}

.entry-content td {
    padding: 12px 18px !important;
    border-bottom: 1px solid var(--ma-border) !important;
    transition: background var(--ma-transition);
}

.entry-content tbody tr:last-child td {
    border-bottom: none !important;
}

.entry-content tbody tr:nth-child(even) {
    background: var(--ma-bg-soft);
}

.entry-content tbody tr:hover {
    background: var(--ma-blue-50);
}
[data-theme="dark"] .entry-content tbody tr:hover {
    background: rgba(59,130,246,0.08);
}

.entry-content .positive { color: var(--ma-emerald-600); font-weight: 600; }
.entry-content .negative { color: var(--ma-red-600); font-weight: 600; }

/* ===== Code ===== */
.entry-content code {
    font-family: var(--ma-font-mono);
    font-size: 0.88em;
    background: var(--ma-bg-soft);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--ma-border);
}

.entry-content pre {
    font-family: var(--ma-font-mono);
    font-size: 0.88em;
    background: var(--ma-slate-900) !important;
    color: #e2e8f0;
    padding: 1.5em 2em;
    overflow-x: auto;
    border-radius: 12px;
    margin-bottom: 1.5em;
    box-shadow: var(--ma-shadow-md);
}

.entry-content pre code {
    padding: 0;
    border: none;
    background: none;
    color: inherit;
}

/* ===== Table of Contents ===== */
#ma-toc {
    background: var(--ma-bg-soft);
    border: 1px solid var(--ma-border);
    border-radius: 12px;
    padding: 24px 28px;
    margin: 0 0 2.5em 0;
    transition: background var(--ma-transition), border var(--ma-transition);
}

#ma-toc .ma-toc-title {
    font-family: var(--ma-font-body);
    font-size: 0.82em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ma-text-secondary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

#ma-toc .ma-toc-title::before {
    content: '▼';
    font-size: 0.7em;
    transition: transform 0.2s;
    color: var(--ma-text-muted);
}

#ma-toc.collapsed .ma-toc-title::before {
    transform: rotate(-90deg);
}

#ma-toc .ma-toc-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ma-border);
}

#ma-toc ul {
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

#ma-toc.collapsed ul {
    max-height: 0 !important;
    opacity: 0;
    margin: 0 !important;
}

#ma-toc ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

#ma-toc li {
    margin: 0 !important;
    padding: 0 !important;
}

#ma-toc a {
    display: block;
    padding: 7px 0 7px 14px;
    font-size: 0.9em;
    color: var(--ma-text-secondary);
    font-weight: 500;
    border-left: 2px solid transparent;
    transition: all var(--ma-transition);
    line-height: 1.4;
}

#ma-toc a:hover,
#ma-toc a.active {
    color: var(--ma-primary);
    border-left-color: var(--ma-primary);
    text-decoration: none;
}

#ma-toc li.toc-h3 a {
    padding-left: 30px;
    font-size: 0.85em;
    color: var(--ma-text-muted);
}

#ma-toc li.toc-h3 a:hover,
#ma-toc li.toc-h3 a.active {
    color: var(--ma-primary);
}

/* ===== Social Share Bar ===== */
.ma-share-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    margin: 2.5em 0;
    border-top: 1px solid var(--ma-border);
    border-bottom: 1px solid var(--ma-border);
}

.ma-share-bar .ma-share-label {
    font-size: 0.82em;
    font-weight: 700;
    color: var(--ma-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 4px;
}

.ma-share-bar a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--ma-bg-soft);
    border: 1px solid var(--ma-border);
    color: var(--ma-text-secondary);
    transition: all var(--ma-transition);
}

.ma-share-bar a:hover {
    background: var(--ma-primary);
    color: #fff;
    border-color: var(--ma-primary);
    transform: translateY(-2px);
    box-shadow: var(--ma-shadow-md);
    text-decoration: none;
}

.ma-share-bar a svg {
    width: 18px;
    height: 18px;
}

/* ===== Newsletter CTA ===== */
.ma-newsletter {
    background: linear-gradient(135deg, var(--ma-slate-900) 0%, var(--ma-slate-800) 100%);
    border-radius: 16px;
    padding: 44px 36px;
    margin: 3em 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ma-newsletter::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -15%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(59,130,246,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.ma-newsletter::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(217,119,6,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.ma-newsletter h3 {
    font-family: var(--ma-font-heading) !important;
    color: #fff !important;
    font-size: 1.5em;
    margin-bottom: 0.3em;
    position: relative;
}

.ma-newsletter p {
    color: var(--ma-slate-300) !important;
    font-size: 0.95em;
    margin-bottom: 1.5em;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.ma-newsletter-form {
    display: flex;
    gap: 10px;
    max-width: 440px;
    margin: 0 auto;
    position: relative;
}

.ma-newsletter-form input[type="email"] {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid var(--ma-slate-600);
    background: var(--ma-slate-800);
    color: #fff;
    border-radius: 10px;
    font-size: 0.95em;
    font-family: var(--ma-font-body);
    outline: none;
    transition: border var(--ma-transition);
}

.ma-newsletter-form input[type="email"]::placeholder {
    color: var(--ma-slate-400);
}

.ma-newsletter-form input[type="email"]:focus {
    border-color: var(--ma-blue-600);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}

.ma-newsletter-form button {
    padding: 14px 28px;
    background: var(--ma-amber-600);
    color: var(--ma-slate-900);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.92em;
    font-family: var(--ma-font-body);
    cursor: pointer;
    transition: all var(--ma-transition);
    white-space: nowrap;
}

.ma-newsletter-form button:hover {
    background: var(--ma-amber-500);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217,119,6,0.3);
}
.ma-nl-msg {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88em;
}
.ma-nl-msg.ok {
    background: rgba(34,197,94,0.15);
    color: #22c55e;
}
.ma-nl-msg.err {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
}

/* ===== Author Box ===== */
.author-info {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    background: var(--ma-bg-soft) !important;
    border-radius: 16px !important;
    padding: 32px !important;
    margin: 3em 0 !important;
    border: 1px solid var(--ma-border) !important;
    transition: background var(--ma-transition), border var(--ma-transition);
}

.author-info .author-avatar img {
    border-radius: 50%;
    width: 72px;
    height: 72px;
    object-fit: cover;
    box-shadow: var(--ma-shadow-sm);
}

/* ===== Category & Tag Pills ===== */
.cat-links, .tag-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cat-links a, .tag-links a {
    display: inline-block;
    background: var(--ma-bg-soft);
    border: 1px solid var(--ma-border);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.78em;
    font-weight: 500;
    color: var(--ma-text-secondary);
    transition: all var(--ma-transition);
    letter-spacing: 0.01em;
}

.cat-links a:hover, .tag-links a:hover {
    background: var(--ma-primary);
    color: #fff;
    border-color: var(--ma-primary);
    text-decoration: none;
    transform: translateY(-1px);
}

/* ===== Floating Buttons (Dark Mode + Back to Top) ===== */
.ma-theme-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--ma-bg);
    border: 1px solid var(--ma-border);
    box-shadow: var(--ma-shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all var(--ma-transition);
    color: var(--ma-text);
    font-size: 18px;
    line-height: 1;
}

.ma-theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.ma-back-to-top {
    position: fixed;
    bottom: 28px;
    right: 86px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--ma-bg);
    border: 1px solid var(--ma-border);
    box-shadow: var(--ma-shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all var(--ma-transition);
    color: var(--ma-text);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.ma-back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.ma-back-to-top:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.ma-back-to-top svg {
    width: 20px;
    height: 20px;
}

/* ===== Footer ===== */
.site-footer {
    background: var(--ma-slate-900) !important;
    color: var(--ma-slate-300) !important;
    border-top: none !important;
    margin-top: 48px;
    transition: background var(--ma-transition);
}

.site-footer .inside-site-info {
    max-width: var(--ma-wide-width) !important;
    margin: 0 auto;
    padding: 48px 32px 32px !important;
    text-align: center;
}

.site-footer a {
    color: var(--ma-slate-300) !important;
    transition: color var(--ma-transition);
}

.site-footer a:hover {
    color: #fff !important;
}

/* ===== Sidebar: Right Sidebar Layout ===== */
.right-sidebar .content-area {
    flex: 1;
    min-width: 0;
}
.right-sidebar .is-right-sidebar {
    width: var(--ma-sidebar-width);
    flex-shrink: 0;
}

.sidebar .widget {
    background: var(--ma-bg-soft);
    border: 1px solid var(--ma-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.sidebar .widget-title {
    font-family: var(--ma-font-heading);
    font-size: 1.05em;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--ma-text);
}
.sidebar .widget ul { list-style: none; padding: 0; }
.sidebar .widget ul li {
    padding: 8px 0;
    border-bottom: 1px solid var(--ma-border);
    font-size: 0.88em;
}
.sidebar .widget ul li:last-child { border-bottom: none; }
.sidebar .widget ul li a { color: var(--ma-text); text-decoration: none; }
.sidebar .widget ul li a:hover { color: var(--ma-primary); }
.sidebar .widget:last-child {
    position: sticky;
    top: 80px;
}

/* ===== Comments ===== */
.comments-area {
    margin-top: 3em;
    padding-top: 2em;
    border-top: 2px solid var(--ma-border);
}

.comment-body {
    background: var(--ma-bg-soft);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--ma-border);
    transition: background var(--ma-transition), border var(--ma-transition);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    border: 1px solid var(--ma-border) !important;
    background: var(--ma-bg) !important;
    border-radius: 10px !important;
    padding: 12px 16px !important;
    font-family: var(--ma-font-body) !important;
    font-size: 0.95em !important;
    transition: border var(--ma-transition);
    color: var(--ma-text) !important;
    width: 100%;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--ma-primary) !important;
    box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

.comment-form .form-submit input[type="submit"] {
    background: var(--ma-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 14px 32px !important;
    font-weight: 600 !important;
    font-size: 0.95em !important;
    cursor: pointer;
    transition: all var(--ma-transition);
    font-family: var(--ma-font-body) !important;
}

.comment-form .form-submit input[type="submit"]:hover {
    background: var(--ma-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: var(--ma-shadow-md);
}

/* ===== Pagination ===== */
.nav-links {
    display: flex;
    justify-content: space-between;
    padding: 2em 0;
    border-top: 1px solid var(--ma-border);
    font-size: 0.9em;
}

.nav-links a {
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--ma-bg-soft);
    border: 1px solid var(--ma-border);
    border-radius: 10px;
    transition: all var(--ma-transition);
}

.nav-links a:hover {
    background: var(--ma-primary);
    color: #fff;
    border-color: var(--ma-primary);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--ma-shadow-md);
}

/* ===== Post Listing Separator ===== */
article.post {
    border-bottom: 1px solid var(--ma-border);
    padding-bottom: 2em;
    margin-bottom: 2em;
}

.home article.post:first-of-type {
    padding-top: 0.5em;
}

article.post:last-child {
    border-bottom: none;
}

/* ===== Utility: Callout Boxes ===== */
.ma-callout {
    border-radius: 12px;
    padding: 20px 24px;
    margin: 2em 0;
    border-left: 4px solid;
    line-height: 1.7;
}

.ma-callout-info {
    background: var(--ma-blue-50);
    border-left-color: var(--ma-blue-600);
    color: var(--ma-slate-800);
}

.ma-callout-bull {
    background: var(--ma-emerald-50);
    border-left-color: var(--ma-emerald-600);
    color: var(--ma-slate-800);
}

.ma-callout-bear {
    background: var(--ma-red-50);
    border-left-color: var(--ma-red-600);
    color: var(--ma-slate-800);
}

.ma-callout-warn {
    background: var(--ma-amber-50);
    border-left-color: var(--ma-amber-600);
    color: var(--ma-slate-800);
}

[data-theme="dark"] .ma-callout {
    background: var(--ma-bg-soft);
    color: var(--ma-text);
    border-color: var(--ma-border);
}
[data-theme="dark"] .ma-author-box,
[data-theme="dark"] .ma-related-posts {
    background: var(--ma-bg-soft);
    border-color: var(--ma-border);
}
[data-theme="dark"] .ma-author-bio {
    color: var(--ma-text-muted);
}
[data-theme="dark"] .ma-nl-msg.ok {
    background: rgba(34,197,94,0.1);
}
[data-theme="dark"] .ma-nl-msg.err {
    background: rgba(239,68,68,0.1);
}

/* ===== Responsive: Tablet ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .site-content { max-width: 95% !important; }
    .right-sidebar .is-right-sidebar { width: 220px; }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
    .sidebar { display: none !important; }
    body { font-size: 16px; }
    .entry-content { font-size: 16px !important; }

    h1.entry-title { font-size: 1.8em !important; }
    h2.entry-title { font-size: 1.3em !important; }
    .entry-content h2 { font-size: 1.4em !important; }
    .entry-content h3 { font-size: 1.15em !important; }

    .inside-article { padding: 28px 0; }
    .site-header .inside-header { padding: 14px 20px !important; }
    .main-navigation .inside-navigation { padding: 0 20px !important; }
    .site-content { padding: 0 20px; }
    .ma-home-hub { padding: 28px 20px 0; }
    .ma-home-hero { padding: 24px 22px; }
    .ma-home-hero h2 { font-size: 1.55em; }
    .ma-home-theme-grid { grid-template-columns: 1fr; }
    .ma-home-theme-card { padding: 20px; }
    .ma-home-hero-links { flex-direction: column; }
    .ma-home-hero-links a { width: 100%; }

    .entry-content table { font-size: 0.82em !important; }
    .entry-content th { padding: 10px 12px !important; font-size: 0.82em; }
    .entry-content td { padding: 10px 12px !important; }

    .author-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px !important;
    }

    #ma-toc { padding: 20px 24px; }
    .ma-newsletter { padding: 32px 24px; }
    .ma-newsletter-form { flex-direction: column; }

    .ma-share-bar { flex-wrap: wrap; }

    .ma-theme-toggle { bottom: 20px; right: 20px; width: 42px; height: 42px; font-size: 16px; }
    .ma-back-to-top { bottom: 20px; right: 74px; width: 42px; height: 42px; }

    .entry-content blockquote { padding: 1.2em 1.5em !important; }
    .entry-meta { gap: 8px; }

    .nav-links { flex-direction: column; gap: 12px; }
    .nav-links a { justify-content: center; }

    .site-footer .inside-site-info { padding: 36px 20px 24px !important; }
}

@media (max-width: 480px) {
    h1.entry-title { font-size: 1.55em !important; }
    .main-title a { font-size: 1.2em !important; }
    .entry-content { font-size: 15.5px !important; }
}

/* ===== Image Figure Placeholder ===== */
.ma-figure-placeholder {
    margin: 2em 0;
    border: 2px dashed var(--ma-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--ma-bg-soft);
    transition: background var(--ma-transition), border var(--ma-transition);
}

.ma-figure-placeholder-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 12px;
    min-height: 200px;
}

.ma-figure-placeholder-inner svg {
    width: 48px;
    height: 48px;
    color: var(--ma-text-muted);
    opacity: 0.5;
}

.ma-figure-desc {
    font-size: 0.9em;
    color: var(--ma-text-secondary);
    text-align: center;
    font-weight: 500;
    max-width: 400px;
    line-height: 1.5;
}

.ma-figure-placeholder figcaption {
    padding: 10px 16px;
    background: var(--ma-bg-muted);
    font-size: 0.82em;
    color: var(--ma-text-muted);
    text-align: center;
    border-top: 1px solid var(--ma-border);
}

/* ===== Author Box ===== */
.ma-author-box {
    display: flex;
    gap: 18px;
    margin-top: 2.5em;
    padding: 24px;
    background: var(--ma-bg-soft);
    border: 1px solid var(--ma-border);
    border-radius: 12px;
}
.ma-author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ma-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1em;
    flex-shrink: 0;
}
.ma-author-name {
    font-family: var(--ma-font-heading);
    font-weight: 700;
    font-size: 1.05em;
    margin-bottom: 4px;
}
.ma-author-bio {
    font-size: 0.88em;
    color: var(--ma-text-muted);
    line-height: 1.6;
    margin-bottom: 6px;
}
.ma-author-link {
    font-size: 0.82em;
    color: var(--ma-primary);
    text-decoration: none;
    font-weight: 600;
}
.ma-author-link:hover { text-decoration: underline; }

/* ===== Related Posts ===== */
.ma-related-posts {
    margin-top: 2.5em;
    padding: 24px 28px;
    background: var(--ma-bg-soft);
    border: 1px solid var(--ma-border);
    border-radius: 12px;
}
.ma-related-title {
    font-family: var(--ma-font-heading);
    font-size: 1.1em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--ma-border);
}
.ma-related-posts ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.ma-related-posts li {
    padding: 8px 0;
    border-bottom: 1px solid var(--ma-border);
}
.ma-related-posts li:last-child {
    border-bottom: none;
}
.ma-related-posts a {
    color: var(--ma-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95em;
}
.ma-related-posts a:hover {
    text-decoration: underline;
}

/* ===== Footer Nav ===== */
.ma-footer-nav a {
    color: var(--ma-slate-300) !important;
    text-decoration: none;
    font-size: 0.9em;
}
.ma-footer-nav a:hover {
    color: #fff !important;
}

/* ===== Disclaimer ===== */
.ma-disclaimer {
    margin-top: 3em;
    padding: 20px 24px;
    background: var(--ma-bg-soft);
    border-left: 4px solid var(--ma-slate-300);
    border-radius: 0 8px 8px 0;
    font-size: 0.82em;
    color: var(--ma-text-secondary);
    line-height: 1.7;
    transition: background var(--ma-transition), border var(--ma-transition);
}

.ma-disclaimer strong {
    color: var(--ma-text);
}

/* ===== Ad Unit ===== */
.ma-ad-unit {
    margin: 2.5em 0 !important;
    text-align: center;
    overflow: hidden;
    clear: both;
}

.ma-ad-unit ins {
    display: block !important;
}

/* ===== Print ===== */
@media print {
    .site-header, .site-footer, .main-navigation,
    .comments-area, .nav-links, .ma-share-bar,
    .ma-newsletter, .ma-theme-toggle, .ma-back-to-top,
    #ma-progress-bar, #ma-toc {
        display: none !important;
    }
    body { background: #fff; color: #000; }
    .entry-content { font-size: 12pt; line-height: 1.6; }
}
