/* Shared, physical chapter tabs. Existing page controllers own their position. */
.material-page.has-chapter-navigation :is(.chapter-bar,.method-rail) {
  padding:8px max(24px,4.25vw) 10px; height:76px; background:#191919;
  color:#f2f2f2; border:0; box-shadow:0 -1px 0 #ffffff24;
}
.material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner) {
  position:relative; display:grid; grid-template-columns:repeat(var(--chapter-count,7),minmax(0,1fr));
  gap:8px; width:100%; height:100%; margin:0; padding:0; max-width:none;
}
.material-page.has-chapter-navigation .method-rail-inner { --chapter-count:6; }
.material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner)>a {
  display:flex; position:relative; justify-content:center; align-items:center; gap:10px;
  min-width:0; min-height:48px; padding:10px 8px; margin:0;
  border:0; background:transparent; color:#ccc; box-shadow:none;
  font:600 clamp(14px,1.12vw,18px)/1.15 var(--site-font); text-align:center; text-decoration:none;
  transition:background .18s,color .18s,translate .18s,box-shadow .18s;
}
.material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner)>a[aria-current] {
  color:#191919; background:#f2f2f2; box-shadow:3px 3px 0 #ff6f61; translate:0 -1px;
}
.material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner)>a:focus-visible {
  outline:2px solid #ff6f61; outline-offset:-4px;
}
.material-page.has-chapter-navigation .rail-number { font-size:12px; color:inherit; opacity:.65; }
.material-page.has-chapter-navigation :is(.rail-dot,.chapter-current) { display:none; }
.material-page.has-chapter-navigation :is(.chapter-indicator,.method-rail-progress) { height:2px; bottom:-10px; opacity:.8; pointer-events:none; }
.material-page.has-chapter-navigation .chapter-dock { display:none; }
.chapter-dock>:not(.chapter-disclosure) { display:none!important; }
.chapter-disclosure { position:relative; width:100%; max-width:680px; margin-inline:auto; }
.chapter-trigger {
  position:relative; width:100%; display:grid; grid-template-columns:minmax(0,1fr) 28px; gap:4px 18px;
  min-height:66px; padding:10px 18px; margin:0; border:1px solid #6b6b6b; border-radius:0;
  background:#242424; color:#fff; box-shadow:3px 3px 0 #ff6f61; text-align:left;
  font-family:var(--site-font); cursor:pointer; transition:background .18s,box-shadow .18s;
}
.chapter-trigger-label { grid-column:1; font-size:12px; font-weight:400; line-height:1.2; color:#bbb; letter-spacing:.025em; }
.chapter-trigger-title { grid-column:1; font-size:20px; font-weight:600; line-height:1.15; letter-spacing:-.015em; }
.chapter-chevron { grid-column:2; grid-row:1/3; align-self:center; justify-self:center; width:10px; height:10px; border-top:2px solid currentColor; border-left:2px solid currentColor; rotate:45deg; transition:rotate .2s; }
.chapter-trigger[aria-expanded="true"] { background:#191919; border-top-color:#191919; }
.chapter-trigger[aria-expanded="true"] .chapter-chevron { rotate:225deg; }
.chapter-dock .chapter-trigger:focus-visible { outline:2px solid #ff6f61; outline-offset:-5px; }
.chapter-panel {
  position:absolute; z-index:1; left:0; right:0; bottom:100%; padding:8px;
  max-height:min(470px,var(--chapter-list-room,60dvh)); overflow:auto; overscroll-behavior:contain;
  background:#f2f2f2; color:#191919; border:1px solid #191919; border-bottom:0;
  box-shadow:3px 0 0 #ff6f61,0 -12px 32px #0003; transform-origin:bottom; scrollbar-width:thin;
}
.chapter-panel[hidden] { display:none!important; }
.chapter-list { list-style:none; margin:0; padding:0; display:grid; gap:4px; }
.chapter-list li { margin:0; padding:0; }
.chapter-list a {
  display:grid; grid-template-columns:28px minmax(0,1fr) 22px; align-items:center; gap:12px;
  min-height:54px; padding:12px 14px; border:0; border-radius:0; margin:0; color:inherit;
  font:600 19px/1.2 var(--site-font); text-decoration:none; background:transparent;
  transition:background .16s,box-shadow .16s,translate .16s;
}
.chapter-list a[aria-current] { color:#fff; background:#191919; box-shadow:3px 0 0 #ff6f61; }
.chapter-list-number { color:#6b6b6b; font-size:12px; font-weight:400; font-variant-numeric:tabular-nums; }
.chapter-list a[aria-current] .chapter-list-number { color:#ff6f61; }
.chapter-list-marker { font-size:19px; font-weight:400; justify-self:end; opacity:0; }
.chapter-list a[aria-current] .chapter-list-marker { opacity:1; color:#ff6f61; }
.chapter-dock .chapter-list a:focus-visible { outline:2px solid #b8453b; outline-offset:-4px; }
.chapter-dock .chapter-list a[aria-current]:focus-visible { outline-color:#ff6f61; }
@media(hover:hover) and (pointer:fine) {
  .material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner)>a:hover { background:#333; color:#fff; translate:0 -2px; box-shadow:2px 2px 0 #777; }
  .material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner)>a[aria-current]:hover { background:#fff; color:#191919; box-shadow:4px 4px 0 #ff6f61; }
  .chapter-trigger:hover { background:#303030; box-shadow:4px 4px 0 #ff6f61; }
  .chapter-list a:hover { background:#dfdfdf; box-shadow:2px 2px 0 #aaa; translate:0 -1px; }
  .chapter-list a[aria-current]:hover { color:#fff; background:#303030; box-shadow:3px 0 0 #ff6f61; }
  .chapter-list a:hover .chapter-list-marker { opacity:1; }
}
.material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner)>a:active { translate:1px 1px; box-shadow:none; }
.chapter-trigger:active { box-shadow:1px 1px 0 #ff6f61; }
.chapter-list a:active { translate:1px 1px; box-shadow:none; }
@media(max-width:900px) {
  :root { --mobile-dock-height:calc(88px + env(safe-area-inset-bottom,0px)); }
  .material-page.has-chapter-navigation { --rail-height:var(--mobile-dock-height); --chapter-height:var(--mobile-dock-height); }
  .material-page.has-chapter-navigation :is(.chapter-bar,.method-rail) { display:none; }
  .material-page.has-chapter-navigation .chapter-dock {
    position:fixed; z-index:45; inset:auto 0 0; width:100%; height:var(--mobile-dock-height);
    display:flex; align-items:flex-start; gap:0; padding:8px max(20px,env(safe-area-inset-right,0px)) calc(12px + env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px));
    margin:0; background:#191919; color:#fff; border:0; box-shadow:0 -1px 0 #ffffff24;
  }
  .material-page.has-chapter-navigation .chapter-dock::before { display:none; }
  .material-page.has-chapter-navigation :is(.site-footer,.method-footer) { padding-bottom:calc(var(--mobile-dock-height) + 36px); }
  html { scroll-padding-bottom:calc(var(--mobile-dock-height) + 20px); }
}
@media(max-height:500px) and (max-width:900px) {
  :root { --mobile-dock-height:calc(66px + env(safe-area-inset-bottom,0px)); }
  .material-page.has-chapter-navigation .chapter-dock { padding-top:5px; padding-bottom:calc(9px + env(safe-area-inset-bottom,0px)); }
  .chapter-trigger { min-height:50px; padding-block:7px; grid-template-columns:auto minmax(0,1fr) 24px; align-items:center; gap:14px; }
  .chapter-trigger-label { grid-column:1; }
  .chapter-trigger-title { grid-column:2; font-size:18px; }
  .chapter-chevron { grid-column:3; grid-row:1; }
  .chapter-list a { min-height:48px; padding-block:10px; font-size:18px; }
}
@media(prefers-reduced-motion:reduce) {
  .material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner)>a,
  .chapter-trigger,.chapter-chevron,.chapter-list a { transition:none; }
  .material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner)>a,
  .material-page.has-chapter-navigation :is(.chapter-links,.method-rail-inner)>a:is(:hover,:active,[aria-current]),
  .chapter-dock .chapter-list a { translate:none; }
}
