/* DSF 서브메뉴 (chapter bar) — compact layout. dsf_web_renual_app v19 (with common/chapterbar-mobile.js)
   Compact mode (class cbm-c, set by the script): the sub-menu is one button — section name, current page, "3 / 9", chevron — that
   stays fixed under the header. Tapping it drops down a panel with every page as an equal tile (3 columns; 2 when there are 4 pages or
   fewer; every tile the same width and height, at least 56px high, 8px apart). The current page is the dark tile; a light backdrop dims
   the page while the panel is open.
   v18: compact mode is used at 900px and below (as before) AND on wider screens whenever the pages do not fit on one line even with
   tighter spacing (class cbm-t first) — so a long sub-menu (e.g. the 9 product families) never scrolls sideways off the screen.
   v19: in compact mode the button and the panel are always the same width — 560px, centred — on every screen and for every
   sub-menu, until the screen is too narrow for that; from then on they fill the width (12px margins). Without the script the
   site's own bar shows. */
.cbm-toggle,.cbm-backdrop{display:none}
/* compact mode */
  body .chapter-bar.cbm.cbm-c{
    display:block!important;overflow:visible!important;overflow-x:visible!important;
    height:auto!important;min-height:0!important;padding:8px 12px!important;
  }
  body .chapter-bar.cbm.cbm-c .cbm-toggle{
    display:flex;align-items:center;gap:10px;width:100%;min-height:48px;margin:0;padding:6px 7px 6px 16px;
    border:1px solid #dbe3e2;border-radius:14px;background:#fff;color:#1d2c35;font:inherit;text-align:left;cursor:pointer;
    box-shadow:0 1px 2px rgba(30,52,64,.05),0 4px 14px rgba(30,52,64,.06);
    -webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:border-color .15s,box-shadow .15s;
  }
  body .chapter-bar.cbm.cbm-c .cbm-toggle:focus-visible{outline:3px solid #e96f3a;outline-offset:2px}
  .cbm-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
  .cbm-sec{font-size:10px;font-weight:800;letter-spacing:.16em;line-height:1.2;color:#e86530}
  .cbm-cur{font-size:15.5px;font-weight:700;letter-spacing:-.02em;line-height:1.25;color:#1d2c35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .cbm-count{flex:none;padding:4px 9px;border-radius:999px;background:#eef3f2;font-size:11.5px;font-weight:600;color:#5d717a;font-variant-numeric:tabular-nums}
  .cbm-chev{flex:none;display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:10px;background:#293f4b;color:#fff;transition:transform .2s,background .15s}
  .cbm-chev svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
  body .chapter-bar.cbm.cbm-c.is-open .cbm-toggle{border-color:#c9d5d4}
  body .chapter-bar.cbm.cbm-c.is-open .cbm-chev{transform:rotate(180deg);background:#e86530}

  /* the page list: hidden until the button is tapped, then a drop-down panel of equal tiles */
  body .chapter-bar.cbm.cbm-c .chapter-bar-track{display:none!important}
  body .chapter-bar.cbm.cbm-c.is-open .chapter-bar-track{
    display:grid!important;grid-template-columns:repeat(var(--cbm-cols,3),minmax(0,1fr));grid-auto-rows:1fr;gap:8px!important;
    position:absolute!important;left:12px;right:12px;top:calc(100% - 4px);z-index:3;
    width:auto!important;min-width:0!important;max-width:none!important;margin:0!important;padding:10px!important;
    justify-content:stretch!important;align-items:stretch!important;
    background:#fff;border:1px solid #dbe3e2;border-radius:18px;box-shadow:0 22px 48px rgba(20,38,48,.22);
    counter-reset:cbm;animation:cbmIn .18s ease-out;
  }
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a{
    position:relative!important;display:flex!important;flex-direction:column;align-items:flex-start;justify-content:flex-end;gap:4px;
    flex:none!important;min-width:0;min-height:62px;height:auto!important;margin:0!important;padding:9px 10px 10px!important;
    border:0!important;border-radius:12px;background:#f2f5f4;
    font-size:12.5px!important;font-weight:600!important;line-height:1.22!important;letter-spacing:-.015em;text-align:left;
    white-space:normal!important;word-break:keep-all;overflow-wrap:anywhere;color:#2f4b58!important;
    -webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:background .15s,color .15s;
    counter-increment:cbm;
  }
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a:before{
    content:counter(cbm,decimal-leading-zero)!important;display:block!important;position:static!important;
    width:auto!important;height:auto!important;margin:0!important;background:none!important;border:0!important;opacity:1!important;transform:none!important;
    font-size:10.5px;font-weight:700;letter-spacing:.08em;color:#9aa9ae;
  }
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a:after{content:none!important;display:none!important}
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a:active{background:#e6ecea}
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a.current,
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a[aria-current="page"]{background:#293f4b;color:#fff!important}
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a.current:before,
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a[aria-current="page"]:before{color:#f4a07a}
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a:focus-visible{outline:3px solid #e96f3a;outline-offset:1px}

  .cbm-backdrop{position:fixed;inset:0;z-index:2040;background:rgba(20,32,38,.32);opacity:0;pointer-events:none;transition:opacity .18s}
  .cbm-backdrop.is-on{display:block;opacity:1;pointer-events:auto}
  @keyframes cbmIn{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}

  /* v19: one width for the button and its panel in compact mode — 560px centred, or the full width (12px margins) when narrower */
  body .chapter-bar.cbm.cbm-c .cbm-toggle{max-width:560px;margin:0 auto}
  body .chapter-bar.cbm.cbm-c.is-open .chapter-bar-track{left:0;right:0;width:min(560px,calc(100% - 24px))!important;margin:0 auto!important}
  /* tighter spacing tried first on wide screens before switching to compact mode */
  body .chapter-bar.cbm.cbm-t:not(.cbm-c) .chapter-bar-track>a{padding-left:15px!important;padding-right:15px!important}
  /* when the pages fit, drop the side padding the site adds for centring a scrolled tab (no sideways scroll) */
  body .chapter-bar.cbm.cbm-wide:not(.cbm-c) .chapter-bar-track{padding-left:0!important;padding-right:0!important;margin-inline:auto!important}

@media (max-width:370px){
  body .chapter-bar.cbm.cbm-c{padding:8px 10px!important}
  body .chapter-bar.cbm.cbm-c.is-open .chapter-bar-track{width:calc(100% - 20px)!important;gap:6px!important;padding:8px!important}
  body .chapter-bar.cbm.cbm-c .chapter-bar-track>a{font-size:12px!important;padding:8px 8px 9px!important}
}
@media (prefers-reduced-motion:reduce){
  body .chapter-bar.cbm.cbm-c.is-open .chapter-bar-track{animation:none}
  .cbm-chev,.cbm-backdrop{transition:none}
}
