/* 똑부러지게사는 주식투자일기 — 블로그 공통 스타일
   Layout: 첫 화면 = 큰 명조 제목 → 원칙 세 줄 → [장부 표지 위 달력 | 글 목록]. 본문 = 700px 읽기 컬럼.
   틀은 design/brunch.md에서 가져왔다(흰 바탕, #333 본문, 나눔명조 제목, 4px 간격, 각진 평면, 청록은 선택·링크에만, 책 표지에만 그림자).
   시안 2(큰 글자, 제목 크기 25% 줄임) + 시안 3(달력·판단 태그) + 시안 1(장부 표지)을 섞었다. 라이트 한 가지. */
:root {
  color-scheme: light;
  --white: #FFFFFF;
  --ink: #171717;
  --text: #333333;
  --text-2: #666666;
  --text-3: #959595;
  --line: #DDDDDD;
  --line-soft: #EEEEEE;
  --subtle: #FBFBFB;
  --teal: #00C6BE;
  --teal-text: #007A75;
  --teal-wash: #EAFBF9;
  --cover: #2D4A42;
  --cover-hi: #46665C;
  --cover-lo: #1F362F;

  --serif: "Nanum Myeongjo", "Batang", "AppleMyungjo", serif;
  --sans: "Noto Sans KR", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 32px; --s6: 48px; --s7: 64px; --s8: 96px;
  --radius-book: 4px 6px 6px 4px;
  --radius-pill: 100px;
  --shadow-book: 0 10px 20px rgba(0, 0, 0, .1);
  --fast: 200ms;
  --ease: cubic-bezier(.2, 0, .2, 1);

  /* 글 안 설명 그림용(국내 관례: 상승 빨강, 하락 파랑) */
  --paper: #FFFFFF;
  --fig: #F7F7F5;
  --fg: #333333;
  --fg-strong: #1A1A1A;
  --muted: #7A7A7A;
  --faint: #9A9A9A;
  --up: #D9535F;
  --up-soft: #FCEEEF;
  --up-text: #B02A3A;
  --down: #4A83DC;
  --down-soft: #EAF1FC;
  --down-text: #2559B5;
  --amber: #E3A93B;
  --bar: #C9CDD3;
  --bar-strong: #5E6672;
  --on-strong: #FFFFFF;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.85;
  letter-spacing: .01em;
  word-break: keep-all;
  overflow-wrap: break-word;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
::selection { background: rgba(0, 198, 190, .22); }
a { color: inherit; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--teal-text); outline-offset: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; }
.wrap > *, .reader > * { min-width: 0; }
.cap { font-size: 12px; line-height: 20px; color: var(--text-3); }

/* ---------- 머리 ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 64px; border-bottom: 1px solid var(--line-soft); }
.brand { font: 400 15px/1.4 var(--serif); letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.top-link { font-size: 13px; color: var(--text-2); text-decoration: none; transition: color var(--fast) var(--ease); }
.top-link:hover { color: var(--teal-text); }

/* ---------- 첫 화면: 제목 ---------- */
.hero { display: flex; flex-direction: column; gap: var(--s4); padding-top: clamp(40px, 7vw, 80px); }
.home-title { margin: 0; font: 400 clamp(36px, 8.6vw, 96px)/1.14 var(--serif); letter-spacing: -.06em; color: var(--ink); word-break: keep-all; }
.home-title span { display: block; }
.lead { font-size: 15px; line-height: 28px; color: var(--text-2); max-width: 32em; }
.rules { margin-top: var(--s5); border-top: 1px solid var(--text); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rules > div { padding: var(--s4) var(--s4) 0 0; display: flex; flex-direction: column; gap: var(--s2); }
.rules > div + div { padding-left: var(--s4); border-left: 1px solid var(--line); }
.rules p { font: 400 18px/1.65 var(--serif); letter-spacing: -.03em; color: var(--text); }

/* ---------- 첫 화면: 표지 달력 + 목록 ---------- */
.home-main { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: var(--s7); padding-block: var(--s7) var(--s8); align-items: start; }
.side { position: sticky; top: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.cover {
  position: relative; display: flex; flex-direction: column; gap: var(--s4); aspect-ratio: 3 / 4;
  padding: var(--s5) var(--s4) var(--s4) calc(6% + var(--s4));
  background: linear-gradient(135deg, var(--cover-hi), var(--cover) 55%, var(--cover-lo));
  border-radius: var(--radius-book); box-shadow: var(--shadow-book);
}
.cover::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6%; background: linear-gradient(90deg, #16302A, #3B5A50); border-right: 1px solid rgba(255, 255, 255, .24); border-radius: 4px 0 0 4px; }
.paper { background: var(--white); padding: var(--s3) var(--s3) var(--s2); box-shadow: 0 1px 2px rgba(0, 0, 0, .14); }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--s2); }
.cal-head b { font: 400 18px/1.5 var(--serif); letter-spacing: -.03em; color: var(--ink); }
.cal-nav { display: flex; gap: var(--s1); }
.cal-nav button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--text-2); font: 400 18px/1 var(--sans); cursor: pointer; transition: color var(--fast) var(--ease), background var(--fast) var(--ease); }
.cal-nav button:hover:not(:disabled) { color: var(--teal-text); background: var(--teal-wash); }
.cal-nav button:disabled { color: var(--line); cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 36px; text-align: center; }
.cal-grid .w { font-size: 12px; line-height: 28px; color: var(--text-3); height: 28px; }
.cal-grid .d { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; line-height: 1; color: var(--text-3); font-variant-numeric: tabular-nums; border: 1px solid transparent; text-decoration: none; }
.cal-grid .d.on { color: var(--ink); font-weight: 500; transition: background var(--fast) var(--ease); }
.cal-grid a.d.on:hover { background: var(--teal-wash); }
.cal-grid .d.on::after { content: ""; width: 4px; height: 4px; background: var(--ink); margin-top: 5px; }
.cal-grid .d.today { border-color: var(--teal-text); color: var(--teal-text); }
.cal-grid .d.today.on::after { background: var(--teal-text); }
.cal-key { display: flex; gap: var(--s4); padding: var(--s2) 0 var(--s1); font-size: 12px; line-height: 20px; color: var(--text-3); }
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.cal-key i { width: 8px; height: 8px; display: inline-block; }
.cover-meta { margin-top: auto; display: flex; justify-content: space-between; gap: var(--s2); color: rgba(255, 255, 255, .82); font-size: 12px; line-height: 20px; }
.cover-meta i { font-family: Georgia, "Times New Roman", serif; }
.no-js-note { font-size: 12px; color: var(--text-3); }

.feed-head { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; padding-bottom: var(--s3); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { min-height: 32px; padding: 2px 14px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: transparent; color: var(--text-2); font: 400 13px/24px var(--sans); cursor: pointer; transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.chip:hover { background: var(--subtle); }
.chip[aria-pressed="true"] { border-color: var(--teal); color: var(--teal-text); background: var(--teal-wash); }
.feed { border-top: 1px solid var(--text); }
.entry { border-bottom: 1px solid var(--line-soft); }
.entry-link { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: var(--s4); padding: var(--s4) 0; color: inherit; text-decoration: none; }
.day { display: flex; flex-direction: column; align-items: flex-start; }
.day small { font-size: 12px; line-height: 20px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.day b { font: 400 40px/1.1 var(--serif); letter-spacing: -.05em; color: var(--ink); }
.day span { margin-top: var(--s1); font-size: 12px; line-height: 20px; color: var(--text-3); }
.tag { display: inline-flex; align-items: center; padding: 0 10px; margin-bottom: var(--s2); border: 1px solid var(--line); border-radius: 40px; font-size: 12px; line-height: 22px; color: var(--text-2); font-weight: 400; }
.entry h2 { margin: 0; font: 400 24px/1.5 var(--serif); letter-spacing: -.035em; color: var(--ink); text-wrap: balance; transition: color var(--fast) var(--ease); }
.entry-link:hover h2, .entry-link:focus-visible h2 { color: var(--teal-text); }
.entry p { margin-top: var(--s2); font-size: 13px; line-height: 23px; color: var(--text-2); }
.entry .rt { display: block; margin-top: var(--s2); font-size: 12px; line-height: 20px; color: var(--text-3); }
.empty { padding: var(--s6) 0; color: var(--text-2); }
.empty b { color: var(--ink); font-weight: 500; }

/* ---------- 푸터 ---------- */
.site-foot { border-top: 1px solid var(--line-soft); padding-block: var(--s4) var(--s6); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s4); font-size: 12px; line-height: 20px; color: var(--text-3); }

/* ---------- 본문 화면 ---------- */
.reader { max-width: 700px; margin: 0 auto; padding-block: var(--s7) var(--s6); font-family: var(--serif); font-size: 18px; line-height: 2; letter-spacing: -.01em; font-weight: 400; color: var(--fg); }
.art-head { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); padding-bottom: var(--s5); margin-bottom: var(--s5); border-bottom: 1px solid var(--line-soft); font-family: var(--sans); }
.art-head .tag { margin: 0; }
.art-head h1 { margin: 0; font: 400 clamp(28px, 5.2vw, 42px)/1.42 var(--serif); letter-spacing: -.045em; color: var(--ink); text-wrap: balance; }
.art-meta { font-size: 13px; line-height: 1.6; color: var(--text-3); font-variant-numeric: tabular-nums; }
.prose { display: flex; flex-direction: column; gap: 28px; }
.prose > * { margin: 0; }
.prose h2 { margin: 24px 0 -4px; font-size: 22px; font-weight: 800; line-height: 1.55; letter-spacing: -.02em; color: var(--fg-strong); text-wrap: balance; }
.prose h2::before { content: ""; display: block; width: 28px; height: 2px; background: var(--fg-strong); margin-bottom: 18px; }
.prose h3 { margin: 12px 0 -8px; font-size: 19px; font-weight: 800; color: var(--fg-strong); }
.prose b { font-weight: 800; color: var(--fg-strong); }
.prose a { color: var(--teal-text); text-underline-offset: 3px; }
.prose code { font-family: Consolas, "Courier New", monospace; font-size: .9em; background: var(--subtle); padding: 0 4px; }
.prose hr { border: 0; border-top: 1px solid var(--line-soft); width: 100%; }
.prose blockquote { margin: 0; padding-left: var(--s4); border-left: 2px solid var(--line); color: var(--text-2); }
.prose img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.scroll-x { overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 17px; font-variant-numeric: tabular-nums; border-top: 1px solid var(--fg-strong); border-bottom: 1px solid var(--fg-strong); }
.prose th, .prose td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--line-soft); line-height: 1.7; }
.prose tr:last-child td { border-bottom: 0; }
.prose th { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--muted); }
.prose td:last-child, .prose th:last-child { text-align: right; }
.prose ul, .prose ol { padding-left: 1.4em; display: flex; flex-direction: column; gap: 8px; }
.prose li::marker { color: var(--teal-text); font-weight: 800; }
.prose ol { padding-left: 1.6em; }
.prose .foot, .prose .disclaimer, .refs { font-family: var(--sans); font-size: 14px; color: var(--muted); line-height: 1.8; }
.prose .disclaimer { border-top: 1px solid var(--line-soft); padding-top: 20px; margin-top: 8px; }
.refs { display: flex; flex-direction: column; gap: 8px; }
.prose .refs h2 { font-family: var(--sans); font-size: 14px; font-weight: 700; color: var(--fg); margin: 0 0 4px; letter-spacing: 0; }
.prose .refs h2::before { display: none; }
.refs ul { gap: 2px; }
.check { font-weight: 700; color: var(--fg); }

figure.fig { margin: 12px 0 4px; padding: 28px 20px 20px; background: var(--fig); display: flex; flex-direction: column; gap: 18px; }
figure.fig svg { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
figure.fig figcaption { font-family: var(--sans); font-size: 13px; line-height: 1.75; color: var(--muted); text-align: center; letter-spacing: 0; padding: 0 8px; }
figure.fig figcaption b { font-weight: 500; color: var(--fg); }
figure.pic { margin: 12px 0 4px; }
figure.pic figcaption { font-family: var(--sans); font-size: 13px; color: var(--muted); text-align: center; margin-top: var(--s2); }

svg { font-family: var(--sans); letter-spacing: 0; }
svg text { fill: var(--fg); }
svg .tm { fill: var(--muted); }
svg .tu { fill: var(--up-text); }
svg .td { fill: var(--down-text); }
svg .ton { fill: var(--on-strong); }
svg .b { font-weight: 700; }
.f-paper { fill: var(--paper); } .f-bg { fill: var(--fig); } .f-ink { fill: var(--fg); } .f-none { fill: none; }
.f-bar { fill: var(--bar); } .f-strong { fill: var(--bar-strong); } .f-amber { fill: var(--amber); }
.f-up { fill: var(--up); } .f-down { fill: var(--down); }
.f-upsoft { fill: var(--up-soft); } .f-downsoft { fill: var(--down-soft); }
.s-line { stroke: var(--line); } .s-ink { stroke: var(--fg); } .s-strong { stroke: var(--bar-strong); }
.s-up { stroke: var(--up); } .s-down { stroke: var(--down); } .s-paper { stroke: var(--paper); }
.s-muted { stroke: var(--muted); }
.fnone { fill: none; }
.hatch-bg { fill: var(--amber); } .hatch-ln { stroke: var(--paper); }

/* 이전 글 · 다음 글 */
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); border-top: 1px solid var(--text); padding-top: var(--s4); margin-top: var(--s6); font-family: var(--sans); }
.pager a { display: flex; flex-direction: column; gap: var(--s1); text-decoration: none; color: inherit; }
.pager a.next { text-align: right; align-items: flex-end; }
.pager .lab { font-size: 12px; line-height: 20px; color: var(--text-3); }
.pager .ttl { font: 400 18px/1.55 var(--serif); letter-spacing: -.03em; color: var(--ink); transition: color var(--fast) var(--ease); }
.pager a:hover .ttl, .pager a:focus-visible .ttl { color: var(--teal-text); }
.back { display: inline-block; margin-top: var(--s4); font: 400 14px/24px var(--sans); color: var(--text-2); text-decoration: none; }
.back:hover { color: var(--teal-text); }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 880px) {
  .home-main { grid-template-columns: minmax(0, 1fr); gap: var(--s6); padding-top: var(--s6); }
  .side { position: static; max-width: 340px; }
}
@media (max-width: 700px) {
  .rules { grid-template-columns: minmax(0, 1fr); }
  .rules > div, .rules > div + div { padding: var(--s3) 0; border-left: 0; border-top: 1px solid var(--line-soft); }
  .rules > div:first-child { border-top: 0; }
  .entry-link { grid-template-columns: 60px minmax(0, 1fr); gap: var(--s3); }
  .day b { font-size: 32px; }
  .entry h2 { font-size: 21px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager a.next { text-align: left; align-items: flex-start; }
}
@media (max-width: 520px) {
  .reader { font-size: 17px; padding-top: var(--s6); }
  figure.fig { padding: 18px 6px 16px; margin-inline: -8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
