﻿body {
    background: linear-gradient(180deg, #f7fbf7 0%, #eef7ee 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #124034;
}

.container {
    width: 1800px;
    max-width: calc(100vw - 48px);
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 15px 30px rgba(17, 58, 45, 0.08);
    padding: 3rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    border: 1px solid #c6dbd1;
}

.nav-section {
    background: #fffcd9;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 0;
    border: 1px solid #cee9d6;
    height: auto;
}

.left-section .nav-section,
.right-section .nav-section {
    background: #f8f9fa;
    border-color: #a8d5ba;
}

.nav-link {
    color: #495057;
    text-decoration: none;
    display: block;
    padding: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    /*margin-bottom: 0.5rem;*/
    border: 1px solid #cee9d6;
    background: #fffcd9;
    font-size: 1.25rem;
}

    .nav-link:hover {
        color: #333;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }

    .nav-link:nth-child(1) {
        border-color: #a8d5ba;
        background: linear-gradient(135deg, #f0f8f0 0%, #e8f5e8 100%);
    }

        .nav-link:nth-child(1):hover {
            background: linear-gradient(135deg, #a8d5ba 0%, #8bc34a 100%);
            color: white;
        }

    .nav-link:nth-child(2) {
        border-color: #b8d4f0;
        background: linear-gradient(135deg, #f0f4f8 0%, #e3f2fd 100%);
    }

        .nav-link:nth-child(2):hover {
            background: linear-gradient(135deg, #b8d4f0 0%, #2196f3 100%);
            color: white;
        }

    .nav-link:nth-child(3) {
        border-color: #f4d4a3;
        background: linear-gradient(135deg, #fef7e0 0%, #fff3c4 100%);
    }

        .nav-link:nth-child(3):hover {
            background: linear-gradient(135deg, #f4d4a3 0%, #ff9800 100%);
            color: white;
        }

    .nav-link:nth-child(4) {
        border-color: #a3e4d7;
        background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    }

        .nav-link:nth-child(4):hover {
            background: linear-gradient(135deg, #66e2d5 0%, #009688 100%);
            color: white;
        }

    .nav-link:nth-child(5) {
        border-color: #c5cae9;
        background: linear-gradient(135deg, #f3f4fa 0%, #e8eaf6 100%);
    }

        .nav-link:nth-child(5):hover {
            background: linear-gradient(135deg, #9fa8da 0%, #3f51b5 100%);
            color: white;
        }
    /*.nav-link:nth-child(4) {
        border-color: #d8c5f8;
        background: linear-gradient(135deg, #f9f6ff 0%, #f1e9ff 100%);
    }

        .nav-link:nth-child(4):hover {
            background: linear-gradient(135deg, #c4a8f7 0%, #7e57c2 100%);
            color: white;
        }

    .nav-link:nth-child(5) {
        border-color: #f7b8bc;
        background: linear-gradient(135deg, #fff2f3 0%, #ffe4e6 100%);
    }

        .nav-link:nth-child(5):hover {
            background: linear-gradient(135deg, #f7a3a8 0%, #e91e63 100%);
            color: white;
        }
*/

    .nav-link i {
        margin-right: 0.5rem;
        width: 20px;
    }

.query-button {
    display: block;
    width: 100%;
    padding: 2rem;
    background: linear-gradient(135deg, #0d6f54 0%, #188764 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 12px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    transition: all 0.3s ease;
    border: 2px solid #0c5d47;
}

    .query-button:hover {
        background: linear-gradient(135deg, #0b5c46 0%, #146a58 100%);
        transform: translateY(-5px);
        box-shadow: 0 10px 25px rgba(16, 66, 48, 0.2);
    }

    .query-button i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

h1 {
    color: #113d2f;
    text-align: center;
    margin-bottom: 2rem;
    font-weight: bold;
}

h2 {
    color: #174b39;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: stretch;
}

.left-section,
.right-section {
    flex: 0 0 auto;
    min-width: 0;
}

.year-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    max-height: 100%; /*Mod By Kevin 20260709 調整一下欄位展開畫面*/
    overflow-y: auto;
    padding-right: 0.25rem;
    padding-top: 0.25rem;
}

    .year-list::-webkit-scrollbar {
        width: 8px;
    }

    .year-list::-webkit-scrollbar-thumb {
        background: rgba(13, 111, 84, 0.6);
        border-radius: 999px;
    }

    .year-list::-webkit-scrollbar-track {
        background: transparent;
    }

.service-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    max-height: none;
    overflow-y: auto;
    padding-right: 0.25rem;
    padding-top: 0.25rem;
}

.year-item {
    background: #ffffff;
    border: 1px solid #a8d5ba;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #184f3c;
    font-weight: 600;
    font-size: 1.25rem;
}

    .year-item small {
        display: inline;
        color: #4b6e5e;
        font-size: 1.25rem;
        font-weight: 400;
        margin-top: 0;
    }

    .year-item:hover,
    .year-item:focus {
        background: #e6f2eb;
        border-color: #98c4aa;
        transform: translateY(-1px);
        outline: none;
    }

@media (max-width: 768px) {
    .container {
        width: auto;
        max-width: calc(100vw - 20px);
        padding: 1.25rem;
    }

    .main-content {
        flex-direction: column;
    }
}

.skip-link {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    z-index: 1000;
    background: #0d6f54;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.skip-link:focus,
.skip-link:focus-visible {
    top: 0.75rem;
    left: 0.75rem;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0.6rem 1rem;
    overflow: visible;
    clip: auto;
    white-space: normal;
    border-radius: 6px;
    color: #ffffff;
    outline: 3px solid #ffbf00;
    outline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #ffbf00 !important;
    outline-offset: 3px !important;
    box-shadow: none !important;
}

.year-item:focus {
    outline: 3px solid #ffbf00 !important;
    outline-offset: 3px !important;
}

.nav-link:nth-child(1):hover,
.nav-link:nth-child(1):focus-visible {
    background: #0d6f54;
    color: #ffffff;
}

.nav-link:nth-child(2):hover,
.nav-link:nth-child(2):focus-visible {
    background: #0d47a1;
    color: #ffffff;
}

.nav-link:nth-child(3):hover,
.nav-link:nth-child(3):focus-visible {
    background: #8a4f00;
    color: #ffffff;
}

/* Keep focus indicators inside scrollable cards so they are not clipped. */
.year-item:focus,
.year-item:focus-visible,
.nav-link:focus,
.nav-link:focus-visible,
.query-button:focus,
.query-button:focus-visible {
    outline: 3px solid #ffbf00 !important;
    outline-offset: -5px !important;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85) !important;
}

.mobile-back-to-top {
    display: none;
}

@media (max-width: 768px) {
    .mobile-back-to-top {
        position: fixed;
        right: 16px;
        bottom: max(16px, env(safe-area-inset-bottom));
        z-index: 1030;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: rgba(13, 111, 84, 0.95);
        box-shadow: 0 3px 10px rgba(13, 111, 84, 0.28);
        color: #ffffff;
        text-decoration: none;
        touch-action: manipulation;
    }

    .mobile-back-to-top:hover,
    .mobile-back-to-top:focus {
        background: rgba(74, 154, 151, 0.95);
        color: #ffffff;
    }

    .mobile-back-to-top:focus-visible {
        outline: 3px solid #f6c744;
        outline-offset: 3px;
    }
}

/* 首頁兩個區塊皆依閱讀順序向下排列，按鈕在桌面每列三個。 */
.year-list > .year-item,
.service-list > .nav-link {
    min-width: 0;
    overflow-wrap: anywhere;
}
@media (max-width: 991px) {
    .year-list,
    .service-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 576px) {
    .year-list,
    .service-list { grid-template-columns: minmax(0, 1fr); }
}
