/* 日系溫暖療癒・極簡：生成色（米白）、墨色文字、抹茶綠與焙茶色點綴 */
:root {
  --bg: #f7f3ec;
  --surface: #fffdf9;
  --tint: #efe9df;
  --ink: #3a3530;
  --muted: #7a7168;
  --line: #e4dbcf;
  --matcha: #5f7a5c;
  --matcha-deep: #4b6349;
  --matcha-soft: #e7ede2;
  --hojicha: #a8795a;
  --hojicha-soft: #f2e8de;
  --radius: 10px;
  --content: 720px;
  --wide: 1120px;
  --serif: "Noto Serif TC", "Hiragino Mincho ProN", "Songti TC", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Hiragino Sans", "Microsoft JhengHei", system-ui, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  line-break: strict;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--matcha-deep);
  text-underline-offset: 3px;
}

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

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.04em;
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--matcha);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 8px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wide) + 48px);
  margin-inline: auto;
  padding-inline: 24px;
}

.narrow {
  width: 100%;
  max-width: calc(var(--content) + 48px);
  margin-inline: auto;
  padding-inline: 24px;
}

@media (max-width: 480px) {
  .wrap,
  .narrow {
    padding-inline: 18px;
  }
}

/* ---- 頁首：左邊名稱、右上角選單 ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 253, 249, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  min-height: 64px;
  padding-block: 8px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.8rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
  margin-inline: -10px;
}

.nav a {
  position: relative;
  padding: 8px 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 2px;
  height: 2px;
  background: var(--matcha);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

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

.nav a:hover::after,
.nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav a[aria-current="page"] {
  color: var(--matcha-deep);
  font-weight: 700;
}

/* ---- 按鈕與標籤 ---- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 0;
}

.actions-center {
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 8px 24px;
  border-radius: var(--radius);
  border: 1.5px solid var(--matcha);
  background: var(--matcha);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.06em;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

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

.btn-outline {
  background: var(--surface);
  color: var(--matcha-deep);
}

.btn-outline:hover {
  background: var(--matcha-soft);
  color: var(--matcha-deep);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--hojicha-soft);
  color: #7c5638;
  font-size: 0.8rem;
  line-height: 1.8;
  text-decoration: none;
  white-space: nowrap;
}

a.chip:hover {
  background: #eadbcd;
  color: #6a4a30;
}

.chips-filter {
  margin-top: 24px;
}

.chips-filter .chip {
  padding: 5px 14px;
  font-size: 0.88rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.chips-filter .chip:hover {
  border-color: var(--matcha);
  background: var(--matcha-soft);
  color: var(--matcha-deep);
}

.chips-filter .chip[aria-current="page"] {
  background: var(--matcha);
  border-color: var(--matcha);
  color: #fff;
}

.chip-count {
  font-size: 0.75em;
  opacity: 0.75;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---- HERO ---- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.hero-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: 78% 20%;
}

.hero-inner {
  padding-block: 28px 44px;
}

.hero-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
}

.hero-tags li {
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--matcha-soft);
  color: var(--matcha-deep);
  font-size: 0.8rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.75rem);
}

.lead {
  margin: 20px 0 0;
  color: var(--muted);
  max-width: 34em;
}

@media (min-width: 900px) {
  .hero-media {
    position: absolute;
    inset: 0;
  }

  .hero-media img {
    height: 100%;
    aspect-ratio: auto;
    object-position: 70% 22%;
  }

  /* 左側牆面加一層生成色漸層，讓標題清楚好讀 */
  .hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(247, 243, 236, 0.95) 0%, rgba(247, 243, 236, 0.82) 36%, rgba(247, 243, 236, 0) 62%);
  }

  .hero-inner {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 580px;
    padding-block: 64px;
  }

  .hero-text {
    max-width: 540px;
  }
}

/* ---- 區塊 ---- */
.section {
  padding-block: 56px;
}

.section-tint {
  background: var(--tint);
}

.section-title {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
}

.section-lead {
  margin: 0 0 28px;
  color: var(--muted);
  max-width: 40em;
}

.topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.topic {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.topic h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.topic p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.8;
}

.more {
  margin-top: auto;
  font-size: 0.9rem;
  text-decoration: none;
}

.more:hover {
  text-decoration: underline;
}

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.feature-media {
  margin: 0;
}

.feature-media img {
  width: 100%;
  border-radius: 14px;
}

.feature-text p {
  margin: 0;
}

@media (min-width: 900px) {
  .feature {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 56px;
  }
}

/* ---- 最新文章卡片 ---- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
  margin-top: 24px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card-media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  padding: 16px 20px 18px;
  min-width: 0;
}

.card-title {
  margin: 0;
  font-size: 1.08rem;
}

.card-title a {
  color: var(--ink);
  text-decoration: none;
}

.card-title a:hover {
  color: var(--matcha-deep);
  text-decoration: underline;
}

.card-desc {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .meta {
  margin-top: auto;
}

/* ---- 文章列表頁 ---- */
.page-head {
  padding-block: 48px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.page-head h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem);
}

.page-head .section-lead {
  margin-bottom: 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

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

.list {
  padding-block: 12px 32px;
}

/* 衛教文章列表：兩欄圖文卡片（手機一欄） */
.cards-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}

@media (min-width: 760px) {
  .cards-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cards-list .card-title {
  font-size: 1.15rem;
}

/* ---- 醫師簡介 ---- */
.about-page {
  padding-block: 36px 16px;
}

.profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.profile-photo {
  margin: 0;
  max-width: 260px;
}

.profile-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 14px;
}

@media (min-width: 640px) {
  .profile {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 36px;
  }
}

.profile-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.profile-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.about-h {
  margin: 36px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 1.2rem;
}

.profile-text .about-h {
  margin-top: 24px;
}

.motto {
  margin: 0;
  padding: 10px 0 10px 18px;
  border-left: 3px solid var(--matcha);
}

.motto p {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.9;
}

.motto-clause {
  display: inline-block;
  max-width: 100%;
}

.motto footer {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.about-list {
  margin: 0;
  padding-left: 1.2em;
}

.about-list li {
  margin-bottom: 0.35em;
}

.about-list li::marker {
  color: var(--matcha);
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.social-link svg {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--brand);
}

.social-link:hover {
  border-color: var(--brand);
  background: var(--matcha-soft);
  color: var(--ink);
}

.placeholder {
  margin-block: 48px;
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.not-found {
  text-align: center;
  border-bottom: 0;
  background: transparent;
  padding-block: 96px;
}

.not-found .section-lead {
  margin-inline: auto;
}

/* ---- 文章頁 ---- */
.post-head {
  padding-top: 36px;
}

.post-head .chips {
  margin-top: 4px;
}

.post-title {
  margin: 14px 0 8px;
  font-size: clamp(1.6rem, 1.15rem + 2vw, 2.3rem);
}

.post-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.02rem;
}

.post-meta {
  padding-block: 12px;
  border-block: 1px solid var(--line);
}

.post-meta strong {
  color: var(--ink);
  font-weight: 500;
}

.post-hero {
  margin-block: 28px;
}

.post-hero img {
  width: 100%;
  border-radius: var(--radius);
}

.prose {
  font-size: 1.04rem;
  line-height: 2;
}

.prose h2 {
  margin: 2.2em 0 0.7em;
  font-size: 1.35rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.prose h3 {
  margin: 1.8em 0 0.5em;
  font-size: 1.15rem;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.2em;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li {
  margin-bottom: 0.3em;
}

.prose li::marker {
  color: var(--matcha);
}

.prose strong {
  color: var(--ink);
  background: linear-gradient(transparent 62%, var(--hojicha-soft) 62%);
}

.prose blockquote {
  margin: 1.5em 0;
  padding: 14px 20px;
  background: var(--matcha-soft);
  border-left: 3px solid var(--matcha);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.prose img {
  border-radius: var(--radius);
}

.prose pre {
  overflow-x: auto;
  background: var(--tint);
  padding: 14px;
  border-radius: 8px;
}

.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 6px 10px;
}

.notice {
  margin-block: 32px;
  padding: 16px 20px;
  background: var(--tint);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.8;
}

/* 文末：同分類的其他文章（參考 drweimis.com 文末格式） */
.related {
  margin-top: 40px;
}

.related-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.related-list li {
  padding-block: 10px;
  min-width: 0;
}

.related-title {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.6;
  text-decoration: none;
}

.related-title:hover {
  color: var(--matcha-deep);
  text-decoration: underline;
}

.related-desc {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post .actions {
  margin-block: 32px 8px;
}

/* 社群圖示裡「挖空」的部分（Spotify 聲波、YouTube 播放鍵） */
.cut-fill {
  fill: #fff;
}

.cut-line {
  fill: none;
  stroke: #fff;
}

/* ---- 頁尾（參考 dr-neil.com：品牌＋社群、英文問候、版權） ---- */
.site-footer {
  margin-top: 64px;
  background: #efe5d2;
  color: var(--ink);
}

.footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  padding-block: 48px 36px;
}

@media (min-width: 900px) {
  .footer-main {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 40px;
  }
}

.footer-logo {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0;
}

.footer-logo-name {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.footer-logo-tag {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.footer-follow,
.footer-slogan,
.footer-hi {
  font-family: "Nunito", var(--sans);
  letter-spacing: 0.01em;
}

.footer-follow {
  margin: 10px 0 16px;
  font-size: 0.95rem;
  font-weight: 700;
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  transition: background 0.2s ease, transform 0.2s ease;
}

.footer-icon svg {
  width: 22px;
  height: 22px;
}

.footer-icon .cut-fill {
  fill: var(--ink);
}

.footer-icon .cut-line {
  stroke: var(--ink);
}

.footer-icon:hover {
  background: var(--matcha-deep);
  color: #fff;
  transform: translateY(-2px);
}

.footer-icon:hover .cut-fill {
  fill: var(--matcha-deep);
}

.footer-icon:hover .cut-line {
  stroke: var(--matcha-deep);
}

.footer-hi {
  margin: 0;
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.8rem);
  font-weight: 700;
  line-height: 1.25;
}

.footer-slogan {
  margin: 18px 0 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--matcha-deep);
}

.footer-copy {
  margin: 0;
  color: var(--muted);
  font-family: "Nunito", var(--sans);
  font-size: 0.88rem;
}

.footer-sub {
  padding-block: 16px 28px;
  border-top: 1px solid #ddd0b8;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-bottom: 8px;
}

.footer-nav a {
  color: var(--ink);
  font-size: 0.88rem;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--matcha-deep);
}

.footer-text {
  margin: 0;
  line-height: 1.8;
}

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