/* 视觉工职院：五格独立轮播。
   标题和外层宽度沿用首页通用样式；轮播样式仅作用于 gallery5-*。
   图片、图片链接、图片顺序均在 index.html 中维护。 */
.gallery5-section {
    background: #fff;
}

.gallery5-grid {
    display: grid;
    grid-template-columns: 1.08fr 1fr .78fr;
    grid-template-rows: repeat(2, 350px);
    gap: 7px;
}

.gallery5-carousel {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: #ddd;
}

.gallery5-c {
    grid-column: 3;
    grid-row: 1 / 3;
}

.gallery5-slide {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .75s ease;
}

.gallery5-slide.is-active {
    z-index: 1;
    opacity: 1;
    pointer-events: auto;
}

.gallery5-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .75s cubic-bezier(.2, .72, .24, 1), filter .4s;
}

.gallery5-carousel:hover .gallery5-slide img,
.gallery5-carousel:focus-within .gallery5-slide img {
    transform: scale(1.075);
    filter: saturate(1.08);
}

.gallery5-controls {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, visibility .25s;
}

.gallery5-carousel.is-ready .gallery5-controls {
    display: block;
}

/* 所有控件统一在对应格子内悬停时显示，移出后隐藏。 */
.gallery5-carousel.is-ready:hover .gallery5-controls {
    visibility: visible;
    opacity: 1;
}

.gallery5-controls button {
    padding: 0;
    color: #fff;
    border: 0;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.gallery5-arrow,
.gallery5-pause {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(0 0 0 / 32%);
    transition: background .25s;
}

.gallery5-arrow {
    top: 50%;
    width: 34px;
    height: 46px;
    border-radius: 3px;
    font: 32px/1 Arial, sans-serif;
    transform: translateY(-50%);
}

.gallery5-prev {
    left: 12px;
}

.gallery5-next {
    right: 12px;
}

.gallery5-pause {
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.gallery5-pause span {
    width: 10px;
    height: 12px;
    border-right: 3px solid currentColor;
    border-left: 3px solid currentColor;
}

.gallery5-pause[aria-pressed="true"] span {
    width: 0;
    height: 0;
    margin-left: 3px;
    border: 6px solid transparent;
    border-right: 0;
    border-left: 9px solid currentColor;
}

.gallery5-arrow:hover,
.gallery5-pause:hover {
    background: rgb(0 0 0 / 55%);
}

.gallery5-dots {
    position: absolute;
    right: 0;
    bottom: 12px;
    left: 0;
    z-index: 2;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.gallery5-dots button {
    position: relative;
    width: 24px;
    height: 24px;
    background: transparent;
    pointer-events: auto;
}

.gallery5-dots button::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 8px;
    width: 8px;
    height: 8px;
    border: 1px solid #fff;
    border-radius: 50%;
    background: rgb(255 255 255 / 38%);
    box-shadow: 0 1px 4px rgb(0 0 0 / 30%);
    transition: background .25s, transform .25s;
}

.gallery5-dots button[aria-current="true"]::before {
    background: #fff;
    transform: scale(1.2);
}

.gallery5-slide:focus-visible,
.gallery5-controls button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -3px;
}

/* 与原五宫格使用相同断点和高度。 */
@media (max-width: 1600px) {
    .gallery5-grid {
        grid-template-rows: repeat(2, 270px);
    }
}

@media (max-width: 1020px) {
    .gallery5-grid {
        grid-template-rows: repeat(2, 220px);
    }
}

@media (max-width: 700px) {
    .gallery5-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(3, 160px);
    }

    .gallery5-c {
        grid-column: 2;
        grid-row: 1 / 3;
    }

    .gallery5-prev {
        left: 6px;
    }

    .gallery5-next {
        right: 6px;
    }

    .gallery5-arrow {
        width: 28px;
        height: 38px;
        font-size: 26px;
    }

    .gallery5-dots {
        bottom: 5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery5-slide,
    .gallery5-slide img {
        transition: none;
    }
}
