/* ========================================
   首頁專屬樣式 (Index Page Styles)
   ======================================== */

/* 首頁 Hero 區塊 */
.index .hero {
    background-image: url('../images/index/banner_bg.jpg');
}

.index .hero-content {
    max-width: 600px;
}

/* 首頁 About 區塊 */
.index .about {
    padding: 0;
    position: relative;
    background-image: url('../images/index/banner_bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.index .about::after,
.index .services::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 0;
    pointer-events: none;
}

.index .about-content-block {
    position: relative;
    z-index: 1;
    background-color: #fff;
    padding: 60px 40px;
    padding-left: calc(40px + 60px);
    padding-right: calc(40px + 60px);
    margin-left: -60px;
    margin-right: -60px;
    margin-bottom: 0;
    padding-bottom: 0;
}

.index .about-grid {
    display: flex;
    gap: 40px;
    align-items: stretch;
    justify-content: flex-start;
    /* 往外撐齊容器內容寬，使內容區塊與下方影片 band 同寬、邊緣對齊 */
    margin-left: -40px;
    margin-right: -40px;
    margin-bottom: 0;
}

.index .about-img {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
}

.index .about-img img {
    width: 600px;
    aspect-ratio: 7 / 8;
    height: auto;
    object-fit: cover;
    display: block;
    box-shadow: none;
}

.index .about-text {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 右側文案於右半側上下左右置中（內容寬度上限 600） */
.index .about-text-inner {
    width: 100%;
    max-width: 600px;
}

.index .about-text h2 {
    font-size: var(--font-size-h2);
    color: var(--primary-teal);
    margin-bottom: 20px;
    font-weight: 700;
    font-family: var(--font-family-chinese);
}

.index .about-text p {
    margin-bottom: 20px;
    font-size: var(--font-size-body);
    color: #555;
}

/* About Footer (About 文字與影片縮圖區塊) */
.index .about-footer {
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 0;
    margin-left: -100px;
    margin-right: -100px;
    /* 與上方「關於恆達」內容拉開間距，灰帶+影片不緊貼（= 左圖上方內距，上下一致） */
    margin-top: 60px;
    padding: 70px 0;
}

.index .about-footer-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #D9D9D9;
    z-index: 0;
    border: none;
    outline: none;
}

.index .about-footer-content {
    position: relative;
    z-index: 1;
    /* 左右內縮 60px，使內容框對齊 .container 內容寬（= 服務項目輪播寬度） */
    padding: 0 60px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 0;
}

/* 灰帶左側白底文字區（寬度對齊上方圖片 600px） */
.index .about-video-text {
    flex: 0 0 600px;
    background: #fff;
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.index .about-video-text h3 {
    font-family: var(--font-family-chinese);
    font-size: var(--font-size-h2);
    font-weight: 700;
    color: var(--primary-teal);
    line-height: 1.35;
    margin: 0 0 18px;
}

.index .about-video-text p {
    font-size: var(--font-size-body);
    line-height: 1.9;
    color: #555;
    margin: 0;
}

/* About 字樣：灰色，與首頁其他區塊英文字同級，貼白色區塊右下、緊鄰灰色上緣（無間距） */
.index .about-label {
    position: absolute;
    bottom: 100%;
    right: 100px;
    z-index: 2;
    text-align: right;
    font-family: 'Chivo', sans-serif;
    font-size: clamp(56px, 9vw, 110px);
    font-weight: 700;
    color: #D9D9D9;
    line-height: 0.8;
    pointer-events: none;
    margin: 0;
    /* 往下貼齊灰色背景，消除字底與灰色間的留白 */
    transform: translateY(0.06em);
}

.index .video-thumbnail {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    align-self: stretch;
    aspect-ratio: 16 / 9;
    height: auto;
    cursor: pointer;
    overflow: hidden;
}

.index .video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .index .video-thumbnail:hover img {
        transform: scale(1.05);
    }
}

.index .play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.index .play-btn::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7.5px 0 7.5px 13.5px;
    border-color: transparent transparent transparent #000000;
    margin-left: 4px;
}

@media (hover: hover) {
    .index .play-btn:hover {
        background-color: var(--hover-green);
    }
}

/* 首頁 Services 區塊 */
.index .services {
    padding: 80px 0;
    position: relative;
    background-image: url('../images/index/banner_bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.index .section-title h2 {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.index .services .section-title h2 {
    color: #fff !important;
}

.index .slider-wrapper {
    position: relative;
    z-index: 1;
}

.index .carousel-container {
    width: 100%;
    overflow: hidden;
}

.index .carousel-track {
    display: flex;
    gap: 20px;
    width: 100%;
    touch-action: pan-y;
}

.index .service-card {
    position: relative;
    flex: 0 0 calc((100% - 40px) / 3);
    display: block;
    color: inherit;
    text-decoration: none;
}

.index .card-img-wrapper {
    width: 100%;
    aspect-ratio: 7 / 8;
    overflow: hidden;
    position: relative;
}

.index .card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.8);
    transition: transform 0.5s ease, filter 0.3s ease;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.index .card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    aspect-ratio: 7 / 8;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.index .card-overlay p {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0;
    text-align: left;
}

@keyframes arrow-shuttle {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    45% {
        transform: translateX(18px);
        opacity: 0;
    }
    46% {
        transform: translateX(-18px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (hover: hover) {
    .index .service-card:hover .card-img-wrapper img {
        filter: brightness(1);
        transform: scale(1.1);
    }

    .index .service-card:hover .card-overlay {
        opacity: 1;
    }

    .index .service-card:hover h3 .arrow {
        animation: arrow-shuttle 0.6s cubic-bezier(0.65, 0, 0.35, 1) 1;
    }
}

.index .service-card h3 {
    position: relative;
    margin-top: 15px;
    left: 0;
    bottom: auto;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.index .service-card h3 .arrow {
    display: inline-block;
    font-weight: 400;
    overflow: hidden;
}

.index .expertise .container {
    position: relative;
    padding: 0 40px;
    /* Ensure padding matches design system */
}

.index .expertise .section-label-large {
    bottom: 35px;
    /* Align with exp-img-front bottom (550px - 515px) */
}

.index .section-label-large {
    position: absolute;
    bottom: 0;
    left: 35px;
    /* 40px padding - 5px optical adjustment */
    font-family: 'Chivo', sans-serif;
    font-size: clamp(56px, 9vw, 110px);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    z-index: 1;
    pointer-events: none;
    line-height: 0.8;
}



.index .services-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 80px;
    position: relative;
    z-index: 1;
}

.index .services-footer .section-label-large {
    position: static;
    pointer-events: auto;
}

.index .services-footer .text-right {
    margin-bottom: 10px;
}

.index .nav-btn {
    top: 50%;
    transform: translateY(-50%);
}

.index .nav-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    transition: 0.3s;
}

.index .prev-btn {
    left: -60px;
}

.index .prev-btn::before {
    transform: translate(-25%, -50%) rotate(-45deg);
}

.index .next-btn {
    right: -60px;
}

.index .next-btn::before {
    transform: translate(-75%, -50%) rotate(135deg);
}

.index .nav-btn:hover {
    opacity: 0.7;
}


@media (max-width: 768px) {
    .index .prev-btn {
        left: 10px;
    }

    .index .next-btn {
        right: 10px;
    }

    .index .card-overlay {
        position: static;
        aspect-ratio: auto;
        width: auto;
        background: transparent;
        padding: 12px 0 0;
        opacity: 1;
        pointer-events: auto;
        display: block;
    }

    .index .card-overlay p {
        text-align: left;
        color: #fff;
    }
}

.index .text-right {
    text-align: right;
}

/* 首頁 Expertise 區塊 */
.index .expertise {
    padding: 100px 0;
    background-color: #fff;
    position: relative;
}

.index .expertise-grid {
    display: flex;
    gap: 50px;
}

.index .expertise-list {
    flex: 1;
}

.index .expertise-item {
    border-bottom: 1px solid #eee;
    padding: 20px 0;
}

.index .exp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.index .exp-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-black);
}

.index .plus {
    font-size: 1.5rem;
    font-weight: 300;
}

.index .expertise-item p {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

.index .expertise-item p {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    color: #666;
    line-height: 1.6;
    transition: max-height 0.4s ease, opacity 0.4s ease, margin-top 0.4s ease;
}

.index .expertise-item.active p {
    max-height: 200px;
    opacity: 1;
    margin-top: 10px;
}

.index .expertise-img-wrapper {
    flex: 1;
    position: relative;
    /* 所有尺寸 clamp + 比例計算 → RWD 過程連續縮放，無斷點跳動 */
    --exp-back-left: clamp(24px, 4vw, 80px);
    --exp-back-top: 0;
    --exp-card-width: clamp(260px, 22vw, 320px);
    --exp-card-height: calc(var(--exp-card-width) * 385 / 320);
    --exp-front-top: calc(var(--exp-card-height) * 0.34);
    --exp-front-left: calc(var(--exp-card-width) * 0.78 + var(--exp-back-left));
    --exp-btn-top: calc(var(--exp-front-top) + var(--exp-card-height) - 48px);
    --exp-front-shift: 22px;
    min-height: calc(var(--exp-front-top) + var(--exp-card-height) + 80px);
}

.index .exp-img-back {
    position: absolute;
    top: var(--exp-back-top);
    left: var(--exp-back-left);
    width: var(--exp-card-width);
    height: var(--exp-card-height);
    z-index: 1;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.25s ease;
}

.index .exp-img-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: brightness(0.9);
    transition: transform 0.4s ease;
}

.index .exp-img-front {
    position: absolute;
    top: var(--exp-front-top);
    left: var(--exp-front-left);
    width: var(--exp-card-width);
    height: var(--exp-card-height);
    z-index: 2;
    box-shadow: -10px -10px 30px rgba(0, 0, 0, 0.1);
    border: 5px solid #fff;
    overflow: hidden;
    transition: transform 0.4s ease, opacity 0.25s ease;
}

.index .exp-img-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

@media (hover: hover) {

    .index .exp-img-back:hover img,
    .index .exp-img-front:hover img {
        transform: scale(1.1);
    }

    /* 只有 hover 後卡（back）才讓前卡（front）右移；hover 前卡時前卡不動 */
    .index .exp-img-back:hover ~ .exp-img-front {
        transform: translateX(var(--exp-front-shift));
    }
}

.index .img-caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 24px 100px 24px 20px;
    color: #fff;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.5;
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.index .img-caption-overlay p {
    margin-bottom: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.index .expertise-img-wrapper.is-switching .exp-img-back,
.index .expertise-img-wrapper.is-switching .exp-img-front,
.index .expertise-img-wrapper.is-switching .img-caption-overlay {
    opacity: 0.35;
}

.index .expertise-img-wrapper .btn-more {
    position: absolute;
    top: var(--exp-btn-top);
    left: var(--exp-back-left);
    margin-top: 0;
    z-index: 2;
    transform: none;
}

.index .section-title h2 {
    font-size: var(--font-size-h2);
    margin-bottom: 40px;
    font-weight: 700;
}

.index .services .section-title h2 {
    color: #fff;
}

/* expertise 在白底，標題用企業色 */
.index .expertise .section-title h2 {
    color: var(--primary-teal);
}

.index .text-center {
    text-align: center;
}

/* 首頁 Contact 區塊 */
/* 首頁 Contact 區塊 */
.index .contact {
    position: relative;
    height: 400px;
    /* Fixed height as requested */
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0;
    /* Remove padding to maintain fixed height */
}

.index .contact-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/index/contact_bg.jpg');
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.index .contact-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
}

.index .contact-inner {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.index .contact-text {
    max-width: 55%;
    padding-left: 0;
}

.index .contact-text h2 {
    font-size: var(--font-size-h2);
    margin-bottom: 20px;
    font-weight: 700;
}

.index .contact-text p {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 0;
    max-width: 28em;
}

.index .contact-cta {
    text-align: right;
}

.index .contact-watermark {
    position: absolute;
    right: 5%;
    bottom: 10px;
    z-index: 1;
    font-family: 'Chivo', sans-serif;
    font-size: clamp(56px, 9vw, 110px);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    line-height: 0.8;
    pointer-events: none;
}

/* 首頁 Join Us 區塊 */
.index .join-us {
    padding: 80px 0;
    position: relative;
    background-color: #FFFFFF;
}

.index .join-us::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #D9D9D9;
    z-index: 0;
}

.index .join-grid {
    display: flex;
    align-items: center;
}

.index .join-img {
    flex: 1.2;
    position: relative;
    transform: translateY(-30px);
    z-index: 1;
}

.index .join-img::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(1, 109, 130, 0.5);
    z-index: 1;
}

.index .join-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.index .join-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Chivo', sans-serif;
    font-weight: 700;
    z-index: 2;
    line-height: 0.8;
    white-space: nowrap;
}

.index .join-overlay h2 {
    font-size: clamp(56px, 9vw, 110px);
    margin: 0;
    line-height: 0.8;
}

.index .join-text {
    flex: 0.8;
    padding: 50px;
    background: #FFFFFF;
    transform: translateY(30px);
    position: relative;
    z-index: 2;
    margin-left: -5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 2;
}

.index .join-text h2 {
    color: var(--primary-teal);
    margin-bottom: 20px;
    font-size: var(--font-size-h2);
    font-weight: 700;
}

.index .join-text p {
    margin-bottom: 0px;
    color: #666;
    line-height: 1.7;
    max-width: 24em;
}

.index .join-text .btn-more {
    margin-top: 40px;
}

/* Video Modal */
.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-modal.active {
    display: flex;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    width: 80%;
    max-width: 900px;
    z-index: 1001;
    background: transparent;
    box-shadow: none;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

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

.close-modal {
    position: fixed;
    top: 30px;
    right: 30px;
    background: var(--primary-teal);
    color: #fff;
    border: none;
    width: 37.5px;
    height: 37.5px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    transition: background 0.3s ease;
    z-index: 1002;
}

@media (hover: hover) {
    .close-modal:hover {
        background: var(--hover-green);
    }
}

/* ========================================
   響應式設計 (Responsive Design)
   ======================================== */

/* Tablet/Narrow Desktop */


@media (max-width: 1200px) {
    .index .expertise-grid {
        flex-direction: column;
    }

    /* Column 佈局：卡片維持 320px 原尺寸（左右空間還夠），重疊設計不變 */
    .index .expertise-img-wrapper {
        --exp-back-left: 0;
        --exp-card-width: 320px;
        --exp-card-height: calc(var(--exp-card-width) * 385 / 320);
        --exp-front-top: calc(var(--exp-card-height) * 0.34);
        --exp-front-left: calc(var(--exp-card-width) * 0.78);
        --exp-btn-top: calc(var(--exp-front-top) + var(--exp-card-height) - 48px);
        --exp-front-shift: 18px;
        min-height: calc(var(--exp-front-top) + var(--exp-card-height) + 24px);
        max-width: 620px;
        width: 100%;
        margin: 0 auto;
    }

    .index .section-label-large {
        position: relative;
        bottom: auto;
        left: auto;
        margin-top: 40px;
        text-align: center;
        width: 100%;
    }

    /* 服務卡 3→2 col、左右切換鈕內縮 */
    .index .service-card {
        flex: 0 0 calc((100% - 20px) / 2);
    }
    .index .prev-btn { left: -20px; }
    .index .next-btn { right: -20px; }
}

/* Mobile */
@media (max-width: 900px) {
    /* section padding 壓縮（手機節奏更緊湊） */
    .index .services { padding: 60px 0; }
    .index .expertise { padding: 64px 0; }
    .index .join-us { padding: 60px 0; }

    .index .hero .container,
    .index .about-grid,
    .index .expertise-grid,
    .index .join-grid {
        flex-direction: column;
    }

    .index .about-content-block {
        padding: 0;
        margin: 0;
        width: 100%;
        margin-top: 0;
    }

    .index .about-grid {
        padding: 40px 30px 0;
        gap: 30px;
    }

    .index .about-img {
        flex: 0 0 100%;
        width: 100%;
        aspect-ratio: 1 / 1;
        display: block;
        overflow: hidden;
    }

    .index .about-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .index .about-text {
        padding: 0;
        flex: 1 1 auto;
        max-width: none;
        display: block;
    }

    .index .about-text-inner {
        max-width: none;
    }

    .index .about-grid {
        margin-left: 0;
        margin-right: 0;
    }

    .index .about-footer {
        height: auto;
        min-height: auto;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: 110px;
        /* Push down to separate from text and sit at bottom */
        position: relative;
        background-color: transparent;
        /* Reset desktop offsets */
        margin-left: 0;
        margin-right: 0;
        padding-right: 0;
        width: 100%;
    }

    .index .about-footer-bg {
        height: 100%;
        /* 覆蓋整個 band，讓 about-video-text 與影片都包在灰色內 */
        top: 0;
        bottom: auto;
    }

    .index .about-footer-content {
        flex-direction: column;
        gap: 0;
        /* 白卡與影片緊鄰、不露出灰色 */
        padding: 40px 20px;
        align-items: center;
        justify-content: flex-end;
        transform: none;
        margin-top: 0;
    }

    .index .about-label {
        left: 0;
        right: 0;
        text-align: center;
        font-size: clamp(56px, 9vw, 110px);
    }

    .index .about-video-text {
        flex: 0 0 auto;
        width: 100%;
        padding: 32px 24px;
    }

    .index .video-thumbnail {
        order: 1;
        /* Video moves to top */
        width: 100%;
        max-width: 450px;
        height: auto;
        aspect-ratio: 16 / 9;
        position: relative;
        z-index: 2;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
        margin-bottom: 0;
        transform: none;
        margin: 0 auto;
        /* Explicit horizontal centering */
    }

    .index .hero-content {
        padding-right: 0;
        margin-bottom: 0;
    }

    .index .contact {
        min-height: 480px;
        height: auto;
        align-items: flex-start;
        padding: 60px 0;
    }

    .index .contact-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 30px;
    }

    .index .contact-text {
        max-width: 100%;
        padding: 0 20px;
        /* Add horizontal padding to match standard container */
    }

    .index .contact-cta {
        text-align: left;
        width: 100%;
        padding: 0 20px;
        /* Add horizontal padding to align with text */
    }

    .index .contact-watermark {
        right: auto;
        left: 50%;
        bottom: 0;
        transform: translateX(-50%);
        width: 100%;
        text-align: center;
        white-space: normal;
        line-height: 1;
    }

    .index .join-text {
        margin: -50px auto 0;
        width: 90%;
        max-width: 500px;
        transform: none;
        margin-left: auto;
        margin-right: auto;
        aspect-ratio: auto;
    }

    .index .join-overlay {
        bottom: calc(50px + 16px);
        top: auto;
    }

    .index .join-overlay h2 {
        white-space: nowrap;
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .index .hero {
        width: 100vw;
        margin-left: 0;
        margin-right: 0;
        background-size: cover;
        background-position: center right;
    }

    .index .expertise-grid {
        flex-direction: column;
    }

    .index .expertise-img-wrapper {
        margin-top: 40px;
    }

    .index .section-label-large {
        position: relative;
        top: auto;
        left: auto;
        margin-top: 80px;
        text-align: center;
    }

    .index .service-card {
        flex: 0 0 100%;
    }

    .index .carousel-track {
        gap: 0;
    }

    .index .prev-btn {
        left: 10px;
        right: auto;
    }

    .index .next-btn {
        right: 10px;
        left: auto;
    }

    .index .services-footer {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        position: relative;
        margin-top: 20px;
    }

    .index .services-footer .section-label-large {
        order: 2;
        position: relative;
        bottom: auto;
        left: auto;
        z-index: 0;
        white-space: normal;
        margin-top: 20px;
        text-align: center;
        width: 100%;
        color: rgba(255, 255, 255, 0.2);
    }

    .index .services-footer .text-right {
        order: 1;
        text-align: left;
        width: 100%;
        position: relative;
        z-index: 10;
        padding-left: 0;
    }

    .index .expertise .section-label-large {
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        text-align: center;
        white-space: normal;
        right: auto;
    }
}

@media (max-width: 700px) {
    /* 寬度不夠 → 卡片改上下堆疊（無重疊），按鈕落在卡片下方 */
    .index .expertise-img-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        min-height: auto;
    }

    .index .exp-img-back,
    .index .exp-img-front {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        width: 100%;
        max-width: 320px;
        height: auto;
        aspect-ratio: 320 / 385;
        margin: 0;
        transform: none !important;
    }

    .index .exp-img-front {
        border: 5px solid #fff;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    }

    .index .exp-img-back img,
    .index .exp-img-front img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .index .expertise-img-wrapper .btn-more {
        position: relative;
        top: auto;
        left: auto;
        margin-top: 12px;
        align-self: flex-start;
        /* 對齊卡片左緣（卡片 max 320 置中，計算 wrapper 與卡片左邊距） */
        margin-left: max(0px, calc((100% - 320px) / 2));
    }
}
