:root {
    /* Light Mode (Default) */
    --brand-blue: #4fc3f7;
    --text-dark: #2c3e50;
    --text-light: #8ca0b3;
    --bg-primary: #f4f6f9;
    --bg-secondary: #FFFFFF;
    --border-color: #e1e8ed;
    --modal-shadow: 0 10px 30px rgba(0,0,0,0.2);
    --btn-dark: #2c3e50;
    --btn-dark-hover: #000;
}

body.dark-mode {
    /* Dark Mode */
    --text-dark: #e5e7eb;
    --text-light: #9ca3af;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --border-color: #374151;
    --modal-shadow: 0 10px 30px rgba(0,0,0,0.5);
    --btn-dark: #374151;
    --btn-dark-hover: #4b5563;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { 
    font-family: 'Poppins', sans-serif; 
    background-color: var(--bg-primary); 
    color: var(--text-dark); 
    transition: background-color 0.3s ease, color 0.3s ease;
}
.container { max-width: 1400px; margin: 0 auto; padding: 0 25px; }

/* HEADER */
.main-header { background-color: var(--bg-secondary); border-bottom: 1px solid var(--border-color); padding: 15px 25px; position: sticky; top: 0; z-index: 1000; transition: background-color 0.3s ease, border-color 0.3s ease; }
.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 12px; font-family: 'Roboto Mono', monospace; font-size: 1.8rem; color: var(--text-dark); text-decoration: none; font-weight: 700; }

/* Theme Toggle Icon Button */
#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
#theme-toggle:hover {
    background-color: var(--bg-primary);
}
#theme-toggle svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-light);
    transition: stroke 0.2s ease;
}
#theme-toggle:hover svg {
    stroke: var(--brand-blue);
}
.icon-sun { display: none; }
.icon-moon { display: block; }
body.dark-mode .icon-sun { display: block; }
body.dark-mode .icon-moon { display: none; }


/* INTRO & STATS */
.intro-section { padding: 60px 0 0; text-align: center; background-color: var(--bg-secondary); transition: background-color 0.3s ease; }
.intro-content { max-width: 700px; margin: 0 auto 40px; }
.intro-content h1 { font-size: 2.8rem; margin-bottom: 1rem; color: var(--text-dark); }
.intro-content p { font-size: 1.1rem; color: var(--text-dark); line-height: 1.8; margin-bottom: 1.5rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.stat-card { background-color: var(--bg-primary); padding: 25px; border-radius: 12px; border: 1px solid var(--border-color); transition: background-color 0.3s ease, border-color 0.3s ease;}
.stat-card-title { font-size: 1rem; color: var(--text-light); margin-bottom: 8px; font-weight: 600; }
.stat-card-value { font-family: 'Roboto Mono', monospace; font-size: 2.2rem; font-weight: 700; color: var(--text-dark); }

/* LINK BUTTONS */
.links-section {
    padding: 20px 0 40px;
    background-color: var(--bg-secondary);
    transition: background-color 0.3s ease;
}
.links-section .container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.link-btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    font-size: 1rem;
    background-color: var(--bg-primary);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease-in-out;
    min-width: 190px;
    text-align: center;
}
.link-btn:hover {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(79, 195, 247, 0.4);
}

/* COLLECTION EXPLORER */
.explorer-section { padding: 30px 0 50px; }
.section-title { font-size: 2.5rem; margin-bottom: 15px; text-align: center; color: var(--text-dark); }
.gallery-controls {
    text-align: center;
    margin-bottom: 25px;
}
.gallery-status { color: var(--text-light); font-size: 1.2rem; }
.gallery-status p { margin-bottom: 0; }

.reset-btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    font-size: 1rem;
    background-color: var(--bg-secondary);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    margin-top: 20px;
}
.reset-btn:hover {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(79, 195, 247, 0.4);
}

.nft-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 25px; }
.nft-card {
    border-radius: 16px; overflow: hidden; border: 2px solid var(--border-color);
    cursor: pointer; transition: border-color 0.2s ease;
}
.nft-card:hover { border-color: var(--brand-blue); }
.nft-card img { width: 100%; display: block; aspect-ratio: 1 / 1; background-color: #eee; }

/* MODAL STYLES */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#modal-overlay:not(.hidden) {
    opacity: 1;
}
#modal-overlay.hidden {
    display: none;
}
#trait-modal {
    position: relative;
    width: 620px;
    max-width: 95vw;
    background: var(--bg-secondary);
    border-radius: 24px;
    box-shadow: var(--modal-shadow);
    padding: 25px;
    cursor: default;
}
#trait-modal h4 {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    text-align: left;
}
.modal-content-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 25px;
}
.modal-left-column {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
}
.modal-left-column img {
    width: 100%;
    border-radius: 16px;
    margin-bottom: 15px;
}
.modal-right-column {
    flex: 1;
    text-align: left;
}
#trait-modal ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
#trait-modal li { 
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 10px; 
    border-radius: 8px;
    margin-top: 6px;
    background-color: var(--bg-primary);
    cursor: pointer;
    transition: background-color 0.2s ease;
}
#trait-modal li:first-child { margin-top: 0; }
#trait-modal li:hover { background-color: var(--brand-blue); color: #FFFFFF; }
#trait-modal .trait-type { font-weight: 600; color: var(--text-light); }
#trait-modal .trait-value { color: var(--text-dark); }
#trait-modal li:hover .trait-type, #trait-modal li:hover .trait-value { color: #FFFFFF; }

#modal-close-btn {
    position: absolute;
    top: 25px;
    right: 25px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}
#modal-close-btn:hover {
    color: var(--text-dark);
}
.opensea-btn {
    display: block;
    width: 100%;
    padding: 14px;
    text-align: center;
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1rem;
    background-color: var(--btn-dark);
    color: #FFFFFF;
    border-radius: 12px;
    transition: background-color 0.2s ease;
    margin-top: auto;
}
.opensea-btn:hover { background-color: var(--btn-dark-hover); }

.message-box { padding: 40px 20px; text-align: center; font-size: 1.2rem; color: var(--text-light); grid-column: 1 / -1; }
.error-message { color: #e74c3c; font-weight: 600; background-color: #fadbd8; border-radius: 8px; }
body.dark-mode .error-message { background-color: #5b2c28; }

/* ===== Media Query for Mobile Devices ===== */
@media (max-width: 768px) {
    /* Two-column grid for the gallery */
    .nft-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    /* Stack the modal content vertically on mobile */
    .modal-content-wrapper {
        flex-direction: column;
    }
    .modal-left-column { /* This is the IMAGE column */
        order: 1; /* Image first */
        flex-basis: auto;
        width: 100%;
    }
    .modal-right-column { /* This is the TRAITS column */
        order: 2; /* Traits second */
        width: 100%;
    }
    /* Make traits two columns on mobile */
    #trait-modal ul {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    #trait-modal h4 { text-align: center; }
}