:root {
    --dark-bg: #111827;
    --card-bg: rgba(42, 53, 71, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-white: #f9fafb;
    --text-muted: #9ca3af;
    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- Base & Aurora BG (Unchanged) --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
}

body {
    font-family: var(--font-family);
    background-color: var(--dark-bg);
    color: var(--text-white);
    overflow-x: hidden;
}

.background-aurora {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at top, #6366f130, transparent),
        radial-gradient(ellipse at bottom, #a855f730, transparent);
    z-index: -1;
    animation: pulse 10s infinite alternate;
}

@keyframes pulse {
    from {
        opacity: 0.5;
    }

    to {
        opacity: 1;
    }
}

/* --- Navbar, Hero, Search (Unchanged) --- */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
}

.navbar {
    position: sticky;
    top: 20px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    margin-bottom: 20px;
    background: rgba(31, 41, 55, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--text-white);
}

.nav-cta {
    background-color: var(--text-white);
    color: var(--dark-bg);
    padding: 10px 20px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition:
        transform 0.3s,
        background-color 0.3s;
}

.nav-cta:hover {
    transform: translateY(-2px);
    background-color: #e5e7eb;
}

.hero {
    text-align: center;
    padding: 60px 0;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.hero .subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 32px;
}

.hero-cta {
    display: inline-block;
    background-color: var(--accent-primary);
    color: var(--text-white);
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    padding: 16px 36px;
    border-radius: 50px;
    transition:
        transform 0.3s,
        background-color 0.3s;
}

.hero-cta:hover {
    transform: translateY(-3px);
    background-color: var(--accent-secondary);
}

.search-container {
    position: relative;
    max-width: 700px;
    margin: 0 auto 50px;
}

.search-container i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

#search-input {
    width: 100%;
    background-color: #1f2937;
    color: var(--text-white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px 16px 50px;
    font-size: 1rem;
    outline: none;
    transition:
        border-color 0.3s,
        box-shadow 0.3s;
}

#search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

/* --- Masonry Grid & Cards --- */
#contributors-container {
    column-count: 4;
    column-gap: 20px;
}

.contributor-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    margin-bottom: 20px;
    overflow: hidden;
    break-inside: avoid;
    animation: fadeIn 0.5s forwards;
    opacity: 0;
    transform: translateY(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.contributor-card.hidden {
    display: none;
}

.contributor-card:hover {
    transform: scale(1.03) translateY(-5px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

.card-iframe-wrapper {
    width: 100%;
    aspect-ratio: 3 / 4;
    position: relative;
    cursor: pointer;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    overflow: hidden;
}

.skeleton {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #1f2937, #374151, #1f2937);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    position: absolute;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.card-iframe-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.card-iframe-wrapper iframe.loaded {
    opacity: 1;
}

.card-footer {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card-footer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.card-footer-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-footer-header a {
    color: var(--text-muted);
    font-size: 1.5rem;
    transition: color 0.3s;
    flex-shrink: 0;
}

.card-footer-header a:hover {
    color: var(--text-white);
}

.card-footer .bio {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 20px;
}

/* NEW: "View Project" button on the card */
.view-project-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.3s;
}

.view-project-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.3s,
        visibility 0.3s;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #1f2937;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    height: 80%;
    display: flex;
    flex-direction: column;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-close-button {
    position: absolute;
    top: -15px;
    right: -15px;
    background: var(--text-white);
    color: var(--dark-bg);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}

#modal-iframe-container {
    flex-grow: 1;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    overflow: hidden;
}

#modal-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#modal-info {
    padding: 20px;
    text-align: center;
}

#modal-info h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

#modal-info a {
    color: var(--accent-secondary);
    text-decoration: none;
}

/* NEW: Device Preview Modal */
.preview-modal-content {
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 1400px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.modal-overlay.visible .preview-modal-content {
    transform: scale(1);
}

.preview-modal-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.preview-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-right: auto;
}

.device-controls {
    display: flex;
    gap: 8px;
    background: #1f2937;
    border-radius: 10px;
    padding: 4px;
}

.device-controls button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition:
        background-color 0.3s,
        color 0.3s;
}

.device-controls button.active {
    background: var(--accent-primary);
    color: var(--text-white);
}

.preview-modal-header .modal-close-button {
    position: static;
    transform: none;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    margin-left: 16px;
}

.preview-iframe-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: auto;
}

#preview-iframe {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 4px solid #333;
    transition:
        width 0.4s ease,
        height 0.4s ease;
}

.preview-iframe-container.view-desktop #preview-iframe {
    width: 100%;
    height: 100%;
}

.preview-iframe-container.view-tablet #preview-iframe {
    width: 768px;
    height: 1024px;
    max-width: 100%;
    max-height: 100%;
}

.preview-iframe-container.view-mobile #preview-iframe {
    width: 375px;
    height: 667px;
    max-width: 100%;
    max-height: 100%;
}

.preview-modal-footer {
    text-align: center;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.preview-modal-footer .hero-cta {
    padding: 12px 24px;
    font-size: 1rem;
}

/* --- Final Polish & Responsive --- */
.no-results-message {
    display: none;
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

#loader {
    display: none;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-secondary);
    border-radius: 50%;
    margin: 40px auto;
    animation: spin 1s linear infinite;
}

#loader.visible {
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(30deg);
    }
}

#sentinel {
    height: 10px;
}

@media (max-width: 1200px) {
    #contributors-container {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    #contributors-container {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    #contributors-container {
        column-count: 1;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
