/* ============================================
   GITHUB STYLE PROJECTS & MODAL
   ============================================ */
.projects-grid-github {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.gh-repo-card {
    background: var(--card-bg-light);
    border: 2px solid var(--card-border);
    border-radius: var(--card-radius, 12px);
    padding: 24px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: var(--transition-smooth, all 0.3s ease);
    box-shadow: var(--shadow-base, 0 4px 15px rgba(0, 0, 0, 0.05));
}

.gh-repo-card-compact {
    gap: 0.6rem;
}

[data-theme="dark"] .gh-repo-card {
    background: var(--card-bg-dark);
}

.gh-repo-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover, 0 20px 50px rgba(0, 0, 0, 0.15));
    border-color: var(--card-border-hover, var(--color-primary));
}

.gh-repo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.gh-repo-icon {
    fill: var(--color-text-muted, #64748b);
    transition: fill 0.3s ease;
}

.gh-repo-card:hover .gh-repo-icon {
    fill: var(--color-primary);
}

.gh-repo-title {
    color: var(--color-primary);
    font-size: 1.15rem;
    font-weight: 700;
    font-family: var(--font-primary, inherit);
    line-height: 1.3;
    word-break: normal;
    overflow-wrap: anywhere;
}

.gh-repo-card:hover .gh-repo-title {
    text-decoration: underline;
}

.gh-repo-badge {
    color: var(--color-text-muted);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.gh-repo-org {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.gh-repo-date {
    margin: 0;
    color: var(--color-text);
    font-size: 0.92rem;
    font-weight: 700;
}

.gh-repo-view-btn {
    margin-top: 0.45rem;
    align-self: flex-start;
    padding: 0.46rem 0.85rem;
    border-radius: 9px;
    border: 1px solid rgba(var(--color-primary-rgb), 0.4);
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gh-repo-view-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.18);
    transform: translateY(-1px);
}

.gh-repo-desc {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
    flex-grow: 1;
    line-height: 1.6;
}

.gh-repo-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    flex-wrap: wrap;
    font-weight: 500;
}

.gh-repo-lang {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gh-lang-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.gh-lang-color.js { background-color: #f1e05a; }
.gh-lang-color.py { background-color: #3572A5; }
.gh-lang-color.html { background-color: #e34c26; }
.gh-lang-color.react { background-color: #61dafb; }
.gh-lang-color.db { background-color: #e38c00; }
.gh-lang-color.sec { background-color: #ff3333; }

/* MODAL STYLES */
.project-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: clamp(1rem, 3vh, 1.5rem);
    overflow: hidden;
    overscroll-behavior: contain;
}

.project-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.project-modal-content {
    background: var(--card-bg-light);
    border: 2px solid var(--card-border);
    border-radius: var(--card-radius, 16px);
    width: 100%;
    max-width: 800px;
    height: min(90vh, calc(100dvh - 2rem));
    max-height: min(90vh, calc(100dvh - 2rem));
    overflow: hidden;
    position: relative;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    box-shadow: var(--shadow-hover);
    margin: 0 auto;
    min-height: 0;
    overscroll-behavior: contain;
}

[data-theme="dark"] .project-modal-content {
    background: var(--card-bg-dark);
}

.project-modal-overlay.active .project-modal-content {
    transform: translateY(0) scale(1);
}

.project-modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(128, 128, 128, 0.03);
    border-radius: var(--card-radius, 16px) var(--card-radius, 16px) 0 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.project-modal-title {
    color: var(--color-text);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    margin: 0;
}

.project-modal-title svg {
    fill: var(--color-primary);
    flex-shrink: 0;
}

.project-modal-close {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 1.8rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    line-height: 1;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.project-modal-close:hover {
    background: #ef4444;
    color: white !important;
    border-color: #ef4444;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.project-modal-body {
    padding: 2rem;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
}

.project-modal-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.project-modal-desc {
    color: var(--color-text-muted);
    line-height: 1.8;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.project-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 2rem;
}

.pm-tag {
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
    border: 1px solid rgba(var(--color-primary-rgb), 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.project-modal-metrics {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.pm-metric {
    background: rgba(128, 128, 128, 0.03);
    border: 1px solid var(--card-border);
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.pm-metric-val {
    color: var(--color-text);
    font-size: 1.5rem;
    font-weight: 800;
}

.pm-metric-label {
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 1) 0%, rgba(var(--color-primary-dark-rgb), 1) 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.3);
}

.project-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--color-primary-rgb), 0.4);
}

/* ============================================
   UNIFIED LAYOUT: Profile & Heatmap Top + Projects Bottom
   ============================================ */
.github-unified-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.75rem;
}

.github-top-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .github-top-row {
        grid-template-columns: minmax(310px, 340px) minmax(0, 1fr);
    }
}

.github-unified-layout .github-profile-card {
    height: auto;
    min-height: 0;
    align-self: start;
    padding: 1.35rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1.5px solid rgba(var(--color-primary-rgb), 0.22);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.github-unified-layout .github-header {
    margin-bottom: 0;
}

.github-unified-layout .gh-metrics {
    gap: 0.55rem;
}

.github-unified-layout .gh-metric {
    padding: 0.65rem 0.5rem;
}

.github-unified-layout .gh-metric-label {
    font-size: 0.63rem;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.github-heatmap-container {
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 1.35rem 1.35rem 1.1rem;
    border-radius: var(--card-radius, 16px);
    background: var(--card-bg-light);
    border: 1.5px solid rgba(var(--color-primary-rgb), 0.22);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    height: auto;
    gap: 0.7rem;
}

[data-theme="dark"] .github-heatmap-container {
    background: linear-gradient(155deg, rgba(15, 23, 42, 0.9), rgba(6, 40, 25, 0.72));
    border-color: rgba(74, 222, 128, 0.32);
}

.github-heatmap-container .heatmap-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: var(--color-text);
}

.heatmap-header {
    display: grid;
    gap: 0.3rem;
}

.heatmap-subtitle {
    margin: 0;
    font-size: 0.96rem;
    color: var(--color-text-muted);
    line-height: 1.45;
}

.heatmap-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.1rem;
}

.heatmap-scroll::-webkit-scrollbar {
    height: 8px;
}

.heatmap-scroll::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.45);
    border-radius: 999px;
}

.heatmap-frame {
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.05);
    border-radius: 12px;
    padding: 0.8rem 0.85rem 0.5rem;
    min-width: fit-content;
}

.github-heatmap-img {
    display: block;
    width: 900px;
    min-width: 900px;
    height: auto;
    border-radius: 8px;
}

.heatmap-legend {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    align-self: flex-end;
}

.heatmap-dot {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.heatmap-dot.level-1 {
    background: #d1fae5;
}

.heatmap-dot.level-2 {
    background: #86efac;
}

.heatmap-dot.level-3 {
    background: #34d399;
}

.heatmap-dot.level-4 {
    background: #059669;
}

[data-theme="dark"] .heatmap-frame {
    background: rgba(6, 95, 70, 0.18);
    border-color: rgba(74, 222, 128, 0.28);
}

[data-theme="dark"] .heatmap-dot.level-1 {
    background: #14532d;
}

[data-theme="dark"] .heatmap-dot.level-2 {
    background: #166534;
}

[data-theme="dark"] .heatmap-dot.level-3 {
    background: #16a34a;
}

[data-theme="dark"] .heatmap-dot.level-4 {
    background: #22c55e;
}

@media (max-width: 1200px) {
    .github-heatmap-img {
        width: 820px;
        min-width: 820px;
    }
}

@media (max-width: 768px) {
    .github-heatmap-container {
        padding: 1rem 0.9rem 0.85rem;
    }

    .github-heatmap-img {
        width: 680px;
        min-width: 680px;
    }

    .heatmap-legend {
        align-self: flex-start;
    }
}

.github-projects-heading {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0.8rem 0 0.2rem 0;
}

/* Projects grid */
.github-unified-layout .projects-grid-github {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.2rem;
    padding: 0;
    align-items: start;
}

.github-unified-layout .gh-repo-card {
    padding: 1.15rem 1.2rem;
    border-width: 1.5px;
    min-height: 210px;
    height: auto;
    gap: 0.55rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

.github-unified-layout .gh-repo-header {
    margin-bottom: 0.2rem;
    gap: 0.55rem;
}

.github-unified-layout .gh-repo-title {
    color: var(--color-text);
    font-size: 1.02rem;
    line-height: 1.28;
    overflow-wrap: break-word;
    hyphens: auto;
}

.github-unified-layout .gh-repo-org {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-muted);
}

.github-unified-layout .gh-repo-date {
    font-size: 1.03rem;
    font-weight: 800;
    margin-bottom: 0.1rem;
}

.github-unified-layout .gh-repo-view-btn {
    margin-top: auto;
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
    border-radius: 10px;
}

@media (max-width: 900px) {
    .github-unified-layout .projects-grid-github {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .github-unified-layout .gh-repo-card {
        min-height: 190px;
    }
}

@media (max-width: 640px) {
    .github-unified-layout .gh-repo-card {
        min-height: 175px;
        padding: 1rem;
    }

    .github-unified-layout .gh-repo-title {
        font-size: 0.98rem;
    }
}

/* ============================================
   STAR FORMAT MODAL SECTIONS
   ============================================ */
.pm-category-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 1) 0%, rgba(var(--color-primary-dark-rgb), 1) 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.pm-subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-style: italic;
}

.pm-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.pm-meta-item {
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pm-star-section {
    margin-bottom: 2rem;
}

.pm-star-heading {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-left: 4px solid var(--color-primary);
    padding-left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pm-star-accent {
    color: var(--color-primary);
    font-weight: 800;
    font-size: 1.4rem;
}

.pm-star-text {
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.8;
}

.pm-star-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pm-star-list li {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.8;
    padding-left: 28px;
    position: relative;
    margin-bottom: 6px;
}

.pm-star-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1rem;
}

/* Responsive modal */
@media (max-width: 768px) {
    .project-modal-content {
        height: min(95vh, calc(100dvh - 1.25rem));
        max-height: min(95vh, calc(100dvh - 1.25rem));
        border-radius: 12px;
    }

    .project-modal-body {
        padding: 1.2rem;
    }

    .pm-meta-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .project-modal-metrics {
        flex-direction: column;
    }

    .github-profile-sidebar {
        position: static;
    }
}
