/* ==========================================================
   吳醫師 顯微根管 — 日式溫暖風格
   ========================================================== */
:root {
  color-scheme: light;
  --bg: #fffaf3;          /* 暖白 */
  --surface: #ffffff;
  --surface-2: #faf0e3;   /* 米杏 */
  --wood: #b27a4c;        /* 暖木 */
  --wood-dark: #8a5530;
  --earth: #7a5238;       /* 栗茶 */
  --moss: #6f8a55;        /* 嫩苔 */
  --text: #3a2c22;
  --muted: #7d6b5c;
  --line: #eedfcc;
  --accent-soft: #f8e7d2;
  --on-wood: #fffaf3;
  --shadow: 0 18px 40px -24px rgba(150, 95, 45, .35);
  --radius: 14px;
  --serif: "Noto Serif TC", "Shippori Mincho", serif;
  --sans: "Noto Sans TC", system-ui, sans-serif;
}
/* 網站固定使用明亮溫暖的淺色版，不跟隨系統深色模式 */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--sans); line-height: 1.85; letter-spacing: .02em;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--wood-dark); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 760px) { .wrap { padding: 0 32px; } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--wood);
  display: grid; place-items: center; font-family: var(--serif); color: var(--wood); font-weight: 700;
}
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.brand-name small { display: block; font-family: var(--sans); font-weight: 400; font-size: .72rem; color: var(--muted); letter-spacing: .12em; }
.nav { display: flex; gap: 4px; list-style: none; }
.nav a {
  display: block; padding: 8px 12px; border-radius: 8px; text-decoration: none;
  color: var(--muted); font-size: .92rem; transition: color .2s, background .2s;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); cursor: pointer; }
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; }
}

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.35; letter-spacing: .04em; }
h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); }
h3 { font-size: 1.2rem; }
.eyebrow {
  display: inline-block; font-size: .78rem; letter-spacing: .28em; color: var(--wood);
  text-transform: uppercase; margin-bottom: 14px;
}
.lead { font-size: 1.08rem; color: var(--muted); max-width: 38em; }
.muted { color: var(--muted); }
.placeholder { background: var(--accent-soft); color: var(--wood-dark); padding: 0 6px; border-radius: 4px; font-size: .92em; }

/* ---------- Sections ---------- */
section { padding: 88px 0; }
section.tight { padding: 56px 0; }
.section-head { margin-bottom: 44px; max-width: 42em; }
.section-head p { color: var(--muted); margin-top: 12px; }
.alt { background: var(--surface-2); }
.divider { width: 48px; height: 2px; background: var(--wood); margin: 18px 0; }

/* ---------- Page hero ---------- */
.page-hero { padding: 72px 0 56px; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.page-hero .en { font-family: var(--serif); color: var(--wood); font-size: 1rem; letter-spacing: .12em; margin-top: 6px; }
.page-hero p.lead { margin-top: 20px; }
.page-hero::after {
  content: attr(data-kanji); position: absolute; right: -2%; bottom: -30%;
  font-family: var(--serif); font-size: clamp(10rem, 26vw, 18rem); color: var(--wood);
  opacity: .06; line-height: 1; pointer-events: none;
}

/* ---------- Home hero ---------- */
.hero { padding: 80px 0 96px; }
.hero-grid { display: grid; gap: 56px; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.15fr 1fr; } }
.hero h1 span { color: var(--wood); }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-figure { max-width: 500px; width: 100%; margin: 0 auto; text-align: center; }
.hero-figure a { display: block; border-radius: 50%; transition: transform .4s ease; }
.hero-figure a:hover { transform: scale(1.015); }
.hero-figure img {
  width: 100%; height: auto;
  clip-path: circle(45.6% at 49.4% 50.4%);   /* 只保留圓形視野，去掉圖片外圍底色 */
}
.hero-figure figcaption {
  font-family: var(--serif); color: var(--muted); letter-spacing: .12em; margin-top: 6px; font-size: .98rem;
}
.hero-visual {
  position: relative; aspect-ratio: 4 / 5; max-width: 420px; width: 100%; margin: 0 auto;
  border-radius: 200px 200px 16px 16px; overflow: hidden;
  background:
    repeating-linear-gradient(95deg, transparent 0 22px, rgba(122,82,54,.07) 22px 23px),
    linear-gradient(170deg, #d8b894, #a47551 70%, #7a5236);
  box-shadow: var(--shadow);
}
.hero-visual .scope {
  position: absolute; inset: 14% 12% auto; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fff7ec 0 38%, #f0dcc2 60%, #caa27a 100%);
  box-shadow: inset 0 0 0 10px rgba(255,255,255,.25), inset 0 0 40px rgba(60,35,20,.45);
  display: grid; place-items: center;
}
.hero-visual .caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 24px;
  color: #fffaf3; font-family: var(--serif); font-size: 1.05rem; letter-spacing: .1em;
  background: linear-gradient(transparent, rgba(40,24,14,.55));
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 26px; border-radius: 999px;
  font-size: .95rem; font-weight: 500; text-decoration: none; border: 1px solid transparent;
  transition: transform .2s, background .2s, box-shadow .2s; cursor: pointer; font-family: inherit;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--wood); color: var(--on-wood); box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--wood-dark); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }

/* ---------- Grids & cards ---------- */
.grid { display: grid; gap: 22px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 700px) and (max-width: 979px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 26px; transition: transform .25s, box-shadow .25s; position: relative;
}
a.card { text-decoration: none; color: inherit; display: block; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .num { font-family: var(--serif); color: var(--wood); font-size: .85rem; letter-spacing: .2em; }
.card h3 { margin: 8px 0 10px; }
.card p { color: var(--muted); font-size: .95rem; }
.card .more { display: inline-block; margin-top: 14px; font-size: .9rem; color: var(--wood-dark); }
.icon {
  width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--wood-dark);
  display: grid; place-items: center; margin-bottom: 18px;
}

/* ---------- Split / quote ---------- */
.split { display: grid; gap: 48px; align-items: start; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } .split.wide-left { grid-template-columns: 1.3fr 1fr; } }
.quote {
  font-family: var(--serif); font-size: clamp(1.25rem, 2.6vw, 1.6rem); line-height: 1.8;
  border-left: 3px solid var(--wood); padding: 6px 0 6px 24px;
}
.quote cite { display: block; font-family: var(--sans); font-style: normal; font-size: .9rem; color: var(--muted); margin-top: 14px; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; gap: 18px; }
@media (min-width: 900px) { .steps.row { grid-template-columns: repeat(var(--n, 4), 1fr); } }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 22px; position: relative; }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  font-family: var(--serif); color: var(--wood); font-size: 1.6rem; font-weight: 700; display: block; margin-bottom: 6px;
}
.step h3 { font-size: 1.05rem; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: .93rem; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; border-left: 1px solid var(--line); padding-left: 24px; }
.timeline li { position: relative; padding-bottom: 22px; }
.timeline li::before {
  content: ""; position: absolute; left: -29px; top: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--wood);
}
.timeline .when { font-size: .85rem; color: var(--wood); letter-spacing: .1em; }

/* ---------- Microscope view ---------- */
.scope-wrap { display: grid; gap: 36px; align-items: center; }
@media (min-width: 900px) { .scope-wrap { grid-template-columns: 1fr 1fr; } }
/* 圖片外圍是白底，用 clip-path 只留下圓形視野 */
.scope-view { max-width: 540px; width: 100%; margin: 0 auto; clip-path: circle(45.6% at 49.4% 50.4%); }
.scope-inner { position: relative; transition: transform .6s ease; transform-origin: 49.4% 50.4%; }
.scope-view.zoomed .scope-inner { transform: scale(1.6); }
.scope-inner img { width: 100%; height: auto; }
.scope-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hotspot { cursor: pointer; }
.hotspot .hit { fill: transparent; }
.hotspot circle.ring { fill: transparent; stroke: transparent; stroke-width: 8; transition: fill .2s, stroke .2s; }
.hotspot:hover circle.ring { fill: rgba(255, 236, 205, .18); stroke: rgba(255, 227, 189, .7); }
.hotspot.active circle.ring { fill: rgba(255, 236, 205, .28); stroke: #ffe3bd; stroke-width: 12; }
.hotspot:focus { outline: none; }
.hotspot:focus-visible circle.ring { stroke: #ffe3bd; stroke-width: 14; }
.scope-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 28px; min-height: 260px; }
.scope-panel h3 { margin-bottom: 10px; }
.scope-panel p { color: var(--muted); }
.scope-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px;
  padding: 6px 14px; font-size: .88rem; cursor: pointer; font-family: inherit;
}
.chip.active, .chip:hover { background: var(--wood); color: var(--on-wood); border-color: var(--wood); }

/* ---------- FAQ ---------- */
.faq details { border-bottom: 1px solid var(--line); padding: 18px 4px; }
.faq summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "＋"; color: var(--wood); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); margin-top: 10px; }

/* ---------- Case view toggle ---------- */
.toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.toggle button {
  border: 0; background: transparent; padding: 8px 18px; border-radius: 999px; cursor: pointer;
  color: var(--muted); font-family: inherit; font-size: .92rem;
}
.toggle button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.case { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px; }
.case-flow { display: grid; gap: 14px; margin-top: 24px; }
.case-flow .stage { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 16px 0; border-top: 1px dashed var(--line); }
.case-flow .stage b { font-family: var(--serif); color: var(--wood-dark); }
@media (max-width: 560px) { .case-flow .stage { grid-template-columns: 1fr; gap: 4px; } }
[data-view="pro"] .only-patient, [data-view="patient"] .only-pro { display: none; }
.tag { display: inline-block; font-size: .78rem; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--wood-dark); margin-right: 6px; }
.notice { font-size: .88rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 12px 16px; margin-top: 18px; }

/* ---------- Contact ---------- */
.info-list { list-style: none; display: grid; gap: 18px; }
.info-list li { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.info-list .k { color: var(--wood); font-size: .88rem; letter-spacing: .15em; }
.hours { width: 100%; border-collapse: collapse; font-size: .93rem; }
.hours th, .hours td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.hours th { color: var(--muted); font-weight: 400; }
.map { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4 / 3; background: var(--surface-2); }
.map iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- CTA band ---------- */
.cta-band { background: linear-gradient(135deg, #a8693d, #d8a066); color: #fffaf3; border-radius: 22px; padding: 56px 32px; text-align: center; }
.cta-band h2 { color: var(--bg); }
.cta-band p { opacity: .8; margin: 12px auto 28px; max-width: 36em; }
.cta-band .btn-primary { background: var(--bg); color: var(--earth); }
.cta-band .btn-ghost { color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.cta-band .btn-ghost:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 32px; margin-top: 40px; font-size: .9rem; color: var(--muted); }
.site-footer .cols { display: grid; gap: 28px; }
@media (min-width: 760px) { .site-footer .cols { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer h4 { font-family: var(--serif); color: var(--text); margin-bottom: 10px; font-size: 1rem; }
.site-footer ul { list-style: none; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--wood-dark); }
.site-footer .copy { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .82rem; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .scope-view svg { transition: none; }
}

/* ---------- Profile (about) ---------- */
.profile { display: grid; gap: 40px; align-items: start; }
@media (min-width: 820px) { .profile { grid-template-columns: 300px 1fr; gap: 64px; } }
.portrait { max-width: 300px; width: 100%; margin: 0 auto; }
.portrait img {
  width: 100%; height: auto; border-radius: 160px 160px 14px 14px;
  box-shadow: 0 0 0 8px var(--surface-2), 0 0 0 9px var(--line), var(--shadow);
}
.portrait figcaption { text-align: center; margin-top: 18px; font-family: var(--serif); color: var(--muted); letter-spacing: .12em; }
.cred { display: grid; gap: 36px; }
.cred-group h3 {
  font-size: 1.05rem; color: var(--wood-dark); letter-spacing: .3em;
  padding-bottom: 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.cred-group ul { list-style: none; }
.cred-group li { position: relative; padding: 10px 0 10px 22px; border-bottom: 1px dashed var(--line); }
.cred-group li::before {
  content: ""; position: absolute; left: 2px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-radius: 50%; border: 2px solid var(--wood);
}

/* 步驟卡片加上圖示時：編號移到右上角 */
.steps.with-icons .step { padding-top: 26px; }
.steps.with-icons .step::before { position: absolute; top: 18px; right: 20px; font-size: 1.1rem; margin: 0; opacity: .75; }
.steps.with-icons .icon { margin-bottom: 16px; }

/* ---------- 流程照片與放大檢視 ---------- */
.step-photo {
  display: block; width: 100%; aspect-ratio: 4 / 3; margin-bottom: 16px; padding: 0; border: 0;
  border-radius: 10px; overflow: hidden; position: relative; cursor: zoom-in; background: var(--surface-2);
}
.step-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.step-photo:hover img { transform: scale(1.05); }
.step-photo:focus-visible { outline: 3px solid var(--wood); outline-offset: 2px; }
.zoom-badge {
  position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: .9rem;
  background: rgba(28, 24, 20, .6); color: #fffaf3;
}
.step.has-photo .icon { display: none; }
.steps.with-icons .step.has-photo::before {
  top: 14px; right: 14px; z-index: 1; padding: 0 8px; border-radius: 999px;
  background: rgba(28, 24, 20, .55); color: #fffaf3; opacity: 1; font-size: .95rem;
}
.lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(92vw, 1100px); max-height: 92vh;
  margin: auto; overflow: visible;
}
.lightbox::backdrop { background: rgba(20, 16, 12, .88); }
.lightbox figure { margin: 0; }
.lightbox img { max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: 10px; }
.lightbox figcaption { color: #efe6db; text-align: center; margin-top: 12px; font-size: .95rem; }
.lightbox figcaption b { font-family: var(--serif); color: #fff; }
.lightbox button {
  position: fixed; border: 0; cursor: pointer; color: #fffaf3; background: rgba(255,255,255,.12);
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; line-height: 1;
}
.lightbox button:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox button[hidden] { display: none; }

/* ---------- Logo ---------- */
.brand-logo {
  width: 46px; height: 46px; border-radius: 50%; background: #fff; flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--line);
}
.footer-logo {
  width: 150px; height: auto; background: #fff; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 16px; box-shadow: 0 0 0 1px var(--line);
}

/* ---------- 門診表 ---------- */
.hours td, .hours th[scope="row"] { text-align: center; }
.hours th[scope="row"] { color: var(--text); font-weight: 500; }
.hours th[scope="col"] { text-align: center; }
.hours th[scope="col"]:first-child { text-align: center; }
.hours td.on { color: var(--wood-dark); font-weight: 500; }
.hours td.off { color: var(--muted); opacity: .6; }
.hours td.away { font-size: .82rem; line-height: 1.4; color: var(--moss); }
.hours td.away small { display: block; font-size: .92em; color: var(--muted); }

/* ---------- AI X 光解讀 ---------- */
.xray { display: grid; gap: 18px; }
.xray:hover, .xray-result:hover { transform: none; }
.xray-warning {
  font-size: .9rem; line-height: 1.7; padding: 12px 16px; border-radius: 10px;
  background: color-mix(in srgb, #c8553d 12%, var(--surface)); border-left: 3px solid #c8553d;
}
.xray-drop {
  display: grid; place-items: center; min-height: 200px; padding: 16px; cursor: pointer; text-align: center;
  border: 2px dashed var(--line); border-radius: 12px; background: var(--surface-2); color: var(--muted);
  transition: border-color .2s;
}
.xray-drop:hover, .xray-drop:focus-within { border-color: var(--wood); }
.xray-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.xray-drop small { display: block; font-size: .82rem; margin-top: 4px; }
.xray-drop img { max-height: 360px; width: auto; border-radius: 8px; }
.xray-field { display: grid; gap: 6px; font-size: .92rem; color: var(--muted); }
.xray-field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: vertical;
}
.xray-consent { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--muted); }
.xray-consent input { margin-top: 6px; accent-color: var(--wood); }
.xray .btn { justify-self: start; }
.xray .btn:disabled { opacity: .6; cursor: wait; transform: none; }
.xray-status { color: var(--wood-dark); font-size: .92rem; min-height: 1.5em; }
.xray-result { margin-top: 24px; }
.xray-result h3 { margin: 22px 0 8px; font-size: 1.08rem; }
.xr-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.xr-urgency { font-size: .82rem; padding: 2px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--wood-dark); }
.xr-urgency[data-u="建議盡快就醫"] { background: #c8553d; color: #fff; }
.xr-list { list-style: none; }
.xr-list li { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.xr-list b { display: block; font-weight: 600; }
.xr-conf { display: inline-block; margin-top: 4px; font-size: .78rem; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.xr-conf.high { color: var(--wood-dark); background: var(--accent-soft); }
.xr-steps { padding-left: 1.4em; }
.xr-steps li { padding: 4px 0; }
