.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.portfolio-group {
    margin-top: 28px;
}

.portfolio-headline {
    margin-bottom: 14px;
}

.portfolio-headline h3 {
    margin-bottom: 6px;
    font-size: 1.2rem;
}

.portfolio-headline p {
    color: var(--text-300);
}

.card  {
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.25s ease, border-color 0.25s ease;
    color: var(--text-100);
    border: 1px solid var(--line);
    background-color: var(--surface-soft);
}

.card img {
    width: 100%;
    height: 165px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    margin-bottom: 14px;
}

.card img.card-image-wide {
    object-fit: contain;
    background: linear-gradient(135deg, rgba(37, 82, 112, 0.95), rgba(24, 60, 86, 0.94));
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(44, 181, 162, 0.65);
}

.card h4 {
    margin-bottom: 8px;
    font-size: 1.06rem;
}

.card p {
    color: var(--text-300);
    margin-bottom: 16px;
}

.card a {
    color: var(--brand);
    font-weight: 600;
}

.card a:hover {
    color: #5fd0c0;
}

.project-case {
    display: grid;
    gap: 24px;
}

.project-hero-image img {
    width: 100%;
    border-radius: 18px;
    border: 1px solid var(--line);
    box-shadow: var(--card-shadow);
}

.project-hero-image-bertoli img {
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: linear-gradient(135deg, rgba(37, 82, 112, 0.95), rgba(24, 60, 86, 0.94));
}

.project-hero-image-bertoli {
    max-width: 980px;
    margin: 0 auto;
}

.project-hero-image-low-pri-game img {
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: linear-gradient(140deg, rgba(20, 32, 52, 0.95), rgba(17, 52, 74, 0.93));
}

.project-hero-image-low-pri-game {
    max-width: 980px;
    margin: 0 auto;
}

.image-carousel {
    position: relative;
    width: 100%;
}

.carousel-image-button {
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: transparent;
    cursor: zoom-in;
}

.carousel-image-button img {
    max-height: 540px;
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(6, 16, 28, 0.65);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.carousel-control:hover {
    background: rgba(10, 28, 46, 0.9);
    transform: translateY(-50%) scale(1.03);
}

.carousel-control-prev {
    left: 14px;
}

.carousel-control-next {
    right: 14px;
}

.carousel-caption {
    margin-top: 10px;
    text-align: center;
    color: var(--text-300);
    font-size: 0.95rem;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(4, 10, 18, 0.88);
    z-index: 1000;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox img {
    width: min(1200px, 96vw);
    max-height: 92vh;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 26px 58px rgba(0, 0, 0, 0.4);
    background: #0d2337;
}

.lightbox-close {
    position: fixed;
    top: 16px;
    right: 22px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
}

.project-content-block {
    padding: 22px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background-color: var(--surface-soft);
}

.project-content-block p + p {
    margin-top: 12px;
}

.project-grid,
.video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.project-panel {
    border-radius: 16px;
    padding: 22px;
    box-shadow: var(--card-shadow);
    color: var(--text-100);
    border: 1px solid var(--line);
    background-color: var(--surface-soft);
}

.project-panel h2,
.project-panel h3 {
    margin-bottom: 10px;
}

.project-panel ul {
    margin-left: 18px;
    color: var(--text-200);
}

.project-panel li + li {
    margin-top: 8px;
}

.video-panel {
    padding-bottom: 18px;
}

.video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 900px) {
    .project-grid,
    .video-grid {
        grid-template-columns: 1fr;
    }

    .carousel-image-button img {
        max-height: 420px;
    }
}

@media (max-width: 560px) {
    .carousel-control {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .carousel-control-prev {
        left: 8px;
    }

    .carousel-control-next {
        right: 8px;
    }

    .image-lightbox {
        padding: 18px 12px;
    }

    .lightbox-close {
        top: 10px;
        right: 12px;
        font-size: 2rem;
    }
}