{
  "$schema": "https://upstage.ai/design-system/schemas/forbidden-rules/0.1.0",
  "version": "0.6.1",
  "createdAt": "2026-05-21",
  "source": "DESIGN_v2.md §7.8 Forbidden Cross-Use Table",
  "scope": "구현 코드의 fallback / raw literal 한정. §2.1 Primitive · §3-M Marketing Colors · §3-P Component Tokens 등 토큰 정의 표의 hex/HSL/rgba 원값은 source of truth로 예외.",
  "stage": "Stage 1.5 — 사람 / Agent self-check가 유일한 방어선. 6월 Task 2에서 lint/schema hardening 초안을 만들고, 빌드 lint 강제는 Stage 2~3 안착 후 적용.",
  "rules": [
    {
      "id": "P-1",
      "context": "product",
      "forbidden": "var(--ups-purple) 호출",
      "reason": "A5 결정 — marketing 전용",
      "alternative": "보라 필요 시 var(--accent-purple-bg), var(--accent-purple-default), var(--accent-purple-fg) Categorical 3단계 세트 사용",
      "severity": "error"
    },
    {
      "id": "P-2",
      "context": "product",
      "forbidden": "var(--key-palette), var(--key-palette-hover) 직접 호출",
      "reason": "Product 표준 토큰이 따로 있음",
      "alternative": "hsl(var(--primary)) 사용",
      "severity": "error"
    },
    {
      "id": "P-3",
      "context": "product",
      "forbidden": "Marketing Highlight 값 #D2FF95의 Product 혼용",
      "reason": "Product와 Marketing은 Highlight 역할을 공유하되 맥락별 원장과 값은 구분",
      "alternative": "Product의 hsl(var(--highlight))를 목적이 분명한 정보 강조에 사용. 보조 동작과 차트 기본색에서는 제외",
      "severity": "error"
    },
    {
      "id": "P-4",
      "context": "product",
      "forbidden": "var(--ink), var(--ink-*) 직접 호출",
      "reason": "Product 표준 토큰이 따로 있음",
      "alternative": "hsl(var(--foreground)) 또는 hsl(var(--muted-foreground)) 사용",
      "severity": "error"
    },
    {
      "id": "P-5",
      "context": "product",
      "forbidden": "var(--surface-light), var(--surface-purple), var(--hero-bg), var(--dark-surface*) 호출",
      "reason": "marketing/website surface 토큰",
      "alternative": "hsl(var(--background)), hsl(var(--subtle)), hsl(var(--accent)) 사용",
      "severity": "error"
    },
    {
      "id": "P-6",
      "context": "product",
      "forbidden": "var(--marketing-card-*), var(--marketing-btn-*), var(--marketing-input-*) 호출",
      "reason": "Product 컴포넌트는 Product semantic 토큰만",
      "alternative": "Product semantic 토큰만 사용",
      "severity": "error"
    },
    {
      "id": "P-7",
      "context": "product",
      "forbidden": "Raw hex 사용 (예: #5B52FF, #0D0D12)",
      "reason": "drift 원천. 모든 토큰은 semantic 경유",
      "alternative": "hsl(var(--*)) 또는 var(--*) 형식",
      "severity": "error",
      "detectPattern": "#[0-9a-fA-F]{3,8}\\b",
      "exceptionBasis": "location",
      "allowedLocations": [
        {
          "id": "token-definition-block",
          "description": "여는 선택자가 :root 또는 .dark인 블록의 내부 전체. 이 안의 hex는 토큰 원본 값이므로 예외다.",
          "appliesTo": "css",
          "openPattern": "^\\s*(:root|\\.dark)(\\s*,\\s*(:root|\\.dark))*\\s*\\{",
          "closePattern": "^\\s*\\}"
        },
        {
          "id": "custom-property-declaration",
          "description": "--* 커스텀 프로퍼티 선언 줄의 우변. 정의 지점은 한 곳뿐이므로 drift가 생기지 않는다. 블록 밖에 있어도(예: 인라인 style의 --x: #hex) 예외.",
          "appliesTo": "css",
          "linePattern": "^\\s*--[a-z0-9-]+\\s*:"
        },
        {
          "id": "documentation-text",
          "description": "HTML 텍스트 노드·문서 산문 안의 hex. 스타일 값이 아니라 사람이 읽는 표기이며, 아직 토큰이 없는 제안 값을 논의할 때 필요하다. 스펙 카드·결정 문서에 한한다.",
          "appliesTo": "html",
          "note": "style 속성·CSS 선언에는 적용되지 않는다. 그쪽은 위 두 항목으로만 예외가 된다."
        },
        {
          "id": "comment",
          "description": "주석 안의 hex. 계산된 값을 사람이 읽기 쉽게 병기한 것이다.",
          "appliesTo": "any",
          "linePattern": "(/\\*|\\*|//|<!--)"
        }
      ],
      "violationExamples": [
        "color: #5B52FF",
        "background: linear-gradient(90deg, #5B52FF, #7578FF)",
        "style=\"border-color:#E4E4E9\"",
        "fill=\"#0D0D12\""
      ],
      "allowedFiles": [
        "tokens.product.css",
        "tokens.marketing.css",
        "tokens/product.css",
        "tokens/marketing.css"
      ],
      "allowedFilesNote": "보조 조건이다. 토큰 원본 파일은 파일 전체가 정의부이므로 파일 단위로 면제하되, 판정의 1차 기준은 allowedLocations다. 단일 HTML 산출물처럼 토큰 정의와 사용부가 한 파일에 섞인 경우 이 목록을 보지 말고 위치로 판정한다."
    },
    {
      "id": "P-8",
      "context": "product",
      "forbidden": "Fallback hex (예: var(--primary, #5B52FF))",
      "reason": "drift 원천",
      "alternative": "var(--primary) 단독 사용",
      "severity": "error",
      "detectPattern": "var\\(--[^,)]+,\\s*#[0-9a-fA-F]{3,8}\\)"
    },
    {
      "id": "P-9",
      "context": "product",
      "forbidden": "magic z-index (예: z-index: 999999)",
      "reason": "stacking context 충돌, drift 원천",
      "alternative": "var(--z-sticky / --z-popover / --z-modal / --z-toast) 사용",
      "severity": "error",
      "detectPattern": "z-index:\\s*[0-9]{4,}"
    },
    {
      "id": "W-1",
      "context": "website",
      "forbidden": "Product semantic token 직접 호출 (예: hsl(var(--primary)))",
      "reason": "Webflow custom code 영역에서는 marketing 토큰 우선",
      "alternative": "var(--key-palette) 사용",
      "severity": "warning",
      "note": "상호작용 컴포넌트는 Hybrid 결정 트리에 따라 Product semantic 허용"
    },
    {
      "id": "W-2",
      "context": "website",
      "forbidden": "Product Island 외부의 app-style card / table / form 남용",
      "reason": "landing은 marketing 톤. product 컴포넌트는 demo/console 영역만",
      "alternative": "marketing 톤 카드/섹션 사용",
      "severity": "warning"
    },
    {
      "id": "W-3",
      "context": "website",
      "forbidden": "var(--highlight) light surface 남용",
      "reason": "lime green은 dark surface 전용",
      "alternative": "dark surface 또는 Announcement Banner에만 사용",
      "severity": "error",
      "exceptions": [
        "Website Announcement Bar의 --highlight light bg (.web-announcement-bar 한정)"
      ]
    },
    {
      "id": "W-4",
      "context": "website",
      "forbidden": "Raw hex (예: #151727, #5B52FF)",
      "reason": "context token으로 감싸야 함",
      "alternative": "var(--surface-nav), var(--action-primary) 등 Website semantic 사용",
      "severity": "error",
      "detectPattern": "#[0-9a-fA-F]{3,8}\\b",
      "allowedFiles": [
        "tokens.product.css",
        "website.css",
        "components.partners-wash.css"
      ]
    },
    {
      "id": "W-5",
      "context": "website",
      "forbidden": "마케팅 accent(#805CFB / --ups-purple / --accent-purple)를 website 코드에서 사용",
      "reason": "웹사이트는 product 키컬러(#5B52FF / --key-palette)로 통일. #805CFB는 DESIGN.md A5·§2.4에서 marketing 전용 L4 토큰으로 Product/Web UI 사용 금지. 실제 staging CSS도 #5b52ff 108회 vs #805cfb 2회.",
      "alternative": "CTA는 var(--action-primary), eyebrow는 var(--colors--purple-700)",
      "severity": "error",
      "detectPattern": "var\\(\\s*--(accent-purple|ups-purple)\\s*\\)",
      "allowedFiles": [
        "components.css",
        "website.css"
      ]
    },
    {
      "id": "M-1",
      "context": "marketing",
      "forbidden": "Product semantic token (예: hsl(var(--primary)), hsl(var(--background)))",
      "reason": "Marketing은 별도 토큰 체계",
      "alternative": "var(--key-palette), var(--surface-light) 등 marketing 토큰 사용",
      "severity": "error"
    },
    {
      "id": "M-2",
      "context": "marketing",
      "forbidden": "Product Categorical (--color-coral-* 등) 직접 호출",
      "reason": "Marketing은 ups-purple 중심",
      "alternative": "ups-purple, key-palette, highlight 사용",
      "severity": "warning",
      "exceptions": [
        "KV/decorative 영역 (F1.2 — 에셋 내부 hardcode 허용)"
      ]
    },
    {
      "id": "M-3",
      "context": "marketing",
      "forbidden": "Product --secondary* 호환 토큰을 Marketing 버튼에 사용",
      "reason": "Product의 deprecated neutral HSL 호환 토큰은 Marketing 역할이 아니다. Product 보조 동작은 outline/ghost를 사용한다.",
      "alternative": "Marketing CTA는 var(--key-palette)",
      "severity": "error"
    },
    {
      "id": "ALL-1",
      "context": "all",
      "forbidden": "var(--ups-purple) interactive button 배경",
      "reason": "A5 결정 — visual anchor 전용",
      "alternative": "var(--key-palette) (CTA) / 다른 정적 surface 토큰",
      "severity": "error"
    },
    {
      "id": "ALL-2",
      "context": "all",
      "forbidden": "var(--marketing-input-border) / var(--marketing-input-placeholder)를 일반 input에 적용",
      "reason": ".input-underline 전용",
      "alternative": "일반 input은 var(--input)",
      "severity": "error"
    },
    {
      "id": "ALL-3",
      "context": "all",
      "forbidden": "CSS 텍스트 그라데이션 (background-clip: text / -webkit-text-fill-color: transparent)",
      "reason": "§2.2 [2026-05-10 확정] — 컨텍스트 무관 전체 금지. Hero/CTA 포함 예외 없음",
      "alternative": "단색 토큰만 (--foreground, --ink, --ups-purple, --highlight 등)",
      "severity": "error",
      "detectPattern": "(background-clip:\\s*text|-webkit-text-fill-color:\\s*transparent)"
    },
    {
      "id": "ALL-5",
      "context": "all",
      "forbidden": "코드 블록 밖에서 mono 폰트 사용 — var(--web-font-mono) · \"Geist Mono\" · monospace",
      "reason": "eyebrow·kicker·날짜·라벨·수치·배지에 mono를 쓰는 관행이 퍼졌다. 2026-08-21 실측: 라이브 mono 규칙 22개 중 21개가 코드 블록이 아니다(eyebrow·kicker 5 · 라벨 7 · 수치 3 · 날짜 1 · 배지 1 · 기타 4). mono는 '코드다'라는 신호인데 그 신호가 닳는다. website 실측에서 출발했지만 marketing·product 예시에도 같은 관행이 남아 있어 2026-08-21 전 컨텍스트로 확대했다",
      "alternative": "본문 폰트를 쓰고 강조는 다른 축으로 만든다 — eyebrow는 --web-text-sm + --web-weight-medium + letter-spacing, 라벨·배지는 크기와 색, 수치는 --web-weight-semibold. mono는 code · pre · kbd · samp 안에서만",
      "severity": "error",
      "allowedSelectors": [
        "code",
        "kbd",
        "pre",
        "samp"
      ],
      "measured2026-08-21": {
        "monoRules": 22,
        "legit": 1,
        "misuse": 21,
        "offenders": [
          ".article-kicker",
          ".cs-dl-eyebrow",
          ".sh-hero-eyebrow",
          ".sh-cover-kicker",
          ".sh-head-eyebrow",
          ".sh-date",
          ".story-point-label",
          ".cs-dl-card-label",
          ".sh-kind",
          ".sh-fig_dt",
          ".sh-btable_th2",
          ".sh-cc-figs_dt",
          ".sh-partners-label",
          ".mabc26-wf-num",
          ".sp4-from",
          ".sp4-delta",
          ".sh-cc-badge",
          ".chg-arrow",
          ".l_small",
          ".sh-try-go",
          ".sh-res-col_h3"
        ]
      }
    },
    {
      "id": "ALL-4",
      "context": "all",
      "forbidden": "로고·제품 마크를 직접 그리거나 텍스트로 대체하기",
      "reason": "`upstage.`는 워드마크이지 글자가 아니다. <span>upstage.</span>로 찍으면 자간·마침표 위치·비율이 전부 틀어지고, SVG 패스를 손으로 그리면 형태가 어긋난다. 2026-08-21 실측: 병합 스킬 zip에 assets/brand 가 0개라 에이전트가 쓸 파일이 없었다. 자산이 있는데도 안 쓰는 게 아니라, 없어서 그렸던 것이다",
      "alternative": "assets/brand/upstage_lockup_{black,white,color}.svg 를 <img> 로 쓴다. 제품 마크는 assets/product/. 전체 목록은 context/brand-assets-index.md. 번들에 없으면 사용자에게 묻는다",
      "severity": "error",
      "detect": [
        "<span>upstage",
        "텍스트로 조판한 워드마크",
        "직접 작성한 로고 SVG path"
      ],
      "measured2026-08-21": {
        "mergedSkillBrandAssets": 0,
        "bundleBrandAssets": 15,
        "cause": "merge_v1.py ADD 목록에 assets/ 가 없었다"
      }
    },
    {
      "id": "P-SURFACE-1",
      "context": "product",
      "forbidden": "Toast·Banner·알림·카드·인용문 한쪽 면의 장식 강조선/색 띠 (방향별 border, inset shadow, 가상 요소 포함)",
      "reason": "2026-09-18 사용자 디자인 결정: 둥근 표면에 한쪽만 굵은 상태색 선을 사용하지 않는다.",
      "alternative": "균일한 외곽선과 상태 아이콘·문구로 표현한다. 인용문은 장식선 없이 표시한다.",
      "severity": "error",
      "exceptions": [
        "표/레이아웃 구분선",
        "입력 underline",
        "포커스 링",
        "로딩 spinner",
        "차트 데이터 표시"
      ]
    }
  ],
  "exceptions": [
    {
      "id": "EX-1",
      "case": "Website Announcement Bar에 --highlight light bg",
      "reason": "upstage.ai 실측 + 의도된 시각 강조. .web-announcement-bar 한정"
    },
    {
      "id": "EX-2",
      "case": "Hybrid 페이지의 Marketing variant button",
      "reason": "Marketing landing 내 CTA는 --marketing-btn-* OK. 단 동작/접근성 레이어는 Product 표준 (ARIA, focus, keyboard)"
    },
    {
      "id": "EX-3",
      "case": "Marketing KV / decorative graphic의 raw hex",
      "reason": "F1.2 결정 — 에셋 내부 hardcode 허용 (예: .deco-block-*의 #C4B5FD, #805CFB)"
    },
    {
      "id": "EX-4",
      "case": "Product onboarding 그래픽 재사용 (Marketing 영역)",
      "reason": "F1.3 결정 — §6 가드레일 4건 충족 시 허용"
    }
  ],
  "enforcementRoadmap": [
    {
      "stage": "1.5",
      "tool": "PR 리뷰 + Agent self-check",
      "when": "지금 — 자동화 전 1차 방어선"
    },
    {
      "stage": "2",
      "tool": "stylelint custom rule 또는 정규식 grep",
      "target": "raw hex / fallback hex / 매직 z-index 검출",
      "when": "2026-06 Task 2 초안 / 로컬 검증, 2026 Q3 안착 목표"
    },
    {
      "stage": "3",
      "tool": "빌드 파이프라인 lint",
      "target": "컨텍스트별 Forbidden 위반 검출. CI fail / LSP 경고",
      "when": "Stage 2 안착 후"
    },
    {
      "stage": "4",
      "tool": "intent.* resolver 강제",
      "target": "토큰 직접 호출 → resolver 호출로 전환",
      "when": "Q4 검토"
    }
  ]
}
