/* === 1. Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');
/* === 2. Reset & Base === */
:root {
  --font-family-base: 'Montserrat', 'Inter', Arial, sans-serif;
  --color-primary: #518000;
  --logo-color: #6ba900;
  --text-color: #3d3d3d;
  --background-color: #f9f9f9;
  --standard-border-radius: 8px;
  --standard-margin-bottom: 2rem;
}

html, body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family-base);
  background: #fff;
  font-size: 16px;
  line-height: 1.8;
  font-weight: 400;
  color: var(--text-color);
}

*, *::before, *::after { 
  box-sizing: inherit; 
}

h1, h2, h3, h4, h5, h6, p, ul, ol { 
  margin: 0; 
  padding: 0; 
}

a { 
  color: inherit; 
  text-decoration: none; 
}

input, textarea {
  font-size: initial;
}

/* === 3. Layout Sections === */


.column-header {
  height: 40vh !important;
  min-height: 40vh;
  background: url(../images/TF-AI-Infria_cover.png);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  


}

.column-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
}

.column-header > * {
  position: relative;
  z-index: 1;
}

.column-header-content p {
  color: white;
  font-size: 1rem;
  margin-bottom: 10px;
  padding:0 100px;
}

.column-header-content h1 {
  font-size: 40px;
  line-height: 1.5;
  font-weight: 600;
  color: white;
  text-align:left;
  padding:0 100px;
}

@media (max-width: 768px) {
  .column-header {
    height: 35vh !important; /* 移动端固定高度 */
    min-height: 35vh;
  }
  
  .column-header-content p,.column-header-content h1 {
    padding:0px;
  }
}

@media (max-width: 600px) {
  .column-header-content h1 {
    font-size: 2rem;
  }
}

/* === 4. Summary & Article === */

/* summary 區塊 */
.summary {
  font-size: 1.3rem;
  margin-bottom: var(--standard-margin-bottom);
  padding:0 100px;
}

.column-content-article{
  padding:0 100px;
}

@media (max-width: 768px) {
  .summary{
    padding:0px;
  }
  .column-content-article{
    padding:0px;
  }
}

/* 原本 main.column p -> 改為 article p */
article p {
  margin-bottom: var(--standard-margin-bottom);
  font-size: 1.1rem !important;
  font-weight: 400;
  line-height: 1.8;
}

article h2, article h3, article h4, article h5 {
  font-family: inherit;
  font-weight: 600;
  margin: 2.5rem 0 1rem 0 ;
  line-height: 1.4;
}

article h2 {
  font-size: 1.8rem;
  scroll-margin-top: 110px; /*目錄偏移校正*/
}
article h3 {font-size: 1.6rem;}
article h4 {font-size: 1.4rem;}
article h5 {font-size: 1.25rem;}

article a {
  color: var(--text-color);
  border-bottom: 3px solid var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

/* 文章圖片樣式：圖片最大寬度不超過容器，並自動等比縮放 */
article p > img  {
  width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto 0 auto; /*edit 20250526*/
}

/*add 20250526*/
/*圖片下方有說明，距離設定*/
article p:has(> img:only-child):has(+ p.img-caption) {
  margin-bottom: 0;
}

/*add 20250526*/
/*圖片說明*/
article > p.img-caption  {
  font-size: 0.875rem;
  color: #666;
  text-align: left;
  margin-top: 0.5rem;
}
.column-content-article li{
  margin-bottom: 1em;

}
/*手機板放大鏡*/
@media (max-width: 768px) {
  article p.has-img-zoom {
    position: relative;
  }

  article p.has-img-zoom::after {
     content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background-color: rgba(0,0,0,0.5);  /* 半透明黑色背景 */
  border-radius: 50%;                 /* 圓形 */
  background-image: url('data:image/svg+xml;utf8,<svg fill="white" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 10-.71.71l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0A4.5 4.5 0 1114 9.5 4.5 4.5 0 019.5 14z"/></svg>');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 70%;              /* 放大鏡大小 */
  pointer-events: none;
  z-index: 2;
  }
  
  /* Lightbox 背景遮罩 */
  #img-lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }

  /* Lightbox 內圖片容器，允許手指滑動 */
  #img-lightbox .img-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    overflow: visible;
    -webkit-overflow-scrolling: touch;
  }

  #img-lightbox img {
    display: block;
    max-width: none; /* 不限制寬度 */
    height: auto;    /* 保持比例 */
  }

  /* 關閉按鈕 */
  #img-lightbox .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    user-select: none;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
  }
}

  
article ul, article ol {
  color: var(--text-color);
  margin: 1.2em 0 2rem 2rem;
  font-size: 1.1rem;
  padding-left: 1.5rem;
}

/* 手機 RWD 調整 */
@media (max-width: 600px) {
  article ul, article ol {
    margin-left: 0rem;
  }
}

article blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 1.2rem 1.5rem;
  margin: 1.2rem 0;
  color: var(--text-color);
  background-color: var(--background-color);
  font-style: italic;
  font-size: 1.05rem;
}
/*table 處理*/
article .table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--standard-margin-bottom);
  position: relative; /* Sticky 的必要條件 */
  border: 1px solid #ddd;
  border-radius: var(--standard-border-radius);
}

/* 基本表格設計 */
article table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 700px;
  margin-bottom:0!important;
  background-color: #fff;
}

/* 表頭 */
article th {
  background-color: var(--background-color);
  font-weight: 600;
  border-bottom: 2px solid #ddd;
  position: sticky;
  padding:12px !important;
  top: 0;
  z-index: 0;
}



/* 單元格 */
article th,article td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
  border-right: 1px solid #ddd;
  word-break: normal;
  white-space: normal;
  word-wrap: normal;
  overflow-wrap: normal;

}

/* Sticky 第一欄為th時 */
article th:first-child {
  position: sticky;
  left: 0;
  background-color: var(--background-color);
  z-index: 1;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.04);
  min-width: 150px; /* 设置最小宽度替代fit-content */
  width: auto; /* 自动宽度 */
}

/* 最後一欄邊框移除 */
article th:last-child,
article td:last-child {
  border-right: none;
}

@media (max-width: 768px) {
  article table {
    min-width: 700px;
  }


}

/*CTA Banner*/
article .inline-cta {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin: 2rem 0;
  background-color: var(--background-color);
  padding: 1rem;
  border-radius: var(--standard-border-radius);
  color: var(--text-color);
  padding: 2rem 1.5rem; /*add 20250526*/
}

article .inline-cta .cta-image {
  flex: 0 0 30%;
  display: flex;
  align-items: center;
  justify-content: center;
}

article .inline-cta .cta-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--standard-border-radius);
}

article .inline-cta .cta-content {
  flex: 1;
}

article .inline-cta .cta-content h3 {
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 1rem; edit 20250526*/
}

/*add 20250526*/
article .inline-cta .cta-content p {
  margin: 0; 
}

/* 共用設定 */
article .inline-cta .cta-content a {
  text-decoration: none;
  color: inherit;
}

/* 文字連結樣式 */
article .inline-cta .cta-content .text-link {
  display: inline;
  border-bottom: 3px solid var(--color-primary);
}

/* 按鈕樣式 */
article .inline-cta .cta-content .btn-link {
  display: block;
  width: fit-content;
  background-color: var(--color-primary);
  color: #fff;
  margin-top: 1em;
  padding: 0.5em 1em;
  border-radius: var(--standard-border-radius);
  transition: background-color 0.3s ease;
}

article .inline-cta .cta-content .btn-link:hover {
  background-color: var(--logo-color); /* 改為使用 LOGO 主色 */
}

/* RWD 手機板樣式 */
@media (max-width: 768px) {
  article .inline-cta {
    flex-direction: column;
    padding:2rem 1rem;
    gap: 0rem;
  }

  article .inline-cta .cta-image,
  article .inline-cta .cta-content {
    width: 100%;
  }
  /*add 20250526*/
  article .inline-cta .cta-image{
  margin-bottom: 1.5rem;
  }
}

.author-section{
 padding:32px 100px;
 margin-top:40px;
 margin-bottom:40px;
 border-top:1px solid #E0E0E0;
 border-bottom:1px solid #E0E0E0;
}

@media (max-width: 768px) {
  .author-section{
    padding:32px 0px;
  }
}

.author-section h3{
  font-size:1.1rem;
  font-weight:600;
}
.author-section p{
  font-size:1rem;
}

.column-contact{
  font-size:1.1rem;
  color:#518000;
  padding:16px 24px;
  border:1px solid #518000;
  border-radius:8px;
  margin-top:40px;
  margin-bottom:80px;
  display:block;
  text-align:center;
  width:fit-content;
  margin-left:auto;
  margin-right:auto;
}

.column-contact:hover{
  background-color:#518000;
  color:#fff;
  border:1px solid #518000;
}

/* 分享下拉選單 */
.share-container{
  padding:0 100px;
  display: flex;
  justify-content: flex-end;
}





.share-dropdown {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size:0.9rem;
  background: none;
  border:none;
  color: #3d3d3d;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.share-btn img {
  width: 16px;
  height: 16px;
}

.share-btn:hover {
  background-color: #f9f9f9;
  color: #3d3d3d;

}

.share-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: none;
  min-width: 160px;
  z-index: 1000;
}

.share-dropdown.active .share-menu {
  display: block;
}

.share-item {
  font-size:1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #333;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.share-item:hover {
  background-color: #f5f5f5;
  text-decoration: underline;
}

.share-item img {
  width: 28px;
}

@media (max-width: 768px) {
  .share-container{
    padding:0px;
  }
}

/* 目录导航样式 */
.column-toc-section {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 0 8px 8px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    max-width: 200px;
    opacity: 0;
    visibility: hidden;
}

.column-toc-section.visible {
    opacity: 1;
    visibility: visible;
}

.toc-title{
  font-size:0.9rem;
  font-weight:500;
  color:#fff;
  writing-mode: vertical-lr;
  text-orientation: upright;
  letter-spacing: 1px;
  padding: 12px;
  display:inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 100%;
  box-sizing: border-box;
  text-align: center;
  line-height: 0;
  vertical-align: middle;
  margin:0;
}
.column-toc-section.collapsed {
  transform: translate(-100%, -50%); /* 桌面版恢复垂直居中 */
}

/* 手机版默认关闭目录 */
@media (max-width: 768px) {
    .column-toc-section {
        transform: translate(-100%, 0%); /* 只水平移动，不垂直移动 */
        top: 7%;
        max-height: 80vh; /* 限制最大高度为视窗高度的80% */
        overflow-y: auto; /* 如果内容过多，允许滚动 */
    }
    
    .column-toc-section.collapsed {
      
        transform: translate(-100%, 0%); /* 保持一致的垂直位置 */
    }
    
    .column-toc-section:not(.collapsed) {
        transform: translate(0, 0); /* 移除垂直居中，使用top定位 */
    }

    .column-toc-section.visible:not(.collapsed) {
        opacity: 1;
        visibility: visible;
    }
}



.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.toc-close-btn {
    /* background: none; */
    border: none;
    cursor: pointer;
    background-color: #84C100;
    border-radius: 50%;
    transition: color 0.3s ease;
    margin-left:auto;
    width: 28px;
    height: 28px;
    line-height: 28px;
    display:flex;
    align-items:center;
    justify-content:center;
}

.toc-close-btn i{
    font-size:1.3rem;
    color:#fff;
}

.toc-close-btn:hover {
    color: #333;
}

.toc-list {
    list-style: none;
    margin: 0;
}

.toc-list li {
    border-right:10px solid #84C100;
    line-height:1.5;
    margin-bottom: 4px;
    padding: 16px;
    background-color: #f9f9f9;
    cursor: pointer;
}

.toc-list li.active {
    background-color: #e8f5e9;
    border-right: 15px solid #2e7d32;
}

.toc-list li a {
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
}

.toc-list li.active a {
    color: #2e7d32;
    font-weight: 500;
}

/* 展开按钮 */
.toc-expand-btn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%); /* 桌面版保持垂直居中 */
    background: #558032;
    border: none;
    padding: 8px;
    cursor: pointer;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 0 8px 8px 0;
    display: none;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

@media (max-width: 768px) {
  .toc-expand-btn{
    top: 7%; /* 与目录位置保持一致 */
    transform: translateY(0); /* 移除垂直居中，使用top定位 */
  }
}

.toc-expand-btn i{
    color:#fff;
    font-size:1.5rem;
}
.column-toc-section.collapsed + .toc-expand-btn {
    display: block;
}

.toc-expand-btn.visible {
    opacity: 1;
    visibility: visible;
}

