/* 說明文件三欄版面：左分類樹、中文件、右本頁目錄；窄螢幕兩側收成抽屜 */
body { --bar: 56px; padding-top: var(--bar); }
.docbar {
  position: fixed;
  inset: 0 0 auto;
  height: var(--bar);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.docbar .brand { font-weight: 700; color: inherit; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docbar nav { margin-left: auto; }
.docbar .btn { margin: 0; }
.docbar .toggle { display: none; padding: 0 10px; }

.docs {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  grid-template-areas: 'nav main toc';
  gap: 32px;
  padding: 0 16px;
}
.doc-nav, .doc-toc {
  position: sticky;
  top: var(--bar);
  align-self: start;
  max-height: calc(100dvh - var(--bar));
  overflow-y: auto;
  padding: 24px 0;
  font-size: 0.875rem;
}
.doc-nav { grid-area: nav; }
.doc-toc { grid-area: toc; }
.doc { grid-area: main; min-width: 0; padding: 32px 0 64px; view-transition-name: doc-main; }
::view-transition-old(doc-main),
::view-transition-new(doc-main) { animation-duration: 140ms; }

.doc-shortcuts { display: none; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.doc-shortcuts a { display: flex; align-items: center; justify-content: center; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--primary); font-weight: 600; text-decoration: none; font-size: 0.8125rem; }
.doc-shortcuts a:hover { border-color: var(--primary); }
.doc-nav input[type='search'] { width: 100%; margin-bottom: 12px; }
.doc-nav details { margin-bottom: 8px; }
.doc-nav summary { min-height: 36px; display: flex; align-items: center; cursor: pointer; color: var(--muted); font-weight: 700; }
.doc-nav ul, .doc-toc ul { list-style: none; margin: 0; padding: 0; }
.doc-nav li a {
  min-height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 12px;
  border-left: 2px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.doc-nav li a:hover { color: var(--primary); }
.doc-nav li a[aria-current='page'] { border-left-color: var(--primary); color: var(--primary); font-weight: 700; }
.doc-nav .hit { color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.doc-nav mark { background: none; color: var(--primary); font-weight: 700; }
.doc-nav .empty { color: var(--muted); padding: 4px 12px; }

.doc-toc p { margin: 0 0 8px; color: var(--muted); font-weight: 700; }
.doc-toc a { display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; }
.doc-toc a.sub { padding-left: 24px; }
.doc-toc a:hover, .doc-toc a.active { color: var(--primary); border-left-color: var(--primary); }

.doc h1 { margin: 0 0 8px; font-size: 1.75rem; }
.doc h1 + .lead { margin: 0 0 24px; color: var(--muted); }
.doc h2 { margin: 32px 0 12px; font-size: 1.25rem; }
.doc h3 { margin: 24px 0 8px; font-size: 1.0625rem; }
.doc h2, .doc h3, .doc [id] { scroll-margin-top: calc(var(--bar) + 16px); }
.doc a { color: var(--primary); }
.doc p, .doc ul, .doc ol { margin: 0 0 12px; }
.doc li + li { margin-top: 4px; }
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 0.9375rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.doc th { color: var(--muted); font-weight: 400; white-space: nowrap; }
.doc .tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0 0 16px; }
.doc .tasks .card { padding: 14px 16px; }
.doc .tasks h3 { margin: 0 0 6px; font-size: 1rem; }
.doc .tasks ul { margin: 0; padding-left: 1.1em; }
.doc details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0 16px;
  margin-bottom: 10px;
}
.doc details summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.doc details summary::-webkit-details-marker { display: none; }
.doc details summary::after {
  content: '▾';
  color: var(--muted);
  font-weight: 400;
  transition: transform 150ms ease;
}
.doc details[open] summary::after { transform: rotate(180deg); }
.doc details > :not(summary) { margin-left: 0; color: var(--muted); }
.doc details[open] { padding-bottom: 4px; }
.doc .docs-index { display: grid; gap: 12px; padding: 0; list-style: none; }
.doc .docs-index li { margin: 0; }
.doc .docs-index a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; }
.doc .docs-index a span { display: block; color: var(--muted); font-size: 0.875rem; }
.doc .docs-index a:hover { border-color: var(--primary); }

.scrim { display: none; }

@media (max-width: 1199px) {
  .docs { grid-template-columns: 240px minmax(0, 1fr); grid-template-areas: 'nav main'; }
  .docbar .toggle.toc { display: inline-flex; }
  .doc-toc { display: none; }
  .doc-toc.open, .doc-nav.open {
    display: block;
    position: fixed;
    top: var(--bar);
    bottom: 0;
    z-index: 30;
    width: min(300px, 85vw);
    max-height: none;
    align-self: stretch;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
  }
  .doc-toc.open { right: 0; }
  .doc-nav.open { left: 0; }
  .scrim.open { display: block; position: fixed; inset: var(--bar) 0 0; z-index: 25; background: rgba(0, 0, 0, 0.4); }
}
@media (max-width: 959px) {
  .docs { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'main'; }
  .docbar .toggle.nav { display: inline-flex; }
  .docbar nav { display: none; }
  .doc-shortcuts { display: grid; }
  .docbar .toggle.toc { margin-left: auto; }
  .doc-nav { display: none; }
  .doc { padding-top: 24px; }
}

/* 步驟截圖：手機橫向滑動、寬螢幕多欄並排，各卡依自身圖高貼齊不留空洞 */
.doc .shots {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 14px;
  padding: 0 0 8px;
  list-style: none;
  counter-reset: shot;
  -webkit-overflow-scrolling: touch;
}
.doc .shots li {
  counter-increment: shot;
  flex: 0 0 min(260px, 76vw);
  scroll-snap-align: start;
  margin: 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}
.doc .shots li > p:first-child::before {
  content: counter(shot) '. ';
  font-weight: 700;
  color: var(--primary);
}
.doc .shots li > p { margin: 0 0 8px; font-size: 0.9375rem; }
.doc .shots img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 60dvh;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: zoom-in;
}
@media (min-width: 640px) {
  .doc .shots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: start;
    overflow-x: visible;
    padding-bottom: 0;
  }
  .doc .shots li { flex: none; }
}

/* 點圖放大（Lightbox） */
.doc-lightbox {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 96vw;
  max-height: 94dvh;
  overflow: visible;
}
.doc-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(2px);
}
.doc-lightbox figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 10px;
}
.doc-lightbox img {
  display: block;
  max-width: 94vw;
  max-height: 84dvh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  cursor: zoom-out;
}
.doc-lightbox figcaption {
  color: #f4ecda;
  font-size: 0.875rem;
  text-align: center;
  max-width: 42em;
}

/* 網址、錯誤代碼後面的複製鈕 */
.doc .copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  margin-left: 0.2em;
  padding: 0;
  vertical-align: middle;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted, #8a7a5c);
  cursor: pointer;
}
.doc .copy:hover { background: rgba(0, 0, 0, 0.06); color: inherit; }
.doc .copy.done { color: #3d8a4f; }
.doc .copy svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
