/* ══════════════════════════════════════════════
   선택가이드 (ver4 신규) — front-bookguide.css
   연령별 길벗스쿨 수학 로드맵 표 + 시리즈 모달
   공통 리셋/nav/footer는 front.css 사용
   ══════════════════════════════════════════════ */

:root {
  --radius:    8px;
  --shadow:    0 2px 10px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.18);
}

/* ══════════ HERO ══════════ */
.guide-hero {
  background: var(--mint-light);
  padding: 44px 24px 36px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.guide-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle, var(--mint-mid) 1.5px, transparent 1.5px);
  background-size: 28px 28px; opacity: 0.55; pointer-events: none;
}
.guide-hero-decos { position: absolute; inset: 0; pointer-events: none; }
.guide-hero-decos .deco {
  position: absolute; font-weight: 900; opacity: 0.13;
  color: var(--mint-dark); user-select: none; line-height: 1;
}
.guide-hero > * { position: relative; z-index: 1; }
.guide-hero h1 {
  font-size: 32px; font-weight: 900;
  letter-spacing: -0.8px; margin-bottom: 10px;
}
.guide-hero h1 .em { color: var(--mint); }
.guide-hero p {
  font-size: 14px; color: var(--gray-text);
  line-height: 1.75; word-break: keep-all;
}
.guide-hero-fade { height: 16px; background: linear-gradient(to bottom, var(--mint-light) 0%, var(--gray-bg) 100%); }
@media (max-width: 640px) {
  .guide-hero { padding: 32px 20px 28px; }
  .guide-hero h1 { font-size: 26px; }
}

/* ── 컨테이너 ── */
.guide-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ── 다운로드 버튼 ── */
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 6px;
  border: 1.5px solid var(--mint);
  background: #fff;
  color: var(--mint-dark);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
}
.download-btn svg {
  width: 15px; height: 15px;
  stroke: var(--mint-dark);
}
.download-btn:hover {
  background: var(--mint);
  color: #fff;
}
.download-btn:hover svg { stroke: #fff; }
.download-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ── 안내 문구 ── */
.guide-hint {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-text);
  font-size: 14px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.guide-hint .hint-icon {
  width: 52px;
  height: 52px;
  background: var(--mint-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.guide-hint .hint-icon svg { width: 26px; height: 26px; fill: var(--mint); }

/* ── 로드맵 컨테이너 ── */
.roadmap-wrap {
  background: #fff;
  border-radius: var(--radius);   /* 카드 외곽 라운드 */
  overflow: visible;              /* 자식 스크롤 클리핑 방지 */
  box-shadow: var(--shadow);
  margin-top: 20px;
}
.roadmap-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-border);
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px 8px 0 0;   /* 상단 모서리만 */
}
.roadmap-head .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.roadmap-head h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}
.roadmap-head .sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--gray-text);
  margin-left: 4px;
}

.table-scroll {
  overflow-x: hidden;
  border-radius: 0 0 8px 8px;
}
@media (max-width: 768px) {
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .thead-sticky-wrap { overflow-x: hidden; }
}

/* thead 분리 sticky 래퍼 */
.thead-sticky-wrap {
  position: sticky;
  top: 56px;
  z-index: 10;
  overflow-x: hidden; /* 스크롤바 숨김, JS로 동기화 */
  background: #fff;
  margin-bottom: -1px;
}

/* 분리된 헤더 테이블 */
#rmap-table-head {
  table-layout: fixed;
  min-width: 0;
}
.scroll-hint {
  display: none;
}
@media (max-width: 768px) {
  .scroll-hint {
    display: block;
    font-size: 12px;
    color: var(--gray-text);
    text-align: center;
    padding: 6px 0 4px;
    background: #fff;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
}
#rmap-table {
  table-layout: fixed;
  min-width: 0;
}

/* 헤더 */
thead th {
  background: var(--mint);
  color: #fff;
  text-align: center;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.18);
  /* top sticky는 .thead-sticky-wrap이 담당 */
}
thead th:first-child {
  background: var(--mint-dark);
  text-align: left;
  padding-left: 16px;
  min-width: 110px;
  position: sticky;
  left: 0;
  z-index: 4;
  border-right: none;
  box-shadow: 1px 0 0 rgba(255,255,255,0.18);
}

/* 바디 */
tbody tr:nth-child(even) td { background: #FAFAFA; }

td {
  border: 1px solid var(--gray-border);
  vertical-align: middle;
  font-size: 12px;
}
td.cat-cell {
  font-weight: 700;
  color: #fff;
  padding: 12px 12px;
  white-space: nowrap;
  font-size: 14px;
  text-align: center;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: none;
}
tbody tr { height: 70px; }
td.empty-cell {
  background: #fff;
}
td.series-cell {
  cursor: pointer;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  padding: 10px 11px 10px 8px;
  line-height: 1.4;
  overflow: hidden;
  transition: filter 0.15s, transform 0.15s;
  border: none;
  outline: 1px solid rgba(0,0,0,0.06);
}
td.series-cell:hover {
  filter: brightness(0.93);
  transform: translateY(-1px);
  z-index: 3;
  position: relative;
  box-shadow: 0 3px 10px rgba(0,0,0,0.14);
}
td.series-cell:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: -2px;
}

/* ── 준비중 화면 ── */
.coming-soon {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  padding: 80px 24px;
}
.cs-icon {
  width: 72px; height: 72px;
  background: var(--mint-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.cs-icon svg { width: 36px; height: 36px; fill: var(--mint); }
.coming-soon h2 {
  font-size: 22px; font-weight: 800;
  color: var(--mint-dark); margin-bottom: 12px;
}
.coming-soon p {
  font-size: 14px; color: var(--gray-text); line-height: 1.9;
}

/* ── 팝업 모달 ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
  transition: background 0.28s;
}
.modal-overlay.open {
  background: rgba(0,0,0,0.52);
  pointer-events: auto;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  padding: 28px 24px 24px;
  position: relative;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.25s, transform 0.25s;
}
.modal-overlay.open .modal {
  opacity: 1;
  transform: none;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gray-border);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--navy);
  transition: background 0.15s;
  line-height: 1;
}
.modal-close:hover { background: var(--gray-line); }

.modal-body { display: flex; gap: 20px; }

.book-cover {
  width: 100px; min-width: 100px; height: 140px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-size: 12px; font-weight: 800;
  color: #fff; line-height: 1.5;
  padding: 10px;
  box-shadow: 3px 4px 14px rgba(0,0,0,0.22);
  word-break: keep-all;
}

.modal-info { flex: 1; }
.modal-name {
  font-size: 17px; font-weight: 800;
  color: var(--navy); margin-bottom: 8px;
  padding-right: 20px; line-height: 1.4;
}
.age-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
  margin-bottom: 12px;
}
.modal-desc {
  font-size: 13px; color: var(--gray-text);
  line-height: 1.75; margin-bottom: 18px;
  word-break: keep-all; overflow-wrap: break-word;
}
.modal-sub {
  font-size: 13px; font-weight: 400; color: var(--gray-text);
  display: block; line-height: 1.4;
}
.modal-cta {
  display: inline-block;
  padding: 10px 22px;
  background: var(--mint);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px; font-weight: 700;
  transition: background 0.18s;
}
.modal-cta:hover { background: var(--mint-dark); }

/* ── 시리즈 셀 다중 텍스트 ── */
.ser-n1 { display:block; font-weight:700; font-size:15px; line-height:1.35; word-break:keep-all; overflow-wrap:break-word; }
.ser-n2 { display:block; font-weight:400; font-size:13px; line-height:1.3; margin-top:3px; word-break:keep-all; overflow-wrap:break-word; }
.ser-n3 { display:block; font-weight:400; font-size:12px; line-height:1.3; margin-top:1px; word-break:keep-all; overflow-wrap:break-word; }
td.series-cell { word-break:keep-all; overflow-wrap:break-word; }
/* ── 팝업 도서 이미지 ── */
.book-cover-img {
  width:100px; min-width:100px; height:auto;
  object-fit:unset; border-radius:6px;
  background:#ffffff;
  box-shadow:3px 4px 14px rgba(0,0,0,0.22);
}

/* ── 반응형 ── */
@media (max-width: 768px) {
  .download-btn { display: none; }
  td.cat-cell { white-space: normal; word-break: keep-all; font-size: 13px; }
  .guide-wrap { padding: 24px 14px 60px; }

  /* 모달: 하단 시트 */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 22px 22px 0 0;
    max-width: 100%;
    max-height: 85vh;
    padding: 0 20px 36px;
    transform: translateY(100%);
  }
  .modal-overlay.open .modal { transform: translateY(0); }
  .modal::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: var(--gray-line);
    border-radius: 2px;
    margin: 12px auto 20px;
  }
  .modal-close { top: 20px; right: 16px; }
  .modal-body { flex-direction: column; align-items: center; gap: 16px; }
  .modal-name { text-align: center; padding-right: 0; }
  .age-badge { display: block; text-align: center; }
  .modal-info { text-align: center; width: 100%; }
  .modal-cta { display: block; text-align: center; }
}

/* ── TOP 버튼 ── */
#top-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--mint);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
}
#top-btn.visible {
  opacity: 1;
  pointer-events: auto;
}
#top-btn:hover { transform: translateY(-3px); }
@media (max-width: 768px) {
  #top-btn { bottom: 20px; right: 16px; }
}
