/* Documentation — VIHEF & Saigon Beerfest (v4: giao diện tối, kiểu tài liệu kỹ thuật) */
@import url("fonts.css");

:root {
  color-scheme: dark;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #14120b;
  --raise: #1b1a13;         /* nền nổi nhẹ: bảng, hộp lưu ý, hover */
  --raise-2: #25241c;       /* nền nổi hơn: dòng nhóm, mục đang chọn */
  --ink: #edecec;           /* màu chính: chữ trắng, nút trắng */
  --ink-2: #cdcbc4;
  --muted: #9b9a92;
  --rule: #2a2920;
  --rule-2: #3d3c32;

  /* Bốn màu công cụ — đây là toàn bộ màu của trang */
  --el: #6aa6ff;            /* Elementor */
  --cms: #3fcf8e;           /* CMS */
  --set: #f5a524;           /* Event → Settings */
  --tech: #a3a297;          /* Nhờ kỹ thuật */
  --accent: var(--ink);     /* màu nhấn của trang: đổi theo công cụ chính */

  --red: #ef4452;           /* số đỏ trên ảnh chụp */
  --focus: #6aa6ff;
  --head-h: 56px;
  --measure: 68ch;
}

body[data-accent="el"] { --accent: var(--el); } body[data-accent="cms"] { --accent: var(--cms); }
body[data-accent="set"] { --accent: var(--set); } body[data-accent="tech"] { --accent: var(--tech); }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--head-h) + 24px); -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink-2);
  font: 400 16px/1.75 var(--font); font-feature-settings: "kern", "calt";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.no-scroll { overflow: hidden; }
b, strong { color: var(--ink); font-weight: 650; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-2); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color .12s; }
a:hover { text-decoration-color: var(--ink); }
img { max-width: 100%; height: auto; display: block; }
::selection { background: rgba(106, 166, 255, .35); color: #fff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, kbd { font: 500 .82em var(--mono); background: var(--raise-2); color: var(--ink); padding: .14em .45em; border-radius: 5px; border: 1px solid var(--rule-2); white-space: nowrap; }
kbd { border-bottom-width: 2px; }
em, i { color: var(--ink); }

.skip { position: fixed; left: 12px; top: -60px; z-index: 200; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 10px; }
.progress { position: fixed; left: 0; top: 0; height: 2px; width: 100%; z-index: 120; pointer-events: none; }
.progress i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: var(--accent); }

/* Thanh trên */
.topbar { position: sticky; top: 0; z-index: 60; height: var(--head-h); display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(20, 18, 11, .84); backdrop-filter: saturate(1.3) blur(14px); -webkit-backdrop-filter: saturate(1.3) blur(14px); border-bottom: 1px solid var(--rule); }
.brand { font-weight: 700; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand span { font-weight: 400; color: var(--muted); margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--rule-2); }
.topbar .spacer { flex: 1; }
.topbar-link { font-size: .88rem; color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; transition: background .12s, color .12s; }
.topbar-link:hover { color: var(--ink); background: var(--raise-2); }
.menu-btn { display: none; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--rule-2); background: var(--raise); color: var(--ink); border-radius: 6px; font: 600 .86rem var(--font); cursor: pointer; }
.menu-btn:hover { background: var(--raise-2); }
.menu-btn:active { background: var(--rule-2); }

/* Khung trang: menu trái dính + nội dung, ngăn bằng một đường kẻ */
.layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); max-width: 1280px; margin: 0 auto; padding: 0 28px; align-items: start; }
.overlay { position: fixed; inset: var(--head-h) 0 0 0; z-index: 48; background: rgba(0, 0, 0, .6); opacity: 0; pointer-events: none; transition: opacity .18s; }
.overlay.on { opacity: 1; pointer-events: auto; }

/* Menu trái */
.side { position: sticky; top: var(--head-h); height: calc(100vh - var(--head-h)); overflow-y: auto; overscroll-behavior: contain; padding: 30px 22px 40px 0; border-right: 1px solid var(--rule); scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent; }
.side h4 { margin: 0 0 12px 10px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.side .nav-item { --t: var(--ink); position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin: 1px 0; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .93rem; line-height: 1.35; transition: background .12s, color .12s; }
.side .nav-item[data-tone="el"] { --t: var(--el); } .side .nav-item[data-tone="cms"] { --t: var(--cms); }
.side .nav-item[data-tone="set"] { --t: var(--set); } .side .nav-item[data-tone="tech"] { --t: var(--tech); }
.side .nav-item .n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--rule-2); color: var(--muted); font-size: .76rem; font-weight: 650; font-variant-numeric: tabular-nums; transition: background .12s, color .12s, border-color .12s; }
.side .ic-home { display: block; width: 15px; height: 15px; }
.side .nav-item:hover { background: var(--raise); color: var(--ink); }
.side .nav-item:hover .n { color: var(--ink); }
.side .nav-item:active { background: var(--raise-2); }
.side .nav-item[aria-current="page"] { background: var(--raise-2); color: var(--ink); font-weight: 650; }
.side .nav-item[aria-current="page"] .n { background: var(--t); border-color: var(--t); color: var(--bg); }
.side .sub { position: relative; margin: 6px 0 16px 22px; padding: 4px 0 4px 20px; }
.side .sub::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 1px; background: var(--rule-2); }
.side .sub a { position: relative; display: block; padding: 8px 8px 8px 0; color: var(--muted); text-decoration: none; font-size: .86rem; line-height: 1.4; transition: color .12s; }
.side .sub a::before { content: ""; position: absolute; left: -21px; top: 50%; width: 3px; height: 0; border-radius: 2px; background: var(--accent); transform: translateY(-50%); transition: height .16s; }
.side .sub a:hover { color: var(--ink); }
.side .sub a.is-active { color: var(--ink); font-weight: 600; }
.side .sub a.is-active::before { height: 20px; }

main { min-width: 0; max-width: 820px; padding: 46px 0 56px 56px; }
.mtoc { display: none; }

/* Chữ */
h1 { font-size: clamp(2rem, 3.6vw, 2.75rem); line-height: 1.12; margin: 0 0 18px; letter-spacing: -.03em; font-weight: 700; color: var(--ink); }
h2 { position: relative; font-size: 1.55rem; margin: 72px 0 14px; padding-top: 26px; border-top: 1px solid var(--rule); line-height: 1.25; letter-spacing: -.02em; font-weight: 650; color: var(--ink); }
h2:first-of-type { margin-top: 52px; }
h3 { font-size: 1.08rem; margin: 34px 0 8px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
h2 .num { display: none; }
h2 .anchor { margin-left: 10px; font-weight: 500; color: var(--rule-2); text-decoration: none; opacity: 0; transition: opacity .12s, color .12s; font-size: 1rem; }
h2:hover .anchor, h2 .anchor:focus-visible { opacity: 1; }
h2 .anchor:hover { color: var(--ink); }
h2.flash, .flash > summary { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: rgba(245, 165, 36, .28); } 100% { background: transparent; } }
p { margin: 0 0 15px; max-width: var(--measure); }
ul, ol { margin: 0 0 18px; padding-left: 1.3em; max-width: var(--measure); }
li { margin: 6px 0; }
li::marker { color: var(--rule-2); }
.lead { font-size: 1.15rem; line-height: 1.65; color: var(--ink-2); max-width: 58ch; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 34px 0; }
.intro { padding: 4px 0 8px; }
.intro h1 { max-width: 16ch; }

/* Nhãn công cụ: chấm vuông màu + chữ */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600; white-space: nowrap; vertical-align: baseline; line-height: 1.3; color: var(--ink-2); }
.tag::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--tech); flex: none; }
.tag-el::before { background: var(--el); } .tag-cms::before { background: var(--cms); }
.tag-set::before { background: var(--set); } .tag-tech::before { background: var(--tech); }

/* Chú giải 4 màu */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin: 22px 0 10px; max-width: 820px; }
.card { padding: 18px 20px 8px; border: 1px solid var(--rule); border-radius: 10px; background: var(--raise); }
.card h3 { margin: 8px 0 4px; font-size: 1.02rem; }
.card p { margin: 0 0 10px; color: var(--muted); font-size: .93rem; }

/* Danh sách trang tiếp theo */
.toc-list { list-style: none; padding: 0; margin: 14px 0 0; max-width: none; border-top: 1px solid var(--rule); }
.toc-list li { margin: 0; border-bottom: 1px solid var(--rule); }
.toc-list a { display: grid; grid-template-columns: 2em 14em 1fr; gap: 6px 14px; align-items: baseline; padding: 14px 6px; text-decoration: none; transition: background .12s, padding .12s; }
.toc-list a:hover { background: var(--raise); padding-left: 14px; }
.toc-list a:active { background: var(--raise-2); }
.toc-list .k { color: var(--muted); font-variant-numeric: tabular-nums; }
.toc-list b { font-weight: 650; }
.toc-list span:last-child { color: var(--muted); font-size: .93rem; }

/* Hộp lưu ý */
.note { padding: 14px 18px; margin: 22px 0; border: 1px solid var(--rule-2); border-radius: 10px; background: var(--raise); max-width: var(--measure); }
.note > :last-child { margin-bottom: 0; }
.note p, .note ul { max-width: none; }
.note strong.t { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 650; color: var(--ink); }
.note strong.t::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--muted); flex: none; }
.note-tip { border-color: rgba(63, 207, 142, .35); } .note-tip strong.t::before { background: var(--cms); }
.note-warn { border-color: rgba(245, 165, 36, .38); } .note-warn strong.t::before { background: var(--set); }
.note-info { border-color: rgba(106, 166, 255, .35); } .note-info strong.t::before { background: var(--el); }

/* Các bước */
ol.steps { list-style: none; counter-reset: s; padding: 0; margin: 18px 0 24px; max-width: var(--measure); }
ol.steps > li { counter-increment: s; position: relative; padding: 2px 0 18px 46px; margin: 0; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 28px; height: 28px; border: 1px solid var(--rule-2); border-radius: 50%; color: var(--ink); font: 650 .84rem/26px var(--font); text-align: center; background: var(--raise); }
ol.steps > li::after { content: ""; position: absolute; left: 13.5px; top: 34px; bottom: 6px; width: 1px; background: var(--rule-2); }
ol.steps > li:last-child::after { display: none; }

/* Ảnh minh hoạ */
figure.shot { margin: 26px 0 34px; max-width: none; }
figure.shot .img { position: relative; display: block; cursor: zoom-in; aspect-ratio: 1568 / 710; border: 1px solid var(--rule-2); border-radius: 10px; overflow: hidden; background: var(--raise); text-decoration: none; transition: border-color .12s, box-shadow .12s; }
figure.shot .img:hover { border-color: var(--muted); box-shadow: 0 0 0 4px rgba(255, 255, 255, .04); }
figure.shot .img::after { content: "Bấm để phóng to"; position: absolute; right: 10px; bottom: 10px; padding: 4px 10px; border-radius: 6px; background: var(--ink); color: var(--bg); font: 600 .78rem var(--font); opacity: 0; transition: opacity .15s; pointer-events: none; }
figure.shot .img:hover::after, figure.shot .img:focus-visible::after { opacity: 1; }
figure.shot img { width: 100%; height: 100%; object-fit: cover; }
figure.shot figcaption { padding: 14px 0 0; font-size: .95rem; }
figure.shot figcaption b.cap { display: block; font-size: 1rem; margin-bottom: 6px; }
figure.shot figcaption p { color: var(--muted); font-size: .92rem; }
ol.callouts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: c; max-width: var(--measure); }
ol.callouts li { position: relative; padding-left: 36px; margin: 0; counter-increment: c; }
ol.callouts li::before { content: counter(c); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; font: 650 .8rem/24px var(--font); text-align: center; }
ol.callouts li[data-n]::before { content: attr(data-n); }

/* Bảng */
.table-wrap { overflow-x: auto; margin: 18px 0 28px; border: 1px solid var(--rule); border-radius: 10px; background: var(--bg); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: .84rem; font-weight: 600; color: var(--muted); white-space: nowrap; background: var(--raise); }
tbody tr { transition: background .1s; }
tbody tr:hover td:not(.group) { background: var(--raise); }
tr:last-child td { border-bottom: 0; }
td.group { padding: 10px 16px; font-weight: 650; font-size: .9rem; background: var(--raise-2); color: var(--ink); }
td a { font-weight: 600; white-space: nowrap; }

/* Ô tìm và bộ lọc */
.finder { position: sticky; top: var(--head-h); z-index: 20; margin: 26px 0 0; padding: 14px 0 12px; background: var(--bg); border-bottom: 1px solid var(--rule); }
.search-box { position: relative; max-width: 560px; }
.search-box svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search { width: 100%; height: 46px; padding: 0 88px 0 42px; border: 1px solid var(--rule-2); border-radius: 8px; font: 500 .98rem var(--font); background: var(--raise); color: var(--ink); transition: border-color .12s, box-shadow .12s; }
.search::placeholder { color: var(--muted); font-weight: 400; }
.search:hover { border-color: var(--muted); }
.search:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 255, 255, .12); outline: none; }
.search::-webkit-search-cancel-button { display: none; }
.search-box .clear { position: absolute; right: 44px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-size: .95rem; display: none; }
.search-box .clear:hover { background: var(--raise-2); color: var(--ink); }
.search-box.has-value .clear { display: block; }
.search-box kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-top: 12px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: 600 .9rem var(--font); cursor: pointer; transition: color .12s, border-color .12s; }
.chip .dot { width: 9px; height: 9px; border-radius: 2px; background: var(--ink); flex: none; }
.chip[data-f="el"] .dot { background: var(--el); } .chip[data-f="cms"] .dot { background: var(--cms); }
.chip[data-f="set"] .dot { background: var(--set); } .chip[data-f="tech"] .dot { background: var(--tech); }
.chip[data-f="all"] .dot { display: none; }
.chip:hover { color: var(--ink); }
.chip:active { color: var(--ink); border-bottom-color: var(--rule-2); }
.chip[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.result-count { margin-left: auto; color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.empty { padding: 40px 0; border-bottom: 1px solid var(--rule); color: var(--muted); }
.empty b { display: block; margin-bottom: 4px; font-size: 1.05rem; }
.hidden { display: none !important; }
.qa-tools { display: flex; gap: 22px; margin: 8px 0 6px; }

/* Bản đồ trang chủ */
.map { margin: 18px 0 26px; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; counter-reset: band; }
.band { display: grid; grid-template-columns: 2em 1fr auto; gap: 14px; align-items: baseline; padding: 14px 16px 14px 14px; border-bottom: 1px solid var(--rule); border-left: 3px solid var(--el); counter-increment: band; transition: background .1s; }
.band:last-child { border-bottom: 0; }
.band:hover { background: var(--raise); }
.band::before { content: counter(band); color: var(--muted); font-variant-numeric: tabular-nums; }
.band b { display: block; }
.band small { color: var(--muted); font-size: .92rem; }
.band.fixed { border-left-color: var(--tech); }

/* FAQ */
.qa { border-bottom: 1px solid var(--rule); }
.qa:first-of-type { border-top: 1px solid var(--rule); }
.qa summary { cursor: pointer; padding: 16px 40px 16px 8px; font-weight: 650; color: var(--ink); list-style: none; position: relative; transition: background .1s; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary:hover { background: var(--raise); }
.qa summary::after { content: ""; position: absolute; right: 10px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); transition: transform .18s; }
.qa[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.qa > div { padding: 0 8px 16px; max-width: var(--measure); }

/* Chuyển trang cuối bài */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 80px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--rule-2); border-radius: 10px; text-decoration: none; transition: border-color .12s, background .12s; }
.pager a:hover { border-color: var(--ink); background: var(--raise); }
.pager a:active { background: var(--raise-2); }
.pager a small { display: block; color: var(--muted); font-size: .84rem; }
.pager a b { display: block; font-size: 1.05rem; margin-top: 2px; }
.credit { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--rule); color: var(--muted); font-size: .9rem; text-align: center; }
.credit a { color: var(--ink-2); font-weight: 600; text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.credit a:hover { color: var(--ink); text-decoration-color: currentColor; }
.pager a.next { text-align: right; grid-column: 2; }
.pager a.prev { grid-column: 1; }

/* Lên đầu trang + thông báo nhỏ */
.to-top { position: fixed; right: 24px; bottom: 24px; z-index: 55; width: 42px; height: 42px; border-radius: 8px; border: 1px solid var(--rule-2); background: var(--raise); color: var(--ink); cursor: pointer; display: grid; place-items: center; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s, transform .18s, background .12s; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 300; transform: translate(-50%, 14px); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Xem ảnh phóng to */
.lb { position: fixed; inset: 0; z-index: 250; display: none; flex-direction: column; background: rgba(12, 11, 7, .96); }
.lb.open { display: flex; }
.lb-bar { display: flex; align-items: center; gap: 14px; padding: 12px 22px; border-bottom: 1px solid var(--rule); color: var(--ink); font-size: .92rem; }
.lb-bar .cap { flex: 1; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-bar .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-stage { position: relative; flex: 1; display: grid; place-items: center; padding: 18px 72px 24px; min-height: 0; }
.lb-stage img { max-width: 100%; max-height: 100%; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--raise); }
.lb-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--raise); color: var(--ink); cursor: pointer; font-size: 1.15rem; transition: background .12s, color .12s; }
.lb-btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.lb-btn:active { background: var(--ink-2); }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-prev { left: 16px; } .lb-next { right: 16px; }

/* Máy tính bảng và điện thoại */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; padding: 0 20px; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 14px; }
  main { padding: 28px 0 50px; max-width: none; }
  .side { position: fixed; z-index: 55; top: var(--head-h); left: 0; bottom: 0; height: auto; width: min(310px, 86vw); background: var(--bg); padding: 22px 20px 40px; border-right: 1px solid var(--rule-2); transform: translateX(-102%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; }
  .side.open { transform: none; visibility: visible; transition: transform .22s ease; }
  .mtoc { display: block; margin: 0 0 8px; border: 1px solid var(--rule); border-radius: 10px; background: var(--raise); }
  .mtoc summary { cursor: pointer; padding: 12px 16px; font-weight: 650; color: var(--ink); font-size: .94rem; list-style: none; display: flex; justify-content: space-between; }
  .mtoc summary::-webkit-details-marker { display: none; }
  .mtoc summary::after { content: ""; width: 8px; height: 8px; margin: 5px 2px 0 0; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .18s; }
  .mtoc[open] summary::after { transform: rotate(-135deg); margin-top: 9px; }
  .mtoc nav { display: grid; padding: 0 8px 10px; }
  .mtoc a { padding: 8px 10px; border-left: 2px solid var(--rule-2); text-decoration: none; color: var(--muted); font-size: .94rem; }
  .mtoc a.is-active { color: var(--ink); font-weight: 600; border-left-color: var(--accent); }
  .toc-list a { grid-template-columns: 1.8em 1fr; }
  .toc-list span:last-child { grid-column: 2; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .brand span { display: none; }
  .band { grid-template-columns: 1.6em 1fr; }
  .band .tag { grid-column: 2; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next, .pager a.prev { grid-column: 1; text-align: left; }
  .lb-stage { padding: 12px 10px 18px; }
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
  h2 { font-size: 1.38rem; margin-top: 58px; }
  .to-top { right: 14px; bottom: 14px; }
  td a { white-space: normal; }
  .chips { gap: 4px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  :root { color-scheme: light; --bg: #fff; --raise: #f4f4f5; --raise-2: #eceef0; --ink: #111; --ink-2: #222; --muted: #555; --rule: #ddd; --rule-2: #bbb; }
  .topbar, .side, .pager, .menu-btn, .to-top, .progress, .finder, .overlay, .mtoc, .skip, .toast, .lb { display: none !important; }
  .layout { display: block; padding: 0; }
  main { padding: 0; }
  figure.shot, .note, .qa, .band { break-inside: avoid; }
  details > div { display: block; }
}
