/* ===================================================================
   파이썬 문법 레퍼런스 공용 스타일  (.pyref-*)
   - projects/py-*.html 에서 <link>로 공유
   =================================================================== */

.pyref {
  --py-blue:        #1B4F72;
  --py-blue-light:  #D6EAF8;
  --py-blue-mid:    #2471A3;
  --py-navy:        #2C3E50;
  --py-yellow:      #FFD43B;   /* python 로고 옐로우 */
  --py-green:       #145A32;
  --py-green-light: #D5F5E3;
  --py-red:         #7B241C;
  --py-red-light:   #FADBD8;
  --py-orange-bg:   #FEF9E7;
  --py-orange-tx:   #7D6608;
  --py-gray-bg:     #F4F6F7;
  --py-gray-border: #BDC3C7;
  --py-code-bg:     #EBF5FB;
  --py-code-tx:     #1A5276;
  --py-muted:       #7F8C8D;

  display: flex;
  align-items: flex-start;
  gap: 0;
  max-width: 1140px;
  margin: 10px auto 48px;
  padding: 0 16px;
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  color: #1a1a1a;
  line-height: 1.7;
  font-size: 15px;
}

/* ── 사이드바 목차 (sticky) ── */
.pyref-side {
  position: sticky;
  top: 16px;
  width: 210px;
  min-width: 210px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--py-navy);
  border-radius: 12px;
  padding: 1.4rem 1rem;
  flex-shrink: 0;
  margin-right: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.pyref-side::-webkit-scrollbar { width: 4px; }
.pyref-side::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.pyref-side-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  margin-bottom: 1rem;
}
.pyref-side nav a {
  display: block;
  font-size: 12.5px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  padding: 5px 9px;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 0.15s;
}
.pyref-side nav a:hover,
.pyref-side nav a.pyref-active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.pyref-side nav a.pyref-sub {
  padding-left: 18px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.4);
}
.pyref-side nav a.pyref-sub:hover { color: rgba(255,255,255,0.72); }

.pyref-side-back {
  display: block;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 11.5px !important;
  color: rgba(255,255,255,0.45) !important;
}

/* ── 메인 콘텐츠 ── */
.pyref-main {
  flex: 1;
  min-width: 0;
  padding-bottom: 2rem;
}

/* ── 태그 영역 ── */
.pyref-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 28px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--py-blue);
}
.pyref-tags span {
  background: var(--py-blue-light);
  color: var(--py-blue);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ── 섹션 ── */
.pyref-main section { margin-bottom: 2.6rem; }

.pyref-h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--py-blue);
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--py-blue-light);
  margin-bottom: 1rem;
  scroll-margin-top: 1.5rem;
}
.pyref-h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--py-navy);
  margin: 1.6rem 0 0.65rem;
  scroll-margin-top: 1.5rem;
}
.pyref-lead {
  color: var(--py-muted);
  font-size: 14px;
  margin: -4px 0 22px;
}

.pyref-body {
  color: #2c2c2c;
  margin-bottom: 0.75rem;
  font-size: 14.5px;
}
.pyref-body strong { color: var(--py-navy); }
.pyref-body code, li code, td code, .pyref-h2 code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  background: var(--py-code-bg);
  color: var(--py-code-tx);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── 코드 블록 (highlight.js) ── */
.pyref-code {
  margin: 0.6rem 0 1.2rem;
  border-radius: 10px;
  border: 1px solid var(--py-gray-border);
  overflow: hidden;
  background: #fafafa;
}
.pyref-code > .pyref-code-cap {
  display: block;
  background: #34495E;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  padding: 6px 14px;
}
.pyref-code pre {
  margin: 0;
  overflow-x: auto;
}
.pyref-code pre code.hljs {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.75;
  padding: 0.85rem 1.1rem;
  background: transparent;
}
/* 결과 주석 강조용 인라인 표기 (# => ...) 는 hljs 기본 comment 색을 사용 */

/* ── 컬러 박스 ── */
.pyref-box {
  border-radius: 8px;
  padding: 0.85rem 1.05rem;
  margin: 0.7rem 0 1.2rem;
  border-left: 4px solid currentColor;
}
.pyref-box-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.pyref-box ul { list-style: none; padding: 0; margin: 0; }
.pyref-box li {
  font-size: 13px;
  padding: 3px 0;
  display: flex;
  gap: 7px;
  line-height: 1.55;
  color: #2c2c2c;
}
.pyref-box li::before { content: "▸"; flex-shrink: 0; color: currentColor; }
.pyref-box-green  { background: var(--py-green-light);  color: var(--py-green);     border-color: var(--py-green); }
.pyref-box-blue   { background: var(--py-blue-light);   color: var(--py-blue);      border-color: var(--py-blue-mid); }
.pyref-box-orange { background: var(--py-orange-bg);    color: var(--py-orange-tx); border-color: #D4AC0D; }
.pyref-box-red    { background: var(--py-red-light);    color: var(--py-red);       border-color: var(--py-red); }

/* ── 표 ── */
.pyref-table-wrap { overflow-x: auto; margin: 0.6rem 0 1.3rem; }
.pyref-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.pyref-table th, .pyref-table td {
  border: 1px solid var(--py-gray-border);
  padding: 7px 11px;
  text-align: left;
  vertical-align: top;
}
.pyref-table th {
  background: var(--py-gray-bg);
  color: var(--py-navy);
  font-weight: 700;
  white-space: nowrap;
}
.pyref-table td:first-child { white-space: nowrap; }

/* ── 구분선 / 인용 ── */
.pyref-divider {
  border: none;
  border-top: 2px dashed var(--py-gray-border);
  margin: 2.2rem 0;
}
.pyref-quote {
  text-align: center;
  font-style: italic;
  color: var(--py-muted);
  font-size: 13.5px;
  margin-top: 1.8rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--py-gray-border);
}

/* ── 하단 이전/다음 네비 ── */
.pyref-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--py-gray-border);
}
.pyref-pager a {
  flex: 1;
  text-decoration: none;
  font-size: 12.5px;
  color: var(--py-blue-mid);
  padding: 9px 13px;
  border: 1px solid var(--py-gray-border);
  border-radius: 8px;
  transition: background 0.15s;
}
.pyref-pager a:hover { background: var(--py-gray-bg); }
.pyref-pager a.pyref-next { text-align: right; }
.pyref-pager span { display: block; font-size: 10.5px; color: var(--py-muted); margin-bottom: 2px; }

/* ── 반응형 ── */
@media (max-width: 768px) {
  .pyref { flex-direction: column; padding: 0 10px; }
  .pyref-side {
    position: static; width: 100%; min-width: 0; max-height: none;
    margin-right: 0; margin-bottom: 16px; border-radius: 10px;
  }
  .pyref-main { padding-bottom: 1rem; }
}
