/* Mobile-only overrides to be non-destructive to desktop */

@media (max-width: 768px) {
    /* Enforce dark appearance regardless of stored theme */
    body {
        --bg-primary: rgba(0, 0, 0, 0.9);
        --bg-secondary: rgba(10, 10, 10, 0.9);
        --bg-card: rgba(15, 15, 15, 0.8);
        --text-primary: #FFFFFF;
        --text-secondary: #CCCCCC;
        --text-muted: #888888;
        --border-color: rgba(120, 120, 120, 0.5);
        --shadow-color: rgba(0, 0, 0, 0.5);
        --body-bg-overlay: rgba(0, 0, 0, 0.65);
        --image-overlay-opacity: 0.4;
        background: #000000;
        color: var(--text-primary);
    }

    /* Ensure background overlays match dark appearance */
    body::before {
        background-image:
            radial-gradient(circle at 20% 20%, rgba(200, 200, 200, 0.1) 1px, transparent 1px),
            radial-gradient(circle at 80% 80%, rgba(200, 200, 200, 0.1) 1px, transparent 1px),
            url('assets/img/tamales.jpg');
        opacity: 0.4;
        filter: blur(1px) brightness(0.7) contrast(1.2);
    }
    body::after {
        background: rgba(0, 0, 0, 0.65);
    }

    /* Mirror key dark-theme component treatments without requiring the class */
    .dashboard-card {
        background: rgba(15, 15, 15, 0.8);
        border: 1px solid #999999;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
    }

    .chart-container {
        background: rgba(15, 15, 15, 0.8);
        border: 1px solid #999999;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        height: 320px;
    }

    /* Force interior text to white for contrast on mobile */
    .dashboard-card, .chart-container, .footer { color: #FFFFFF; }
    .card-title { color: #FFFFFF !important; }
    /* Keep gradient/animation for large values intact (do not override .card-value/.trading-fees-value) */
    .rewards-content, .reward-item, .reward-label, .reward-amount { color: #FFFFFF !important; }
    .painting-artist, .painting-title, .painting-medium, .painting-dimensions, .painting-year { color: #FFFFFF !important; }
    .progress-text, .current-reward, .progress-subtitle { color: #FFFFFF !important; }
    .status-text { color: #FFFFFF !important; }
    .footer-text { color: #FFFFFF !important; }

    /* Whitepaper page mobile formatting */
    .whitepaper-content { padding: 10vh 20px 100px !important; max-width: 800px; width: 100%; text-align: center; margin-left: auto; margin-right: auto; }
    .whitepaper-content h1, .whitepaper-content h2, .whitepaper-content h3,
    .whitepaper-content p, .whitepaper-content li { color: #FFFFFF !important; }
    .whitepaper-content p, .whitepaper-content li { overflow-wrap: anywhere; word-break: normal; }
    .whitepaper-content ul { list-style-position: inside; padding-left: 0; }

    /* Icon treatments */
    .social-links { display: flex !important; visibility: visible !important; opacity: 1 !important; }
    .social-link { display: inline-flex !important; align-items: center; justify-content: center; gap: 6px; visibility: visible !important; }
    .social-icon { filter: brightness(0) invert(1); width: 18px; height: 18px; display: block; }
    /* Keep DexScreener logo natural to avoid white square */
    .dex-icon { filter: none !important; }
    .logo { display: flex !important; align-items: center; visibility: visible !important; }
    .logo-image { max-height: 56px; height: 56px; width: auto; display: block !important; visibility: visible !important; }

    /* Hide theme toggle and long logo text */
    .theme-toggle { display: none !important; }
    .logo-title { display: none !important; }

    /* Convert whitepaper link to icon-only, matching social buttons style */
    .whitepaper-link {
        font-size: 0 !important;
        padding: 8px !important;
        width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        border: none !important;
        background: transparent !important;
    }
    .whitepaper-link::before {
        content: '📄';
        font-size: 18px;
        line-height: 1;
    }

    /* Keep header layout compact */
    .header {
        height: 56px;
        background: rgba(15, 15, 15, 0.6);
        border: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        padding: 0 10px; /* tighter to keep icons in view */
        display: flex;
        align-items: center;
    }
    .header-right { gap: 8px; }
    .social-links { gap: 10px; }

    /* Fix only the header buy button to bottom; avoid affecting other .buy-button usages */
    /* Reset any global mobile rule that pins ALL .buy-button */
    .buy-button {
        position: static !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: auto !important;
        border-radius: 16px !important;
        transform: none !important;
    }

    /* Hide the desktop header buy button on mobile */
    .header .buy-button { display: none !important; }

    /* Show and pin the dedicated mobile buy button */
    .buy-button-mobile {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 16px;
        background: #FFFFFF;
        color: #000000;
        text-decoration: none;
        border: 0;
        border-radius: 0;
        z-index: 3000;
        font-weight: 600;
        font-size: 16px;
        box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.2) inset;
    }
    /* Hide mobile buy button on desktop by default */
}

/* Desktop default: keep mobile button hidden */
@media (min-width: 769px) {
    .buy-button-mobile { display: none; }
}

/* Scope the following adjustments to mobile only */
@media (max-width: 768px) {
    /* Ensure content isn't hidden behind the fixed CTA */
    .main-content { padding-bottom: 90px !important; }

    /* Tighter paddings for small screens */
    .main-content { padding-left: 20px !important; padding-right: 20px !important; }
    .footer { padding-left: 20px !important; padding-right: 20px !important; }

    /* Typography scale adjustments */
    .card-value { font-size: 4rem !important; }
    .trading-fees-value { font-size: 5rem !important; }

    /* Stack painting content vertically */
    .painting-content { flex-direction: column; text-align: center; gap: 20px; }
}

@media (max-width: 480px) {
    .chart-container { height: 260px; }
    .dashboard-card { padding: 20px; }
    .card-value { font-size: 2.8rem !important; }
    .trading-fees-value { font-size: 3.6rem !important; }
}

