/* =========================================================================
   한국증시 레시피 — shared stylesheet
   Static, framework-free. Light/Dark via [data-theme] on <html>.
   Data colors (KR convention): up = red, down = blue.
   ========================================================================= */

/* Pretendard 는 baseof <head> 에서 공식 dynamic-subset CSS 를 link 로 로드(@font-face 제공). */

/* ---------- tokens ---------- */
:root {
  --font-sans: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', 'Menlo', 'Consolas', monospace;

  --bg:        #ffffff;
  --bg-subtle: #f7f8fa;
  --bg-inset:  #f1f3f5;
  --bg-card:   #ffffff;
  --border:    #e7eaee;
  --border-strong: #d4d9e0;
  --text:      #1a1d21;
  --text-2:    #4b525b;
  --text-muted:#8b929c;

  --up:        #e23232;   /* 상승 = 빨강 */
  --up-bg:     #fdecec;
  --down:      #1f6fd6;   /* 하락 = 파랑 */
  --down-bg:   #e9f1fd;
  --flat:      #8b929c;

  --accent:    #2f3b8c;   /* brand chrome (data색과 충돌 피한 잉크블루) */
  --accent-2:  #5566c4;

  --radius:    10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(20,24,31,.05);
  --shadow:    0 4px 16px -6px rgba(20,24,31,.14);
  --maxw:      1180px;
  --header-h:  58px;
}

html[data-theme='dark'] {
  --bg:        #0e1014;
  --bg-subtle: #14171d;
  --bg-inset:  #1a1e26;
  --bg-card:   #161a21;
  --border:    #262c36;
  --border-strong: #343c48;
  --text:      #e9edf2;
  --text-2:    #b3bcc7;
  --text-muted:#727b88;

  --up:        #ff6b6b;
  --up-bg:     #2a1719;
  --down:      #4da3ff;
  --down-bg:   #14202f;
  --flat:      #727b88;

  --accent:    #9aa8ff;
  --accent-2:  #b7c1ff;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 6px 22px -8px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.65;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

a { color: inherit; text-decoration: none; }

.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; letter-spacing: -0.01em; }
.up   { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: var(--maxw); margin: 0 auto; height: 100%;
  padding: 0 22px;
  display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; letter-spacing: -0.03em; white-space: nowrap; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
html[data-theme='dark'] .brand__mark { color: #0e1014; }
.brand__sub { color: var(--text-muted); font-weight: 600; font-size: 12px; }

.nav { display: flex; gap: 4px; margin-left: 4px; }
.nav a {
  padding: 7px 11px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--text-2);
}
.nav a:hover { background: var(--bg-inset); color: var(--text); }
.nav a.is-active { color: var(--accent); }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg-inset); border: 1px solid transparent;
  border-radius: 8px; padding: 6px 10px; min-width: 190px;
}
.search:focus-within { border-color: var(--border-strong); background: var(--bg-card); }
.search input { border: 0; background: none; outline: none; color: var(--text); font-family: var(--font-sans); font-size: 13px; width: 100%; }
.search svg { color: var(--text-muted); flex: none; }
.icon-btn {
  width: 34px; height: 34px; flex: none; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle .moon { display: none; }
html[data-theme='dark'] .theme-toggle .sun { display: none; }
html[data-theme='dark'] .theme-toggle .moon { display: block; }

/* ---------- layout shell ---------- */
.shell { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  padding: 3px 9px; border-radius: 999px; line-height: 1.5;
}
.badge--cat   { background: var(--accent); color: #fff; }
html[data-theme='dark'] .badge--cat { color: #0e1014; }
.badge--soft  { background: var(--bg-inset); color: var(--text-2); }
.badge--up    { background: var(--up-bg); color: var(--up); }
.badge--down  { background: var(--down-bg); color: var(--down); }
.badge--hold  { background: var(--bg-inset); color: var(--text-2); }

.dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- snapshot cards ---------- */
.snap-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px;
}
.snap {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 15px 13px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 7px; position: relative; overflow: hidden;
}
.snap__name { font-size: 12.5px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.snap__name .tk { color: var(--text-muted); font-weight: 600; font-size: 11px; }
.snap__val { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.snap__chg { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.snap__chg .pct { font-size: 12.5px; }
.snap__spark { position: absolute; right: 12px; top: 12px; width: 56px; height: 22px; opacity: .9; }

/* ---------- generic data table ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
table.dt { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
table.dt thead th {
  text-align: left; font-weight: 700; font-size: 11.5px; letter-spacing: .02em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 10px 13px; border-bottom: 1px solid var(--border); background: var(--bg-subtle);
  white-space: nowrap;
}
table.dt tbody td { padding: 11px 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.dt tbody tr:last-child td { border-bottom: 0; }
table.dt tbody tr:hover { background: var(--bg-subtle); }
table.dt td.r, table.dt th.r { text-align: right; }
table.dt .name { font-weight: 700; color: var(--text); }
table.dt .code { color: var(--text-muted); font-size: 11.5px; }
table.dt .cmt { color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
table.dt .src { color: var(--accent); font-size: 11.5px; font-weight: 600; white-space: nowrap; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 56px; background: var(--bg-subtle); }
.site-footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 30px 22px 40px; display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; color: var(--text-muted); font-size: 12.5px; }
.site-footer .brand { font-size: 14px; }

/* =========================================================================
   ARTICLE / POST
   ========================================================================= */

.art-head { padding: 34px 0 22px; border-bottom: 1px solid var(--border); }
.art-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); margin-bottom: 14px; }
.art-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); opacity: .55; }
.art-title { font-size: 32px; line-height: 1.22; font-weight: 800; letter-spacing: -0.035em; margin: 0 0 12px; text-wrap: balance; }
.art-lede { font-size: 16.5px; line-height: 1.6; color: var(--text-2); margin: 0; max-width: 62ch; }
.art-updated { margin-top: 14px; font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }

/* 보고서 본문 이미지(히어로·매크로). aspect-ratio 로 로드 전에도 자리를 잡아 레이아웃 이동(CLS)을 막는다. */
.report-visual {
  margin: 24px 0 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-subtle);
  box-shadow: 0 14px 38px rgba(14, 27, 42, .08);
}
.report-visual--hero { margin: 26px 0 0; }
.report-visual img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

/* two-column: sticky nav rail + content */
.art-layout { display: grid; grid-template-columns: 212px minmax(0, 1fr); gap: 40px; align-items: start; padding-top: 26px; }

.secnav { position: sticky; top: calc(var(--header-h) + 22px); }
.secnav__title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); padding: 0 12px 10px; }
.secnav__list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.secnav__list a {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 7px 12px; margin-left: -1px; border-left: 2px solid transparent;
  font-size: 13px; font-weight: 600; color: var(--text-muted); line-height: 1.3;
  transition: color .15s, border-color .15s;
}
.secnav__list a:hover { color: var(--text); }
.secnav__list a .n { font-size: 10.5px; font-variant-numeric: tabular-nums; opacity: .6; }
.secnav__list a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 700; }
.secnav__progress { margin: 14px 12px 0; height: 3px; background: var(--bg-inset); border-radius: 99px; overflow: hidden; }
.secnav__progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .12s linear; }

/* mobile horizontal chip bar (hidden on desktop) */
.chipbar { display: none; }

/* sections */
.art-content { min-width: 0; }
.sec { padding: 30px 0; border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--header-h) + 16px); }
.sec:last-child { border-bottom: 0; }
.sec__head { display: flex; align-items: baseline; gap: 11px; margin: 0 0 18px; }
.sec__num { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--accent); padding-top: 3px; }
.sec__title { font-size: 21px; font-weight: 800; letter-spacing: -0.025em; margin: 0; }
.sec__hint { margin-left: auto; font-size: 12px; color: var(--text-muted); font-weight: 600; align-self: center; }

.prose p { margin: 0 0 13px; color: var(--text); line-height: 1.72; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 700; }
.prose .hl-up { color: var(--up); font-weight: 700; }
.prose .hl-down { color: var(--down); font-weight: 700; }

.subhead { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.subhead::before { content: ''; width: 3px; height: 13px; background: var(--accent); border-radius: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack-12 > * + * { margin-top: 12px; }

/* macro callout strip */
.macro-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin: 4px 0 6px; }
.macro-cell { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 13px; }
.macro-cell .k { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 5px; }
.macro-cell .v { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.macro-cell .d { font-size: 12px; font-weight: 700; margin-top: 2px; }

/* insight cards */
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.insight {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 17px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 11px;
}
.insight__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.insight__name { font-size: 15.5px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 7px; }
.insight__name .code { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.insight__rows { display: flex; flex-direction: column; gap: 8px; }
.irow { display: grid; grid-template-columns: 64px 1fr; gap: 10px; font-size: 13px; line-height: 1.55; }
.irow .lab { color: var(--text-muted); font-weight: 700; font-size: 11.5px; padding-top: 1px; letter-spacing: .02em; }
.irow .val { color: var(--text-2); }
.insight__concl { display: flex; align-items: center; gap: 9px; padding-top: 11px; border-top: 1px solid var(--border); font-size: 12.5px; }
.insight__concl .lab { color: var(--text-muted); font-weight: 700; }
/* 인사이트 카드 안에 일봉 차트를 커플처럼 묶어 넣는 프레임(카드 톤과 통일) */
.insight__chart { margin: 3px 0 1px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg); }
.insight__chart img { display: block; width: 100%; height: auto; }
.insight__chart figcaption { padding: 5px 9px 6px; font-size: 10.5px; color: var(--text-muted); border-top: 1px solid var(--border); letter-spacing: .01em; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2.5px solid var(--accent); }
.timeline .t-time { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; color: var(--accent); }
.timeline .t-title { font-weight: 700; font-size: 14px; margin: 2px 0 4px; }
.timeline .t-body { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.timeline .t-src { font-size: 11.5px; color: var(--accent); font-weight: 600; margin-left: 7px; }
.timeline .t-when { display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--accent); background: var(--bg-subtle); border-radius: 999px; padding: 1px 8px; margin-right: 8px; vertical-align: 2px; }
.timeline .t-impact { display: block; margin-top: 5px; font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.timeline .t-impact::before { content: '↳ '; color: var(--accent); font-weight: 700; }

/* schedule / extra cols */
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mini-card { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; }
.mini-card h4 { margin: 0 0 11px; font-size: 13.5px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.mini-list li { font-size: 13px; line-height: 1.5; display: flex; justify-content: space-between; gap: 10px; color: var(--text-2); }
.mini-list li .when { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; flex: none; font-weight: 600; }

.trend { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 12.5px; }

/* disclaimer */
.disclaimer {
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; font-size: 12.5px; line-height: 1.7; color: var(--text-muted);
}
.disclaimer strong { color: var(--text-2); }

/* =========================================================================
   HOME / LIST
   ========================================================================= */
.home-hero { padding: 30px 0 20px; }
.home-hero h1 { font-size: 25px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 6px; }
.home-hero p { margin: 0; color: var(--text-2); font-size: 14.5px; }

.section-label { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 14px; }
.section-label h2 { font-size: 16px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.section-label .more { margin-left: auto; font-size: 12.5px; color: var(--accent); font-weight: 700; }

.post-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-card); }
.post-row { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--border); transition: background .15s; }
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: var(--bg-subtle); }
.post-row__main { min-width: 0; }
.post-row__meta { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--text-muted); margin-bottom: 7px; flex-wrap: wrap; }
.post-row__title { font-size: 16.5px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; line-height: 1.35; }
.post-row:hover .post-row__title { color: var(--accent); }
.post-row__excerpt { font-size: 13.5px; color: var(--text-2); line-height: 1.55; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-row__mini { display: flex; gap: 14px; align-items: flex-start; flex: none; padding-top: 22px; }
.kv { text-align: right; }
.kv .k { font-size: 10.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
.kv .v { font-size: 14px; font-weight: 800; letter-spacing: -.02em; }

.feat-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.feat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 22px 20px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.feat-card.lg { justify-content: space-between; }
.feat-card .post-row__meta { margin-bottom: 11px; }
.feat-card h3 { font-size: 22px; font-weight: 800; letter-spacing: -.03em; line-height: 1.25; margin: 0 0 10px; }
.feat-card .post-row__excerpt { -webkit-line-clamp: 3; font-size: 14px; }
.feat-side { display: flex; flex-direction: column; gap: 16px; }
.feat-side .feat-card { padding: 17px 18px; }
.feat-side h3 { font-size: 15.5px; margin-bottom: 7px; line-height: 1.32; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  /* minmax(0,1fr): 1fr(=minmax(auto,1fr))이 표 min-content 만큼 늘어나 화면을 넘는 것 방지 */
  .art-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; }
  .secnav { position: sticky; top: var(--header-h); margin: 0 -22px; padding: 0; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); z-index: 30; }
  .secnav__title, .secnav__progress { display: none; }
  .secnav__list { display: flex; overflow-x: auto; border-left: 0; padding: 9px 16px; gap: 6px; scrollbar-width: none; }
  .secnav__list::-webkit-scrollbar { display: none; }
  .secnav__list a { border-left: 0; border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; white-space: nowrap; background: var(--bg-card); }
  .secnav__list a.is-active { border-color: var(--accent); background: var(--accent); color: #fff; }
  html[data-theme='dark'] .secnav__list a.is-active { color: #0e1014; }
  .secnav__list a .n { display: none; }
}
@media (max-width: 900px) {
  .snap-grid { grid-template-columns: repeat(2, 1fr); }
  .nav, .search { display: none; }
  .insight-grid, .grid-2, .macro-strip, .cols-3, .feat-grid { grid-template-columns: 1fr; }
  .macro-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  .art-title { font-size: 25px; }
  .post-row { grid-template-columns: 1fr; }
  .post-row__mini { padding-top: 4px; }
  .macro-strip { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .snap-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .snap__val { font-size: 21px; }
  body { font-size: 15px; }
}

/* ---------- 일반 글(소개/정책/연락처 등) 본문 ---------- */
.page-prose { font-size: 15.5px; line-height: 1.75; color: var(--text); }
.page-prose h2 { font-size: 20px; font-weight: 800; letter-spacing: -.025em; margin: 30px 0 12px; }
.page-prose h3 { font-size: 16px; font-weight: 800; margin: 22px 0 8px; }
.page-prose p { margin: 0 0 14px; }
.page-prose ul, .page-prose ol { margin: 0 0 14px; padding-left: 20px; }
.page-prose li { margin: 4px 0; }
.page-prose a { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.page-prose blockquote { margin: 14px 0; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--bg-subtle); border-radius: 0 8px 8px 0; color: var(--text-2); }
.page-prose code { font-family: var(--font-mono); font-size: .9em; background: var(--bg-inset); padding: 1px 5px; border-radius: 5px; }
.page-prose hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
/* 본문 이미지 — 문단에 이미지 하나만 있을 때(마크다운 ![]() 는 <p><img></p> 로 렌더된다) */
.page-prose > p:has(> img:only-child) { margin: 22px 0 26px; }
.page-prose > p > img:only-child {
  display: block; width: 100%; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 38px rgba(12, 24, 45, .12);
}
/* 마크다운 표 — 좁은 화면에서 가로 스크롤(display:block 이라야 overflow-x 가 먹는다) */
.page-prose table {
  display: block; width: 100%; overflow-x: auto; border-collapse: collapse;
  margin: 18px 0 22px; font-size: 14px; border: 1px solid var(--border); border-radius: 10px;
}
.page-prose table th, .page-prose table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.page-prose table th { font-weight: 700; color: var(--text-2); background: var(--bg-subtle); white-space: nowrap; }
.page-prose table tr:last-child td { border-bottom: 0; }

/* ---------- 주간레시피 에세이(.weekly-prose = art-content 안의 page-prose) ---------- */
/* 본문 헤딩이 목차 앵커 대상 — 스티키 헤더에 가리지 않게 오프셋 */
.weekly-prose h2, .weekly-prose h3 { scroll-margin-top: calc(var(--header-h) + 16px); }
.weekly-prose > h2:first-child, .weekly-prose > h3:first-child { margin-top: 6px; }
.weekly-prose h2 { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
/* 마크다운 표(클래스 없는 <table>) — 좁은 화면에선 가로 스크롤 */
.weekly-prose table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14px; margin: 0 0 16px; }
.weekly-prose table th, .weekly-prose table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.weekly-prose table th { font-weight: 700; color: var(--text-2); background: var(--bg-subtle); }
.weekly-prose table td.num, .weekly-prose table td:not(:first-child) { font-variant-numeric: tabular-nums; }
/* 주간 에세이 본문 이미지 — 마크다운 ![]() 는 <p><img></p> 로 렌더된다 */
.weekly-prose > p:has(> img:only-child) { margin: 22px 0 28px; }
.weekly-prose > p > img:only-child {
  display: block; width: 100%; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 38px rgba(12, 24, 45, .12);
}

/* ---------- 브랜드 마크 = 이미지 아이콘 ---------- */
img.brand__mark { width: 26px; height: 26px; flex: none; display: block; background: transparent; border-radius: 6px; object-fit: cover; padding: 0; }

/* ---------- footer 링크 ---------- */
.footer-links { margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.footer-links a { color: var(--accent); font-weight: 600; }
.footer-links a:hover { text-decoration: underline; }
html[data-theme='dark'] .footer-links a { color: var(--accent-2); }

/* ---------- 햄버거 모바일 메뉴 ---------- */
.nav-toggle { display: none; }
@media (max-width: 900px) {
  .site-header__inner { position: relative; }
  .nav-toggle { display: grid; }
  .nav { display: none; position: absolute; top: calc(var(--header-h) - 4px); left: 16px; right: 16px;
         flex-direction: column; gap: 2px; background: var(--bg-card); border: 1px solid var(--border);
         border-radius: 12px; padding: 8px; box-shadow: var(--shadow); z-index: 60; }
  .nav.is-open { display: flex; }
  .nav a { padding: 11px 13px; border-radius: 8px; font-size: 14.5px; }
  .nav a:hover { background: var(--bg-inset); }
}

/* ---------- 모바일 가로 스크롤 차단 + sticky 유지 ---------- */
/* overflow-x: clip 은 가로 스크롤만 잘라내고 스크롤 컨테이너를 만들지 않아
   position:sticky(좌측 목차/헤더)를 깨뜨리지 않는다 (hidden 과의 차이). */
html { overflow-x: clip; }
body { overflow-x: clip; max-width: 100%; }
.shell { width: 100%; }
.art-head, .art-content, .sec, .prose, .home-hero { min-width: 0; max-width: 100%; }
img, svg, video { max-width: 100%; height: auto; }

@media (max-width: 620px) {
  .shell { padding: 0 16px; }
  .secnav { margin: 0 -16px; }              /* 칩바 풀블리드 — shell 패딩과 일치 */
  .snap__val { font-size: 20px; }
  .sec { padding: 24px 0; }
  .sec__hint { display: none; }              /* 좁은 폭에서 헤더 우측 힌트 숨김 */

  /* === 세로형 표: 각 행을 카드로(라벨 왼쪽 / 값 오른쪽, 같은 줄) ===
     block + float::before 패턴(특이도 tbody td 로 base 규칙을 확실히 덮음). */
  .tbl-wrap { border: 0; background: transparent; overflow: visible; }
  table.dt { min-width: 0; display: block; font-size: 13.5px; }
  table.dt thead { display: none; }
  table.dt tbody { display: block; }
  table.dt tbody tr { display: block; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); padding: 10px 14px; margin-bottom: 9px; }
  table.dt tbody tr:hover { background: var(--bg-card); }
  table.dt tbody td { display: block; border: 0; padding: 5px 0; text-align: right; vertical-align: baseline; }
  table.dt tbody td::before { content: attr(data-label); float: left; color: var(--text-muted); font-weight: 700; font-size: 11.5px; letter-spacing: .02em; }
  table.dt tbody td:empty { display: none; }
  table.dt tbody td.name { text-align: left; font-size: 15.5px; font-weight: 800; padding: 0 0 7px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
  table.dt tbody td.name::before { content: none; }
  table.dt tbody td.cmt { text-align: left; line-height: 1.55; }
  table.dt tbody td.cmt::before { display: block; float: none; margin-bottom: 3px; }
  /* 섹션 점프 시 상단 헤더+칩바에 안 가리도록 여유 */
  .sec { scroll-margin-top: calc(var(--header-h) + 58px); }
}

/* ---------- 섹터 전광판 (heat board) ----------
   타일 크기는 균일. 정렬(거래대금 순)이 '자금이 어디로 갔나'를, 색이 등락을 나타낸다.
   트리맵(면적=시총)은 모바일에서 하위 타일이 뭉개져 쓰지 않는다.
   색만으로 값을 전달하지 않는다 — 타일에 등락률 숫자를 항상 병기(색맹 대비). */
:root {
  --heat-up3:   #b02a1f;  --heat-up3-fg:   #fff;
  --heat-up2:   #d9534f;  --heat-up2-fg:   #fff;
  --heat-up1:   #f8c9c4;  --heat-up1-fg:   #5d1a13;
  --heat-flat:  #e9ecef;  --heat-flat-fg:  #454b53;
  --heat-down1: #c3d9f5;  --heat-down1-fg: #12365f;
  --heat-down2: #3d7fd0;  --heat-down2-fg: #fff;
  --heat-down3: #1a4b96;  --heat-down3-fg: #fff;
}
html[data-theme='dark'] {
  --heat-up3:   #8f2b22;  --heat-up3-fg:   #ffe9e6;
  --heat-up2:   #a8463f;  --heat-up2-fg:   #ffe9e6;
  --heat-up1:   #5c332f;  --heat-up1-fg:   #ffd8d3;
  --heat-flat:  #2a2f38;  --heat-flat-fg:  #aeb6c0;
  --heat-down1: #2b3d5c;  --heat-down1-fg: #cfe0f7;
  --heat-down2: #2a5fa8;  --heat-down2-fg: #e6f0fd;
  --heat-down3: #1d4585;  --heat-down3-fg: #e6f0fd;
}

.heat-grid {
  display: grid;
  /* auto-fill + minmax: 데스크톱 4~5열 → 태블릿 3열 → 모바일 2열로 자동 접힘(미디어쿼리 불필요) */
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.heat {
  border-radius: var(--radius-sm);
  padding: 12px 13px 11px;
  background: var(--heat-flat);
  color: var(--heat-flat-fg);
  min-width: 0;
}
.heat--up3   { background: var(--heat-up3);   color: var(--heat-up3-fg); }
.heat--up2   { background: var(--heat-up2);   color: var(--heat-up2-fg); }
.heat--up1   { background: var(--heat-up1);   color: var(--heat-up1-fg); }
.heat--flat  { background: var(--heat-flat);  color: var(--heat-flat-fg); }
.heat--down1 { background: var(--heat-down1); color: var(--heat-down1-fg); }
.heat--down2 { background: var(--heat-down2); color: var(--heat-down2-fg); }
.heat--down3 { background: var(--heat-down3); color: var(--heat-down3-fg); }

.heat__name {
  font-size: 12.5px; font-weight: 700; line-height: 1.3;
  display: flex; align-items: baseline; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.heat__mkt { font-size: 10px; font-weight: 600; opacity: .62; flex: none; }
.heat__pct { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin-top: 5px; line-height: 1.1; }
.heat__amt { font-size: 11px; font-weight: 600; opacity: .72; margin-top: 2px; }

/* 메인 페이지 요약 스트립 — 상승/하락 상위 몇 개만 한 줄로 */
.heat-strip { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.heat-strip .heat { padding: 8px 11px; border-radius: 999px; display: flex; align-items: baseline; gap: 8px; }
.heat-strip .heat__name { font-size: 12px; }
.heat-strip .heat__pct { font-size: 13px; margin-top: 0; }

/* ── 홈 투자상식 카드 ───────────────────────────────────────── */
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.guide-grid .feat-card h3 { font-size: 17px; line-height: 1.32; }

/* ── 글 하단 내부 링크 (태그 · 이전/다음 · 관련 글) ──────────────
   글에서 글로 이어지는 유일한 경로다. 크롤러의 사이트 순회와 독자의
   다음 클릭이 둘 다 여기에 달려 있다. */
.post-foot { margin-top: 34px; padding-top: 28px; border-top: 1px solid var(--border); }
.post-foot--offset { margin-left: calc(212px + 40px); }
.post-foot--narrow { max-width: 760px; }

.post-foot__tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px; }
.tagchip {
  font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px;
  background: var(--bg-inset); color: var(--text-2); border: 1px solid var(--border);
  transition: background .15s, color .15s, border-color .15s;
}
.tagchip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.post-foot__nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pnav {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 15px 17px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); transition: border-color .15s, background .15s;
}
.pnav:hover { border-color: var(--accent); background: var(--bg-subtle); }
.pnav--next { text-align: right; }
.pnav__dir { font-size: 11.5px; font-weight: 700; color: var(--accent); letter-spacing: -.01em; }
.pnav__title {
  font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pnav:hover .pnav__title { color: var(--accent); }

.post-foot__related { margin-top: 30px; }
.post-foot__related .section-label { margin-top: 0; }

.post-foot__more { margin-top: 20px; font-size: 13px; font-weight: 700; }
.post-foot__more a { color: var(--accent); }

@media (max-width: 980px) {
  .post-foot--offset { margin-left: 0; }
}
@media (max-width: 620px) {
  .guide-grid { grid-template-columns: 1fr; }
  .post-foot__nav { grid-template-columns: 1fr; }
  .pnav--next { text-align: left; }
}
