/* auth.hj4.it (Authelia 4.39) — com_setting/webdoc/runbook-2.0.0 토큰을 입힌 테마.
 *
 * Authelia 에는 커스텀 CSS 기능이 없다. 이 파일은 nginx 가
 *   - location = /theme.css 로 내보내고
 *   - location / 의 sub_filter 가 index.html <head> 끝에 <link> 를 끼워 넣어
 * 원본 스타일시트 뒤에 붙는다 (선택자 특이도가 같으므로 나중 것이 이긴다).
 *
 * CSP 가 style-src 'self' 라 반드시 "같은 오리진의 외부 파일" 이어야 한다 —
 * 인라인 <style> 은 nonce 를 붙일 수 없어 차단된다. 웹폰트도 default-src 'self' 라
 * 외부 CDN 에서 못 받는다. 그래서 폰트는 기기에 설치된 것만 이름으로 부른다.
 *
 * 4.39 프론트는 Tailwind v4 + shadcn 토큰이라 색이 전부 변수 뒤에 있다.
 * 그래서 여기서는 [data-theme=*] 의 변수만 덮는다 — 클래스에는 손대지 않는다.
 * 업그레이드로 변수 이름이 바뀌면 화면이 깨지는 게 아니라 원래 색으로 돌아갈 뿐이다.
 * data-theme 은 JS 가 <html> 에 넣는다 (theme: 'auto' 면 light/dark 로 풀린다).
 * grey 는 일부러 남겨 둔다 — 무채색 선택지 자체가 목적인 테마다.
 *
 * 토큰 대응: shadcn --primary <- runbook --accent, shadcn --accent 는 브랜드색이 아니라
 * "호버 바탕" 이라 runbook --n2 로 간다. 이름이 아니라 쓰임으로 맞춘 것이다.
 */

/* ── 라이트 = runbook 라이트 (n0 종이 / n7 잉크 / accent #1f4fd1) ─────────── */
:root[data-theme="light"] {
  --background: #ffffff;              /* n0 */
  --foreground: #2a2a27;              /* n7 */
  --card: #ffffff;                    --card-foreground: #2a2a27;
  --popover: #ffffff;                 --popover-foreground: #2a2a27;
  --primary: #1f4fd1;                 --primary-foreground: #ffffff;
  --secondary: #16389a;               --secondary-foreground: #ffffff;
  --muted: #f7f7f5;                   /* n1 */
  --muted-foreground: #6f6f6a;        /* n5 */
  --accent: #ededea;                  /* n2 — 호버 바탕 */
  --accent-foreground: #2a2a27;
  --destructive: #b42318;             --destructive-foreground: #ffffff;
  --success: #1a7f37;                 --success-foreground: #2a2a27;
  --warning: #9a5b00;                 --warning-foreground: #2a2a27;
  --info: #1f4fd1;                    --info-foreground: #ffffff;
  --border: #d9d9d4;                  /* n3 헤어라인 */
  --input: #d9d9d4;
  --divider: #d9d9d4;
  --ring: #1f4fd1;
  --custom-icon: #1f4fd1;
  --custom-loading-bar: #1f4fd1;
}

/* ── 다크 = runbook 다크 (n0 #15171a / n7 #e0e3e8 / accent #8ab0ff) ───────── */
:root[data-theme="dark"] {
  --background: #15171a;              /* n0 */
  --foreground: #e0e3e8;              /* n7 */
  --card: #1b1e22;                    --card-foreground: #e0e3e8;   /* n1 */
  --popover: #1b1e22;                 --popover-foreground: #e0e3e8;
  --primary: #8ab0ff;                 --primary-foreground: #15171a; /* 밝은 파랑 위엔 어두운 글자 */
  --secondary: #5d8ae6;               --secondary-foreground: #15171a;
  --muted: #23272c;                   /* n2 */
  --muted-foreground: #9ca3ae;        /* n5 */
  --accent: #23272c;                  --accent-foreground: #e0e3e8;
  --destructive: #f37a6a;             --destructive-foreground: #15171a;
  --success: #5cc46f;                 --success-foreground: #e0e3e8;
  --warning: #e2aa35;                 --warning-foreground: #e0e3e8;
  --info: #8ab0ff;                    --info-foreground: #15171a;
  --border: #333840;                  /* n3 */
  --input: #333840;
  --divider: #333840;
  --ring: #8ab0ff;
  --custom-icon: #8ab0ff;
  --custom-loading-bar: #8ab0ff;
}

/* ── oled = 다크와 같은 색, 바탕만 순수 검정 ──────────────────────────────── */
:root[data-theme="oled"] {
  --background: #000000;
  --foreground: #e0e3e8;
  --card: #0d0f11;                    --card-foreground: #e0e3e8;
  --popover: #0d0f11;                 --popover-foreground: #e0e3e8;
  --primary: #8ab0ff;                 --primary-foreground: #000000;
  --secondary: #5d8ae6;               --secondary-foreground: #000000;
  --muted: #15171a;                   --muted-foreground: #9ca3ae;
  --accent: #15171a;                  --accent-foreground: #e0e3e8;
  --destructive: #f37a6a;             --destructive-foreground: #000000;
  --success: #5cc46f;                 --success-foreground: #e0e3e8;
  --warning: #e2aa35;                 --warning-foreground: #e0e3e8;
  --info: #8ab0ff;                    --info-foreground: #000000;
  --border: #23272c;
  --input: #23272c;
  --divider: #23272c;
  --ring: #8ab0ff;
  --custom-icon: #8ab0ff;
  --custom-loading-bar: #8ab0ff;
}

/* 원본 body 는 Roboto/Helvetica/Arial 로 못 박혀 있어 한글이 기기 기본 폰트로 떨어진다.
   runbook 의 --sans 와 같은 스택으로 바꾼다. 전부 "설치돼 있으면 쓰는" 로컬 폰트라
   외부 요청이 없다 (CSP font-src 는 default-src 'self'). */
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, system-ui,
               "Apple SD Gothic Neo", "Noto Sans KR", Roboto, Helvetica, Arial, sans-serif;
}
