/*
 * ss-base — Studio 화면의 전역 기본값 (ss = shadcn-studio). 설계 §5.3, §11.
 *
 * 가장 낮은 layer다. 4단계 철거 뒤에는 문서 뿌리(.ss-app)·전역 리셋·포커스·44px를 여기서 정한다. 그래프 CSS(ss-graph)와
 * 컴포넌트·화면 배치가 그 위에서 이긴다. 새 마크업에만 필요한 리셋은 .ss-scope(새로 쓴 화면의 컨테이너, 검토 갤러리의 body) 안이다.
 * !important는 layer 순서가 뒤집혀 가장 낮은 layer가 가장 강하다. [hidden]과 reduced-motion에만 쓴다.
 */
@layer ss-base {
  [hidden] { display: none !important; }

  /* 문서 기본값. 4단계 철거 전에는 운영 styles.css(:root·*·body·button·h1-h4,p)와 파일럿 studio-admin.css(body.studio-admin)가
     정하던 값이다(같은 값). 토큰이 .ss-app(body)에 선언돼 있어 글꼴·글자색·바탕은 html이 아니라 body에 둔다. 그래서 html은
     기본값이고, 캔버스 바탕은 body 바탕이 퍼진다(설계 §15). */
  * { box-sizing: border-box; }
  .ss-app {
    max-width: 100%;
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    color: var(--ss-foreground);
    background: var(--ss-background);
    font-family: var(--ss-font-sans);
    line-height: 1.5;
  }
  :where(.ss-app) :where(button, input, select, textarea) { font: inherit; }
  :where(.ss-app) :where(h1, h2, h3, h4, p) { margin-top: 0; }
  :where(.ss-app) :where(button) { cursor: pointer; }
  :where(.ss-app) :where(button:disabled) { cursor: not-allowed; }
  :where(.ss-app) :where(button[aria-busy="true"]) { cursor: progress; }

  /* 유일한 포커스 표시. 컴포넌트는 outline을 선언하지 않는다(테스트). 운영 components.css와 같은 값이다. */
  :focus-visible { outline: 3px solid var(--ss-ring); outline-offset: 3px; }

  /* 조작 영역 44px. 운영 components.css와 같은 하한이다. */
  :where(button, input, select, textarea) { min-height: 44px; }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
  }

  .ss-scope {
    color: var(--ss-foreground);
    background: var(--ss-background);
    font-family: var(--ss-font-sans);
    line-height: 1.5;
  }
  .ss-scope, .ss-scope *, .ss-scope *::before, .ss-scope *::after { box-sizing: border-box; }
  .ss-scope :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dd, figure, pre, fieldset) { margin: 0; }
  /* 4단계: 원문 JSON·오류 응답(pre)은 고정폭으로 줄을 바꾼다. 안의 code는 pre 글꼴을 따른다. 글 속 인라인 code는 UA monospace
     그대로다(자가 진단 설명문이 이미 그렇게 그려진다). fieldset·legend는 UA 테두리·여백을 지운다. */
  .ss-scope :where(pre) { font-family: var(--ss-font-mono); font-size: .8125rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
  .ss-scope :where(pre code) { font: inherit; }
  .ss-scope :where(fieldset) { min-width: 0; padding: 0; border: 0; }
  .ss-scope :where(legend) { padding: 0; }
  .ss-scope :where(button, input, select, textarea) { font: inherit; color: inherit; }
  /* shadcn-studio 문서의 Cursor 권고. */
  .ss-scope :where(button:not(:disabled), [role="button"], [role="tab"], [role="menuitem"], [role="option"], label[for], select:not(:disabled)) { cursor: pointer; }

  /* 그래프 번들(app/src/flow, React Flow)이 그리는 조작 요소. data-slot이 없어 컴포넌트 규칙이 닿지 않는다. 4단계 철거 전 운영
     styles.css의 button·input·label 기본값이 칠하던 모양(여백·테두리·굵기·비활성·위 여백)을 같은 값으로 둔다(색은 뺀다).
     그래프 CSS(ss-graph)와 pages/network.css(ss-pages)는 이 layer 위라 같은 속성을 정하면 이긴다. 그래서 여기 선언은 그래프 CSS가
     정하지 않는 속성만 효과가 있다(색은 pages/network.css가 칠한다). 위 ss-scope 폼 리셋보다 뒤에 둔다. */
  .network-flow-shell :where(button) { padding: .6rem .9rem; border-width: 1px; border-style: solid; border-radius: .5rem; font-weight: 700; }
  .network-flow-shell :where(button:disabled) { cursor: not-allowed; opacity: .65; }
  .network-flow-shell :where(input, select, textarea) { width: 100%; margin-top: .35rem; padding: .65rem .75rem; border-width: 1px; border-style: solid; border-radius: .5rem; }
  .network-flow-shell :where(label) { display: block; font-size: .9rem; font-weight: 650; }

  /* Tailwind sr-only. 화면에서는 감추고 보조 기술에는 읽힌다. */
  .ss-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}
