/* =========================================================================
   設計基礎
   低彩度的沉靜藍綠 + 暖白底，避免鮮豔，維持專業與舒適感。
   ========================================================================= */

:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --surface-alt: #f4f2ee;

  --ink: #22303a;
  --ink-soft: #4a5a66;
  --muted: #6d7c86;

  --brand: #2e6b6e;
  --brand-deep: #23545a;
  --brand-soft: #e8f0ef;

  --line: #e4e1db;
  --line-strong: #d4d0c8;

  --radius: 14px;
  --radius-sm: 9px;

  --shadow-sm: 0 1px 2px rgba(34, 48, 58, 0.05);
  --shadow-md: 0 6px 20px rgba(34, 48, 58, 0.07);

  --content-width: 68ch;
  --page-width: 1120px;

  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161c21;
    --surface: #1d252b;
    --surface-alt: #222b32;

    --ink: #e6eaec;
    --ink-soft: #bcc6cc;
    --muted: #93a1a9;

    --brand: #7db8b4;
    --brand-deep: #9dcecb;
    --brand-soft: #24343a;

    --line: #2d383f;
    --line-strong: #3a464e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.32);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.75;
  /* 中文長詞不會被硬切，但超長英文/網址不會撐破版面 */
  overflow-wrap: break-word;
  word-break: normal;
  line-break: strict;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--brand-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand);
}

h1,
h2,
h3 {
  line-height: 1.35;
  letter-spacing: 0.01em;
  margin: 0;
  /* 標題最容易破框，明確允許必要時斷行 */
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- layout */

.wrap {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: clamp(18px, 5vw, 40px);
}

.section {
  padding-block: clamp(48px, 8vw, 88px);
}

.section-head {
  margin-bottom: clamp(24px, 4vw, 40px);
}

/* 英文小標，壓在中文區塊標題上方（參考站的作法） */
.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--brand);
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 1.15rem + 1.1vw, 1.95rem);
  color: var(--ink);
}

.section-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.97rem;
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  font-family: var(--font-serif);
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  flex: none;
}

.nav {
  display: flex;
  gap: clamp(12px, 3vw, 26px);
  flex-wrap: wrap;
  min-width: 0;
}

.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.94rem;
  white-space: nowrap;
}

.nav a:hover {
  color: var(--brand);
}


/* ---------------------------------------------------------------- hero */

/* 滿版沉浸式 Hero，淺色版。
   背景鋪的是手繪圖的「原始檔」，沒有做任何濾鏡或色彩處理，
   紙張質感與筆觸都保留原樣。
   上面只覆一層暖白薄紗，用途單純是讓文字讀得清楚，不是為了改變照片的樣子。 */

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: clamp(420px, 72vh, 660px);
  padding-block: clamp(64px, 10vw, 116px);
  overflow: hidden;
  background-color: var(--brand-soft);
  border-bottom: 1px solid var(--line);
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("/assets/hero/hero.jpg");
  background-size: cover;
  background-position: center 60%;
  background-repeat: no-repeat;
}

/* 暖白薄紗。
   注意：兩層漸層疊起來，不透明度是相乘的。
   先前中央是 90% 疊 72%，實際遮蔽率高達 97%，圖等於看不見。
   所以下面只讓「一層」負責遮蔽，另一層純粹做底部收邊，其餘區域完全透明。 */
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    /* 底部收邊：和下一區的背景色自然接上 */
    linear-gradient(180deg,
      transparent 0%,
      transparent 74%,
      color-mix(in srgb, var(--bg) 55%, transparent) 88%,
      var(--bg) 100%),

    /* 文字區薄紗：橢圓形，只罩住中央放文字的範圍。
       黑色標題壓在黑色線條上會互相干擾，這一層把文字底下的圖淡化掉，
       邊緣則完全透明，手繪線條維持原本的濃度。 */
    radial-gradient(ellipse 64% 46% at 50% 46%,
      color-mix(in srgb, var(--bg) 82%, transparent) 0%,
      color-mix(in srgb, var(--bg) 74%, transparent) 44%,
      color-mix(in srgb, var(--bg) 38%, transparent) 78%,
      transparent 100%),

    /* 基底薄紗：整體壓一層淡的，統一色調 */
    radial-gradient(125% 95% at 50% 48%,
      color-mix(in srgb, var(--bg) 42%, transparent) 0%,
      color-mix(in srgb, var(--bg) 40%, transparent) 100%);
}

.hero-inner {
  position: relative;
  text-align: center;
  max-width: 900px;
  min-width: 0;
}

/* 不可斷行片段。中文沒有空格，瀏覽器預設會在任何字之間換行，
   把詞組包起來才不會出現「泌尿手／術」這種切在詞中間的斷句。 */
.nb {
  white-space: nowrap;
}

.hero-eyebrow {
  margin: 0 0 clamp(16px, 2.4vw, 24px);
  font-size: clamp(0.7rem, 0.66rem + 0.16vw, 0.79rem);
  letter-spacing: 0.24em;
  color: var(--brand-deep);
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 1.2rem + 3.8vw, 3.7rem);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: clamp(14px, 2vw, 20px);
  /* 同底色的暈邊：只在筆畫周圍生效，讓字從手繪線條上浮出來，
     不必為此把整片背景壓白 */
  text-shadow:
    0 0 22px var(--bg),
    0 0 10px var(--bg),
    0 0 4px var(--bg);
}

.hero-sub {
  margin: 0 auto clamp(28px, 4vw, 40px);
  /* 不要用 ch —— 它以西文「0」的寬度計算，中文字約是它的兩倍，容器會被算得太窄 */
  max-width: 42em;
  font-size: clamp(0.97rem, 0.92rem + 0.32vw, 1.13rem);
  line-height: 1.9;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  text-shadow: 0 0 12px var(--bg), 0 0 5px var(--bg);
}

/* 副標的分隔線：窄螢幕時讓它成為自然斷點，不要卡在行尾 */
.sub-sep {
  color: var(--line-strong);
  padding-inline: 6px;
}

@media (max-width: 560px) {
  .sub-sep {
    display: block;
    height: 0;
    overflow: hidden;
  }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.97rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-deep);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    color: #12191d;
  }
  .btn-primary:hover {
    color: #12191d;
  }
}

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
}

/* Hero 的按鈕比內文按鈕稍寬一些，其餘沿用 .btn-primary / .btn-ghost */
.hero-actions .btn {
  padding-inline: 26px;
}

/* ---------------------------------------------------------------- 入口卡片 */

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: clamp(14px, 1.8vw, 18px);
}

.entry {
  /* 讓卡片成為容器查詢的基準，標題才能依卡片寬度自動調整字級 */
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: clamp(18px, 2.4vw, 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  min-width: 0;
}

.entry:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand);
}

/* 卡片第一行：編號 + 小標籤。
   高度固定，四張卡片的主標題才會起始在同一條水平線上
   （第四張沒有「陳醫師解析」標籤，靠這一行維持對齊）。 */
.entry-head {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 34px;
  min-width: 0;
}

.entry-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  display: grid;
  place-items: center;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: none;
}

/* 「陳醫師解析」這種重複前綴退成標籤，不跟主題搶第一眼 */
.entry-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

/* 主題本身：卡片上最先被看到的東西。
   字級用容器查詢單位（cqw），跟著「卡片自己的寬度」縮放而不是視窗寬度。
   桌機四欄時自動縮到最長的標題「難以啟齒的男性困擾」剛好單行放得下，
   手機單欄卡片變寬，字級就吃到上限 1.44rem。 */
.entry-title {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 10.7cqw, 1.44rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  margin-top: 2px;
}

/* 卡片標題下的關鍵字列（性功能 ・ 菜花） */
.entry-terms {
  font-size: 0.85rem;
  color: var(--brand-deep);
  letter-spacing: 0.02em;
}

.entry-desc {
  margin: 0;
  font-size: 0.93rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------------------------------------------------------------- 信任區 */

.trust {
  background: var(--surface-alt);
  border-block: 1px solid var(--line);
}

.trust-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(28px, 5vw, 56px);
}

@media (min-width: 800px) {
  .trust-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* 關於我：照片 + 文字 */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(26px, 4vw, 48px);
  align-items: start;
  margin-bottom: clamp(40px, 6vw, 68px);
}

@media (min-width: 820px) {
  .about-grid {
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  }
}

.about-photo {
  margin: 0;
  min-width: 0;
}

.about-photo img {
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: block;
}

@media (min-width: 820px) {
  .about-photo {
    position: sticky;
    top: 84px;
  }
  .about-photo img {
    max-width: 100%;
  }
}

.about-text {
  min-width: 0;
}

.about-text p {
  margin: 0 0 1.15em;
  color: var(--ink-soft);
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-text .lead {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  color: var(--ink);
  font-weight: 600;
}

.about-text .pull-quote {
  font-family: var(--font-serif);
  font-size: clamp(1.08rem, 1rem + 0.45vw, 1.28rem);
  color: var(--brand-deep);
  border-left: 3px solid var(--brand);
  padding: 4px 0 4px 18px;
  margin-block: 1.5em;
}

.about-text .closing {
  padding-top: 1.1em;
  border-top: 1px solid var(--line-strong);
  color: var(--ink);
}

.about-text strong {
  color: var(--ink);
  font-weight: 650;
}

/* 資歷區 */
.cv-block {
  padding-top: clamp(30px, 4vw, 44px);
  border-top: 1px solid var(--line-strong);
}

.cv-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: clamp(24px, 3.5vw, 40px);
  margin-bottom: clamp(30px, 4vw, 44px);
}

.cv-col {
  min-width: 0;
}

.cv-heading {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--brand-deep);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.credentials {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.credentials li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  color: var(--ink-soft);
  font-size: 0.97rem;
  min-width: 0;
}

.credentials li::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 11px;
  border-radius: 50%;
  background: var(--brand);
  flex: none;
}

/* 學術發表：與其他資歷欄位同一套排版，不做成數字牆 */
.publications {
  padding-top: clamp(22px, 3vw, 30px);
  border-top: 1px solid var(--line);
  min-width: 0;
}

/* ---------------------------------------------------------------- 文章卡片 */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: clamp(14px, 2.2vw, 22px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  min-width: 0;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand);
}

.card-link {
  display: flex;
  flex-direction: column;
  gap: 9px;
  height: 100%;
  padding: clamp(20px, 3vw, 26px);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

/* 有封面圖時，圖要貼齊卡片上緣，所以內距改由下方的內容自己負責 */
.card.has-cover .card-link {
  padding-top: 0;
}

/* 封面圖：各篇原圖比例不一（橫幅、方形都有），
   統一裁成 16:9 卡片排起來才整齊；裁切位置由 coverPosition 逐篇微調。 */
.card-cover {
  display: block;
  margin: 0 calc(-1 * clamp(20px, 3vw, 26px)) clamp(14px, 2vw, 18px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-alt);
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.card:hover .card-cover img {
  transform: scale(1.03);
}

.card-tag {
  align-self: flex-start;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 3px 11px;
}

.card-title {
  font-size: 1.09rem;
  font-weight: 650;
  color: var(--ink);
}

.card-desc {
  margin: 0;
  font-size: 0.93rem;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 6px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--muted);
}

.card-views::before {
  content: "· ";
}

.card-more {
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand-deep);
}

.card:hover .card-more {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 分類頁：尚無文章時的提示，避免點進來看到一片空白 */
.topic-empty {
  margin: 0;
  padding: clamp(28px, 4vw, 44px);
  text-align: center;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.topic-foot {
  margin: clamp(28px, 4vw, 40px) 0 0;
  font-size: 0.94rem;
}

.topic-foot a {
  text-decoration: none;
  font-weight: 600;
}

.topic-foot a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- 文章頁 */

.article {
  padding-block: clamp(36px, 6vw, 64px);
}

.article-inner {
  max-width: var(--content-width);
  margin-inline: auto;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 0.86rem;
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--brand-deep);
  text-decoration: underline;
}

.article-header {
  padding-bottom: 22px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.reviewed {
  color: var(--muted);
}

/* 開頭的一句話結論。AI 搜尋最常整段引用這一塊，所以放在正文之前。 */
.quick-answer {
  margin-bottom: 34px;
  padding: clamp(20px, 3vw, 28px);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
  border-radius: var(--radius);
}

.quick-answer h2 {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--brand-deep);
}

.quick-answer p {
  margin: 0;
  font-size: clamp(1rem, 0.96rem + 0.24vw, 1.1rem);
  line-height: 1.9;
  color: var(--ink);
}

/* 主視覺：放在結論之後，不搶第一屏 */
.article-banner {
  margin: 0 0 34px;
}

.article-banner img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

/* 文末常見問題。答案是靜態 HTML，不用點擊展開，搜尋引擎與 AI 直接讀得到。 */
.faq {
  margin-top: 48px;
  padding-top: 30px;
  border-top: 1px solid var(--line-strong);
}

.faq > h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  margin-bottom: 22px;
  color: var(--ink);
}

.faq-item + .faq-item {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.faq-q {
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--ink);
  margin: 0 0 8px;
}

.faq-a {
  margin: 0;
  color: var(--ink-soft);
}

/* 醫療免責聲明 */
.disclaimer {
  margin-top: 40px;
  padding: 18px 22px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--muted);
}

.article-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 14px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: 0.9rem;
  color: var(--muted);
}

.article-author {
  color: var(--ink-soft);
  font-weight: 600;
}

.article-author-title {
  color: var(--muted);
  font-weight: 400;
}

/* 內文排版 */
.article-content {
  min-width: 0;
}

.article-content > * + * {
  margin-top: 1.15em;
}

.article-content h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.55rem);
  margin-top: 2em;
  padding-top: 0.2em;
  color: var(--ink);
}

.article-content h3 {
  font-size: clamp(1.06rem, 1rem + 0.35vw, 1.2rem);
  margin-top: 1.7em;
  color: var(--ink);
}

.article-content p {
  color: var(--ink-soft);
}

.article-content ul,
.article-content ol {
  padding-left: 1.4em;
  color: var(--ink-soft);
}

.article-content li + li {
  margin-top: 0.45em;
}

.article-content blockquote {
  margin-inline: 0;
  padding: 14px 20px;
  border-left: 3px solid var(--brand);
  background: var(--surface-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
}

.article-content blockquote > :first-child {
  margin-top: 0;
}

/* 圖片：等比例縮放，寬度不超過內文區 */
.article-content figure {
  margin: 1.8em 0;
}

.article-content img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.article-content figcaption {
  margin-top: 9px;
  text-align: center;
  font-size: 0.86rem;
  color: var(--muted);
}

/* 長程式碼與表格不撐破版面 */
.article-content pre {
  overflow-x: auto;
  padding: 14px 16px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.article-content code {
  overflow-wrap: anywhere;
  font-size: 0.92em;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.table-scroll table {
  border-collapse: collapse;
  width: 100%;
  min-width: 460px;
  font-size: 0.93rem;
}

.table-scroll th,
.table-scroll td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table-scroll th {
  background: var(--surface-alt);
  font-weight: 650;
}

/* 主幹 ↔ 分支 內部連結區 */
.related {
  margin-top: 48px;
  padding: clamp(20px, 3vw, 26px);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.related h2 {
  font-size: 1.02rem;
  margin-bottom: 12px;
  color: var(--ink);
}

.related ul {
  margin: 0;
  padding-left: 1.2em;
}

.related li + li {
  margin-top: 8px;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 40px;
  font-size: 0.94rem;
  text-decoration: none;
  color: var(--brand-deep);
}

.article-back:hover {
  text-decoration: underline;
}

.views-line {
  color: var(--muted);
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
  padding-block: clamp(36px, 5vw, 56px);
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: clamp(24px, 4vw, 44px);
  margin-bottom: 28px;
}

.footer-col h3 {
  font-size: 0.92rem;
  color: var(--ink);
  margin-bottom: 11px;
}

.footer-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.footer-col a {
  color: var(--muted);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--brand-deep);
  text-decoration: underline;
}

/* 只給螢幕閱讀器的文字。表格用色塊表達看診狀態，
   但色塊本身沒有語意，這些文字讓讀螢幕的人也拿得到同樣的資訊。 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------- 門診時段表 */

.schedule {
  margin-bottom: clamp(32px, 5vw, 48px);
  padding-bottom: clamp(28px, 4vw, 40px);
  border-bottom: 1px solid var(--line-strong);
}

.schedule-title {
  font-size: 0.92rem;
  color: var(--ink);
  margin: 0 0 16px;
}

/* 極窄螢幕的保險：表格自己捲，不會撐破頁面 */
.schedule-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.schedule-table {
  border-collapse: separate;
  border-spacing: 4px;
  width: 100%;
  min-width: 320px;
  font-size: 0.86rem;
}

.schedule-table th,
.schedule-table td {
  padding: 0;
  text-align: center;
  font-weight: 500;
}

.schedule-table thead th {
  color: var(--ink-soft);
  font-weight: 650;
  padding-bottom: 4px;
}

.schedule-table thead th.is-sun {
  color: var(--muted);
}

/* 列標題：時段名稱 + 時間 */
.schedule-table tbody th {
  text-align: left;
  white-space: nowrap;
  color: var(--ink-soft);
  padding-right: 10px;
  font-weight: 600;
  width: 1%;
}

.schedule-table tbody th small {
  display: block;
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* 狀態色塊 */
.schedule-table td {
  height: 34px;
  border-radius: 7px;
}

.schedule-table td.on {
  background: var(--brand);
}

.schedule-table td.other {
  background: color-mix(in srgb, var(--brand) 26%, transparent);
}

.schedule-table td.off {
  background: color-mix(in srgb, var(--line-strong) 45%, transparent);
}

/* 圖例 */
.schedule-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.84rem;
  color: var(--muted);
}

.schedule-legend li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.key {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  flex: none;
}

.key.on {
  background: var(--brand);
}

.key.other {
  background: color-mix(in srgb, var(--brand) 26%, transparent);
}

.key.off {
  background: color-mix(in srgb, var(--line-strong) 45%, transparent);
}

.hours-note {
  margin: 14px 0 0;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--muted);
}

.muted-note {
  font-size: 0.84rem;
  opacity: 0.85;
}

.footer-bottom {
  padding-top: 22px;
  border-top: 1px solid var(--line-strong);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  align-items: center;
}

.footer-note {
  margin: 0;
  max-width: 62ch;
  font-size: 0.85rem;
  line-height: 1.7;
}

.credits {
  margin: 14px 0 0;
  font-size: 0.82rem;
  line-height: 1.7;
}

.credits a {
  color: var(--muted);
}

/* ---------------------------------------------------------------- 佔位提示 */

/* 尚未填入正式文字的區塊，建置期間一眼可辨識。內容補齊後刪掉這個 class 即可。 */
.todo {
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, #d9a441 12%, transparent),
    color-mix(in srgb, #d9a441 12%, transparent) 9px,
    transparent 9px,
    transparent 18px
  );
  border-radius: 3px;
  padding: 0 3px;
}
