/* ============================================================
   Beacon — 디자인 토큰 (명세서 §2 단일 진실 공급원)
   모든 색·타이포·간격은 이 파일의 변수만 참조한다. 하드코딩 금지.
   ============================================================ */

/* ---------- 폰트 (오프라인 번들 — 런타임 로딩 금지) ---------- */
@font-face {
  font-family: 'IBM Plex Sans KR';
  src: url('../fonts/IBMPlexSansKR-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans KR';
  src: url('../fonts/IBMPlexSansKR-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans KR';
  src: url('../fonts/IBMPlexSansKR-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/IBMPlexMono-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/IBMPlexMono-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/IBMPlexMono-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  /* ---------- §2.1 색상 (다크 기본) ---------- */
  --bg:            #0D1117;
  --bg-canvas:     #0F1318;
  --surface:       #161B22;
  --surface2:      #1C2128;
  --border:        #21262D;
  --border-strong: #30363D;
  --border-hover:  #3A4250;
  --text-primary:  #E6EDF3;
  --text-body:     #C9D1D9;
  --text-secondary:#8B949E;
  --text-tertiary: #6E7681;
  --accent-info:   #58A6FF;

  /* 위험 레벨 4색 — 면(fill) / 다크 배경 위 텍스트 / 배지 위 텍스트 */
  --green-fill:    #2E7D32;
  --green-text:    #7BC67E;
  --green-on:      #FFFFFF;
  --yellow-fill:   #F9A825;
  --yellow-text:   #F9C74F;
  --yellow-on:     #1F1500;
  --red-fill:      #C62828;
  --red-text:      #F08080;
  --red-on:        #FFFFFF;
  --black-fill:    #212121;
  --black-border:  #3A3F46;
  --black-text:    #C9D1D9;
  --black-on:      #E6EDF3;

  --red-hover:     #A82020;
  --red-tint:      rgba(198, 40, 40, 0.10);
  --yellow-tint:   rgba(249, 168, 37, 0.08);
  --yellow-tint-border: rgba(249, 168, 37, 0.55);
  --green-tint:    #16301F;
  --yellow-chip-tint: #332907;

  /* 비상 모드 배경 */
  --bg-emergency:  #080A0D;

  /* 지도 다크 타일 */
  --map-bg:        #0E141B;
  --map-road:      #1C2733;
  --map-water:     #10202E;

  /* ---------- §2.2 타이포그래피 ---------- */
  --font-sans: 'IBM Plex Sans KR', 'Noto Sans KR', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

  /* ---------- §2.3 간격·모서리·크기 ---------- */
  --pad-screen: 15px;        /* 모바일 좌우 패딩 14~16 */
  --pad-screen-desktop: 22px;
  --radius-btn: 6px;
  --radius-card: 11px;
  --radius-tile: 14px;
  --radius-chip: 14px;
  --touch-min: 48px;
  --touch-emergency: 64px;
  --tabbar-h: 64px;
  --strip-h: 52px;
  --rail-w: 218px;
}

/* ---------- 베이스 리셋 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  word-break: keep-all;          /* §2.2 한국어 줄바꿈 규칙 */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  height: 100dvh;
  overflow: hidden;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  word-break: keep-all;
}
input {
  font-family: inherit;
  color: var(--text-primary);
}
a { color: var(--accent-info); text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: rgba(88, 166, 255, 0.30); }

/* 스크롤바 (데스크톱) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* 포커스 링 §6 */
:focus-visible { outline: 1.5px solid var(--accent-info); outline-offset: 1px; }

/* ---------- 공통 유틸 ---------- */
.mono { font-family: var(--font-mono); }

/* 섹션 라벨: 영문 대문자 · 한국어 병기 (§2.2) */
.section-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 점멸 도트 — 브랜드 모티프 (§3.1) 1.6s 주기 */
.beacon-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red-fill);
  animation: beacon-blink 1.6s infinite;
  flex-shrink: 0;
}
@keyframes beacon-blink {
  0%, 45%  { opacity: 1; }
  55%, 95% { opacity: 0.12; }
  100%     { opacity: 1; }
}

/* 절전/모션 최소화 — 명세서 §7·§9 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- §9 절전 모드 변형 ---------- */
body.powersave {
  --bg: #000000;
  --bg-canvas: #000000;
  --bg-emergency: #000000;
  --surface: #0A0A0A;
  --surface2: #111111;
  --text-primary: #DDDDDD;
  --text-body: #DDDDDD;
  --text-secondary: #888888;
  --text-tertiary: #666666;
  --map-bg: #050505;
  --map-road: #151515;
  --map-water: #0B0E11;
}
body.powersave *, body.powersave *::before, body.powersave *::after {
  animation: none !important;
  transition: none !important;
}
