/* Public pages share the Machine font stack and native keyboard focus.
   Area-specific work surfaces and semantic colors remain in their own styles. */
:root {
  --public-ui-font: var(--ui-font, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif);
}

body {
  font-family: var(--public-ui-font);
}

:where(button, input, select, summary) {
  font-family: inherit;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-focus, currentColor);
  outline-offset: 2px;
}

body.workspace-page > .workspace-header.site-nav {
  --workspace-header-height: 40px;
}

.story-navigation > h1:only-child {
  grid-column: 1 / -1;
}

/* SF modal viewport guard; docked non-modal CAD panels are intentionally excluded. */
html[data-public-area="sf"] dialog:modal {
  box-sizing:border-box;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);
  overflow:auto;overscroll-behavior:contain;
}
html[data-public-area="sf"] dialog:modal :where(form,fieldset,section) { min-width:0; }
html[data-public-area="sf"] dialog:modal :where(input:not([type=checkbox]):not([type=radio]),select,textarea) { max-width:100%;min-width:0; }
html[data-public-area="sf"] dialog:modal footer { flex-wrap:wrap; }

/* SF only: local workspace stacking order, no changes to other public areas. */
html[data-public-area="sf"] {
 --sf-layer-canvas:1;--sf-layer-view:10;--sf-layer-panel:30;--sf-layer-menu:60;
}
html[data-public-area="sf"] dialog:modal { max-inline-size:calc(100vw - 16px)!important;max-block-size:calc(100dvh - 16px)!important;min-inline-size:0!important;min-block-size:0!important; }
html[data-public-area="sf"] dialog:modal :where(input,select,textarea,fieldset){box-sizing:border-box;max-inline-size:100%}
html[data-public-area="sf"] :is(.md-commandbar,.cps-ribbon,.cam-commandbar):has(details[open]){position:relative;z-index:var(--sf-layer-menu);overflow:visible}
html[data-public-area="sf"] :is(.md-menu-items,.cps-menu-items,.cam-work-menu-items){z-index:var(--sf-layer-menu)!important;max-inline-size:calc(100vw - 16px);max-block-size:min(65dvh,440px);overflow:auto;overscroll-behavior:contain;box-sizing:border-box}
html[data-public-area="sf"] :is(#md-browser,#cam-browser,.coords-popover){z-index:var(--sf-layer-panel)}
html[data-public-area="sf"] body.cps-page .gear-stage:has(#assembly-dof:not([hidden])) .part-name{display:none}
html[data-public-area="sf"] body.cps-page #assembly-dof{max-block-size:36%;overflow:auto;pointer-events:auto;z-index:var(--sf-layer-view);white-space:normal}
html[data-public-area="sf"] body.cps-page .gear-stage:has(.cps-timeline:not([hidden])) .selection-rail{bottom:calc(72px + 8px)}
@media(max-width:430px){
 html[data-public-area="sf"] body#modeling-workbench.modeling-workbench.nc-practice .md-commandbar{grid-template-rows:auto auto;min-height:0;flex:0 0 auto;align-items:start}
 html[data-public-area="sf"] body#modeling-workbench .md-ribbon-tabs{height:auto!important;min-height:36px;flex-wrap:wrap;overflow:visible!important}
 html[data-public-area="sf"] body#modeling-workbench.modeling-workbench.nc-practice .md-command-group{height:auto;min-height:0;max-height:31dvh;flex-wrap:wrap;overflow:auto;align-content:start;row-gap:4px}
 html[data-public-area="sf"] body#modeling-workbench.modeling-workbench.nc-practice .md-tool-cluster{max-width:100%;min-width:0}
 html[data-public-area="sf"] body#modeling-workbench.modeling-workbench.nc-practice .md-tool-cluster>div{display:flex;flex-wrap:wrap;height:auto;min-height:0;max-width:100%}
 html[data-public-area="sf"] body.cps-page .cps-ribbon-top{flex-wrap:wrap;height:auto;min-height:36px}
 html[data-public-area="sf"] body.cps-page .cps-ribbon-groups{flex-wrap:wrap;height:auto!important;max-height:31dvh;overflow:auto;align-content:start}
 html[data-public-area="sf"] body.cps-page .cps-group{max-width:100%;min-width:0}
 html[data-public-area="sf"] body.cps-page .cps-group>div{flex-wrap:wrap}
 html[data-public-area="sf"] body#cam-workbench.cam-workbench.nc-practice .cam-commandbar{height:auto;min-height:0;flex-wrap:wrap;overflow:visible;flex:0 0 auto}
 html[data-public-area="sf"] .cam-command-group{display:flex;flex-wrap:wrap;min-width:0;max-width:100%}
 html[data-public-area="sf"] body.machine-workspace :is(.suite-shell,#nc-workbench-v3) .nc-commandbar{height:auto!important;min-height:0!important;flex-wrap:wrap!important;overflow:visible!important;padding:4px 8px!important;flex:0 0 auto!important}
 html[data-public-area="sf"] body.machine-workspace .nc-commandbar :is(.approved-command-group,.machine-mode){flex-wrap:wrap;max-width:100%;min-width:0}
 html[data-public-area="sf"] .slicer-toolbar{height:auto;min-height:0;flex-wrap:wrap;overflow:visible}
 html[data-public-area="sf"] .slicer-toolbar .slicer-tool-options{flex-wrap:wrap;min-width:0;max-width:100%}
 html[data-public-area="sf"] :is(.md-menu-items,.cps-menu-items,.cam-work-menu-items){max-inline-size:calc(100vw - 16px)}
}
