/**
 * Coach Role 通用角色頁樣式 (雙卡片分離佈局)
 *
 * 對齊專案既有設計語言：
 * - 顏色/圓角/陰影一律使用 M3 tokens（variables.css）與 archcross-landing.css 的 --ac-* tokens
 * - 結構沿用 .ac-container / .ac-glass-card / .ac-badge
 *
 * 載入順序依賴：jex-variables-style → jex-landing-shared-style → jex-coach-role-style
 */

/* ======== 根容器 ======== */
.jex-coach-role {
    /* 建立整體高度限制，保持不捲動整個網頁 */
    height: calc(100vh - 120px);
    min-height: 540px;
    max-height: 1080px;
    padding: clamp(1rem, 2vw, 2rem) 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.jcr-app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    height: 100%; /* 撐滿父層 */
    display: grid;
    /* 左側卡片寬一點以容納名稱與簡介，右側自動 */
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: clamp(1rem, 2.5vw, 1rem);
    align-items: stretch; /* 讓左右兩張卡片一樣高 */
}

/* ======== 側邊欄：角色資訊與歷史紀錄 (左卡片) ======== */
.jcr-sidebar, .jcr-main-stage {
    /* 扁平化大圓角卡片設計 */
    background: var(--md-sys-color-surface);
    border-radius: var(--jex-container-radius);
    overflow: hidden; /* 保證圓角生效裁切子元素 */
}

.jcr-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    padding: clamp(1em, 2vw, 1rem);
    box-sizing: border-box;
    gap: 1rem; /* 頭像區塊跟歷史紀錄區塊的間距 */
}

/* 角色資訊區塊 */
.jcr-sidebar-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px; /* 縮減間距 */
    flex-shrink: 0;
}

.jcr-sidebar-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.jcr-mobile-history-toggle {
    display: none; /* 預設桌面隱藏 */
}

/* 如果沒有圖片，維持首字設計 */
.jcr-sidebar-avatar {
    width: clamp(80px, 8vw, 100px);
    height: clamp(80px, 8vw, 100px);
    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--jex-cover-ai-text);
    overflow: hidden;
}

.jcr-sidebar-avatar-glyph {
    font-size: 2.5rem;
    font-weight: 800;
}

.jcr-sidebar-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jcr-sidebar-name {
    margin: 0.5rem !important; /* 強制消除邊距，防止被 WP 主題蓋掉 */
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--md-sys-color-on-surface);
    line-height: 1.1; 
    letter-spacing: -0.02em;
}

.jcr-sidebar-desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.6;
    word-break: break-word;
}

.jex-coach-role-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.jex-coach-role-actions .ac-btn {
    min-width: 120px;
}

/* 歷史紀錄區塊 */
.jcr-history-inner {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    /* 移除強硬的上邊框，讓整體更融通 */
    position: relative;
    padding-top: 8px;
}

/* 歷史對話標題 (目前隱藏) */
.jcr-history-head {
    display: none; 
}

.jcr-history-body {
    flex: 1 1 auto;
    min-height: 0; /* 讓內部捲軸生效 */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--jex-scrollbar-thumb) transparent;
    
    /* 讓兩側稍微有點 padding，避免清單與捲軸貼死邊緣 */
    padding: 0 var(--md-sys-spacing-sm);
    margin: 0 calc(var(--md-sys-spacing-sm) * -1);
}

.jcr-history-body::-webkit-scrollbar {
    width: 6px;
}
.jcr-history-body::-webkit-scrollbar-thumb {
    background: var(--jex-scrollbar-thumb);
    border-radius: var(--md-sys-shape-corner-full);
}

/* ======== 重構歷史清單項目樣式 ======== */
/* 加入 .jex-conversation-history-list 提高 Specificity 避免被 conversation.css 的預設樣式干擾 */
.jcr-sidebar .jex-conversation-history-list {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.jcr-sidebar .jex-conversation-history-list .jex-conversation-history-items-container {
    display: flex;
    flex-direction: column;
    gap: var(--md-sys-spacing-sm); /* 項目之間的呼吸空間 */
    padding: 2px; /* 為 Hover 動畫稍微預留邊界 */
}

/* 強制清除 base item 的 padding, border-bottom 甚至 hover background，因為我們把樣式轉移至 link */
.jcr-sidebar .jex-conversation-history-list .history-list-item {
    margin: 0;
    border: none;
    padding: 0;
    background: transparent;
}

.jcr-sidebar .jex-conversation-history-list .history-list-item:hover,
.jcr-sidebar .jex-conversation-history-list .history-list-item:focus,
.jcr-sidebar .jex-conversation-history-list .history-list-item.active {
    background: transparent;
    color: inherit;
}

.jcr-sidebar .jex-conversation-history-list .history-item-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: var(--md-sys-spacing-md);
    border-radius: var(--md-sys-shape-corner-large); 
    text-decoration: none;
    /* 預設給予極淡背景與邊框，讓它有「獨立卡片感」而不是空洞的文字 */
    background: var(--md-sys-color-surface-variant);
    border: 1px solid transparent; 
    transition: var(--jex-transition-standard);
}

.jcr-sidebar .jex-conversation-history-list .history-item-link:hover,
.jcr-sidebar .jex-conversation-history-list .history-item-link:focus {
    /* Hover 時反白浮現，增強互動性與質感 */
    background: var(--md-sys-color-surface);
    border-color: var(--md-sys-color-outline-variant);
    box-shadow: var(--md-sys-elevation-1);
    transform: translateY(var(--jex-hover-lift));
    color: inherit; /* 防止 base a:hover 影響 */
}

/* active 由 item 身上判斷，但樣式轉移至 link */
.jcr-sidebar .jex-conversation-history-list .history-list-item.active .history-item-link {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

.jcr-sidebar .jex-conversation-history-list .history-item-snippet {
    /* 使用微調的 M3 排版字體大小 */
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: var(--md-sys-typescale-body-medium-line-height);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--md-sys-color-on-surface);
    font-weight: 500;
    white-space: normal; /* 解除 base snippet nowrap 限制 */
}

.jcr-sidebar .jex-conversation-history-list .history-item-time {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 600;
    margin-top: 2px;
}


/* ======== Main Stage (右卡片：即時對話區) ======== */
.jcr-main-stage {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    /* 這裡不再重複寫 background 跟 border-radius，已經共用 */
    padding: 1rem;
    box-sizing: border-box;
}

.jcr-chat-area {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 給 conversation 內部容器一個 100% 確保它佈展 */
.jcr-chat-area .jex-conversation-mount-point,
.jcr-chat-area .jex-conversation-wrapper {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}


/* ======== 響應式 (Mobile & Tablet) ======== */
@media (max-width: 960px) {
    .jex-coach-role {
        /* 手機取消鎖定 100vh 高度，讓網頁可以往下捲動 */
        height: auto;
        min-height: 0;
        max-height: none;
        padding: 8px; /* 手機版防貼邊保護間距 */
        box-sizing: border-box;
    }

    .jcr-app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr; /* 頭部自適應，下方撐滿 */
        gap: var(--md-sys-spacing-sm);
    }

    .jcr-sidebar {
        /* 手機上將側邊欄改為頂層 Header */
        order: 1; 
        height: auto; 
        padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md);
        gap: 0;
        border-radius: var(--jex-container-radius); /* 統一使用系統大圓角 */
        position: relative; /* 為了 Popup 定位 */
        z-index: var(--jex-z-dropdown);
        overflow: visible; /* 解除裁切讓 Popup 可以掉出來 */
    }

    .jcr-sidebar-profile {
        /* 橫式排列 */
        flex-direction: row;
        text-align: left;
        align-items: center;
        gap: var(--md-sys-spacing-md);
        width: 100%;
        justify-content: space-between;
    }

    .jcr-sidebar-text {
        flex: 1 1 auto;
        align-items: flex-start;
        min-width: 0;
        gap: 0; /* 手機版消除間距 */
        justify-content: center;
    }

    .jcr-sidebar-avatar {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }

    .jcr-sidebar-avatar-glyph {
        font-size: 1.25rem;
    }

    .jcr-sidebar-name {
        font-size: 1.15rem;
        line-height: 1; /* 緊貼邊緣 */
        margin: 0 !important;
    }
    
    .jcr-sidebar-desc {
        font-size: 0.8rem;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .jex-coach-role-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .jcr-mobile-history-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        gap: 4px;
        background: var(--md-sys-color-surface-variant);
        border: none;
        border-radius: var(--md-sys-shape-corner-medium);
        padding: 8px 12px;
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        color: var(--md-sys-color-on-surface-variant);
        transition: var(--jex-transition-standard);
    }
    
    .jcr-mobile-history-toggle:active {
        background: var(--md-sys-color-surface-container);
    }

    .jcr-main-stage {
        /* 對話區在下方 */
        order: 2; 
        height: calc(100vh - 120px); 
        min-height: 540px;
    }

    /* 歷史記錄轉換為 Popup 菜單 */
    #jcr-history-drawer {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        width: 100%;
        max-height: 50vh;
        background: var(--md-sys-color-surface);
        border-radius: var(--jex-container-radius); /* 統一使用外層容器大圓角 */
        box-shadow: var(--md-sys-elevation-3);
        border: 1px solid var(--md-sys-color-outline-variant);
        padding: var(--md-sys-spacing-sm);
        box-sizing: border-box;
        z-index: var(--jex-z-modal);
        
        /* 隱藏與動畫狀態 */
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: all var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
    }
    
    #jcr-history-drawer.jcr-drawer-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 600px) {
    /* 微調激進小螢幕 */
    .jcr-mobile-history-toggle .toggle-text {
        display: none; /* 小螢幕只留時鐘 Icon */
    }
    .jcr-mobile-history-toggle {
        padding: 8px;
    }
}

/* ======== PHP Profile 公開介紹頁 ======== */
.jex-coach-guide {
    --jcg-accent: var(--md-sys-color-primary);
    --jcg-on-accent: var(--md-sys-color-on-primary);
    --jcg-accent-container: var(--md-sys-color-primary-container);
    --jcg-on-accent-container: var(--md-sys-color-on-primary-container);

    padding: clamp(2rem, 6vw, 5rem) 0;
    color: var(--md-sys-color-on-surface);
}

.jcg-layout-constellation {
    --jcg-accent: var(--md-sys-color-primary);
    --jcg-on-accent: var(--md-sys-color-on-primary);
    --jcg-accent-container: var(--md-sys-color-primary-container);
    --jcg-on-accent-container: var(--md-sys-color-on-primary-container);
}

.jcg-layout-decision {
    --jcg-accent: var(--md-sys-color-tertiary);
    --jcg-on-accent: var(--md-sys-color-on-tertiary);
    --jcg-accent-container: var(--md-sys-color-tertiary-container);
    --jcg-on-accent-container: var(--md-sys-color-on-tertiary-container);
}

.jcg-layout-workbench {
    --jcg-accent: var(--md-sys-color-secondary);
    --jcg-on-accent: var(--md-sys-color-on-secondary);
    --jcg-accent-container: var(--md-sys-color-secondary-container);
    --jcg-on-accent-container: var(--md-sys-color-on-secondary-container);
}

.jcg-layout-pathway {
    --jcg-accent: var(--md-sys-color-success);
    --jcg-on-accent: var(--md-sys-color-on-success);
    --jcg-accent-container: var(--md-sys-color-success-container);
    --jcg-on-accent-container: var(--md-sys-color-on-success-container);
}

.jcg-layout-practice {
    --jcg-accent: var(--md-sys-color-info);
    --jcg-on-accent: var(--md-sys-color-on-info);
    --jcg-accent-container: var(--md-sys-color-info-container);
    --jcg-on-accent-container: var(--md-sys-color-on-info-container);
}

.jcg-layout-evidence {
    --jcg-accent: var(--md-sys-color-warning);
    --jcg-on-accent: var(--md-sys-color-on-warning);
    --jcg-accent-container: var(--md-sys-color-warning-container);
    --jcg-on-accent-container: var(--md-sys-color-on-warning-container);
}

.jcg-shell {
    display: flex;
    flex-direction: column;
    gap: clamp(2rem, 5vw, 4.5rem);
    max-width: 1120px;
}

.jcg-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(220px, 0.65fr) minmax(0, 1.35fr);
    gap: clamp(1.5rem, 5vw, 4rem);
    overflow: hidden;
    padding: clamp(1.5rem, 4vw, 3.5rem);
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-extra-large);
    box-shadow: var(--md-sys-elevation-1);
}

.jcg-identity {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    align-self: start;
    gap: var(--md-sys-spacing-md);
}

.jcg-avatar {
    width: clamp(72px, 8vw, 96px);
    height: clamp(72px, 8vw, 96px);
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    color: var(--jcg-on-accent-container);
    background: var(--jcg-accent-container);
    border: 3px solid var(--md-sys-color-surface-container-lowest);
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 2rem;
    font-weight: 800;
}

.jcg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jcg-eyebrow,
.jcg-name,
.jcg-positioning,
.jcg-introduction,
.jcg-section-index,
.jcg-card p,
.jcg-situation-card p,
.jcg-section-hint,
.jcg-approach > p,
.jcg-boundary p {
    margin: 0;
}

.jcg-eyebrow {
    color: var(--jcg-accent);
    font-size: var(--md-sys-typescale-label-medium-size);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.jcg-name {
    margin-top: var(--md-sys-spacing-xs);
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-large-size);
    font-weight: 650;
}

.jcg-hero-copy h1 {
    position: relative;
    z-index: 1;
    max-width: 18ch;
    margin: 0;
    color: var(--md-sys-color-on-surface);
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.jcg-positioning {
    position: relative;
    z-index: 1;
    max-width: 42rem;
    margin-top: var(--md-sys-spacing-lg);
    color: var(--md-sys-color-on-surface);
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    line-height: 1.65;
    font-weight: 600;
}

.jcg-introduction {
    position: relative;
    z-index: 1;
    max-width: 48rem;
    margin-top: var(--md-sys-spacing-md);
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.8;
}

.jcg-actions {
    position: relative;
    z-index: 1;
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: var(--md-sys-spacing-md);
}

/* 共用 .ac-btn 的品牌變數只存在 Landing scope；介紹頁直接綁定 M3 token。 */
.jcg-actions .ac-btn-primary {
    color: var(--jcg-on-accent);
    background: var(--jcg-accent);
}

.jcg-actions .ac-btn-primary:hover,
.jcg-actions .ac-btn-primary:focus-visible {
    color: var(--jcg-on-accent);
    background: var(--jcg-accent);
    box-shadow: var(--md-sys-elevation-2);
}

.jcg-actions .ac-btn-outline {
    color: var(--md-sys-color-on-surface);
    background: transparent;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.jcg-actions .ac-btn-outline:hover,
.jcg-actions .ac-btn-outline:focus-visible {
    color: var(--jcg-accent);
    background: var(--md-sys-color-surface-container);
    border-color: var(--jcg-accent);
}

.jcg-section {
    display: grid;
    grid-template-columns: minmax(190px, 0.4fr) minmax(0, 1.6fr);
    gap: clamp(1.5rem, 5vw, 4rem);
}

.jcg-section-heading {
    display: flex;
    gap: var(--md-sys-spacing-md);
    align-self: start;
}

.jcg-section-index {
    display: grid;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    color: var(--jcg-on-accent-container);
    background: var(--jcg-accent-container);
    border-radius: var(--md-sys-shape-corner-full);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 700;
}

.jcg-section h2,
.jcg-boundary h2 {
    margin: 0;
    color: var(--md-sys-color-on-surface);
    font-size: clamp(1.35rem, 3vw, 2rem);
    line-height: 1.25;
}

.jcg-section-hint {
    max-width: 30rem;
    margin-top: var(--md-sys-spacing-sm);
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.65;
}

.jcg-situation-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--md-sys-spacing-md);
    margin: 0;
    padding: 0;
    counter-reset: jcg-situation;
    list-style: none;
}

.jcg-situation-list > li {
    position: relative;
    min-width: 0;
    counter-increment: jcg-situation;
}

.jcg-situation-list > li::before {
    position: absolute;
    z-index: 1;
    top: var(--md-sys-spacing-lg);
    left: var(--md-sys-spacing-lg);
    content: counter(jcg-situation, decimal-leading-zero);
    color: var(--jcg-accent);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 800;
    letter-spacing: 0.08em;
}

.jcg-situation-card {
    height: 100%;
    min-height: 250px;
    padding: 4.25rem var(--md-sys-spacing-lg) var(--md-sys-spacing-xl);
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.jcg-situation-card h3 {
    margin: 0;
    color: var(--md-sys-color-on-surface);
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    line-height: 1.35;
}

.jcg-situation-card p {
    margin-top: var(--md-sys-spacing-md);
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.75;
}

.jcg-outcome-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--md-sys-spacing-md);
}

.jcg-card {
    min-height: 150px;
    padding: clamp(1.25rem, 3vw, 2rem);
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.jcg-card p {
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: 1.65;
    font-weight: 600;
}

.jcg-approach > p {
    max-width: 48rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--jcg-on-accent-container);
    background: var(--jcg-accent-container);
    border-radius: var(--md-sys-shape-corner-extra-large);
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    line-height: 1.85;
}

.jcg-starter-list {
    display: flex;
    flex-direction: column;
    gap: var(--md-sys-spacing-md);
}

.jcg-starter-list blockquote {
    margin: 0;
    padding: var(--md-sys-spacing-lg);
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--jcg-accent-container);
    border-radius: var(--md-sys-shape-corner-large);
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: 1.65;
}

.jcg-boundary {
    padding: clamp(1.5rem, 4vw, 2.5rem);
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.jcg-boundary h2 {
    margin-top: 0;
    font-size: var(--md-sys-typescale-title-large-size);
}

.jcg-boundary p {
    margin-top: var(--md-sys-spacing-sm);
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.75;
}

/* 幕僚中心：以不對稱 Bento 呈現一個入口連到多個專業視角。 */
.jcg-layout-constellation .jcg-hero {
    color: var(--jcg-on-accent-container);
    background: var(--jcg-accent-container);
    border: 0;
}

.jcg-layout-constellation .jcg-hero-copy h1,
.jcg-layout-constellation .jcg-positioning,
.jcg-layout-constellation .jcg-name {
    color: var(--jcg-on-accent-container);
}

.jcg-layout-constellation .jcg-introduction {
    color: var(--jcg-on-accent-container);
}

.jcg-layout-constellation .jcg-avatar {
    color: var(--jcg-on-accent);
    background: var(--jcg-accent);
    border-color: var(--jcg-accent-container);
}

.jcg-layout-constellation .jcg-situation-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.jcg-layout-constellation .jcg-situation-list > li:first-child {
    grid-row: span 2;
}

.jcg-layout-constellation .jcg-situation-list > li:first-child .jcg-situation-card {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    justify-content: flex-end;
    padding-top: 7rem;
    background: var(--md-sys-color-surface-container-high);
}

.jcg-layout-constellation .jcg-situation-list > li:not(:first-child) .jcg-situation-card {
    min-height: 190px;
}

/* 決策型：用垂直路徑呈現需要依序釐清的三種岔路。 */
.jcg-layout-decision .jcg-hero {
    border: 2px solid var(--jcg-accent-container);
}

.jcg-layout-decision .jcg-situation-list {
    grid-template-columns: 1fr;
    gap: 0;
}

.jcg-layout-decision .jcg-situation-list > li {
    padding: 0 0 var(--md-sys-spacing-lg) 4.5rem;
}

.jcg-layout-decision .jcg-situation-list > li::before {
    top: var(--md-sys-spacing-lg);
    left: 0;
    display: grid;
    width: 3rem;
    height: 3rem;
    place-items: center;
    color: var(--jcg-on-accent);
    background: var(--jcg-accent);
    border-radius: var(--md-sys-shape-corner-full);
}

.jcg-layout-decision .jcg-situation-list > li:not(:last-child)::after {
    position: absolute;
    top: 4.5rem;
    bottom: 0;
    left: 1.5rem;
    width: 2px;
    content: "";
    background: var(--jcg-accent-container);
}

.jcg-layout-decision .jcg-situation-card {
    min-height: 0;
    padding: var(--md-sys-spacing-xl);
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.jcg-layout-decision .jcg-approach > p {
    background: var(--md-sys-color-surface-container-low);
    border: 2px solid var(--jcg-accent-container);
    border-radius: var(--md-sys-shape-corner-extra-large);
}

/* 工作台型：用不同寬度的工作區塊呈現流程拆解與工具選擇。 */
.jcg-layout-workbench .jcg-hero,
.jcg-layout-workbench .jcg-situation-card,
.jcg-layout-workbench .jcg-card {
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.jcg-layout-workbench .jcg-hero {
    grid-template-columns: minmax(180px, 0.5fr) minmax(0, 1.5fr);
    background: var(--md-sys-color-surface-container-low);
    box-shadow: none;
}

.jcg-layout-workbench .jcg-situation-list {
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.jcg-layout-workbench .jcg-situation-list > li:nth-child(1) {
    grid-column: span 7;
}

.jcg-layout-workbench .jcg-situation-list > li:nth-child(2) {
    grid-column: span 5;
}

.jcg-layout-workbench .jcg-situation-list > li:nth-child(3) {
    grid-column: span 12;
}

.jcg-layout-workbench .jcg-situation-card {
    min-height: 220px;
    border: 2px solid var(--jcg-accent-container);
}

.jcg-layout-workbench .jcg-situation-list > li:nth-child(3) .jcg-situation-card {
    min-height: 0;
}

/* 成長路徑型：三張卡片逐步下降，像一條能追蹤的發展階梯。 */
.jcg-layout-pathway .jcg-hero {
    background: var(--md-sys-color-surface-container-low);
    border: 2px solid var(--jcg-accent-container);
    box-shadow: none;
}

.jcg-layout-pathway .jcg-situation-list {
    margin-bottom: 3rem;
}

.jcg-layout-pathway .jcg-situation-list > li:nth-child(2) {
    transform: translateY(1.5rem);
}

.jcg-layout-pathway .jcg-situation-list > li:nth-child(3) {
    transform: translateY(3rem);
}

.jcg-layout-pathway .jcg-situation-card {
    border: 2px solid var(--jcg-accent-container);
}

/* 演練型：把可以直接開口的句子做成主要練習區。 */
.jcg-layout-practice .jcg-hero {
    grid-template-columns: 1fr;
    background: var(--jcg-accent-container);
    border: 0;
}

.jcg-layout-practice .jcg-hero-copy,
.jcg-layout-practice .jcg-actions {
    grid-column: 1;
    max-width: 52rem;
}

.jcg-layout-practice .jcg-situation-card {
    border-style: dashed;
    border-width: 2px;
}

.jcg-layout-practice .jcg-starters {
    padding: clamp(1.5rem, 4vw, 3rem);
    background: var(--jcg-accent-container);
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.jcg-layout-practice .jcg-starter-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.jcg-layout-practice .jcg-starter-list blockquote {
    height: 100%;
    border: 0;
    border-radius: var(--md-sys-shape-corner-large);
}

/* 證據型：以文件與核對清單的密度呈現需要查證的內容。 */
.jcg-layout-evidence .jcg-hero {
    border: 2px solid var(--jcg-accent-container);
    border-radius: var(--md-sys-shape-corner-extra-large);
    box-shadow: none;
}

.jcg-layout-evidence .jcg-section {
    grid-template-columns: minmax(170px, 0.3fr) minmax(0, 1.7fr);
}

.jcg-layout-evidence .jcg-situation-list,
.jcg-layout-evidence .jcg-outcome-grid {
    grid-template-columns: 1fr;
}

.jcg-layout-evidence .jcg-situation-card {
    min-height: 0;
    padding: 4rem var(--md-sys-spacing-xl) var(--md-sys-spacing-xl);
    border-radius: var(--md-sys-shape-corner-large);
    box-shadow: var(--md-sys-elevation-1);
}

.jcg-layout-evidence .jcg-card {
    position: relative;
    min-height: 0;
    padding: var(--md-sys-spacing-lg) var(--md-sys-spacing-xl) var(--md-sys-spacing-lg) 4rem;
    border-radius: var(--md-sys-shape-corner-large);
}

.jcg-layout-evidence .jcg-card::before {
    position: absolute;
    top: var(--md-sys-spacing-lg);
    left: var(--md-sys-spacing-lg);
    display: grid;
    width: 1.5rem;
    height: 1.5rem;
    place-items: center;
    content: "✓";
    color: var(--jcg-on-accent);
    background: var(--jcg-accent);
    border-radius: var(--md-sys-shape-corner-extra-small);
    font-size: var(--md-sys-typescale-label-medium-size);
    font-weight: 800;
}

.jcg-layout-evidence .jcg-boundary {
    background: var(--jcg-accent-container);
    border: 1px solid var(--jcg-accent);
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.jcg-layout-evidence .jcg-boundary h2,
.jcg-layout-evidence .jcg-boundary p {
    color: var(--jcg-on-accent-container);
}

@media (max-width: 820px) {
    .jcg-hero,
    .jcg-layout-workbench .jcg-hero,
    .jcg-section,
    .jcg-layout-evidence .jcg-section {
        grid-template-columns: 1fr;
    }

    .jcg-actions {
        grid-column: 1;
    }

    .jcg-outcome-grid,
    .jcg-situation-list,
    .jcg-layout-constellation .jcg-situation-list,
    .jcg-layout-workbench .jcg-situation-list,
    .jcg-layout-practice .jcg-starter-list {
        grid-template-columns: 1fr;
    }

    .jcg-layout-workbench .jcg-situation-list > li:nth-child(1),
    .jcg-layout-workbench .jcg-situation-list > li:nth-child(2),
    .jcg-layout-workbench .jcg-situation-list > li:nth-child(3) {
        grid-column: auto;
    }

    .jcg-layout-constellation .jcg-situation-list > li:first-child {
        grid-row: auto;
    }

    .jcg-layout-constellation .jcg-situation-list > li:first-child .jcg-situation-card,
    .jcg-layout-constellation .jcg-situation-list > li:not(:first-child) .jcg-situation-card,
    .jcg-layout-workbench .jcg-situation-card {
        min-height: 0;
    }

    .jcg-layout-pathway .jcg-situation-list {
        margin-bottom: 0;
    }

    .jcg-layout-pathway .jcg-situation-list > li:nth-child(2),
    .jcg-layout-pathway .jcg-situation-list > li:nth-child(3) {
        transform: none;
    }

    .jcg-card {
        min-height: 0;
    }
}

@media (max-width: 520px) {
    .jcg-identity {
        align-items: flex-start;
    }

    .jcg-actions {
        flex-direction: column;
    }

    .jcg-actions .ac-btn {
        width: 100%;
    }

    .jcg-section-heading {
        align-items: flex-start;
    }

    .jcg-situation-card {
        min-height: 0;
    }

    .jcg-layout-decision .jcg-situation-list > li {
        padding-left: 3.5rem;
    }

    .jcg-layout-decision .jcg-situation-list > li::before {
        width: 2.5rem;
        height: 2.5rem;
    }

    .jcg-layout-decision .jcg-situation-list > li:not(:last-child)::after {
        left: 1.25rem;
    }
}
