/* ====================================================
   기본 리셋 & 변수
   ==================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:   #1a2a4a;
  --navy2:  #243660;
  --gold:   #b8975a;
  --gold2:  #d4af70;
  --bg:     #f6f5f4;
  --white:  #ffffff;
  --text:   #1f2937;
  --muted:  #6b7280;
  --border: #e5e7eb;
  --new:    #dc2626;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:       0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03);
  --shadow-hover: 0 4px 14px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
  --max-width: 1100px;

  /* 간격 스케일 */
  --space-xxs: 4px;
  --space-xs:  8px;
  --space-sm:  12px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  28px;
  --space-xxl: 32px;
}

html { scroll-behavior: auto; }

/* ====================================================
   스크롤 진행률 표시줄
   ==================================================== */
#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold2));
  z-index: 1000;
  pointer-events: none;
}

/* ====================================================
   스크롤 리빌 — 뷰포트에 들어올 때 살짝 떠오르며 표시
   ==================================================== */
.reveal {
  opacity: 0;
  transform: translateY(32px) scale(0.97);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

body {
  font-family: 'Inter', 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold); }

/* ====================================================
   헤더
   ==================================================== */
header {
  background:
    url("header-bg.svg") no-repeat right center / cover,
    linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
  color: var(--white);
  padding: 0;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.header-top > div:first-child {
  flex: 1;
  min-width: 0;
}

.author-affiliation {
  white-space: nowrap;
}

.author-name {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.15;
}

.author-title {
  color: var(--gold2);
  font-size: 15px;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.author-affiliation {
  font-size: 14px;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
}

.author-bio {
  font-size: 15px;
  color: rgba(255,255,255,0.8);
  max-width: 640px;
  margin-top: 16px;
  line-height: 1.7;
  white-space: pre-line;
}

.bio-toggle {
  display: inline-block;
  margin-top: 8px;
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.65);
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.bio-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: var(--white);
  border-color: rgba(255,255,255,0.6);
}

.header-contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-right: 76px;
}

.profile-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.3);
}

.header-contact a {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  transition: var(--transition);
  white-space: nowrap;
}

.header-contact a:hover {
  background: rgba(255,255,255,0.1);
  color: var(--white);
  border-color: rgba(255,255,255,0.6);
}

/* ====================================================
   네비게이션
   ==================================================== */
nav {
  background: var(--navy2);
  border-top: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar { display: none; }

.nav-inner a {
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
}

.nav-inner a:hover,
.nav-inner a.active {
  color: var(--gold2);
  border-bottom-color: var(--gold2);
}

/* ====================================================
   검색바
   ==================================================== */
.search-section {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}

.search-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.topic-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.topic-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.topic-tag {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--navy);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.topic-tag:hover {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.topic-tag.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.search-row {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 11px 16px 11px 42px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: var(--transition);
  outline: none;
}

#searchInput:focus {
  border-color: var(--navy);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(26,42,74,0.08);
}

#searchInput::placeholder { color: var(--muted); }

.search-result-count {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

/* ====================================================
   메인 레이아웃
   ==================================================== */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

section { margin-bottom: 64px; }

.section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--navy);
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--navy);
}

.section-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

/* ====================================================
   NEW 배지
   ==================================================== */
.badge-new {
  display: inline-block;
  background: var(--new);
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ====================================================
   최신 발행물 섹션
   ==================================================== */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
}

.recent-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  transition: var(--transition);
  cursor: pointer;
}

.recent-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.recent-card-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gold);
  margin-bottom: 8px;
}

.recent-card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.1px;
  margin-bottom: 6px;
  color: var(--text);
}

.recent-card-meta {
  font-size: 13px;
  color: var(--muted);
}

/* ====================================================
   책 그리드
   ==================================================== */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.book-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.book-cover-link {
  display: block;
  overflow: hidden;
  background: #f0f0f0;
  line-height: 0;
}

.book-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.book-card:hover .book-cover {
  transform: scale(1.03);
}

.book-cover-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
}

.book-card-body {
  padding: var(--space-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.book-year {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.book-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.2px;
  color: var(--text);
}

.book-subtitle {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.book-publisher {
  font-size: 13px;
  color: var(--navy);
  font-weight: 500;
}

.book-description {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.6;
  flex: 1;
}

.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag {
  font-size: 11px;
  padding: 3px 8px;
  background: #f0f4ff;
  color: var(--navy2);
  border-radius: 20px;
  font-weight: 500;
}

.book-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ====================================================
   버튼
   ==================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--navy2);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--navy);
  background: #f0f4ff;
  color: var(--navy);
}

/* ====================================================
   매체 탭 바
   ==================================================== */
.pub-tab-bar {
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 20px;
  cursor: grab;
  user-select: none;
}

.pub-tab-bar::-webkit-scrollbar { display: none; }

.pub-tab-bar.dragging { cursor: grabbing; }

.pub-tab-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 6px;
}

.pub-tab-row:last-child { margin-bottom: 0; }

.pub-tab-spacer { flex-shrink: 0; display: inline-block; }

.pub-tab.tab-dragging { opacity: 0.35; }

.pub-tab.tab-drag-over {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
  transform: scale(1.05);
}

.pub-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.pub-tab:hover {
  background: var(--white);
  color: var(--navy);
  border-color: #d1d5db;
}

.pub-tab.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
  font-weight: 600;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.pub-tab.active .tab-count {
  background: rgba(255,255,255,0.25);
  color: var(--white);
}

/* 탭 바 아래 구분선 */
.pub-tab-bar-wrapper {
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 20px;
}

/* article-list가 탭과 이어지는 느낌 */
#articlesSection .article-list {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
}

/* 탭 영역 내 카드는 border 간소화 */
#articlesSection .article-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: none;
}

#articlesSection .article-card:hover {
  box-shadow: var(--shadow);
  border-color: #d1d5db;
}

/* ====================================================
   칼럼/기고문 목록
   ==================================================== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.article-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  transition: var(--transition);
}

.article-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateX(2px);
}

.article-type-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

.type-column  { background: #e0f2fe; color: #0369a1; }
.type-essay   { background: #fef3c7; color: #b45309; }
.type-research{ background: #f0fdf4; color: #166534; }

.article-body { flex: 1; min-width: 0; }

.article-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.1px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.article-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.article-meta span { display: flex; align-items: center; gap: 4px; }

.article-description {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 10px;
}

.article-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.article-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

/* ====================================================
   검색 결과 없음
   ==================================================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state .emoji { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 16px; }

/* ====================================================
   푸터
   ==================================================== */
footer {
  background: var(--navy);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 32px 24px;
  font-size: 14px;
  line-height: 1.8;
}

footer a { color: var(--gold2); }
footer a:hover { color: var(--white); }

/* ── 홈(맨 위로) 버튼 ── */
#backToTop {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s, background 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  z-index: 999;
}
#backToTop.visible { opacity: 1; visibility: visible; }
#backToTop:hover { background: var(--gold); }

/* ====================================================
   반응형
   ==================================================== */
@media (max-width: 700px) {
  header { background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%); }
  .header-inner { padding: 32px 16px 28px; }
  main { padding: 28px 16px 60px; }

  .author-affiliation { white-space: normal; }
  .header-top { flex-direction: column; }
  .header-contact {
    flex-direction: row;
    align-self: flex-start;
    margin-right: 0;
    padding-top: 0;
  }
  .profile-photo { width: 80px; height: 80px; }

  .book-grid { grid-template-columns: 1fr; }
  .recent-grid { grid-template-columns: 1fr; }

  .article-card {
    flex-direction: column;
    gap: 10px;
  }

  .article-actions {
    flex-direction: row;
    align-items: center;
  }

  .article-type-badge { align-self: flex-start; }
  .nav-inner a { padding: 12px 14px; font-size: 13px; }
}

@media (max-width: 480px) {
  .section-header h2 { font-size: 18px; }
  .book-title { font-size: 15px; }
  .article-title { font-size: 15px; }
}
