/* 講義列印：作答頁＋簡答（handout-print.js，T-261109-05 A 段） */

/* 每節標題下的「列印」列 */
.hp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 4px; font-size: .86rem; }
.hp-row-t { color: #8a7378; font-weight: 700; letter-spacing: .1em; margin-right: 2px; }
.hp-row button, #hp-bar button {
  font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer; padding: 3px 12px; border-radius: 6px;
  border: 1px solid #d9b8c0; background: #fff; color: #7a2e3c;
}
.hp-row button:hover, #hp-bar button:hover { background: #fceff1; }

/* 預覽（螢幕）：只看作答頁／簡答 */
html.hp-view body > *:not(#hp-sheet):not(#hp-bar) { display: none !important; }
html.hp-view body { background: #ece6e7 !important; padding-top: 64px; }
#hp-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; background: #3f161d; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.hp-bar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 210mm; margin: 0 auto; padding: 9px 12px; }
#hp-bar .hp-seg, #hp-bar .hp-secs { display: inline-flex; flex-wrap: wrap; gap: 4px; }
#hp-bar button { border-color: rgba(255,255,255,.4); background: transparent; color: #fff; }
#hp-bar button.on { background: #fff; color: #7a2e3c; border-color: #fff; }
#hp-bar button:hover { background: rgba(255,255,255,.15); }
#hp-bar button.on:hover { background: #fff; }
#hp-bar .hp-go { background: #fff; color: #7a2e3c; border-color: #fff; padding: 4px 20px; }
#hp-bar .hp-sp { flex: 1 1 auto; }
#hp-bar .hp-msg { max-width: 210mm; margin: 0 auto; padding: 0 12px 10px; font-size: .9rem; }
#hp-bar .hp-msg a { color: #ffd9e0; font-weight: 700; margin-left: 6px; }

@media screen {
  #hp-sheet { width: 210mm; max-width: 100%; box-sizing: border-box; margin: 12px auto 40px; padding: 12mm 14mm; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15); }
  #hp-sheet .hp-foot { margin-top: 10mm; }
}
@media screen and (max-width: 640px) {
  html.hp-view body { padding-top: 104px; }
  #hp-sheet { padding: 16px 14px; }
}

/* 版面（螢幕預覽與列印共用） */
#hp-sheet { color: #222; font-size: 11pt; line-height: 1.6; }
#hp-sheet .hp-tbl { width: 100%; border-collapse: collapse; }
#hp-sheet .hp-tbl > * > tr > td { padding: 0; vertical-align: top; }
#hp-sheet .hp-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px;
  border-bottom: 1.5px solid #3f161d; padding: 0 0 4px; margin: 0 0 4mm; font-size: 10.5pt; }
#hp-sheet .hp-head b { color: #3f161d; font-size: 11.5pt; }
#hp-sheet .hp-kind { display: inline-block; border: 1px solid #3f161d; border-radius: 3px; padding: 0 6px; font-size: 9.5pt; font-weight: 700; color: #3f161d; }
#hp-sheet .hp-who { font-size: 10pt; color: #444; white-space: nowrap; }
#hp-sheet .hp-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 8.5pt; color: #666; border-top: 1px solid #bbb; padding-top: 2mm; }
#hp-sheet .hp-foot-gap { height: 10mm; }
#hp-sheet .hp-sec { font-weight: 800; font-size: 12pt; color: #3f161d; margin: 4mm 0 2mm; padding: 1mm 0; border-bottom: 1px solid #d9b8c0; }
#hp-sheet .hp-sub { font-weight: 700; font-size: 10.5pt; color: #7a2e3c; margin: 3mm 0 1mm; }

/* 作答頁每題 */
#hp-sheet .hp-item { display: grid; grid-template-columns: 4.6em 1fr; column-gap: 3mm; padding: 3mm 0 0; border-top: 1px dashed #c9c0c2; }
#hp-sheet .hp-r-sub + .hp-r-item .hp-item, #hp-sheet .hp-r-sec + .hp-r-item .hp-item, #hp-sheet tbody > .hp-r-item:first-child .hp-item { border-top: none; }
/* 題號很長（大考出處題名、情境題類題）：題號自己一列，不壓到題目（2026-11-30） */
#hp-sheet .hp-item.hp-long { grid-template-columns: 1fr; }
#hp-sheet .hp-k.hp-long { grid-template-columns: 13em 1fr; }
#hp-sheet .hp-no { font-weight: 800; color: #3f161d; white-space: nowrap; }
#hp-sheet .hp-stem { min-width: 0; }
#hp-sheet .hp-stem p { margin: 0 0 1.5mm; }
#hp-sheet .hp-stem .note-sm { font-size: 10.5pt; color: #222; }
#hp-sheet .hp-stem .fig { margin: 2mm 0; text-align: center; }
#hp-sheet .hp-stem .fig > svg, #hp-sheet .hp-stem svg.qfig { max-width: 100%; height: auto; }   /* 不可寫成所有 svg：KaTeX 的箭頭也是 svg */
#hp-sheet .hp-stem .katex-display { overflow: visible !important; margin: 1.5mm 0; }
#hp-sheet .hp-space { grid-column: 1 / -1; }
/* 11-27 省紙（老師：一頁有圖至少 2 題、純文字 3～4 題）：圖縮小，一張不扁的圖放題目右邊、作答空白在左欄和圖並排；
   其餘圖放題目下面、整張較矮。尺寸和 handout-print.js 的 SZ 同一組（58／46／38 mm）。 */
#hp-sheet .hp-side .hp-stem { display: flex; align-items: flex-start; gap: 4mm; }
#hp-sheet .hp-side .hp-left { flex: 1 1 auto; min-width: 0; }
#hp-sheet .hp-side .hp-figs { flex: 0 0 auto; max-width: 58mm; }
#hp-sheet .hp-side .hp-figs .fig { margin: 0 0 1mm; }
#hp-sheet .hp-side .hp-figs .fig > svg, #hp-sheet .hp-side .hp-figs svg.qfig, #hp-sheet .hp-side .hp-figs img { max-width: 58mm; max-height: 46mm; width: auto; height: auto; }
#hp-sheet .hp-below .hp-stem .fig > svg, #hp-sheet .hp-below .hp-stem svg.qfig, #hp-sheet .hp-below .hp-stem img { max-height: 38mm; width: auto; height: auto; max-width: 100%; }
#hp-sheet .hp-figrow { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 2mm 6mm; }
#hp-sheet .hp-figrow .fig { margin: 1mm 0; }
#hp-sheet .hp-stem .fig figcaption, #hp-sheet .hp-stem .fig .caption { font-size: 9pt; }
#hp-sheet .hp-grp > .hp-item { border-top: none; }
#hp-sheet .hp-grp > .hp-sec:first-child { margin-top: 2mm; }

/* 範例＝卡片、類題＝輕量（2026-11-12 範例類題區隔方案 C）：作答頁一樣分得出 */
#hp-sheet .hp-item.hp-ex { border: 1.2px solid #5c222b; border-left: 4px solid #5c222b; border-radius: 2mm; padding: 2mm 3mm 0; margin-top: 3mm; }
#hp-sheet .hp-item.hp-ex .hp-no { color: #5c222b; }
#hp-sheet .hp-item.hp-sim { border-top: none; border-left: 1.5px dashed #8a5a26; padding: 2mm 0 0 3mm; margin: 2mm 0 0 4mm; }
#hp-sheet .hp-item.hp-sim .hp-no { color: #8a5a26; font-weight: 600; }

/* 簡答 */
#hp-sheet .hp-keys { display: grid; grid-template-columns: 1fr; }
#hp-sheet .hp-k { display: grid; grid-template-columns: 4.6em 1fr; column-gap: 3mm; padding: 1.4mm 0; border-bottom: 1px dotted #ccc; break-inside: avoid; page-break-inside: avoid; }
#hp-sheet .hp-kn { font-weight: 800; color: #3f161d; white-space: nowrap; }
#hp-sheet .hp-ka { min-width: 0; }
#hp-sheet .hp-ka .katex-display { margin: .5mm 0; overflow: visible !important; }
#hp-sheet .hp-ksub { font-weight: 700; font-size: 10.5pt; color: #7a2e3c; margin: 2.5mm 0 .5mm; }
#hp-sheet svg.ic { width: 1em; height: 1em; vertical-align: -.12em; }

/* 本節重點（2026-11-12）：觀念、公式、重點框照講義樣式，墊白底、框不切頁 */
#hp-sheet .hp-note { padding: 0 0 1.5mm; }
#hp-sheet .hp-note p { margin: 0 0 1.5mm; }
#hp-sheet .hp-note .callout { background: #fff !important; box-shadow: none !important; margin: 1.5mm 0 2.5mm; break-inside: avoid; page-break-inside: avoid; }
#hp-sheet .hp-note .fig { margin: 2mm 0; text-align: center; break-inside: avoid; page-break-inside: avoid; }
#hp-sheet .hp-note .fig > svg { max-width: 100%; height: auto; max-height: 70mm; }
#hp-sheet .hp-note .caption { text-align: center; font-size: 9.5pt; color: #555; margin: -1mm 0 2mm; }
#hp-sheet .hp-note .kw-scroll { overflow: visible !important; }
#hp-sheet .hp-note table { width: 100%; border-collapse: collapse; font-size: 10pt; }
#hp-sheet .hp-note table th, #hp-sheet .hp-note table td { border: 1px solid #ccc; padding: 1mm 1.5mm; vertical-align: top; }
#hp-sheet .hp-note .katex-display { overflow: visible !important; margin: 1.5mm 0; }
#hp-sheet .hp-note .co-title { display: block !important; }   /* 框標題是 flex 排版，行內公式會被拉開 */
#hp-sheet .hp-note .callout .co-li { display: flex; align-items: baseline; }
#hp-sheet .hp-note .callout .co-li.co-sub { padding-left: 1.35em; }
#hp-sheet .hp-note .callout .co-li > .co-mark { flex: 0 0 auto; white-space: pre; }
#hp-sheet .hp-note .callout .co-li > .co-txt { display: block; flex: 1 1 0; min-width: 0; }
#hp-sheet .hp-note .callout br.co-br-hide { display: none; }

/* 直接用瀏覽器列印（Ctrl+P、選單列印）要擋（老師 11-10 裁定）：講義、詳解本、練習本只印一頁提示。
 * 只有頁面自己的列印模式印得出題目：作答頁／簡答（html.hp-on）、練習本題組列印（body.print-one）。
 * 用 @media print 預設隱藏，不靠攔鍵盤；載入本檔的頁面才擋（教學手冊不載入）。 */
@media print {
  html:not(.hp-on) body:not(.print-one) > * { display: none !important; }
  html:not(.hp-on) body:not(.print-one) { background: #fff !important; padding: 0 !important; margin: 0 !important; }
  html:not(.hp-on) body:not(.print-one)::before {
    display: block; margin: 40mm 10mm 0; padding: 10mm; border: 1.5px solid #3f161d; border-radius: 4mm;
    font-size: 14pt; line-height: 1.8; color: #3f161d; text-align: center; white-space: pre-line;
    content: "這一頁不能直接列印。\A講義請用每節標題下的「列印：本節重點／本節作答頁／本節簡答」；\A練習本請用題組的「列印」鈕。\A講解與完整詳解請在線上看。";
  }
}

@page hp { size: A4; margin: 12mm 14mm 8mm; }
@media print {
  .hp-row { display: none !important; }
  html.hp-on body > *:not(#hp-sheet) { display: none !important; }
  html.hp-on body { background: #fff !important; padding: 0 !important; margin: 0 !important; }
  html.hp-on #hp-sheet { display: block !important; page: hp; width: auto; margin: 0; padding: 0; box-shadow: none; }
  #hp-sheet .hp-r-item, #hp-sheet .hp-r-sub, #hp-sheet .hp-r-sec { break-inside: avoid; page-break-inside: avoid; }
  #hp-sheet .hp-r-sub, #hp-sheet .hp-r-sec { break-after: avoid; page-break-after: avoid; }
  #hp-sheet.hp-ws tbody > .hp-r-brk { break-before: page; page-break-before: always; }   /* 作答頁印多節：預設接著排（11-27 省紙）；勾「每節換頁」才換頁 */
  #hp-sheet.hp-both tbody > .hp-r-sec:not(:first-child), #hp-sheet.hp-notes tbody > .hp-r-sec:not(:first-child) { break-before: page; page-break-before: always; }   /* 重點與作答分頁、多節每節換頁 */
  #hp-sheet .hp-r-note { break-inside: avoid; page-break-inside: avoid; }
  #hp-sheet .hp-foot { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; }
  #hp-sheet .hp-tbl > thead { display: table-header-group; }
  #hp-sheet .hp-tbl > tfoot { display: table-footer-group; }
}
