/* ========================
   Portfolio Page
   ======================== */

.main-portfolio-container {
    width: 100%;
}

.main-portfolio-container > h1 {
    margin-bottom: 8px;
}

.main-portfolio-container nav ul {
    display: flex;
    list-style-type: none;
    justify-content: space-evenly;
    font-weight: bold;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
    margin-bottom: 12px;
}

.main-portfolio-container nav ul li {
    cursor: pointer;
    color: rgba(4, 180, 224, 0.5);
    padding: 4px 10px;
    border-radius: 20px;
    transition: color 200ms ease, background-color 200ms ease;
}

.main-portfolio-container nav ul li:hover {
    color: var(--dcol);
    background-color: rgba(4, 180, 224, 0.1);
}

/* ========================
   Animations
   ======================== */
@keyframes bounce-in-left {
    0% {
        transform: translateX(-600px);
        animation-timing-function: ease-in;
        opacity: 0;
    }
    38% {
        transform: translateX(0);
        animation-timing-function: ease-out;
        opacity: 1;
    }
    55% {
        transform: translateX(-68px);
        animation-timing-function: ease-in;
    }
    72% {
        transform: translateX(0);
        animation-timing-function: ease-out;
    }
    81% {
        transform: translateX(-28px);
        animation-timing-function: ease-in;
    }
    90% {
        transform: translateX(0);
        animation-timing-function: ease-out;
    }
    95% {
        transform: translateX(-8px);
        animation-timing-function: ease-in;
    }
    100% {
        transform: translateX(0);
        animation-timing-function: ease-out;
    }
}

.bounce-in-left {
    animation: bounce-in-left 1.1s both;
}

/* ========================
   Portfolio Grid — Desktop
   ======================== */
.contents {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 10px;
}

.contents div {
    width: calc(25% - 10px);
    height: 180px;
    color: #0582ca;
    border-radius: 15px;
    overflow: hidden;
    margin: 0;
    position: relative; /* needed for ::after overlay */
    cursor: pointer;
}

.contents div img {
    width: 100%;
    height: 80%;
    border-radius: 15px;
    object-fit: cover;
    transition: transform 250ms ease;
}

.contents div h3 {
    text-align: center;
    margin-top: 4px;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

/* Project card overlay */
.contents div::after {
    content: "\2197  View Project";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 20%; /* match the 80% image height */
    background: rgba(4, 180, 224, 0.82);
    color: #fff;
    font-size: 0.82em;
    font-weight: 700;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px 15px 0 0;
    opacity: 0;
    transition: opacity 220ms ease;
    pointer-events: none;
}

.contents div:hover::after {
    opacity: 1;
}

.contents div img:hover {
    transform: scale(1.06);
    cursor: pointer;
}

/* ========================
   RESPONSIVE — Tablet (768px – 1024px)
   ======================== */
@media (max-width: 1024px) {
    .contents div {
        width: calc(33% - 10px);
        height: 160px;
    }

    .contents div h3 {
        font-size: 0.8em;
    }
}

/* ========================
   RESPONSIVE — Mobile (≤ 768px)
   ======================== */
@media (max-width: 768px) {
    .main-portfolio-container > h1 {
        font-size: 1.4em;
        margin-bottom: 6px;
    }

    .main-portfolio-container nav ul {
        justify-content: flex-start;
        gap: 6px;
        margin-bottom: 10px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .main-portfolio-container nav ul li {
        flex-shrink: 0;
        font-size: 0.85em;
        padding: 4px 12px;
        border: 1px solid rgba(4, 180, 224, 0.3);
    }

    .contents {
        gap: 8px;
        justify-content: flex-start;
    }

    .contents div {
        width: calc(50% - 4px);
        height: 130px;
    }

    .contents div h3 {
        font-size: 0.75em;
    }
}

/* ========================
   RESPONSIVE — Small Mobile (≤ 400px)
   ======================== */
@media (max-width: 400px) {
    .contents div {
        width: 100%;
        height: 140px;
    }

    .contents div img {
        height: 75%;
    }
}