/* CGU AI HUB – unified site styles */
html {
    overflow-y: scroll; /* 強制永遠顯示垂直卷軸軌道，解決頁面跳動問題 */
}
:root{
  /* Brand */
  --primary: #ffaf60;
  --primary-hover: #e69e56;
  --primary-weak: rgba(255,175,96,.14);

  /* Helper palette (soft accents) */
  --accent-warm: #f1b87b;
  --accent-sand: #cecab0;
  --accent-mint: #b5d2ca;
  --accent-sky:  #95dae4;

  /* Neutrals */
  --bg: #f7f7f6;
  --surface: rgba(255,255,255,.92);
  --surface-strong: #ffffff;
  --text: #111827;
  --text-2: #374151;
  --text-3: #6b7280;
  --border: rgba(17,24,39,.10);

  /* Radius & shadow */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --shadow-sm: 0 2px 10px rgba(17,24,39,.06);
  --shadow-md: 0 10px 24px rgba(17,24,39,.08);

  /* Layout */
  --container: 1180px;
}

*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI","Microsoft JhengHei",system-ui,-apple-system,Arial,sans-serif;
  line-height: 1.7;
  display:flex;
  flex-direction:column;
  min-height:100vh;
}
img{ max-width:100%; height:auto; display:block; }
a{ color: inherit; }

/* ---------- Layout ---------- */
.container{
  width: min(100% - 40px, var(--container));
  margin-inline:auto;
}
main{ flex:1; padding: 26px 0 44px; }

/* ---------- Typography ---------- */
h1,h2,h3{ line-height:1.25; margin:0 0 10px; letter-spacing:.2px; }
h1{ font-size: clamp(1.7rem, 2.2vw, 2.25rem); }
h2{ font-size: clamp(1.15rem, 1.6vw, 1.45rem); }
h3{ font-size: 1.05rem; }
p{ margin: 0 0 10px; color: var(--text-2); }
.small, small{ color: var(--text-3); }

hr{
  border:0;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* ---------- Header / Nav ---------- */
header{
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-content{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding: 14px 0;
}

.logo{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color: var(--text);
  font-weight: 800;
  letter-spacing:.3px;
  flex-shrink: 0; /* 防止 Logo 被擠壓 */
}
.logo i{ color: var(--primary); font-size: 1.35rem; }

.nav-links{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  align-items:center;
  gap: 8px; /* 手機端縮小間距 */
  flex-wrap: wrap;
}

.nav-links a{
  text-decoration:none;
  color: var(--text-2);
  font-weight: 600;
  font-size: .95rem;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background .2s ease, color .2s ease;
}
.nav-links a:hover{
  background: var(--primary-weak);
  color: var(--text);
}

/* ---------- Surfaces / Cards ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.card:hover{ box-shadow: var(--shadow-md); }
.card h3{ margin-bottom: 8px; }

/* softer left accent (avoid jumping colors) */
.card{ border-left: 6px solid rgba(17,24,39,.10); }
.card--warm{ border-left-color: var(--accent-warm); background: rgba(241,184,123,.14); }
.card--sand{ border-left-color: var(--accent-sand); background: rgba(206,202,176,.20); }
.card--mint{ border-left-color: var(--accent-mint); background: rgba(181,210,202,.18); }
.card--sky { border-left-color: var(--accent-sky);  background: rgba(149,218,228,.18); }

/* ---------- Buttons / Links ---------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  background: var(--primary);
  color: #111827;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(17,24,39,.10);
  text-decoration:none;
  font-weight: 800;
  cursor:pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: 0 6px 14px rgba(17,24,39,.10);
}
.btn:hover{ background: var(--primary-hover); transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }

/* ---------- Grids ---------- */
.grid-3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-2{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 980px){
  .grid-3{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px){
  .grid-3, .grid-2{ grid-template-columns: 1fr; }
  main{ padding: 18px 0 34px; }
  
  /* 手機端導航列置中並自動折行 */
  .header-content {
    flex-direction: column;
    padding: 12px 0;
  }
  .nav-links {
    justify-content: center;
    width: 100%;
  }
}

/* ---------- Hero (used across pages) ---------- */
.hero{
  text-align:center;
  padding: 26px 18px;
  background: linear-gradient(180deg, rgba(255,175,96,.14), rgba(255,255,255,.88));
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow:hidden;
}
.hero:after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:0;
  height: 3px;
  background: var(--primary);
  opacity:.9;
}
.hero p{ max-width: 760px; margin: 8px auto 0; color: var(--text-2); }

/* Intro text helper */
.intro{ margin: 6px 0; color: var(--text-2); }

/* ---------- AI Ethics page helpers ---------- */
.page-ethics .hero-meta{
  margin-top: 14px;
  display:flex;
  justify-content:center;
  gap: 10px;
  flex-wrap:wrap;
}
.page-ethics .badge{
  font-size: .9rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.70);
  color: var(--text-2);
}
.page-ethics .checklist{
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(225,193,150,.18);
}
.page-ethics .checklist ul{ margin: 10px 0 0; padding-left: 18px; }
.page-ethics .checklist li{ margin: 8px 0; color: var(--text-2); }
.page-ethics .tips{ margin: 10px 0 0; padding-left: 18px; }
.page-ethics .tips li{ margin: 7px 0; color: var(--text-2); }

/* If old pages still have inline border-left colors, soften them */
.card[style*="border-left"]{ border-left-width: 6px !important; }

/* ---------- Tool Row (homepage/tools) ---------- */
.tool-row{
  display:flex;
  gap: 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow:hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.tool-content{
  flex: 1;
  padding: 22px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap: 10px;
}
.tool-content h3{
  font-size: 1.25rem;
  margin:0;
  display:flex;
  align-items:center;
  gap: 10px;
}
.tool-content h3 i{ color: var(--primary); }
.tool-media{
  flex: 1;
  background: rgba(17,24,39,.03);
  min-height: 280px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.tool-media img{ width:100%; height:100%; object-fit:cover; }
.tool-media iframe{ width:100%; height:100%; border:none; min-height: 320px; }

@media (max-width: 900px){
  .tool-row{ flex-direction:column; }
  .tool-media{ min-height: 220px; }
}

/* ---------- Prompt Box ---------- */
.prompt-box{
  background: #fff7cd;
  color: #000000;
  padding: 16px;
  border-radius: var(--r-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  position: relative;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,.08);
  word-break: break-all; /* 防止長程式碼撐破容器 */
}
.prompt-tag{
  position:absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,175,96,.90);
  color: #111827;
  font-size: .8rem;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 900;
}

/* ---------- Video & News ---------- */
.video-wrapper{
  position:relative;
  padding-bottom:56.25%;
  height:0;
  overflow:hidden;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  background:#000;
}
.video-wrapper iframe{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:none;
}

.news-box{
  background: var(--surface);
  padding: 16px 18px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.news-list{ list-style:none; margin: 10px 0 0; padding:0; }
.news-list li{
  padding: 12px 0;
  border-bottom: 1px dashed rgba(17,24,39,.16);
  display:flex;
  gap: 10px;
  align-items: baseline;
}
.news-list li:last-child{ border-bottom:none; }

.news-date{
  color: rgba(17,24,39,.75);
  font-weight: 900;
  font-size: .9rem;
  min-width: 92px;
  flex-shrink: 0;
}

.news-title{
  color: var(--text);
  text-decoration:none;
  font-weight: 650;
  transition: color .2s ease;
  word-break: break-word; /* 防止標題太長 */
}

@media (max-width: 480px) {
  .news-list li {
    flex-direction: column;
    gap: 4px;
  }
  .news-date {
    min-width: auto;
    font-size: 0.8rem;
    opacity: 0.8;
  }
}

.news-title:hover{ color: var(--primary-hover); text-decoration: underline; }

.more-btn{
  display:inline-block;
  margin-top: 12px;
  font-size: .92rem;
  color: var(--text-3);
  text-decoration:none;
}
.more-btn:hover{ color: var(--text); }

/* ---------- Footer ---------- */
footer{
  background: #111827;
  color: rgba(255,255,255,.78);
  text-align:center;
  padding: 28px 0;
  border-top: 4px solid rgba(255,175,96,.85);
}
footer a{ color: rgba(255,255,255,.90); }

/* ---------- Small utilities ---------- */
.m0{ margin:0 !important; }
.mt8{ margin-top:8px !important; }
.mt12{ margin-top:12px !important; }
.mt16{ margin-top:16px !important; }

/* --- Typography & spacing: roomier layout --- */
:root{
  --text-base: 17px;          
  --leading: 1.8;             
  --h-leading: 1.25;          
  --space-1: 10px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
}

html { font-size: var(--text-base); }
body { line-height: var(--leading); }

h1, h2, h3, h4{
  line-height: var(--h-leading);
  margin: var(--space-3) 0 var(--space-2);
}

.container > h1:first-child,
.container > h2:first-child { margin-top: var(--space-2); }

p{ margin: 0 0 var(--space-2); }
.intro{ margin-bottom: var(--space-2); }

ul, ol{ margin: 0 0 var(--space-2); padding-left: 1.2em; }
li{ margin: 8px 0; }

.section{ margin: var(--space-4) 0; }
.card{ padding: 18px 18px; }
.card p{ margin-bottom: 12px; }

/* 手機版字體縮小與間距微調 */
@media (max-width: 600px) {
  :root {
    --text-base: 16px;
    --space-3: 18px;
    --space-4: 24px;
  }
  .nav-links a {
    font-size: 0.85rem;
    padding: 6px 8px;
  }
}