/* =============================================================================
   site.css — 멀티페이지 공용 디자인 시스템 (리디자인)
   「데이터의 눈으로 그림 읽기」 수업 사이트.
   밝고 차분한 미술관 톤(에어리 블루 + 슬레이트)을 기본으로, 다크는 변형으로 제공.
   변수명·클래스명은 기존과 동일 — 모든 페이지가 수정 없이 새 디자인을 입습니다.
   ============================================================================= */
:root {
  /* ☀ 기본 = 밝은 미술관 톤. 표면 위계: 배경 < 패널 < 중첩. */
  --bg: #EEF7FF; --bg2: #E7F0FA;
  --panel: #FFFFFF; --panel2: #F2F6FC; --panel3: #EAF1FB;
  --line: #E2EAF4; --text: #0E1523; --muted: #667080; --muted2: #9AA6B6;
  --accent: #2C3A52; --accent-rgb: 44,58,82;          /* 포인트색 — 차분한 슬레이트 잉크 */
  --accent2: #4C6CA6;                                  /* 보조 강조 — 미술관 블루(링크) */
  --good: #2FA874; --danger: #E0596C; --adv: #6F63C4;
  --radius: 18px; --maxw: 1180px;
  --header: rgba(255, 255, 255, .82);
  --shadow: 0 18px 40px -28px rgba(14,21,35,.34), 0 2px 6px -3px rgba(14,21,35,.06);
}
/* 🌙 어두운 테마 — 같은 브랜드 색조의 야간 변형(작품 캔버스 몰입과 통일) */
:root[data-theme="dark"] {
  --bg: #0E1523; --bg2: #0A0F1A;
  --panel: #161E2E; --panel2: #1C2638; --panel3: #243049;
  --line: #28344A; --text: #EAEFF7; --muted: #93A1B8; --muted2: #6A788F;
  --accent: #6E86C9; --accent-rgb: 110,134,201;       /* 야간 가독을 위해 밝힌 슬레이트블루 */
  --accent2: #8FA6DE;
  --good: #4DC78A; --danger: #F2667A; --adv: #B09CFF;
  --header: rgba(14, 21, 35, .78);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 36px -8px rgba(0,0,0,.36);
}
:root[data-theme="dark"] body {
  background:
    radial-gradient(1100px 600px at 50% -20%, rgba(110,134,201,.10) 0%, transparent 62%),
    var(--bg);
}
:root[data-theme="dark"] .btn.ghost { background: transparent; }

* { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-x: clip; }   /* 안전망: 어떤 요소가 삐져나가도 페이지 전체 가로 스크롤바는 생기지 않게 (sticky 헤더는 유지) */
body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  background:
    radial-gradient(1200px 640px at 50% -22%, rgba(76,108,166,.10) 0%, transparent 60%),
    var(--bg);
  color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; line-height: 1.5;
  letter-spacing: -0.01em;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------------- 공용 헤더/내비 (떠 있는 라운드 카드) ----------------------------- */
.site-header {
  position: sticky; top: 14px; z-index: 40; height: 58px;
  width: min(var(--maxw), calc(100% - 28px)); margin: 14px auto 0;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 0 12px 0 20px; background: var(--header); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 40px -26px rgba(14,21,35,.30), 0 2px 6px -3px rgba(14,21,35,.05);
}
.site-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; white-space: nowrap; color: var(--text); }
.site-brand .logo { color: var(--accent); font-size: 19px; }
.site-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.site-nav a, .navdrop > button {
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: 999px; white-space: nowrap; transition: color .15s, background .15s;
}
.site-nav a:hover, .navdrop > button:hover { color: var(--text); background: var(--panel2); text-decoration: none; }
.site-nav a.active, .navdrop > button.active { color: var(--accent); background: rgba(var(--accent-rgb),.10); }
.navdrop { position: relative; }
.navdrop-menu {
  position: absolute; top: 100%; left: 0; margin-top: 8px; min-width: 200px; padding: 7px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 50px -22px rgba(14,21,35,.40), 0 2px 6px -3px rgba(14,21,35,.08);
  display: none; flex-direction: column; gap: 2px; z-index: 50;
}
.navdrop.open .navdrop-menu { display: flex; }
.navdrop-menu a { padding: 10px 12px; border-radius: 11px; color: var(--text); font-size: 13.5px; font-weight: 600; }
.navdrop-menu a:hover { background: var(--panel2); }
.navdrop-menu a small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; margin-top: 2px; }
.site-user { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); white-space: nowrap; padding-right: 6px; }
.site-user b { color: var(--text); }
.site-user .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(47,168,116,.18); }
.site-user .dot.off { background: var(--muted2); box-shadow: none; }

/* ----------------------------- 레이아웃 컨테이너 ----------------------------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 34px 20px 80px; }
.wrap.narrow { max-width: 860px; }
.page-head { margin: 12px 0 26px; }
.page-head h1 { font-size: 30px; margin: 0 0 7px; letter-spacing: -.03em; font-weight: 800; }
.page-head p { color: var(--muted); margin: 0; font-size: 14.5px; }
.eyebrow { color: var(--accent2); font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }

/* 섹션 제목 — 위계: 페이지 h1(30) > 섹션 h2(20) > 카드 h3(16) > 본문(13.5) */
.sec-head { margin: 40px 0 14px; }
.sec-head h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; font-weight: 800; }
.sec-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.sec-head p b { color: var(--text); }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }               /* 긴 내용이 그리드 칸을 밀어내 가로 넘침이 생기지 않게 */
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h2, .card h3 { margin: 0 0 10px; letter-spacing: -.02em; }
.card h3 { font-size: 16px; }
.card.hover p.muted { font-size: 13.5px; line-height: 1.6; margin: 6px 0 0; }   /* 링크 카드 본문이 제목보다 커 보이지 않게 */
.card.hover .badge { margin-bottom: 8px; }
.card.hover { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; cursor: pointer; }
.card.hover:hover { transform: translateY(-3px); border-color: rgba(var(--accent-rgb),.35); box-shadow: 0 30px 60px -34px rgba(14,21,35,.42), 0 3px 8px -4px rgba(14,21,35,.08); }
.muted { color: var(--muted); }
.sep { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ----------------------------- 버튼/배지/칩 ----------------------------- */
.btn { font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 15px; cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.btn:hover { border-color: rgba(var(--accent-rgb),.4); background: var(--panel3); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #fff; border: 1px solid transparent; border-radius: 999px; font-weight: 700; box-shadow: 0 12px 26px -16px rgba(var(--accent-rgb),.9); }
.btn.primary:hover { filter: brightness(1.08); border: 1px solid transparent; background: var(--accent); }
.btn.accent2 { background: rgba(var(--accent-rgb),.12); color: var(--accent); border: 1px solid rgba(var(--accent-rgb),.28); font-weight: 700; border-radius: 999px; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; justify-content: center; border-radius: 999px; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 999px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.core { color: var(--accent2); border-color: rgba(var(--accent-rgb),.34); background: rgba(var(--accent-rgb),.08); }
.badge.adv { color: var(--adv); border-color: rgba(111,99,196,.34); background: rgba(111,99,196,.08); }
.badge.good { color: var(--good); border-color: rgba(47,168,116,.34); background: rgba(47,168,116,.08); }

/* ----------------------------- 폼 ----------------------------- */
label.field { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 14px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(76,108,166,.14); }
textarea { resize: vertical; min-height: 70px; line-height: 1.55; }
.range-row { display: flex; align-items: center; gap: 10px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; background: var(--line); border-radius: 5px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 0 0 4px rgba(var(--accent-rgb),.16); }
output, .val { color: var(--accent2); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ----------------------------- 설명 아이콘(ⓘ) ----------------------------- */
.info-ic {
  display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px;
  border-radius: 50%; border: 1px solid var(--accent2); color: var(--accent2); background: rgba(var(--accent-rgb),.08);
  font-size: 12px; font-weight: 800; cursor: pointer; vertical-align: middle; line-height: 1; padding: 0; }
.info-ic:hover { background: var(--accent2); color: #fff; }
.with-info { display: inline-flex; align-items: center; gap: 7px; }

/* ----------------------------- 모달/팝업 ----------------------------- */
.modal-bg { position: fixed; inset: 0; background: rgba(14,21,35,.42); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 80; padding: 18px; }
.modal-bg.show { display: flex; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  max-width: 680px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 0; position: relative;
  box-shadow: 0 40px 90px -40px rgba(14,21,35,.55); }
.modal-card .mc-head { padding: 22px 26px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); border-radius: 22px 22px 0 0; }
.modal-card .mc-head h2 { margin: 0; font-size: 20px; padding-right: 30px; letter-spacing: -.02em; }
.modal-card .mc-head .lv { font-size: 12px; color: var(--muted); margin-top: 4px; }
.modal-card .mc-body { padding: 20px 26px 26px; }
.modal-close { position: absolute; right: 16px; top: 16px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text); cursor: pointer; font-size: 15px; }
.modal-close:hover { border-color: var(--accent2); background: var(--panel3); }

.lvl { border: 1px solid var(--line); border-radius: 14px; margin: 12px 0; overflow: hidden; }
.lvl > .lvl-h { display: flex; align-items: center; gap: 8px; padding: 12px 15px; font-weight: 800; font-size: 14px; background: var(--panel2); }
.lvl.easy > .lvl-h { color: var(--accent2); }
.lvl.deep > .lvl-h { color: var(--accent); }
.lvl.limit > .lvl-h { color: var(--danger); }
.lvl.idea > .lvl-h { color: var(--good); }
.lvl-b { padding: 14px 16px; font-size: 13.7px; line-height: 1.72; }
.lvl-b ul { margin: 6px 0; padding-left: 18px; }
.lvl-b li { margin: 5px 0; }
.lvl-b .ex { background: var(--panel2); border-left: 3px solid var(--accent2); padding: 10px 13px; border-radius: 0 10px 10px 0; margin: 10px 0; color: var(--text); font-size: 13px; }
.lvl-b code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; color: var(--accent2); }

/* ----------------------------- 안내(아이디어) 콜아웃 ----------------------------- */
.callout { display: flex; gap: 11px; align-items: flex-start; background: rgba(47,168,116,.07);
  border: 1px solid rgba(47,168,116,.26); border-radius: 14px; padding: 13px 15px; margin: 14px 0; font-size: 13.3px; }
.callout .ic { font-size: 17px; line-height: 1.4; }
.callout b { color: var(--good); }
.callout.info { background: rgba(var(--accent-rgb),.07); border-color: rgba(var(--accent-rgb),.24); }
.callout.info b { color: var(--accent2); }
.callout.warn { background: rgba(224,150,60,.10); border-color: rgba(224,150,60,.3); }
.callout.warn b { color: #C2761B; }
.idea-rotator { cursor: pointer; }
.idea-rotator .next { flex: none; white-space: nowrap; margin-left: auto; color: var(--muted); font-size: 11.5px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }

/* ----------------------------- 토스트 ----------------------------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(18px);
  background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 12px 20px; border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: 0 20px 44px -18px rgba(14,21,35,.4); opacity: 0; pointer-events: none; transition: .25s; z-index: 90; max-width: 84vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----------------------------- 차트/캔버스 ----------------------------- */
.chart-card { display: flex; flex-direction: column; }
.chart-card canvas { width: 100%; height: auto; background: var(--panel2); border-radius: 12px; border: 1px solid var(--line); }
.chart-title { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; margin-bottom: 9px; }
.memo { margin-top: 10px; }
.memo label { font-size: 11.5px; color: var(--muted); }
.recreate { position: relative; }
.recreate canvas { width: 100%; border-radius: 12px; background: #0E1523; border: 1px solid var(--line); display: block; }
.recreate .rc-tag { position: absolute; left: 9px; top: 9px; font-size: 10.5px; color: #fff; background: rgba(14,21,35,.6); padding: 3px 9px; border-radius: 999px; }

/* 팔레트 스와치 */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }   /* 줄바꿈된 마지막 칸이 한 줄 전체로 늘어나지 않게 */
.sw { height: 40px; min-width: 0; border-radius: 10px; border: 1px solid rgba(14,21,35,.08);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px; }
.sw small { font-size: 9.5px; color: #fff; background: rgba(0,0,0,.3); padding: 0 4px; border-radius: 4px; text-shadow: 0 1px 2px #000; }

/* 갤러리/테이블 */
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gal .item { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.gal .item:hover { transform: translateY(-3px); box-shadow: 0 30px 60px -34px rgba(14,21,35,.42); }
.gal .item img, .gal .item canvas { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; background: #0E1523; }
.gal .item .meta { padding: 12px 14px; }
.gal .item .meta h4 { margin: 0 0 3px; font-size: 14px; }
.gal .item .meta p { margin: 0; font-size: 12px; color: var(--muted); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-weight: 700; }
table.data tr:hover td { background: var(--panel2); }

.chk-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 9px 0; cursor: pointer; }
.chk-row input { accent-color: var(--accent); width: 16px; height: 16px; }
.hide { display: none !important; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(var(--accent-rgb),.2); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer-note { text-align: center; color: var(--muted2); font-size: 12px; padding: 30px 0 10px; }

/* ----------------------------- 스크롤바(세로·가로) — 얇고 통일된 모양 ----------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); background-clip: padding-box; }

/* ----------------------------- 좁은 화면 — 가로 넘침 방지 ----------------------------- */
@media (max-width: 860px) {
  .site-header { padding: 0 8px 0 14px; gap: 8px; }
  .site-brand { font-size: 14px; }
  /* 메뉴는 헤더 안에서만 옆으로 밀어 보기 (페이지 전체가 가로로 밀리지 않게) */
  .site-nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a, .navdrop > button { padding: 8px 9px; }
  .navdrop { position: static; }
  .navdrop-menu { left: 8px; right: 8px; top: 64px; margin-top: 0; }
  .site-user b, .site-user span:not(.dot) { display: none; }
}
@media (max-width: 600px) {
  .wrap { padding: 26px 16px 64px; }
  .page-head h1 { font-size: 24px; }
  .sec-head { margin-top: 32px; }
  .card { padding: 18px; }
}
