/* ==========================================================================
   ielts-test-dates.css｜/ielts/test-dates.html 專屬（雅思考試日期與時間）
   載入順序：site.css → article.css → ielts-test-dates.css
   命名空間：.td-*（全站最小字級 14px）
   色彩約定：IDP ＝ 品牌紅、英國文化協會 BC ＝ 深灰 #272727（同費用頁）
   考期涵蓋月份、地區收合日期表、考試時間卡
   快速跳轉（.ip-jump）、地區區塊（.ip-area）、A／B／C 小標（.ip-letter-title）、核對清單（.ip-checkgrid）、
   延伸連結（.ip-related）已移到 article.css 共用，這裡只放本頁的版面微調
   ========================================================================== */

/* ---------- 開頭｜考期涵蓋月份 ---------- */
.ielts-article .ip-content .td-period {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 18px;
    margin: 6px 0 0;
    text-align: center;
    padding: 18px 24px;
    background: #272727;
    color: #fff;
}

.ielts-article .td-period-label {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .08em;
    color: #d9d9d9;
}

.ielts-article .td-period-range {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 14px;
}

.ielts-article .td-period-range strong {
    font-size: clamp(20px, 1.9vw, 24px);
    font-weight: 800;
    line-height: 1.4;
    color: #fff;
}

/* 「至」只顯示一條紅線（文字保留在 HTML 給螢幕閱讀器與 SEO，視覺上隱藏） */
.ielts-article .td-period-to {
    flex: none;
    display: block;
    width: 32px;
    height: 2px;
    background: var(--red);
    font-size: 0;
    line-height: 0;
    color: transparent;
    overflow: hidden;
}

.ielts-article .ip-content .td-period-note {
    margin-top: 14px;
    font-size: 15px;
    line-height: 1.85;
    color: #555;
}

/* ---------- 開頭｜快速跳轉：本頁改為置中格狀排列（共用樣式見 article.css .ip-jump） ---------- */
.ielts-article .ip-jump {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, auto));
    justify-content: center;
    margin: 24px 0 0;
}

.ielts-article .ip-jump a {
    justify-content: center;
    line-height: 1.4;
}

/* ---------- 地區區塊（共用樣式見 article.css .ip-area） ---------- */
.ielts-article .td-area--flush {
    margin-top: 26px;
    padding-top: 0;
    border-top: 0;
}

.ielts-article .ip-content .td-table-note {
    margin: 14px 0 0;
    font-size: 14px;
    line-height: 1.8;
    color: #777;
}

.ielts-article .ip-content .ip-area + .ip-note,
.ielts-article .ip-content .ip-area + .ip-callout {
    margin-top: 32px !important;
}

/* ---------- 地區收合（<details>） ---------- */
.ielts-article .td-region {
    margin-top: 22px;
    border: 1px solid var(--ip-border);
    background: #fff;
}

.ielts-article .td-region > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
    padding: 12px 16px 12px 20px;
    cursor: pointer;
    list-style: none;
    transition: background .15s;
}

.ielts-article .td-region > summary::-webkit-details-marker {
    display: none;
}

.ielts-article .td-region > summary:hover {
    background: #f8edef;
}

.ielts-article .td-region[open] > summary {
    background: var(--ip-cream);
    border-bottom: 1px solid var(--ip-border);
}

.ielts-article .td-region-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #222;
}

/* ▼ 展開箭頭：細框方塊（同首頁錨點卡箭頭） */
.ielts-article .td-region-icon {
    flex: none;
    position: relative;
    width: 36px;
    height: 36px;
    border: 1px solid #222;
    background: #fff;
    transition: background .15s, border-color .15s;
}

.ielts-article .td-region-icon::before {
    content: "";
    position: absolute;
    top: 11px;
    left: 13px;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid #222;
    border-bottom: 1.5px solid #222;
    transform: rotate(45deg);
    transition: transform .2s, top .2s;
}

.ielts-article .td-region[open] .td-region-icon {
    background: var(--red);
    border-color: var(--red);
}

.ielts-article .td-region[open] .td-region-icon::before {
    top: 15px;
    border-color: #fff;
    transform: rotate(225deg);
}

/* ---------- 日期表（沿用 .ip-table-wrap） ---------- */
.ielts-article .td-region .ip-table-wrap {
    margin: 0;
    border-bottom: 0;
}

.ielts-article .td-table table {
    min-width: 0;
    table-layout: fixed;
}

.ielts-article .td-table thead th {
    padding: 13px 16px;
    font-size: 15px;
}

.ielts-article .td-table thead th:nth-child(1) {
    width: 116px;
}

.ielts-article .td-table thead th:nth-child(2) {
    width: 118px;
}

/* 以月份分組：不使用斑馬紋，改由每組上方的深色線區隔 */
.ielts-article .td-table tbody tr:nth-child(even) {
    background: transparent;
}

.ielts-article .td-table tbody + tbody {
    border-top: 2px solid #2a2a2a;
}

.ielts-article .td-table th,
.ielts-article .td-table td {
    padding: 16px;
    vertical-align: top;
}

.ielts-article .td-table .td-month {
    min-width: 0;
    background: var(--ip-cream);
    color: #222;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
}

.ielts-article .td-year {
    display: block;
    font: 15px/1.5 Georgia, "Times New Roman", serif;
    font-weight: 400;
    color: #777;
}

.ielts-article .td-mon {
    display: block;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.4;
    color: #222;
}

.ielts-article .td-unit {
    white-space: nowrap;
}

/* 報名單位標籤：IDP 紅、BC 深灰 */
.ielts-article .td-tag {
    display: inline-block;
    padding: 2px 10px;
    background: var(--red);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.7;
}

.ielts-article .td-tag--bc {
    background: #272727;
}

/* 日期方塊：以格線排列，數字欄位對齊 */
.ielts-article .td-dates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ielts-article .td-dates li {
    margin: 0;
}

.ielts-article .td-dates time {
    display: block;
    padding: 3px 0;
    border: 1px solid var(--ip-border);
    background: #fff;
    color: #333;
    font: 15px/1.6 Georgia, "Times New Roman", serif;
    letter-spacing: .02em;
    text-align: center;
    white-space: nowrap;
}

/* IDP 那一列的日期方塊：左側紅色細邊；BC：深灰細邊 */
.ielts-article .td-table tr:has(.td-tag--idp) .td-dates time {
    border-left: 2px solid var(--red);
}

.ielts-article .td-table tr:has(.td-tag--bc) .td-dates time {
    border-left: 2px solid #272727;
}

/* Life Skills（三欄表）：日期欄較寬 */
.ielts-article .td-table--3 .td-dates {
    grid-template-columns: repeat(auto-fill, minmax(64px, 88px));
}

/* ---------- 04｜考試時間卡 ---------- */
.ielts-article .ip-content .td-total {
    display: inline-block;
    padding: 0 8px;
    background: var(--red);
    color: #fff;
    font-size: 1.1em;
    line-height: 1.7;
}

.ielts-article .td-timing {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 28px 0 30px;
}

.ielts-article .td-time-card {
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 30px 22px 22px;
    background: #fff;
    border: 1px solid var(--ip-border);
    border-left-width: 0;
}

.ielts-article .td-time-card:first-child {
    border-left-width: 1px;
}

/* 聽讀寫：頂部實線一路串連；口說：與前三科留空並改用虛線 */
.ielts-article .td-time-card--run {
    border-top: 4px solid var(--red);
}

.ielts-article .td-time-card--apart {
    margin-left: 18px;
    border-left-width: 1px;
    border-top: 4px dashed #272727;
    background: var(--ip-cream);
}

/* 實線上的節點 */
.ielts-article .td-time-card--run::before {
    content: "";
    position: absolute;
    top: -9px;
    left: 22px;
    width: 14px;
    height: 14px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 1px var(--red);
}

.ielts-article .td-time-card dd {
    margin: 0;
}

.ielts-article .td-time-skill {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #222;
}

.ielts-article .td-time-letter {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--red);
    color: var(--red);
    font: italic 16px/1 Georgia, serif;
}

.ielts-article .td-time-card--apart .td-time-letter {
    border-color: #272727;
    color: #272727;
}

.ielts-article .td-time-length {
    margin: 14px 0 12px !important;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--ip-border);
    font-size: clamp(21px, 2vw, 26px);
    font-weight: 800;
    line-height: 1.35;
    color: var(--red);
}

.ielts-article .td-time-card--apart .td-time-length {
    color: #222;
}

.ielts-article .td-time-desc {
    font-size: 15px;
    line-height: 1.8;
    color: #555;
}

/* ---------- 05｜核對清單：本頁第一欄較寬、上下留白（共用樣式見 article.css .ip-checkgrid） ---------- */
.ielts-article .ip-checkgrid {
    --check-col: 210px;
    margin: 22px 0 26px;
}

/* ---------- 延伸閱讀連結：兩欄卡片上方間距（共用樣式見 article.css .ip-related） ---------- */
.ielts-article .ip-related--pair {
    margin-top: 26px;
}

/* ---------- 響應式 ---------- */
@media (max-width: 1150px) {
    .ielts-article .ip-jump {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        justify-content: stretch;
    }
}

@media (max-width: 1050px) {

    .ielts-article .ip-checkgrid {
        --check-col: 160px;
    }

    .ielts-article .td-timing {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* 口說卡另起一列、橫跨全寬 */
    .ielts-article .td-time-card--apart {
        grid-column: 1 / -1;
        margin: 18px 0 0;
    }
}

/* 日期表：960px 以下改為「月份卡片」堆疊 */
@media (max-width: 960px) {

    .ielts-article .td-table table,
    .ielts-article .td-table tbody,
    .ielts-article .td-table tr,
    .ielts-article .td-table th,
    .ielts-article .td-table td {
        display: block;
        width: auto !important;
    }

    .ielts-article .td-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .ielts-article .td-table tbody + tbody {
        border-top: 2px solid #2a2a2a;
    }

    .ielts-article .td-table .td-month {
        padding: 10px 16px;
        border-top: 0;
    }

    .ielts-article .td-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 16px;
        padding: 16px;
        border-top: 1px solid var(--ip-border);
    }

    /* 第一列的月份標題要撐滿整列、貼齊卡片邊緣 */
    .ielts-article .td-table tr:has(> .td-month) {
        padding-top: 0;
        border-top: 0;
    }

    .ielts-article .td-table tr > .td-month {
        grid-column: 1 / -1;
        margin: 0 -16px 14px;
    }

    .ielts-article .td-year,
    .ielts-article .td-mon {
        display: inline;
        font-size: 16px;
    }

    .ielts-article .td-year {
        margin-right: 4px;
    }

    .ielts-article .td-table tr > .td-unit {
        grid-column: 1 / -1;
        padding: 0 0 12px;
        border: 0;
    }

    .ielts-article .td-table tr > .td-date-cell {
        padding: 0;
        border: 0;
    }

    .ielts-article .td-table--3 tr > .td-date-cell {
        grid-column: 1 / -1;
    }

    /* 欄位名稱（原表頭）顯示在日期上方 */
    .ielts-article .td-date-cell::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 8px;
        font-size: 14px;
        font-weight: 700;
        letter-spacing: .04em;
        color: #777;
    }
}

@media (max-width: 760px) {
    .ielts-article .ip-content .td-period {
        padding: 16px 18px;
    }

    .ielts-article .td-period-range {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .ielts-article .td-period-range strong {
        font-size: 20px;
        white-space: nowrap;
    }

    .ielts-article .td-period-to {
        width: 20px;
    }

    .ielts-article .td-area--flush {
        margin-top: 22px;
        padding-top: 0;
    }

    .ielts-article .td-region > summary {
        min-height: 54px;
        padding: 10px 12px 10px 16px;
    }

    .ielts-article .td-region-name {
        font-size: 17px;
    }

    .ielts-article .td-timing {
        grid-template-columns: minmax(0, 1fr);
    }

    /* 手機：時間卡改為直向時間軸，左側實線串連 */
    .ielts-article .td-time-card,
    .ielts-article .td-time-card:first-child {
        padding: 20px 18px 18px 26px;
        border: 1px solid var(--ip-border);
        border-top-width: 0;
    }

    .ielts-article .td-time-card--run {
        border-left: 4px solid var(--red) !important;
    }

    .ielts-article .td-time-card--run:first-child {
        border-top-width: 1px;
    }

    .ielts-article .td-time-card--run::before {
        top: 24px;
        left: -9px;
    }

    .ielts-article .td-time-card--apart {
        margin-top: 16px;
        border-top-width: 1px;
        border-left: 4px dashed #272727 !important;
    }
}

@media (max-width: 520px) {
    .ielts-article .ip-jump {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ielts-article .td-table tr {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .ielts-article .td-dates {
        grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
        gap: 5px;
    }

    .ielts-article .td-dates time {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .ielts-article .td-region-icon::before {
        transition: none;
    }
}
