:root {
    --map-panel: rgba(6, 6, 6, 0.94);
    --line-color: rgba(220, 220, 220, 0.38);
    --star-core: #f2f2f2;
    --star-glow: rgba(255, 255, 255, 0.85);
}

.projects-main {
    margin-top: 1rem;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 5.5rem);
}

.projects-main::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 18%, rgba(122, 20, 40, 0.18), transparent 35%),
        radial-gradient(circle at 82% 75%, rgba(205, 205, 205, 0.12), transparent 42%);
    pointer-events: none;
    animation: sky-shift 18s linear infinite alternate;
}

.heading {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto 1rem;
    text-align: center;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    color: rgba(220, 228, 255, 0.78);
    font-family: 'Space Grotesk', sans-serif;
}

.heading h1 {
    margin: 0.45rem 0;
    color: #f4f6ff;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.9rem, 9vw, 3rem);
    line-height: 1.08;
}

.heading p {
    margin: 0;
    color: #d6defd;
}

/* Mobile: Grid view */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    width: 100%;
    max-width: 900px;
    margin: 0 auto 2rem;
    position: relative;
    z-index: 1;
}

.project-card {
    display: flex;
    flex-direction: column;
    border-radius: 0.95rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: linear-gradient(135deg, rgba(15, 15, 20, 0.8), rgba(8, 8, 12, 0.9));
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 255, 255, 0.08);
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
    color: inherit;
}

.project-cover-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.project-thumbnail {
    width: 100%;
    aspect-ratio: 3 / 2;
    display: block;
    position: relative;
    overflow: hidden;
}

.project-thumbnail::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(122, 20, 40, 0.25), transparent);
    pointer-events: none;
    transition: opacity 220ms ease;
}

.project-info {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.project-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

.project-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.34rem 0.68rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(234, 233, 239, 0.1);
    color: #f4f6ff;
    text-decoration: none;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.project-btn:hover,
.project-btn:focus-visible {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.28), 0 0 14px rgba(122, 20, 40, 0.26);
    transform: translateY(-1px);
    outline: none;
}

.project-btn-subtle {
    background: rgba(234, 233, 239, 0.03);
    border-color: rgba(255, 255, 255, 0.14);
    color: rgba(233, 238, 255, 0.8);
}

.project-info h3 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #f3f5ff;
    line-height: 1.2;
}

.project-type {
    margin: 0;
    font-size: 0.72rem;
    color: rgba(200, 210, 245, 0.8);
    font-family: 'Manrope', sans-serif;
}

/* GitHub API enrichment elements */
.project-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
}

.project-tag {
    font-size: 0.68rem;
    color: rgba(200, 210, 245, 0.45);
    background: rgba(234, 233, 239, 0.06);
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    white-space: nowrap;
}

.project-stars {
    font-size: 0.68rem;
    color: rgba(200, 210, 245, 0.4);
    margin-left: auto;
}

.project-lang-badge {
    position: absolute;
    bottom: 7px;
    right: 7px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.15);
    display: block;
}

@media (hover: hover) and (pointer: fine) {
    .project-card:hover,
    .project-card:focus-visible {
        transform: translateY(-4px);
        border-color: rgba(255, 255, 255, 0.3);
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 255, 255, 0.16), 0 0 14px rgba(122, 20, 40, 0.2);
    }

    .project-card:focus-visible {
        outline: none;
    }
}

/* Desktop: Constellation view */
.constellation-wrap {
    display: none;
}

.constellation-main {
    margin-top: 1rem;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 5.5rem);
}

.constellation-wrap {
    position: relative;
    z-index: 1;
    height: 70vh;
    min-height: 430px;
    max-width: 1100px;
    margin: 0 auto;
    background: linear-gradient(165deg, var(--map-panel), rgba(18, 20, 34, 0.82));
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 22px rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.constellation-wrap::before {
    content: "";
    position: absolute;
    inset: -25% -60%;
    background: linear-gradient(112deg, transparent 44%, rgba(255, 255, 255, 0.16) 50%, transparent 56%);
    animation: map-scan 11s linear infinite;
    pointer-events: none;
}

.constellation-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.constellation-lines polyline {
    fill: none;
    stroke: var(--line-color);
    stroke-width: 0.34;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1 1.3;
    animation: dash-float 10s linear infinite;
}

.constellation-lines {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.18));
}

.star {
    position: absolute;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    text-decoration: none;
    color: inherit;
}

.star-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, var(--star-core));
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.08), 0 0 24px 5px var(--star-glow);
    transition: transform 200ms ease, box-shadow 220ms ease;
}

.star-label {
    position: absolute;
    left: calc(100% + 0.5rem);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(9, 12, 22, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 0.55rem;
    padding: 0.45rem 0.58rem;
    min-width: 170px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.star-label strong {
    display: block;
    color: #f8f9ff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
}

.star-label small {
    display: block;
    margin-top: 0.12rem;
    color: #c9d6ff;
    font-size: 0.72rem;
}

.star:hover .star-dot,
.star:focus-visible .star-dot {
    transform: scale(1.45);
    box-shadow:
    0 0 0 7px rgba(255, 255, 255, 0.2),
    0 0 28px 8px rgba(255, 255, 255, 0.95),
    0 0 65px 18px rgba(255, 255, 255, 0.45),
    0 0 26px rgba(122, 20, 40, 0.34);
}

.star:hover .star-label,
.star:focus-visible .star-label {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
    border-color: rgba(255, 255, 255, 0.82);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.34), inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.s1 { left: 9%; top: 15%; }
.s2 { left: 23%; top: 26%; }
.s3 { left: 33%; top: 37%; }
.s4 { left: 45%; top: 49%; }
.s5 { left: 56%; top: 56%; }
.s6 { left: 68%; top: 65%; }
.s7 { left: 81%; top: 72%; }
.s8 { left: 63%; top: 43%; }
.s9 { left: 90%; top: 58%; }

.s3,
.s6 {
    animation: twinkle 3.2s ease-in-out infinite;
}

.s5,
.s8 {
    animation: twinkle 4.1s ease-in-out infinite;
    animation-delay: 0.9s;
}

.s9 {
    animation: twinkle 3.6s ease-in-out infinite;
    animation-delay: 0.4s;
}

.s6 .star-label,
.s7 .star-label,
.s9 .star-label {
    left: auto;
    right: calc(100% + 0.5rem);
    text-align: right;
}

.todo-widget {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 1.1rem auto 0;
    background: linear-gradient(160deg, rgba(8, 8, 8, 0.94), rgba(14, 18, 30, 0.88));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.1);
}

.todo-widget h2 {
    margin: 0;
    color: #f4f6ff;
    font-size: 1.2rem;
}

.todo-widget p {
    margin: 0.35rem 0 0.9rem;
    color: #d0d9f7;
}

.todo-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.todo-controls input {
    flex: 1;
    min-width: 210px;
    padding: 0.62rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.56rem;
    background: rgba(5, 5, 5, 0.82);
    color: #eef4ff;
}

.todo-controls button {
    padding: 0.5rem 0.8rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
}

/* Cosmic Lens widget moved from homepage */
.pexels-section {
    box-sizing: border-box;
    width: min(100%, 1100px);
    margin: 1.1rem auto 0;
    padding: 1.15rem;
    background: rgba(8, 8, 12, 0.72);
    border: 1px solid rgba(234, 233, 239, 0.1);
    border-radius: 1rem;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
    position: relative;
    z-index: 1;
}

.pexels-intro {
    text-align: center;
    margin-bottom: 0.9rem;
}

.pexels-intro h2 {
    margin: 0 0 0.25rem;
    font-size: clamp(1.16rem, 2.8vw, 1.46rem);
    color: #eae9ef;
}

.pexels-intro p {
    margin: 0;
    color: rgba(234, 233, 239, 0.62);
    font-size: 0.88rem;
}

.pexels-intro a,
.pexels-credit a {
    color: rgba(234, 233, 239, 0.8);
    text-decoration: underline;
}

.pexels-search-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.95rem;
}

.pexels-search-row input {
    flex: 1;
    min-width: 0;
    background: rgba(234, 233, 239, 0.06);
    border: 1px solid rgba(234, 233, 239, 0.14);
    border-radius: 0.55rem;
    padding: 0.65rem 0.85rem;
    color: #eae9ef;
    font-size: 0.9rem;
}

.pexels-search-row button {
    padding: 0.65rem 1.05rem;
    background: rgba(14, 12, 20, 0.66);
    border: 1px solid rgba(234, 233, 239, 0.28);
    color: #f0f2fb;
    border-radius: 0.55rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.86rem;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.pexels-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.58rem;
    margin-bottom: 0.65rem;
}

.pexels-photo {
    position: relative;
    display: block;
    border-radius: 0.55rem;
    overflow: hidden;
    border: 1px solid rgba(234, 233, 239, 0.1);
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.pexels-photo img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.photo-credit {
    position: absolute;
    inset: auto 0 0 0;
    padding: 0.28rem 0.45rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.66rem;
    opacity: 0;
    transition: opacity 180ms ease;
}

.pexels-photo:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.48);
}

.pexels-photo:hover .photo-credit {
    opacity: 1;
}

.pexels-loading,
.pexels-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(234, 233, 239, 0.52);
    font-size: 0.86rem;
}

.pexels-credit {
    margin: 0;
    text-align: right;
    font-size: 0.72rem;
    color: rgba(234, 233, 239, 0.35);
}

@media (min-width: 740px) {
    .pexels-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .pexels-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.todo-controls button:hover,
.todo-controls button:focus-visible {
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.26), 0 0 18px rgba(122, 20, 40, 0.32);
    border-color: rgba(255, 255, 255, 0.7);
    outline: none;
}

.todo-lists {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.todo-list,
.done-list {
    flex: 1;
    min-width: 220px;
}

.todo-list h3,
.done-list h3 {
    margin: 0 0 0.5rem;
    color: #f4f6ff;
    font-size: 1rem;
}

.todo-list ul,
.done-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px dashed rgba(238, 244, 255, 0.35);
}

.todo-list li,
.done-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(241, 241, 241, 0.28);
}

.todo-list li span,
.done-list li span {
    flex: 1;
    color: #e9eeff;
}

.actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.actions button {
    padding: 0.25rem 0.46rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
}

.actions button:hover,
.actions button:focus-visible {
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.58);
    outline: none;
}

@keyframes twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes dash-float {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: 12; }
}

@keyframes sky-shift {
    from { transform: translateX(0); }
    to { transform: translateX(14px); }
}

@keyframes map-scan {
    from { transform: translateX(-44%); opacity: 0; }
    20% { opacity: 0.9; }
    60% { opacity: 0.28; }
    to { transform: translateX(44%); opacity: 0; }
}

/* Desktop: Keep cards and increase columns */
@media (min-width: 900px) {
    .projects-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
        max-width: 1100px;
    }

    .projects-main {
        margin-top: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .projects-main::before,
    .project-card {
        animation: none;
    }

    .project-btn,
    .project-card {
        transition: none;
    }
}

.credentials {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 1.1rem auto 0;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(160deg, rgba(8, 8, 10, 0.94), rgba(12, 14, 24, 0.9));
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 255, 255, 0.1);
}

.credentials h2 {
    margin: 0;
    color: #f4f6ff;
    font-size: 1.2rem;
}

.credentials p {
    margin: 0.35rem 0 0.8rem;
    color: #d0d9f7;
}

.credentials-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.72rem;
}

.credential-card {
    display: flex;
    flex-direction: column;
    border-radius: 0.9rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 12, 0.8);
    text-decoration: none;
    color: inherit;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.credential-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.credential-title {
    padding: 0.58rem 0.7rem;
    color: #eef4ff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
}

.credential-card:hover,
.credential-card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.42);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42), 0 0 16px rgba(255, 255, 255, 0.16);
    outline: none;
}

@media (max-width: 700px) {
    .credentials-grid {
        grid-template-columns: 1fr;
    }
}
