/* Shared design system for all treatment detail pages (treatments/*.html).
   Each page sets --tx-c and a hero gradient inline, everything else lives here.
   Two-lens convention: --tx-west (grey) always means "how Western medicine
   sees it"; --tx-c (varies per page) always means "this treatment's TCM
   identity" — the same grey/colour pairing repeats in every 中西醫怎麼看
   section so a reader learns the code once and reuses it across pages. */

:root {
  --tx-west: #5B6470;
}

/* ── Floating WhatsApp contact button ────────────────────────────────
   Fixed to the viewport corner (not the nav) so it stays reachable the
   whole way down the page, independent of scroll position. Matches the
   same component on index.html. */
.fab-whatsapp {
  position: fixed;
  right: clamp(1.25rem, 4vw, 2rem);
  bottom: clamp(1.25rem, 4vw, 2rem);
  z-index: 90;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #25D366;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4), 0 2px 8px rgba(0,0,0,0.12);
  transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.25s ease;
}
.fab-whatsapp svg { width: 28px; height: 28px; }
.fab-whatsapp:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 10px 28px rgba(37, 211, 102, 0.48), 0 4px 10px rgba(0,0,0,0.14); }
.fab-whatsapp:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .fab-whatsapp { transition: none; } }
@media (max-width: 640px) {
  .fab-whatsapp { width: 50px; height: 50px; }
  .fab-whatsapp svg { width: 25px; height: 25px; }
}

/* ── Hero ─────────────────────────────────────────────────────────── */
.tx-hero {
  position: relative;
  overflow: hidden;
  padding: 5.5rem 0 3.5rem;
  border-bottom: 1.5px solid var(--border);
}
.tx-hero-deco {
  position: absolute;
  top: 12%; left: 0; right: 0;
  width: 100%; height: 90px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}
.tx-breadcrumb {
  position: relative; z-index: 1;
  font-size: 0.75rem; color: var(--text-light); margin-bottom: 1.75rem;
}
.tx-breadcrumb a { color: var(--text-light); text-decoration: none; }
.tx-breadcrumb a:hover { color: var(--tx-c); }
.tx-breadcrumb span { margin: 0 0.4rem; }
.tx-hero-icon {
  position: relative; z-index: 1;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tx-c) 12%, white);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--tx-c) 18%, transparent);
}
.tx-hero-tag {
  position: relative; z-index: 1;
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 12px;
  border-radius: 12px; margin-bottom: 1rem;
  background: color-mix(in srgb, var(--tx-c) 10%, white); color: var(--tx-c);
}
.tx-hero h1 {
  position: relative; z-index: 1;
  font-family: var(--font-display); font-size: 2.6rem; color: var(--text-dark);
  line-height: 1.25; margin-bottom: 0.8rem; font-weight: 600; letter-spacing: -0.01em;
}
.tx-hero-sub {
  position: relative; z-index: 1;
  font-size: 1.02rem; color: var(--text-light); line-height: 1.85; max-width: 560px;
}

/* ── Section-jump TOC: sticky under the fixed nav ────────────────────
   The one real navigational aid these pages were missing — lets someone
   skip straight to "適合哪些人" without reading the theory first. */
.tx-toc-wrap {
  position: sticky;
  top: 64px;
  z-index: 20;
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.tx-toc {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.7rem clamp(1.5rem, 5vw, 4rem);
  scrollbar-width: none;
}
.tx-toc::-webkit-scrollbar { display: none; }
.tx-toc a {
  flex: 0 0 auto;
  font-size: 0.8rem;
  color: var(--text-light);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  border: 1px solid transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.tx-toc a:hover { color: var(--tx-c); }
.tx-toc a.active {
  color: var(--tx-c);
  background: color-mix(in srgb, var(--tx-c) 10%, white);
  border-color: color-mix(in srgb, var(--tx-c) 24%, white);
  font-weight: 600;
}

/* ── Section shell ────────────────────────────────────────────────── */
.tx-body { max-width: 720px; margin: 0 auto; }
.tx-section { padding: 3.25rem 0; border-bottom: 1.5px solid var(--border); scroll-margin-top: 116px; }
.tx-section:last-of-type { border-bottom: none; }
.tx-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--tx-c); margin-bottom: 0.6rem;
}
.tx-section h2 {
  font-family: var(--font-display); font-size: 1.6rem; color: var(--text-dark);
  margin-bottom: 1.15rem; font-weight: 600; letter-spacing: -0.005em;
}
.tx-prose { font-size: 0.94rem; color: var(--text-light); line-height: 1.95; }
.tx-prose + .tx-prose { margin-top: 0.9rem; }

/* ── Method cards: for a page covering 2+ distinct techniques side by
   side (e.g. 拔罐 vs 刮痧) within the same "什麼是" section ──────────── */
.tx-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 1.5rem; }
.tx-method-card { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.tx-method-icon { font-size: 1.8rem; margin-bottom: 0.75rem; display: block; }
.tx-method-card h4 { font-size: 1rem; font-weight: 700; color: var(--text-dark); margin-bottom: 0.5rem; font-family: var(--font-display); }
.tx-method-card p { font-size: 0.83rem; color: var(--text-light); line-height: 1.75; }
@media (max-width: 680px) { .tx-two-col { grid-template-columns: 1fr; } }

/* ── Sub-type cards: for a page listing 2–3 variants of one technique
   (e.g. 艾條懸灸／艾灸盒／隔薑灸) within "什麼是" ─────────────────────── */
.tx-moxa-types { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
.tx-moxa-card { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.tx-moxa-card .icon { font-size: 1.6rem; margin-bottom: 0.6rem; display: block; }
.tx-moxa-card h4 { font-size: 0.88rem; font-weight: 700; color: var(--text-dark); margin-bottom: 0.4rem; }
.tx-moxa-card p { font-size: 0.78rem; color: var(--text-light); line-height: 1.7; }
@media (max-width: 680px) { .tx-moxa-types { grid-template-columns: 1fr; } }

/* ── Tags (適合哪些人) ────────────────────────────────────────────── */
.tx-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.5rem; }
.tx-tag {
  font-size: 0.82rem; padding: 5px 14px; border-radius: 20px;
  border: 1.5px solid color-mix(in srgb, var(--tx-c) 28%, white);
  color: var(--tx-c); background: color-mix(in srgb, var(--tx-c) 7%, white);
}

/* ── Steps (中醫怎麼治療): numbered path, a real sequence ──────────── */
.tx-steps { position: relative; display: flex; flex-direction: column; gap: 1.5rem; margin-top: 1.5rem; }
.tx-steps::before {
  content: '';
  position: absolute;
  left: 15px; top: 16px; bottom: 16px;
  width: 1.5px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--tx-c) 35%, transparent), color-mix(in srgb, var(--tx-c) 8%, transparent));
}
.tx-step { position: relative; display: flex; gap: 1.1rem; align-items: flex-start; }
.tx-step-num {
  position: relative; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%; background: var(--tx-c);
  color: white; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-accent); font-size: 1rem; font-weight: 700;
  flex-shrink: 0; margin-top: 2px;
}
.tx-step-title { font-size: 0.96rem; font-weight: 600; color: var(--text-dark); margin-bottom: 0.3rem; }
.tx-step-desc { font-size: 0.84rem; color: var(--text-light); line-height: 1.7; }

/* ── Compare (中西醫怎麼看): grey = Western, colour = TCM ──────────── */
.tx-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
.tx-compare-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.25rem;
  position: relative;
  overflow: hidden;
}
.tx-compare-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--_c);
}
.tx-compare-card--west { --_c: var(--tx-west); background: color-mix(in srgb, var(--tx-west) 5%, white); }
.tx-compare-card--tcm { --_c: var(--tx-c); background: color-mix(in srgb, var(--tx-c) 6%, white); }
.tx-compare-badge {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; margin-bottom: 0.85rem;
  background: color-mix(in srgb, var(--_c) 16%, white);
}
.tx-compare-card h4 { font-size: 0.92rem; font-weight: 700; color: var(--text-dark); margin-bottom: 0.8rem; }
.tx-compare-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.tx-compare-card li { font-size: 0.81rem; color: var(--text-light); line-height: 1.6; display: flex; align-items: flex-start; gap: 6px; }
.tx-compare-card li::before { content: "·"; color: var(--_c); font-weight: 700; flex-shrink: 0; }

/* ── Disclosure: shared open/close mechanic for FAQ and "深入了解" ─── */
.tx-disclosure-item { border-bottom: 1.5px solid var(--border); }
.tx-disclosure-item:first-child { border-top: 1.5px solid var(--border); }
.tx-disclosure-q {
  width: 100%; background: none; border: none; text-align: left; font-family: inherit;
  font-size: 0.92rem; font-weight: 600; color: var(--text-dark);
  padding: 1.1rem 0; cursor: pointer; display: flex; justify-content: space-between;
  align-items: center; gap: 1rem; transition: color 0.15s;
}
.tx-disclosure-q:hover { color: var(--tx-c); }
.tx-disclosure-chevron { font-size: 0.65rem; color: var(--text-light); transition: transform 0.2s; flex-shrink: 0; }
.tx-disclosure-item.open .tx-disclosure-chevron { transform: rotate(180deg); }
.tx-disclosure-a { font-size: 0.85rem; color: var(--text-light); line-height: 1.85; padding-bottom: 1.2rem; display: none; }
.tx-disclosure-item.open .tx-disclosure-a { display: block; }

.tx-faq { display: flex; flex-direction: column; margin-top: 1.5rem; }

/* "深入了解" — the two-tier depth control: plain overview stays in the
   compare cards above; anyone who wants the clinical detail opens this. */
.tx-more { margin-top: 1.5rem; border: 1.5px solid color-mix(in srgb, var(--tx-c) 22%, white); border-radius: var(--radius); background: color-mix(in srgb, var(--tx-c) 4%, white); }
.tx-more .tx-disclosure-item, .tx-more .tx-disclosure-item:first-child { border: none; }
.tx-more .tx-disclosure-q { padding: 0.9rem 1.1rem; font-size: 0.88rem; }
.tx-more .tx-disclosure-q::before { content: "🔬"; margin-right: 0.15rem; }
.tx-more .tx-disclosure-a { padding: 0 1.1rem 1.1rem; }

/* ── Safety note ──────────────────────────────────────────────────── */
.tx-note {
  background: color-mix(in srgb, var(--tx-c) 8%, white);
  border-left: 3px solid var(--tx-c);
  padding: 1rem 1.25rem; border-radius: 8px;
  font-size: 0.85rem; color: var(--text-dark); line-height: 1.8;
  margin-top: 1.5rem;
}

/* ── Related treatments ──────────────────────────────────────────── */
.tx-related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.5rem; }
.tx-related a {
  font-size: 0.82rem; padding: 6px 16px; border-radius: 20px;
  border: 1.5px solid var(--border); color: var(--text-dark); background: white;
  text-decoration: none; transition: border-color 0.2s ease, color 0.2s ease;
}
.tx-related a:hover { border-color: var(--tx-c); color: var(--tx-c); }

/* ── CTA banner ───────────────────────────────────────────────────── */
.tx-cta { background: var(--tx-c); color: white; padding: 3.5rem 2rem; border-radius: var(--radius-lg); text-align: center; margin: 3rem 0 0; }
.tx-cta h3 { font-family: var(--font-display); font-size: 1.65rem; margin-bottom: 0.75rem; color: white; font-weight: 600; }
.tx-cta p { font-size: 0.9rem; opacity: 0.85; margin-bottom: 1.75rem; line-height: 1.85; }
.tx-cta .btn-white {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: white; color: var(--tx-c); font-weight: 700; font-size: 0.9rem;
  padding: 0.75rem 2rem; border-radius: 50px; text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tx-cta .btn-white:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.tx-cta .btn-white:focus-visible { outline: 2px solid white; outline-offset: 3px; }

@media (max-width: 680px) {
  .tx-hero h1 { font-size: 2rem; }
  .tx-hero { padding: 4.5rem 0 2.5rem; }
  .tx-compare { grid-template-columns: 1fr; }
  .tx-toc-wrap { top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .tx-cta .btn-white { transition: none; }
}
