/* =========================================================
   複製自 https://cc.mgt.ncu.edu.tw/css/common.css（內容未修改）
   版面骨架：品牌頁首、導覽列、主欄、頁尾
   ========================================================= */

/* ===== 品牌頁首 ===== */
.header {
  text-align: center;
  margin: 2.25rem auto 1.25rem;
  padding: 0 1rem;
}

.header a.brand {
  display: inline-block;
  text-decoration: none;
}

.header .site-mark {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .45em;
  text-indent: .45em;
  color: var(--muted);
}

.header .site-title {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-indent: .14em;
  color: var(--brand);
  margin-top: .2rem;
}

.header a.brand:hover {
  text-decoration: none;
}

.header a.brand:hover .site-title {
  color: var(--brand-strong);
}

/* ===== 導覽列（深藍橫幅） ===== */
.links {
  background-color: var(--nav-bg);
  text-align: center;
  margin: 0;
  padding: 0 3.4rem;   /* 兩側留空給右側的深色模式開關，維持選單置中 */
  position: relative;
}

.links > a,
.links > details.dropdown > summary {
  display: inline-block;
  color: var(--nav-text);
  font-size: 1.0625rem;
  font-weight: 700;
  padding: .7rem .9rem;   /* 上下加左右 → 觸控目標高度 ≥ 44px */
  margin: 0;
  letter-spacing: .04em;
}

.links > a:hover,
.links > details.dropdown > summary:hover {
  background-color: rgba(255, 255, 255, .14);
  color: var(--nav-text);
  text-decoration: none;
}

/* 深色底上的焦點框改用白色，維持可見性 */
.links > a:focus,
.links > details.dropdown > summary:focus {
  outline: 2px dashed var(--nav-focus);
  outline-offset: -4px;
}

/* ===== <details> 下拉選單 ===== */
.links details.dropdown {
  position: relative;
  display: inline-block;
  vertical-align: baseline;
}

.links details.dropdown > summary {
  cursor: pointer;
  list-style: none;            /* 移除瀏覽器預設的三角形記號 */
}

.links details.dropdown > summary::-webkit-details-marker {
  display: none;               /* 舊版 Safari 的三角形記號 */
}

.links details.dropdown > summary::after {
  content: " ▾";
}

.links details.dropdown[open] > summary::after {
  content: " ▴";
}

.links details.dropdown .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 11em;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
  border-radius: 0 0 6px 6px;
  z-index: 1000;
  text-align: left;
}

.links details.dropdown .dropdown-menu li a {
  display: block;
  padding: .65rem 1rem;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
}

.links details.dropdown .dropdown-menu li a:hover,
.links details.dropdown .dropdown-menu li a:focus {
  background: var(--surface);
  color: var(--brand);
}

/* ===== 主欄 ===== */
.main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 760px;
  margin: 2rem auto 0;
  padding: 0 1.5rem;
  box-sizing: border-box;
}

/* ===== 頁尾（深藍橫幅） ===== */
.footer {
  flex-shrink: 0;
  margin-top: 3.5rem;
  background-color: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 1.6rem 1rem 1.3rem;
  font-size: .875rem;
  line-height: 2;
}

.footer a {
  color: var(--footer-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer a:hover {
  color: #ffffff;
}

.footer a:focus {
  outline-color: var(--nav-focus);
}

.footer .footer-unit {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .08em;
}

.footer .footer-credit {
  color: var(--footer-dim);
  font-size: .8125rem;
  margin-top: .4rem;
}


/* ===== 深色模式切換開關（導覽列最右側） ===== */
.theme-toggle {
  position: absolute;
  right: .6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;    /* 44px 觸控目標 */
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  color: var(--nav-text);
  cursor: pointer;
  transition: background-color .2s ease;
}

.theme-toggle:hover {
  background-color: rgba(255, 255, 255, .14);
}

.theme-toggle:focus {
  outline: 2px dashed var(--nav-focus);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 亮色時顯示月亮（按下切到暗色）；暗色時顯示太陽 */
.theme-toggle .icon-sun { display: none; }
.theme-toggle.is-dark .icon-sun { display: block; }
.theme-toggle.is-dark .icon-moon { display: none; }

/* ===== 小螢幕 ===== */
@media (max-width: 600px) {
  .header {
    margin: 1.5rem auto .9rem;
  }
  .header .site-title {
    font-size: 1.25rem;
  }
  .links > a,
  .links > details.dropdown > summary {
    font-size: 1rem;
    padding: .65rem .55rem;
  }
  /* 下拉選單靠右展開，避免超出畫面 */
  .links details.dropdown .dropdown-menu {
    left: auto;
    right: 0;
  }
  .main {
    margin-top: 1.5rem;
    padding: 0 1.1rem;
  }
}
