/* 투자일기 타임라인 공개 사이트 — 자체 테마 (Obsidian CSS 변수 대체) */
:root {
  --bg: #ffffff;
  --bg2: #f5f6f8;
  --bg3: #eceef2;
  --border: #d9dce3;
  --text: #1f2328;
  --muted: #6b7280;
  --faint: #9aa1ac;
  --accent: #2b6fb0;
  --accent-text: #ffffff;
  --up: #30a46c;
  --down: #e5484d;
  --hl: rgba(43, 182, 115, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --bg2: #1e2128;
    --bg3: #262a33;
    --border: #343945;
    --text: #e6e8ec;
    --muted: #9aa1ac;
    --faint: #6b7280;
    --accent: #5b9dd9;
    --accent-text: #10233a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
}
main { max-width: 920px; margin: 0 auto; padding: 16px 14px 60px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45em; margin: 8px 0 4px; }
h2 { font-size: 1.2em; margin: 40px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); }
h4 { margin: 22px 0 4px; }
button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.92em;
  min-height: 36px;
}
button:hover { background: var(--bg3); }
button.active { font-weight: 700; border-color: var(--accent); color: var(--accent); }

.site-nav { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; color: var(--muted); font-size: 0.9em; }
.intro { color: var(--muted); font-size: 0.92em; margin: 6px 0 0; }
.section-note { color: var(--muted); font-size: 0.88em; margin: 2px 0 12px; }

/* ── 차트 ── */
#range-controls { display: flex; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; }
.chart-box { position: relative; height: 300px; margin-bottom: 6px; }
.chart-cap { font-size: 0.8em; color: var(--muted); margin: 2px 0 10px; line-height: 1.55; }
.chart-cap b { color: var(--text); font-weight: 600; }
.chart-cap .release { margin-top: 3px; font-style: italic; opacity: 0.9; }

/* 날짜 상세 패널 (차트 탭 → 그날 지표·일기·핫토픽) */
#detail-panel {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--bg2);
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 0.92em;
}
#detail-panel.flash { animation: dp-flash 1.2s; }
@keyframes dp-flash { 0% { background: var(--hl); } 100% { background: var(--bg2); } }
#detail-panel .dp-date { font-weight: 700; font-size: 1.05em; }
#detail-panel .dp-hint { color: var(--faint); }
#detail-panel .dp-ind { color: var(--muted); margin: 4px 0 6px; }
#detail-panel .dp-diary a { display: block; font-weight: 600; margin: 2px 0; }
#detail-panel .dp-topic { margin: 8px 0 0; }
#detail-panel .dp-topic .t { font-weight: 600; }
#detail-panel .dp-topic .b { color: var(--muted); font-size: 0.95em; margin-top: 2px; }
#detail-panel .dp-topic .s { font-size: 0.85em; }

/* ── 표 (일기 목록) ── */
.table-wrap { overflow-x: auto; }
table.list { border-collapse: collapse; width: 100%; font-size: 0.9em; }
table.list th, table.list td { border-bottom: 1px solid var(--border); padding: 7px 10px; text-align: left; white-space: nowrap; }
table.list td.title-cell { white-space: normal; min-width: 200px; }
table.list th { color: var(--muted); font-weight: 600; background: var(--bg2); }
.badge { font-size: 0.78em; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }

/* ── 핫토픽 ── */
.ht-day { margin: 18px 0; }
.ht-day h3 { margin: 0 0 4px; font-size: 1em; }
.ht-day .diary-link { display: block; font-weight: 600; margin: 2px 0; }
.ht-day p { margin: 6px 0; }
.ht-day .src { font-size: 0.85em; }
.ht-day .body { color: var(--muted); font-size: 0.95em; }

/* ── 캘린더 (ijc-*) ── */
.ijc-wrap { font-size: 0.9em; }
.ijc-head { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 10px; }
.ijc-title { font-weight: 700; font-size: 1.15em; min-width: 8.5em; text-align: center; }
.ijc-today-btn { font-size: 0.85em !important; padding: 4px 10px !important; }
.ijc-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: auto; grid-auto-rows: 96px; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ijc-wd { background: var(--bg2); text-align: center; font-weight: 600; padding: 5px 0; font-size: 0.85em; color: var(--muted); }
.ijc-wd.sun { color: #e5484d; } .ijc-wd.sat { color: #3e63dd; }
.ijc-cell { background: var(--bg); overflow: hidden; padding: 3px 4px 5px; display: flex; flex-direction: column; gap: 2px; }
.ijc-cell.pad { background: var(--bg2); }
.ijc-daynum { font-size: 0.82em; font-weight: 600; color: var(--muted); line-height: 1.4; }
.ijc-daynum.sun { color: #e5484d; } .ijc-daynum.sat { color: #3e63dd; }
.ijc-cell.today .ijc-daynum { color: var(--accent-text); background: var(--accent); border-radius: 999px; width: 1.5em; height: 1.5em; display: inline-flex; align-items: center; justify-content: center; }
.ijc-ev { font-size: 0.72em; line-height: 1.25; padding: 1px 4px; border-radius: 3px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ijc-ev.rule { border-left-style: dashed; opacity: 0.9; }
.ijc-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; font-size: 0.82em; color: var(--muted); align-items: center; }
.ijc-legend .item { display: inline-flex; align-items: center; gap: 5px; }
.ijc-legend .sw { width: 11px; height: 11px; border-radius: 3px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); }
.ijc-note { margin-top: 6px; font-size: 0.8em; color: var(--faint); }

/* 일정 설명 카드: 데스크톱=커서 따라다니는 카드, 모바일=하단 시트 */
#ijc-tip { position: fixed; z-index: 9999; max-width: 340px; pointer-events: none; background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 18px rgba(0,0,0,0.35); padding: 9px 11px; font-size: 0.8rem; line-height: 1.45; }
#ijc-tip.pinned { pointer-events: auto; }
#ijc-tip .ijc-tip-close { display: none; }
#ijc-tip.pinned .ijc-tip-close { display: block; position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 1.1em; color: var(--muted); min-height: auto; padding: 4px 8px; }
#ijc-tip .ijc-tip-title { font-weight: 700; padding-right: 20px; }
#ijc-tip .ijc-tip-meta { color: var(--muted); font-size: 0.9em; margin: 2px 0 5px; }
#ijc-tip .ijc-tip-note { margin-bottom: 4px; }
#ijc-tip .ijc-tip-term { border-top: 1px solid var(--border); padding-top: 5px; margin-top: 5px; }
#ijc-tip .ijc-tip-term-h { font-weight: 600; }
#ijc-tip .ijc-tip-term-d { margin-top: 1px; }
#ijc-tip .ijc-tip-term-t { color: var(--muted); margin-top: 3px; }
#ijc-tip .ijc-tip-term-p { margin-top: 3px; }
#ijc-tip .ijc-tip-hint { color: var(--muted); }
#ijc-tip .ijc-tip-insight { margin: 5px 0 2px; }
#ijc-tip .ijc-tip-ih { font-weight: 700; margin-bottom: 3px; }
#ijc-tip .ijc-tip-il { display: flex; gap: 5px; margin-top: 3px; align-items: baseline; }
#ijc-tip .ijc-tip-il-k { flex: 0 0 auto; font-weight: 600; white-space: nowrap; }
#ijc-tip .ijc-tip-il-k.up { color: var(--up); }
#ijc-tip .ijc-tip-il-k.down { color: var(--down); }
#ijc-tip .ijc-tip-foot { margin-top: 7px; color: var(--faint); font-size: 0.9em; }

/* ── 일기 페이지 ── */
.diary-nav { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0 20px; font-size: 0.92em; }
.diary-entry { margin: 26px 0; }
.diary-entry h2 { border-top: none; padding-top: 0; margin-top: 0; }
.ind-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.ind-chips .chip { font-size: 0.8em; color: var(--muted); background: var(--bg2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.summary-box { border: 1px solid var(--border); border-left: 4px solid var(--up); border-radius: 8px; background: var(--bg2); padding: 4px 16px 10px; margin: 10px 0; }
.summary-box .label { font-size: 0.8em; font-weight: 700; color: var(--up); margin-top: 8px; }
details.full-view { margin: 10px 0; }
details.full-view > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; }
.md-body img { max-width: 100%; }
.md-body blockquote { border-left: 3px solid var(--border); margin: 8px 0; padding: 2px 14px; color: var(--muted); }
.md-body code { background: var(--bg3); border-radius: 4px; padding: 1px 5px; font-size: 0.9em; }
.md-body pre { background: var(--bg3); border-radius: 8px; padding: 10px 14px; overflow-x: auto; }
.md-body table { border-collapse: collapse; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 5px 10px; }

footer.site-foot { margin-top: 50px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--faint); font-size: 0.82em; }

/* ── 모바일 ── */
@media (max-width: 600px) {
  main { padding: 12px 10px 50px; }
  .chart-box { height: 250px; }
  .ijc-grid { grid-auto-rows: 64px; }
  .ijc-ev { font-size: 0.64em; }
  #ijc-tip { left: 8px !important; right: 8px; bottom: 8px; top: auto !important; max-width: none; max-height: 55vh; overflow-y: auto; }
  table.list th, table.list td { padding: 6px 7px; }
}
