/**
 * Pitechpedia Journal — Google Material Design 3 (Material You / M3) Design System
 * 100% Original, Open-Source & Copyright-Free Tokens (Apache 2.0 & OFL Compliant)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Roboto+Mono:wght@400;500;600&family=Roboto+Serif:opsz,wght@8..144,400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0');

:root {
    /* M3 Tonal Palette */
    --md-primary: #0B57D0;
    --md-on-primary: #FFFFFF;
    --md-primary-container: #D3E3FD;
    --md-on-primary-container: #041E49;

    --md-secondary: #00639B;
    --md-on-secondary: #FFFFFF;
    --md-secondary-container: #C2E7FF;
    --md-on-secondary-container: #001D32;

    --md-tertiary: #B36B00;
    --md-on-tertiary: #FFFFFF;
    --md-tertiary-container: #FFDDB3;
    --md-on-tertiary-container: #2B1700;

    --md-surface: #F8F9FA;
    --md-surface-dim: #DED8E1;
    --md-surface-bright: #FEF7FF;
    --md-surface-container-lowest: #FFFFFF;
    --md-surface-container-low: #F3F4F6;
    --md-surface-container: #F0F4F9;
    --md-surface-container-high: #E9EEF6;
    --md-surface-container-highest: #E1E3E8;

    --md-on-surface: #1F1F1F;
    --md-on-surface-variant: #444746;
    --md-outline: #E0E2E0;
    --md-outline-variant: #C4C7C5;

    --md-success: #146C2E;
    --md-success-container: #C4EED0;
    --md-error: #B3261E;
    --md-error-container: #F9DEDC;

    /* M3 Elevation Shadows */
    --m3-shadow-1: 0 1px 3px 1px rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --m3-shadow-2: 0 2px 6px 2px rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --m3-shadow-3: 0 4px 12px 3px rgba(0, 0, 0, 0.08), 0 1px 3px 0 rgba(0, 0, 0, 0.05);

    /* Fonts */
    --font-heading: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-editorial: 'Roboto Serif', Georgia, serif;
    --font-mono: 'Roboto Mono', monospace;
}

/* Global Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    padding: 0;
    background-color: var(--md-surface);
    color: var(--md-on-surface);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--md-on-surface);
    margin-top: 0;
    line-height: 1.25;
}

a { color: var(--md-primary); text-decoration: none; transition: opacity 0.15s; }
a:hover { opacity: 0.85; }

/* Utilities */
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-4 { grid-column: span 4 / span 4; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.text-center { text-align: center; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: var(--font-mono); }
.rounded-full { border-radius: 9999px; }
.rounded-2xl { border-radius: 16px; }
.rounded-3xl { border-radius: 24px; }
.shadow-sm { box-shadow: var(--m3-shadow-1); }
.shadow-md { box-shadow: var(--m3-shadow-2); }
.shadow-lg { box-shadow: var(--m3-shadow-3); }
.my-4 { margin-top: 16px; margin-bottom: 16px; }
.my-6 { margin-top: 24px; margin-bottom: 24px; }
.my-8 { margin-top: 32px; margin-bottom: 32px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

/* M3 Elevated Cards */
.m3-card {
    background-color: var(--md-surface-container-lowest);
    border: 1px solid var(--md-outline);
    border-radius: 16px;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1);
    overflow: hidden;
}
.m3-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--m3-shadow-2);
}

/* M3 Buttons */
.m3-btn-filled {
    background-color: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    border-radius: 9999px;
    padding: 10px 24px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.m3-btn-filled:hover { background-color: #0842a0; box-shadow: var(--m3-shadow-1); }

.m3-btn-tonal {
    background-color: var(--md-primary-container);
    color: var(--md-on-primary-container);
    border: none;
    border-radius: 9999px;
    padding: 8px 18px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.m3-btn-tonal:hover { background-color: #c2d8fa; }

.m3-btn-outlined {
    background-color: transparent;
    color: var(--md-primary);
    border: 1px solid var(--md-outline);
    border-radius: 9999px;
    padding: 8px 20px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.m3-btn-outlined:hover { background-color: var(--md-surface-container); border-color: var(--md-primary); }

/* M3 Filter Chips */
.m3-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--md-outline);
    background-color: var(--md-surface-container-lowest);
    color: var(--md-on-surface-variant);
    cursor: pointer;
    transition: all 0.15s;
}
.m3-chip:hover { background-color: var(--md-surface-container); color: var(--md-on-surface); }
.m3-chip.active {
    background-color: var(--md-primary-container);
    border-color: var(--md-primary);
    color: var(--md-on-primary-container);
    font-weight: 600;
}

/* M3 Top Bar & Masthead */
.m3-ticker-bar {
    background-color: #041E49;
    color: #D3E3FD;
    font-size: 12px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.m3-masthead {
    background-color: var(--md-surface-container-lowest);
    border-bottom: 1px solid var(--md-outline);
    padding: 16px 0;
}
.m3-nav-pill-search {
    background-color: var(--md-surface-container);
    border: 1px solid transparent;
    border-radius: 9999px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 280px;
    transition: all 0.2s;
}
.m3-nav-pill-search:focus-within {
    border-color: var(--md-primary);
    background-color: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.15);
}
.m3-nav-pill-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 14px;
    color: var(--md-on-surface);
}

/* Article Reading Experience */
.m3-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background-color: var(--md-primary);
    width: 0%;
    z-index: 9999;
    transition: width 0.1s;
}
.m3-article-body {
    font-family: var(--font-editorial);
    font-size: 18px;
    line-height: 1.85;
    color: #1F1F1F;
}
.m3-article-body p { margin-bottom: 24px; }
.m3-article-body h2 { font-size: 26px; margin-top: 40px; margin-bottom: 16px; border-bottom: 1px solid var(--md-outline); padding-bottom: 8px; }
.m3-article-body h3 { font-size: 21px; margin-top: 32px; margin-bottom: 12px; }

/* Affiliate Disclosure & Partner Boxes */
.affiliate-box {
    background-color: #FEF7FF;
    border-left: 4px solid var(--md-tertiary);
    border-radius: 0 12px 12px 0;
    padding: 16px 20px;
    margin: 28px 0;
    font-size: 15px;
    font-family: var(--font-body);
}
.affiliate-cta {
    display: inline-block;
    background-color: var(--md-tertiary);
    color: #FFFFFF !important;
    padding: 6px 14px;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 13px;
    margin-top: 8px;
}

/* Paywall Gating Card */
.m3-paywall-gate {
    background: linear-gradient(180deg, rgba(248, 249, 250, 0.2) 0%, #FFFFFF 60%);
    border: 1px solid var(--md-outline);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: var(--m3-shadow-3);
    margin-top: -80px;
    position: relative;
    z-index: 10;
}

/* Responsive Table Container */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-responsive table {
    min-width: 640px;
    width: 100%;
}

/* Horizontal Smooth-Scrolling Chips Ribbon */
.m3-chips-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.m3-chips-scroll::-webkit-scrollbar {
    display: none;
}

/* PWA App Installation Floating Banner */
.pwa-banner {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    width: calc(100% - 32px);
    max-width: 480px;
    background-color: #041E49;
    color: #FFFFFF;
    border-radius: 20px;
    padding: 12px 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Mobile Drawer Overlay */
.m3-mobile-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 9999;
}
.m3-mobile-drawer.active {
    display: block;
}
.m3-drawer-panel {
    width: 280px;
    max-width: 80%;
    height: 100%;
    background-color: var(--md-surface-container-lowest);
    box-shadow: var(--m3-shadow-3);
    padding: 24px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Responsive Grid & Viewport Breakpoints */
@media (max-width: 992px) {
    .grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .col-span-2, .col-span-3, .col-span-4 { grid-column: span 1 / span 1 !important; }
    .m3-nav-pill-search { width: 220px; }
}

@media (max-width: 768px) {
    .grid-cols-2, .grid-cols-4 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
    .m3-nav-pill-search { display: none; }
    .container { padding: 0 16px; }

    /* Mobile Typography Scaling */
    h1 { font-size: 24px !important; line-height: 1.3 !important; }
    h2 { font-size: 20px !important; }
    h3 { font-size: 18px !important; }
    .text-3xl { font-size: 22px !important; }
    .text-4xl { font-size: 26px !important; }
    
    /* Article Reading Comfort on Small Devices */
    .m3-article-body {
        font-size: 16px !important;
        line-height: 1.75 !important;
    }
    .m3-article-body p { margin-bottom: 20px !important; }

    /* Code Sandbox Responsiveness */
    .m3-playground-body iframe {
        height: 280px !important;
    }
    .m3-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* Paywall Teaser Padding on Mobile */
    .m3-paywall-gate {
        padding: 24px 16px !important;
        margin-top: -50px !important;
    }

    /* Hide ticker on very small screens for clean UX */
    .m3-ticker-bar {
        font-size: 11px !important;
        padding: 4px 0 !important;
    }
    .m3-ticker-bar .container {
        flex-direction: column !important;
        gap: 2px !important;
        text-align: center !important;
    }

    /* Buttons Minimum Touch Targets (44px) */
    .m3-btn-filled, .m3-btn-tonal, .m3-btn-outlined {
        min-height: 44px;
        padding: 10px 18px;
    }
}

