.portfolio-page {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.portfolio-page--root {
    background: transparent;
    height: auto;
    min-height: 0;
    overflow: visible;
    
}

.portfolio-page--detail {
    display: block;
}

.content-portfoliomain {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: stretch;
    width: min(1100px, 100%);
    margin: 0 auto;
    box-sizing: border-box;
    height: auto;
}

.content-description {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 1.6rem;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(26px) saturate(180%);
    -webkit-backdrop-filter: blur(26px) saturate(180%);
}

.content-description h1 {
    font-size: clamp(2.2rem, 4.2vw, 3rem);
    color: var(--text-primary);
    text-align: left;
    font-weight: 800;
    line-height: 1.05;
    margin: 0;
}

.content-description span {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-description p {
    font-size: clamp(0.95rem, 1.5vw, 1.12rem);
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 48ch;
    margin: 0;
}

.btnsportfolio {
    display: flex;
    gap: 0.65rem;
    padding: 0.4rem 0 0.2rem;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.btn-portfolio {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: clamp(0.9rem, 1.6vw, 1.02rem);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.btn-portfolio:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    background: rgba(255, 255, 255, 0.16);
}

.verde {
    background: #25D366;
    border-color: rgba(37, 211, 102, 0.7);
    color: #0C1127;
}

.verde:hover {
    box-shadow: 0 12px 32px rgba(13, 187, 65, 0.25);
    background: #1fb85a;
    border-color: rgba(37, 211, 102, 0.85);
}

.portfolio-grid {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    grid-auto-rows: 110px;
    grid-auto-flow: dense;
    max-height: calc(100vh - 200px);
    overflow: hidden;
}

.itemportfolio {
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.itemportfolio:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 40px rgba(255, 255, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.itemportfolio h3 {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    background: none;
    color: var(--text-primary);
    font-size: 0.7rem;
    text-align: center;
    z-index: 2;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-transform: capitalize;
    transition: all 0.3s ease;
    padding-bottom: 0.3rem;
    border-radius: 50%;
    overflow: hidden;
    clip-path: circle(50% at 50% 50%);
    pointer-events: none;
    isolation: isolate;
}


.itemportfolio img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
    border-radius: 50%;
}

.itemportfolio:hover img {
    transform: scale(1.1);
}

.content-portfolio {
    width: min(1100px, 100%);
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.portfolio-page--detail .content-portfolio {
    justify-content: flex-start;
}

.portfolio-detail {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

.back-button {
    position: relative;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: bold;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.back-button::before {
    content: "volver";
    position: absolute;
    padding: 10px 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.back-button span {
    display: inline-block;
    transition: all 0.3s ease;
}

.back-button:hover span {
    opacity: 0;
    transform: translateX(-10px);
}

.back-button:hover::before {
    opacity: 1;
    transform: translate(-50%, -50%) translateX(10px);
}

.back-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.35);
}

.containerbackbutton {
    margin-top: 90px;
}

.contProjectName {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
}

.contProjectName h3 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    color: var(--text-primary);
    text-align: center;
    font-weight: 800;
    text-transform: capitalize;
    letter-spacing: 1px;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .content-description {
        align-items: center;
    }

    .content-description h1,
    .content-description p {
        text-align: center;
        margin: 0 auto;
    }

    .content-description p {
        max-width: 100%;
    }

    .btnsportfolio {
        justify-content: center;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    }
}

@media screen and (min-width: 1024px) {
    .portfolio-page--root {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .portfolio-page--root .content-portfoliomain {
        grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
        height: min(82vh, 640px);
    }

    .portfolio-page--root .content-description {
        justify-content: center;
    }

    .portfolio-page--root .portfolio-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(0, 1fr));
        grid-auto-rows: unset;
        height: 100%;
    }

    .portfolio-page--root .itemportfolio {
        height: 100%;
    }

    .portfolio-page--root .itemportfolio img {
        height: 100%;
    }

    .portfolio-page--detail {
        padding: clamp(4rem, 6vw, 5.5rem) clamp(2rem, 5vw, 3rem) clamp(5rem, 7vw, 6.5rem);
    }

    .portfolio-page--detail .portfolio-detail {
        padding: 0;
    }
}
