/* ===========================================================================
   Phase 1 — 타이포그래피 · 색 토큰 · 다크모드
   styles.css(부트스트랩 번들) 뒤에 로드해서 덮어쓰는 레이어.
   마크업은 건드리지 않고 이 파일만으로 외형을 바꾼다.
   =========================================================================== */

:root {
  /* 타입 스케일 */
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.1875rem;
  --text-h3: 1.1875rem;
  --text-h2: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  --text-h1: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);

  --leading-body: 1.62;
  --leading-tight: 1.2;
  --measure: 70ch;

  /* 색 — 라이트 (Coursera 계열 블루 #0056d2) */
  --bg: #eef5ff;
  --surface: #ffffff;
  --rail-bg: #0056d2;
  --rail-fg: #cfe1fb;
  --rail-fg-strong: #ffffff;
  --text: #11223a;
  --text-muted: #55657a;
  --border: #d2e2f9;
  --accent: #0056d2;
  --accent-hover: #00409e;
  --accent-soft: #dfecff;
  --shadow: 0 1px 2px rgba(0, 48, 120, 0.06), 0 8px 24px -12px rgba(0, 48, 120, 0.22);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1526;
    --surface: #12203a;
    --rail-bg: #0b2d63;
    --rail-fg: #a9c3e8;
    --rail-fg-strong: #f1f6ff;
    --text: #e3ebf7;
    --text-muted: #91a4bd;
    --border: #1e3250;
    --accent: #6aa8ff;
    --accent-hover: #8dbdff;
    --accent-soft: #16294a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 24px -12px rgba(0, 0, 0, 0.7);
  }
}

:root[data-theme="dark"] {
  --bg: #0a1526;
  --surface: #12203a;
  --rail-bg: #0b2d63;
  --rail-fg: #a9c3e8;
  --rail-fg-strong: #f1f6ff;
  --text: #e3ebf7;
  --text-muted: #91a4bd;
  --border: #1e3250;
  --accent: #6aa8ff;
  --accent-hover: #8dbdff;
  --accent-soft: #16294a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 24px -12px rgba(0, 0, 0, 0.7);
}

/* --- 기본 ---------------------------------------------------------------- */

html { -webkit-text-size-adjust: 100%; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-feature-settings: "ss01", "tnum" 0;
  letter-spacing: -0.003em;
}

::selection { background: var(--accent-soft); color: var(--text); }

/* --- 섹션 레이아웃 ------------------------------------------------------- */

section.resume-section {
  display: block;
  min-height: 0;
  max-width: none;
  padding: 3.25rem 1.25rem;
  scroll-margin-top: 4rem;
  border-bottom: 1px solid var(--border);
}

section.resume-section:last-of-type { border-bottom: 0; }

section.resume-section .resume-section-content {
  width: 100%;
  max-width: var(--measure);
}

@media (min-width: 768px) {
  section.resume-section { min-height: 0; }
}

@media (min-width: 992px) {
  section.resume-section { padding: 3.5rem 3.25rem; }
}

/* --- 제목 ---------------------------------------------------------------- */

h1, .h1, h2, .h2, h3, .h3, h4, .h4 {
  font-family: var(--font-sans);
  line-height: var(--leading-tight);
  letter-spacing: -0.022em;
  text-wrap: balance;
  color: var(--text);
}

h1, .h1 {
  font-size: var(--text-h1);
  font-weight: 760;
  letter-spacing: -0.035em;
}

h1 .text-primary { color: var(--accent) !important; }

h2, .h2 {
  font-size: var(--text-h2);
  font-weight: 700;
  margin-bottom: 1.5rem !important;
}

h3, .h3 {
  font-size: var(--text-h3);
  font-weight: 650;
  letter-spacing: -0.015em;
}

h4, .h4, h5, .h5, h6, .h6 { font-size: var(--text-base); font-weight: 600; }

/* 섹션 안의 작은 라벨 — 원래 Saira Extra Condensed 1.5rem 대문자였으나
   폰트가 로드되지 않아 그냥 큰 대문자로 보였다. 라벨답게 줄인다. */
.subheading {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- 본문 · 리스트 ------------------------------------------------------- */

p, li { text-wrap: pretty; }

p.lead, .lead {
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-body);
  color: var(--text);
}

#about .lead:first-of-type { color: var(--text-muted); }

/* 인라인 font-size:1.5em 로 커져 있던 목록들 */
.resume-section-content ol,
.resume-section-content ul {
  font-size: var(--text-base) !important;
}

.resume-section-content ol.fa-ul > li,
.resume-section-content ul.fa-ul > li {
  margin-bottom: 0.55rem;
  line-height: 1.55;
  color: var(--text);
}

.fa-ul .fa-li { color: var(--text-muted); }

/* 이력 항목의 기간 텍스트 — 주황을 걷어내고 수치용 서체로 */
section.resume-section .text-primary {
  color: var(--text-muted) !important;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  font-weight: 500;
}

section.resume-section h1 .text-primary {
  color: var(--accent) !important;
  font-size: inherit;
  font-weight: inherit;
}

.resume-section-content .text-md-end,
.resume-section-content .text-end {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

/* 세로 여백 압축 — 부트스트랩 기본 간격이 본문에서는 너무 넓다 */
section.resume-section .mb-5 { margin-bottom: 1.75rem !important; }
section.resume-section .mb-4 { margin-bottom: 1.25rem !important; }
section.resume-section .mb-3 { margin-bottom: 0.55rem !important; }
section.resume-section .mt-4 { margin-top: 1.5rem !important; }
section.resume-section p { margin-bottom: 0.85rem; }

/* 빈 <p></p> 가 한 줄씩 자리를 차지하고 있다 */
section.resume-section p:empty,
section.resume-section div:empty:not([class]) { display: none; }

/* 항목 사이 간격 (경력·학력·수상 행) */
section.resume-section .d-flex.flex-column { margin-bottom: 1.5rem !important; }
section.resume-section .d-flex.flex-column:last-child { margin-bottom: 0 !important; }

/* --- 링크 ---------------------------------------------------------------- */

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

/* --- 좌측 레일 ----------------------------------------------------------- */

#sideNav.bg-primary { background-color: var(--rail-bg) !important; }

#sideNav { border-right: 1px solid rgba(255, 255, 255, 0.06); }

#sideNav .navbar-brand { opacity: 1; }

#sideNav .navbar-nav .nav-item .nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--rail-fg);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
}

#sideNav .navbar-nav .nav-item .nav-link:hover,
#sideNav .navbar-nav .nav-item .nav-link:focus-visible {
  color: var(--rail-fg-strong);
  background-color: rgba(255, 255, 255, 0.07);
}

/* 외부로 나가는 링크는 마크업 수정 없이 화살표로 구분 */
#sideNav .nav-link[target="_blank"]::after,
#sideNav .nav-link[href^="http"]::after {
  content: "↗";
  font-size: 0.75em;
  margin-left: 0.35em;
  opacity: 0.55;
}

/* 하위 페이지(.html)는 살짝 다른 톤 */
#sideNav .nav-link[href$=".html"] { color: color-mix(in srgb, var(--rail-fg) 88%, white); }

@media (min-width: 992px) {
  body { padding-left: 15.5rem; }
  /* 메뉴가 늘어나 화면 높이를 넘으면 레일 안에서만 스크롤 */
  #sideNav { width: 15.5rem; overflow-y: auto; }
  #sideNav .navbar-collapse { padding-bottom: 1rem; }
  #sideNav .navbar-brand .img-profile {
    max-width: 8.5rem;
    max-height: 8.5rem;
    border: 0.35rem solid rgba(255, 255, 255, 0.1);
  }
  #sideNav .navbar-collapse .navbar-nav { padding: 0 0.6rem; }
}

/* --- 아이콘 ------------------------------------------------------------- */

.dev-icons { font-size: 2rem; color: var(--text-muted); }

.social-icons .social-icon {
  height: 2.75rem;
  width: 2.75rem;
  font-size: 1.15rem;
  background-color: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin-right: 0.75rem;
}

.social-icons .social-icon:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 공사중 🔧 안내 블록 */
.lead .social-icons .fa-wrench { color: var(--accent); margin-right: 0.5rem; }
.lead .social-icons { display: inline; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  opacity: 1;
  margin: 1.75rem 0;
}

/* --- 테마 토글 ----------------------------------------------------------- */

.theme-toggle {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 1100;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 0.95rem;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .fa-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .fa-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .fa-sun { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .fa-moon { display: none; }
}

/* --- 인쇄(CV 출력) ------------------------------------------------------- */

@media print {
  #sideNav, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .container-fluid > div, section.resume-section {
    padding: 0 0 1.25rem !important;
    border: 0;
    page-break-inside: avoid;
  }
  section.resume-section .resume-section-content { max-width: none; }
  a { color: #000; text-decoration: none; }
}
