/*
Theme Name: XGravity
Author: Sayan
Description: Modern, optimized, AdSense-friendly WordPress theme.
Version: 1.0
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.0
Text Domain: xgravity
*/

/* =========================================
   VARIABLES & DESIGN SYSTEM
   ========================================= */
:root {
    /* Colors */
    --primary: #f97316; /* Vibrant Orange */
    --primary-hover: #ea580c;
    --primary-light: #ffedd5;
    
    --secondary: #1e1b4b; /* Deep Indigo */
    --secondary-light: #312e81;
    
    --bg-main: #f8fafc; /* Soft off-white */
    --bg-surface: #ffffff;
    
    --text-main: #334155;
    --text-muted: #64748b;
    --text-heading: #0f172a;
    
    --border-color: #e2e8f0;
    
    /* Typography */
    --font-sans: 'Inter', 'Noto Serif Bengali', system-ui, sans-serif;
    --font-heading: 'Outfit', 'Noto Serif Bengali', system-ui, sans-serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.4);
    
    /* Radii */
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   RESET & BASE STYLES
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    /* FIX: Prevent horizontal scroll bleed that body alone can't catch */
    overflow-x: hidden;
}

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    /* FIX: Ensure full-width on mobile */
    width: 100%;
    min-width: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-heading);
    font-weight: 600;
    line-height: 1.2;
    /* FIX: Prevent long words from breaking layout */
    word-break: break-word;
    overflow-wrap: break-word;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

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

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    /* FIX: Prevent container from exceeding viewport */
    box-sizing: border-box;
}

.text-primary { color: var(--primary); }
.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =========================================
   BACKGROUND ELEMENTS (Modern Aesthetics)
   ========================================= */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.4;
    animation: float 10s ease-in-out infinite;
    /* FIX: Prevent shapes from causing overflow */
    pointer-events: none;
    max-width: 100vw;
}

.shape-1 {
    top: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: var(--primary-light);
}

.shape-2 {
    top: 20%;
    right: -150px;
    width: 500px;
    height: 500px;
    background: rgba(49, 46, 129, 0.1);
    animation-delay: -5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(30px) scale(1.05); }
}

/* =========================================
   COMPONENTS
   ========================================= */
/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    transition: var(--transition);
    /* FIX: Prevent buttons from overflowing their container */
    white-space: nowrap;
    max-width: 100%;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

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

.btn-secondary {
    background-color: white;
    color: var(--secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--secondary-light);
    color: var(--secondary-light);
}

.btn-white {
    background-color: white;
    color: var(--primary);
}

.btn-white:hover {
    background-color: var(--bg-main);
    transform: translateY(-2px);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.shadow-glow {
    box-shadow: var(--shadow-glow);
}

/* Glassmorphism */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

/* =========================================
   HEADER / NAVBAR
   ========================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
    padding: 1rem 0;
}

.navbar.scrolled {
    padding: 0.75rem 0;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--secondary);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-size: 1.1rem;
    /* FIX: Prevent shrinking on flex containers */
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a:not(.btn) {
    font-weight: 500;
    color: var(--text-main);
    position: relative;
}

.nav-links a:not(.btn)::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: var(--transition);
}

.nav-links a:not(.btn):hover::after,
.nav-links a:not(.btn).active::after {
    width: 100%;
}

.nav-links a:not(.btn):hover,
.nav-links a:not(.btn).active {
    color: var(--primary);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary);
    cursor: pointer;
    /* FIX: Ensure minimum tap target size (44x44px recommended) */
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
}

/* =========================================
   HERO SECTION
   ========================================= */
.hero {
    padding: 100px 0 60px;
    display: flex;
    align-items: center;
    /* FIX: Contain everything within viewport */
    overflow: hidden;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    color: var(--primary-hover);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    /* FIX: Allow wrapping on small screens */
    white-space: normal;
    word-break: break-word;
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 90%;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap; /* FIX: Allow buttons to wrap on narrow screens */
}

.hero-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    /* FIX: Add padding to contain floating badges without overflow */
    padding: 24px;
}

.hero-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    object-fit: cover;
    border: 4px solid white;
    display: block; /* FIX: Remove inline-block gap */
}

/* FIX: Floating badges repositioned to stay inside the padded wrapper */
.floating-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    background: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--secondary);
    border: 1px solid var(--border-color);
    z-index: 2;
    animation: float 6s ease-in-out infinite;
    /* FIX: Prevent badge text overflow */
    max-width: calc(100% - 1rem);
    font-size: 0.875rem;
    white-space: nowrap;
}

.badge-top {
    bottom: auto;
    top: 0;
    left: auto;
    right: 0;
    animation-delay: -3s;
}

.alert-icon {
    font-size: 1.25rem;
    animation: pulse 2s infinite;
    flex-shrink: 0; /* FIX: Prevent icon from shrinking */
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* =========================================
   STATS SECTION
   ========================================= */
.stats-section {
    padding: 2rem 0;
    margin-top: -3rem;
    position: relative;
    z-index: 10;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    /* FIX: Prevent grid from overflowing */
    overflow: hidden;
}

.stat-box {
    text-align: center;
    padding: 1rem;
    border-right: 1px solid var(--border-color);
}

.stat-box:last-child {
    border-right: none;
}

.stat-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
    color: var(--secondary);
    /* FIX: Scale down on small screens */
    word-break: break-all;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem; /* FIX: Slightly smaller for better fit */
}

/* =========================================
   INFO SECTION (Cards)
   ========================================= */
.info-section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.section-header.text-left {
    text-align: left;
    margin-left: 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.info-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-left: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    /* FIX: Prevent card from overflowing its grid cell */
    min-width: 0;
    overflow: hidden;
}

.info-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--secondary);
}

.card-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    flex-shrink: 0; /* FIX: Don't shrink icon */
}

.info-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.info-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    flex-grow: 1;
}

.read-more {
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.read-more:hover {
    color: var(--secondary);
    gap: 0.75rem;
}

/* =========================================
   TABLE SECTION
   ========================================= */
.table-section {
    padding: 2rem 0 4rem;
}

.glass-container {
    background: white;
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    /* FIX: Prevent container itself from overflowing */
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* FIX: Ensure scroll is accessible and visible */
    width: 100%;
    display: block;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    /* FIX: Minimum width so content doesn't squish unreadably */
    min-width: 400px;
}

.modern-table th, .modern-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    /* FIX: Prevent cell content from breaking layout */
    word-break: break-word;
}

.modern-table th {
    font-family: var(--font-heading);
    color: var(--text-heading);
    font-size: 1.1rem;
    background: var(--bg-main);
    border-top: 1px solid var(--border-color);
    /* FIX: Don't wrap header text on larger screens */
    white-space: nowrap;
}

.modern-table tbody tr {
    transition: var(--transition);
}

.modern-table tbody tr:hover {
    background-color: var(--bg-main);
}

.modern-table td strong {
    color: var(--secondary);
}

.table-link {
    color: var(--primary);
    font-weight: 500;
}

.table-link:hover {
    text-decoration: underline;
}

/* =========================================
   BLOG CONTENT SECTION
   ========================================= */
.content-section {
    padding: 2rem 0 3rem;
}

.blog-content {
    margin: 0 auto;
    padding: 3rem;
    border-top: 6px solid var(--primary);
    /* FIX: Prevent content from overflowing */
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.blog-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--secondary);
}

.blog-content h2 {
    font-size: 2rem;
    margin: 2.5rem 0 1rem;
    color: var(--secondary);
}

.blog-content h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    color: var(--text-heading);
}

.blog-content h4 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.blog-content h5 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.5rem;
    color: var(--text-muted);
}

.blog-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    line-height: 1.8;
}

.blog-content .lead-text {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 500;
}

.blog-content ul, .blog-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.blog-content ul li, .blog-content ol li {
    margin-bottom: 0.5rem;
}

.blog-content ul {
    list-style-type: disc;
}

.blog-content ul li::marker {
    color: var(--primary);
}

/* FIX: Make embedded images in blog posts responsive */
.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    display: block;
}

/* FIX: Make iframes/embeds responsive */
.blog-content iframe,
.blog-content embed,
.blog-content video {
    max-width: 100%;
}

.blog-content blockquote {
    border-left: 4px solid var(--primary);
    background: var(--bg-main);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    font-size: 1.25rem;
    font-style: italic;
    color: var(--secondary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* =========================================
   CTA SECTION
   ========================================= */
.cta-section {
    padding: 4rem 0;
}

.cta-card {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
    border-radius: var(--radius-xl);
    padding: 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.cta-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: var(--primary);
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.cta-content {
    max-width: 60%;
    position: relative;
    z-index: 1;
}

.cta-content h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.cta-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.cta-action {
    position: relative;
    z-index: 1;
}

/* =========================================
   LATEST POSTS SECTION
   ========================================= */
.latest-posts-section {
    padding: 4rem 0;
    background-color: var(--bg-main);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.post-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    /* FIX: Prevent card overflow inside grid */
    min-width: 0;
}

.post-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.post-img {
    width: 100%;
    height: 220px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.post-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-img img {
    transform: scale(1.05);
}

.post-content {
    padding: 1.5rem;
    flex-grow: 1;
}

.post-content h3 {
    font-size: 1.15rem;
    color: var(--text-heading);
    line-height: 1.5;
    margin-bottom: 0;
    transition: var(--transition);
}

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

/* =========================================
   FOOTER
   ========================================= */
.footer {
    background: #0f172a;
    color: white;
    padding: 5rem 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 3rem;
    margin-bottom: 4rem;
}

/* Footer Logo */
.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-bottom: 15px;
}

/* Logo Image */
.footer-logo-img {
    height: 45px;
    width: auto;
    display: block;
}

/* Site Name */
.footer-site-name {
    color: #ffffff;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.5px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .footer-logo-img {
        height: 38px;
    }

    .footer-site-name {
        font-size: 23px;
    }
}


.footer-about p {
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap; /* FIX: Allow social icons to wrap */
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #1e293b;
    border-radius: 50%;
    color: white;
    /* FIX: Ensure tap target size */
    flex-shrink: 0;
}

.social-links a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-links h4, .footer-contact h4 {
    color: white;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
}

.footer-links ul li {
    margin-bottom: 0.75rem;
}

.footer-links ul a {
    color: #94a3b8;
}

.footer-links ul a:hover {
    color: var(--primary);
    padding-left: 5px;
}

.footer-contact ul li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.footer-contact ul li i {
    color: var(--primary);
    margin-top: 5px;
    flex-shrink: 0; /* FIX: Prevent icon from shrinking */
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #1e293b;
    color: #64748b;
    font-size: 0.9rem;
}

/* =========================================
   ANIMATIONS (Scroll Reveal)
   ========================================= */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal.right {
    transform: translateX(50px);
}
.reveal.right.active {
    transform: translateX(0);
}

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }

/* =========================================
   RESPONSIVE — TABLET (max 1024px)
   ========================================= */
@media (max-width: 1024px) {
    .hero-title { font-size: 3rem; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 2rem;
    }
    .stat-box:nth-child(2) { border-right: none; }
    .stat-box:nth-child(1),
    .stat-box:nth-child(2) { border-bottom: 1px solid var(--border-color); }

    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .posts-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* =========================================
   RESPONSIVE — MOBILE (max 768px)
   ========================================= */
@media (max-width: 768px) {
    /* --- Navbar --- */
    .mobile-toggle { display: flex; }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: white;
        flex-direction: column;
        justify-content: center;
        padding: 2rem;
        gap: 2.5rem;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        overflow-y: auto; /* FIX: Allow scroll in nav on small phones */
    }

    .nav-links.active { right: 0; }

    .nav-links a:not(.btn) { font-size: 1.25rem; }

    .mobile-toggle {
        z-index: 1000;
        position: relative;
    }

    /* --- Hero --- */
    .hero {
        padding: 100px 0 50px;
        min-height: auto;
        text-align: center;
        /* FIX: Remove overflow:hidden here so content isn't clipped on scroll */
        overflow: visible;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 2rem; /* FIX: Reduce gap on mobile */
    }

    .hero-title { font-size: 2.5rem; }
    .hero-subtitle { max-width: 100%; margin: 0 auto 2rem; }
    .hero-actions { justify-content: center; }

    /* FIX: Constrain image wrapper so badges don't overflow screen */
    .hero-image-wrapper {
        padding: 30px 30px 40px; /* Extra bottom padding for bottom badge */
        max-width: 400px;
    }

    /* FIX: Scale down floating badges on mobile */
    .floating-badge {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    /* --- Stats --- */
    .stats-section {
        margin-top: 1.5rem; /* FIX: Remove negative margin on mobile to avoid overlap */
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 1.5rem;
        gap: 0;
    }

    .stat-number { font-size: 2rem; }

    /* --- Cards --- */
    .cards-grid { grid-template-columns: 1fr; }

    .info-card {
        padding: 1.75rem; /* FIX: Reduce padding on mobile */
    }

    /* --- Posts --- */
    .posts-grid { grid-template-columns: 1fr; }

    /* --- CTA --- */
    .cta-card {
        flex-direction: column;
        text-align: center;
        padding: 2.5rem 1.75rem;
        gap: 2rem;
    }
    .cta-content {
        max-width: 100%;
    }
    .cta-content h2 { font-size: 2rem; }

    /* --- Table/Glass Container --- */
    .glass-container {
        padding: 1.5rem 1rem; /* FIX: Tighter padding on mobile */
        border-radius: var(--radius-lg);
    }

    /* --- Blog Content --- */
    .blog-content {
        padding: 2rem 1.25rem; /* FIX: Reduce padding on mobile */
    }

    .blog-content h1 { font-size: 1.875rem; }
    .blog-content h2 { font-size: 1.625rem; }
    .blog-content h3 { font-size: 1.375rem; }

    .blog-content p,
    .blog-content ul,
    .blog-content ol {
        font-size: 1rem; /* FIX: Slightly smaller text on mobile */
    }

    .blog-content blockquote {
        padding: 1rem 1.25rem;
        font-size: 1.1rem;
    }

    /* --- Section headers --- */
    .section-header h2 { font-size: 2rem; }
    .section-header { margin-bottom: 2.5rem; }

    /* --- Footer --- */
    .footer { padding: 3rem 0 1.5rem; }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* =========================================
   RESPONSIVE — SMALL MOBILE (max 480px)
   ========================================= */
@media (max-width: 480px) {
    .container { padding: 0 1rem; } /* FIX: Slightly tighter side padding */

    /* --- Hero --- */
    .hero { padding: 90px 0 40px; }
    .hero-title { font-size: 1.875rem; }
    .hero-subtitle { font-size: 1rem; }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        align-items: center;
    }

    .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* FIX: Hide floating badges on very small screens to prevent overflow */
    .floating-badge {
        display: none;
    }

    .hero-image-wrapper {
        padding: 0;
        max-width: 100%;
    }

    /* --- Stats --- */
    .stats-section { margin-top: 1rem; }

    .stats-grid {
        grid-template-columns: 1fr;
        padding: 1.25rem;
    }

    .stat-box {
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem 0.75rem;
    }

    .stat-box:last-child { border-bottom: none; }

    .stat-number { font-size: 1.875rem; }
    .stat-icon { font-size: 1.75rem; }

    /* --- Cards --- */
    .cards-grid { gap: 1.25rem; }

    .info-card { padding: 1.5rem 1.25rem; }

    .info-card h3 { font-size: 1.25rem; }

    /* --- CTA --- */
    .cta-card { padding: 2rem 1.25rem; }
    .cta-content h2 { font-size: 1.75rem; }

    /* --- Section header --- */
    .section-header h2 { font-size: 1.75rem; }

    /* --- Blog --- */
    .blog-content {
        padding: 1.5rem 1rem;
    }

    .blog-content h1 { font-size: 1.625rem; }
    .blog-content h2 { font-size: 1.375rem; }
    .blog-content h3 { font-size: 1.25rem; }

    .blog-content ul,
    .blog-content ol {
        padding-left: 1.25rem;
    }

    /* --- Table --- */
    .glass-container { padding: 1rem 0.75rem; }

    .modern-table th,
    .modern-table td {
        padding: 0.875rem 0.75rem;
        font-size: 0.9rem;
    }

    /* --- Footer --- */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }

    .footer { padding: 2.5rem 0 1rem; }

    /* --- Posts --- */
    .post-img { height: 180px; }
}

/* =========================================
   RESPONSIVE — VERY SMALL (max 360px)
   ========================================= */
@media (max-width: 360px) {
    html { font-size: 15px; } /* FIX: Slightly scale down root font */

    .hero-title { font-size: 1.625rem; }

    .navbar { padding: 0.75rem 0; }

    .logo { font-size: 1.25rem; }
}

/* =========================================
   AUTHOR BOX
   ========================================= */

.xgravity-author-box {
    position: relative;
    margin: 3rem auto 2rem;
    max-width: 860px;
    width: 100%;                   /* FIX: never wider than container */
    box-sizing: border-box;        /* FIX: padding included in width   */
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    /* Accent top border */
    border-top: 4px solid var(--primary);
    overflow: visible;
}

/* Floating label badge */
.author-box-label {
    position: absolute;
    top: -0.85rem;
    left: 2rem;
    background: var(--primary);
    color: white;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.9rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

/* Inner flex row */
.author-box-inner {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* ── Avatar ── */
.author-box-avatar {
    flex-shrink: 0;
}

.author-box-avatar a {
    display: block;
    border-radius: 50%;
    /* glowing ring on hover */
    transition: var(--transition);
}

.author-box-avatar a:hover {
    box-shadow: 0 0 0 4px var(--primary-light), 0 0 0 6px var(--primary);
}

.author-avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: var(--shadow-md);
    display: block;
}

/* ── Content ── */
.author-box-content {
    flex: 1;
    min-width: 0;
}

.author-box-name {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    line-height: 1.2;
}

.author-box-name a {
    color: var(--secondary);
    transition: var(--transition);
}

.author-box-name a:hover {
    color: var(--primary);
}

.author-box-bio {
    font-size: 0.975rem;
    color: var(--text-muted);
    line-height: 1.75;
    margin-bottom: 1.25rem;
}

.author-box-bio--empty {
    font-style: italic;
    opacity: 0.6;
}

/* ── Social icons ── */
.author-box-socials {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.author-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-main);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    font-size: 1rem;
    transition: var(--transition);
    text-decoration: none;
    flex-shrink: 0;
}

.author-social-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .author-box-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.25rem;
    }

    .author-box-socials {
        justify-content: center;
    }

    .author-box-label {
        font-size: 0.7rem;
        left: 50%;
        transform: translateX(-50%);
        white-space: nowrap;
    }

    .xgravity-author-box {
        padding: 2rem 1rem;    /* tighter horizontal padding on small screens */
        margin: 2rem 0 1.5rem; /* no side margin — let container handle it    */
    }

    .author-box-name {
        font-size: 1.1rem;
    }

    .author-box-bio {
        font-size: 0.9rem;
        word-break: break-word; /* long bios don't overflow */
    }

    .author-avatar-img {
        width: 80px;
        height: 80px;
    }

    /* Social icon buttons — wrap tightly */
    .author-social-link {
        width: 34px;
        height: 34px;
        font-size: 0.875rem;
    }
}

/* =========================================
   THREADED COMMENTS — nested reply design
   ========================================= */

/* Reset the outer list */
.comment-list,
.comment-list .children {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ── Thread connector line for replies ── */
.comment-list .children {
    /* Indent replies so they sit visually "under" the parent */
    margin-top: 0.75rem;
    margin-left: 1.25rem;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;

    /* The orange vertical thread line on the left */
    border-left: 3px solid var(--primary);
    position: relative;
}

/* Suppress any further deep nesting indentation beyond 2 levels */
.comment-list .children .children {
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left-color: var(--primary-light);
}

/* Top-level comment spacing */
.comment-list > .comment-item {
    margin-bottom: 0; /* gap handled by parent flex */
}

/* Reply card — already has orange border via inline styles,
   this adds a small arrow/pointer on the left edge */
.comment-card--reply {
    position: relative;
}

.comment-card--reply::before {
    content: '';
    position: absolute;
    left: -1.55rem;           /* sits over the thread border-left */
    top: 1.2rem;
    width: 0.9rem;
    height: 2px;
    background: var(--primary);
}

/* Avatar sizing consistency */
.comment-avatar {
    border-radius: 50%;
    display: block;
    object-fit: cover;
}

.comment-card--top .comment-avatar {
    width: 52px;
    height: 52px;
}

.comment-card--reply .comment-avatar {
    width: 40px;
    height: 40px;
}

/* ── Responsive — tighter on mobile ── */
@media (max-width: 600px) {
    .comment-list .children {
        margin-left: 0.75rem;
        padding-left: 0.75rem;
    }

    .comment-card--reply::before {
        left: -1rem;
    }
}

/* =========================================
   POST CARD — Rich Metadata
   ========================================= */

/* Category pill on post cards */
.post-card-cat {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    margin-bottom: 0.5rem;
}

/* 2-line excerpt below post title */
.post-card-excerpt {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0.4rem 0 0.75rem;
    /* Clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Date + "Read more" row */
.post-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.post-card-readmore {
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.post-card:hover .post-card-readmore {
    gap: 8px;
}

/* No posts found */
.no-posts {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 3rem 0;
    grid-column: 1 / -1;
}

/* =========================================
   PAGINATION
   ========================================= */

.pagination-wrap {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

.pagination-wrap .nav-links,
.pagination-wrap .page-numbers {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-wrap .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 0.875rem;
    border-radius: var(--radius-lg);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-main);
    transition: var(--transition);
}

.pagination-wrap .page-numbers:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pagination-wrap .page-numbers.current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.pagination-wrap .page-numbers.dots {
    border: none;
    background: none;
    color: var(--text-muted);
    transform: none !important;
    box-shadow: none !important;
}

/* =========================================
   ACCESSIBILITY — Skip Link
   ========================================= */

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-weight: 700;
    text-decoration: none;
    font-size: 0.9rem;
    transition: top 0.2s ease;
}

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

/* =========================================
   COMMENT FORM — Mobile Responsive Fix
   ========================================= */

/*
 * WordPress comment_form() outputs inputs/textareas without explicit widths.
 * This global rule ensures ALL form elements inside the comment form
 * never exceed their container on any screen size.
 */
.comment-form-wrap,
.comment-form-wrap *,
#respond,
#respond * {
    box-sizing: border-box;
}

/* Textarea — the main culprit */
#commentform textarea,
.comment-form-wrap textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;           /* override any browser default min-width */
    resize: vertical;       /* only allow vertical resize, not horizontal */
    display: block;
}

/* Text / email / url inputs */
#commentform input[type="text"],
#commentform input[type="email"],
#commentform input[type="url"],
#commentform input[type="search"],
.comment-form-wrap input[type="text"],
.comment-form-wrap input[type="email"],
.comment-form-wrap input[type="url"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: block;
}

/* Submit button — full-width on narrow screens */
#commentform .submit,
.comment-form-wrap .submit {
    width: 100%;
    max-width: 100%;
}

/* Form field labels */
#commentform label,
.comment-form-wrap label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary);
}

/* Spacing between form fields */
#commentform p,
.comment-form-wrap p {
    margin-bottom: 1.25rem;
}

/* Comment text — prevent long words/URLs from overflowing */
.comment-text,
.comment-text p {
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Comment card — ensure it never overflows */
.comment-card {
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
}

/* Comments area outer wrapper */
.comments-area {
    width: 100%;
    box-sizing: border-box;
    overflow: visible !important;   /* Ensure no independent scrolling occurs */
}

/* Glass container inside comments — constrained */
.comment-form-wrap.glass-container {
    width: 100%;
    box-sizing: border-box;
    overflow: visible !important;   /* Ensure no independent scrolling occurs */
}

/* ── Mobile ── */
@media (max-width: 600px) {
    #commentform textarea,
    .comment-form-wrap textarea {
        font-size: 16px; /* prevents iOS auto-zoom on focus */
    }

    #commentform input[type="text"],
    #commentform input[type="email"],
    #commentform input[type="url"],
    .comment-form-wrap input[type="text"],
    .comment-form-wrap input[type="email"],
    .comment-form-wrap input[type="url"] {
        font-size: 16px; /* prevents iOS auto-zoom on focus */
    }

    .comment-form-wrap.glass-container {
        padding: 1.25rem 1rem;
    }
}

/* --- Page Links (wp_link_pages) Pagination --- */
.page-links {
    clear: both;
    margin: 2rem 0;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-links a,
.page-links > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: var(--radius-md);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    text-decoration: none;
    transition: all var(--transition-fast) ease;
}

.page-links a:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white !important;
    box-shadow: var(--shadow-glow);
}

.page-links > span {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    cursor: default;
}
