/* ==========================================================================
   생기부 점검 허브 — Design System
   토큰 + 전역 리셋 + 공용 컴포넌트 계약(§2)
   이 파일이 노출하는 클래스명은 다른 페이지(subject.html/career.html)가
   그대로 갖다 쓴다. 이름을 바꾸면 다른 화면이 깨진다.
   ========================================================================== */

/* ---- 1. 토큰 ------------------------------------------------------------ */
:root {
  /* 팔레트 */
  --bg: #F7F8FB;
  --surface: #FFFFFF;
  --ink: #1B1F2E;
  --ink-soft: #5A6072;
  --line: #E4E7EF;
  --brand: #4F46E5;
  --brand-deep: #3730A3;
  --brand-soft: #EEF0FE;

  /* 형광펜 파스텔 7색 (배경/글자 짝) */
  --hl-amber-bg: #FDF0C9;  --hl-amber-ink: #8A5A00;
  --hl-rose-bg:  #FCE7EE;  --hl-rose-ink:  #9F1D50;
  --hl-teal-bg:  #D9F2EF;  --hl-teal-ink:  #0F5F58;
  --hl-violet-bg:#EDE8FB;  --hl-violet-ink:#5B3FA8;
  --hl-slate-bg: #E8ECF4;  --hl-slate-ink: #3E4A63;
  --hl-red-bg:   #FBE4E1;  --hl-red-ink:   #A3271A; /* 위반 확정 */
  --hl-brown-bg: #F3E8DC;  --hl-brown-ink: #7A4E1F; /* 확인 필요 */

  /* 타이포 */
  --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
    'Segoe UI', system-ui, Roboto, 'Apple SD Gothic Neo', sans-serif;

  /* 형태 */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-1: 0 1px 2px rgba(27, 31, 46, 0.04), 0 6px 16px rgba(27, 31, 46, 0.06);
  --shadow-2: 0 2px 4px rgba(27, 31, 46, 0.05), 0 12px 28px rgba(27, 31, 46, 0.10);

  /* 레이아웃 */
  --container-w: 1080px;
  --header-h: 64px;
  --section-pad: clamp(56px, 8vw, 96px);

  /* z-index 스케일 */
  --z-header: 50;
  --z-actionbar: 40;
  --z-toast: 1000;
}

@media (max-width: 640px) {
  :root { --header-h: 56px; }
}

/* ---- 2. 리셋 ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--brand-soft); color: var(--brand-deep); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 폼 필드는 아웃라인 대신 인디고 2px 박스섀도 링 — 인접 테두리와 겹쳐 흐려지는 문제 방지 */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand);
}

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

/* ---- 3. 레이아웃 --------------------------------------------------------- */
.container {
  max-width: var(--container-w);
  margin-inline: auto;
  padding-inline: 24px;
}
@media (max-width: 640px) {
  .container { padding-inline: 20px; }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.site-logo__mark {
  display: inline-flex;
  flex-shrink: 0;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav__link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.site-nav__link:hover { background: var(--brand-soft); color: var(--brand-deep); }
.site-nav__link[aria-current="page"] { color: var(--brand-deep); background: var(--brand-soft); }

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 32px;
  margin-top: var(--section-pad);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}
.site-footer__credit {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.site-footer__credit a {
  color: var(--brand-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.site-footer__privacy {
  font-size: 13px;
  color: var(--ink-soft);
}

.page-title {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.3;
}

/* ---- 4. 공용 그리드 헬퍼(보너스) ------------------------------------------ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.stats-row { display: flex; flex-wrap: wrap; gap: 28px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- 5. 이미지 폴백 프레임(§7) -------------------------------------------
   구조: <div class="illus [illus-*]" role="img" aria-label="...">
           <img src="..." alt="" onerror="this.style.display='none';this.closest('.illus').classList.add('img-missing')">
           <div class="illus-fallback" aria-hidden="true">...대체 아트...</div>
         </div>
   실제 이미지 로드 실패 시 .img-missing이 붙고, illus-fallback이 노출된다.
   ------------------------------------------------------------------------- */
.illus {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--brand-soft);
}
.illus img { width: 100%; height: 100%; object-fit: cover; }
.illus-fallback { display: none; width: 100%; height: 100%; }
.illus.img-missing .illus-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- 6. 카드/버튼 -------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand);
  color: #FFFFFF;
  box-shadow: var(--shadow-1);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-deep); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--brand-soft);
  color: var(--brand-deep);
  border-color: var(--brand-soft);
}

/* ---- 7. 칩 / 배지 --------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
button.chip { cursor: pointer; }
.chip.active { background: var(--brand); color: #FFFFFF; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  background: var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

/* ---- 8. 토글 그룹 --------------------------------------------------------- */
.toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.toggle-btn {
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.toggle-btn.active {
  background: var(--surface);
  color: var(--brand-deep);
  box-shadow: var(--shadow-1);
}

/* ---- 9. 통계 / 게이지 ------------------------------------------------------ */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

.gauge {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}
.gauge-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--brand);
  transition: width 0.3s ease, background 0.15s ease;
}
.gauge.over .gauge-fill, .gauge-fill.over { background: var(--hl-red-ink); }

/* ---- 10. 업로드 존 -------------------------------------------------------- */
.upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.upload-zone.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* ---- 11. 빈 상태 --------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-soft);
}
.empty-state .illus { width: 160px; aspect-ratio: 4 / 3; margin-bottom: 4px; }

/* ---- 12. 토스트 ----------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  background: var(--ink);
  color: #FFFFFF;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-2);
  animation: toast-in 0.25s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
