/* ================================================================
   배당 재투자 계산기 — 공통 스타일
   색은 네이비 한 계열만 쓴다. 밝은 파랑·하늘색 음영은 쓰지 않는다.
   강조는 색을 늘려서가 아니라 크기와 무게의 위계로 준다.
   ================================================================ */

@font-face {
  font-family: 'Pretendard';
  font-weight: 400 700;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/woff2/PretendardVariable.woff2') format('woff2-variations');
}

:root {
  --navy-deep: #142a4c;
  --navy: #1b3a5f;
  --navy-soft: #3c5a7d;
  --ink: #1f2937;
  --muted: #5b6573;
  --faint: #7c8695;
  --rule: #dde1e7;
  --border: #c3cad4;
  --tint: #f4f6f8;
  --canvas: #f7f8fa;
  --paper: #ffffff;

  --measure: 68ch;
  --radius: 4px;
  --shadow-raise: 0 1px 2px rgba(20, 42, 76, .06), 0 8px 24px -12px rgba(20, 42, 76, .22);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--border) var(--canvas);
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  font-feature-settings: 'ss01';
  -webkit-font-smoothing: antialiased;
}

/* 브라우저가 기본으로 그리는 것들도 이 사이트의 색으로 바꾼다 */
::selection { background: var(--navy-deep); color: #fff; }
:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
  border-radius: 2px;
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--canvas); }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 3px solid var(--canvas);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--navy-soft); }

a {
  color: var(--navy);
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
  text-decoration-color: var(--border);
  transition: text-decoration-color .18s var(--ease-out);
}
a:hover { text-decoration-color: var(--navy); }

/* ---------------- 뼈대 ---------------- */

.wrap { width: min(100% - 2.5rem, 1120px); margin-inline: auto; }
.wrap--prose { width: min(100% - 2.5rem, 760px); }

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.masthead__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem 2rem;
  padding-block: 1.15rem;
}
.masthead__name {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--navy-deep);
  text-decoration: none;
}
.masthead__name:hover { text-decoration: underline; text-underline-offset: .25em; }
.nav { display: flex; flex-wrap: wrap; gap: 1.35rem; margin-left: auto; }
.nav a {
  font-size: .9375rem;
  color: var(--muted);
  text-decoration: none;
  padding-block: 2px;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--navy-deep); border-bottom-color: var(--border); }
.nav a[aria-current='page'] { color: var(--navy-deep); font-weight: 600; border-bottom-color: var(--navy-deep); }

main { padding-block: 3.25rem 4.5rem; }

.foot {
  border-top: 1px solid var(--rule);
  background: var(--paper);
  padding-block: 2.25rem 3rem;
  font-size: .875rem;
  color: var(--muted);
}
.foot a { color: var(--muted); }
.foot__links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-bottom: 1rem; }
.foot p { margin: .35rem 0; max-width: var(--measure); }

/* ---------------- 글자 ---------------- */

h1, h2, h3 { letter-spacing: -.025em; text-wrap: balance; }

h1 {
  font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.375rem);
  line-height: 1.24;
  font-weight: 700;
  color: var(--navy-deep);
  margin: 0 0 .75rem;
}
h2 {
  font-size: 1.375rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--navy-deep);
  margin: 3.25rem 0 .9rem;
}
h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--navy);
  margin: 2.25rem 0 .6rem;
}
p, ul, ol { max-width: var(--measure); }
p { margin: 0 0 1.05rem; }
li { margin-bottom: .4rem; }
strong { font-weight: 700; color: var(--navy-deep); }

.lede {
  font-size: 1.0625rem;
  color: var(--muted);
  max-width: var(--measure);
  margin-bottom: 2rem;
}

.num { font-variant-numeric: tabular-nums; }

/* ---------------- 계산기 ---------------- */

.calc {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  margin-top: 2.25rem;
}
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; gap: 2rem; } }

.panel {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.65rem;
}

.field { margin-bottom: 1.15rem; }
.field > label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--navy-deep);
  margin-bottom: .35rem;
}
.field__hint {
  display: block;
  font-size: .8125rem;
  font-weight: 400;
  color: var(--faint);
  margin-top: .1rem;
}
.control { position: relative; display: flex; align-items: center; }
.control input,
.control select {
  width: 100%;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem 2.6rem .55rem .7rem;
  caret-color: var(--navy);
  transition: border-color .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
.control select { padding-right: .7rem; appearance: none; background-image: none; }
.control input:hover, .control select:hover { border-color: var(--navy-soft); }
.control input:focus, .control select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27, 58, 95, .12);
  outline: none;
}
.control__unit {
  position: absolute;
  right: .7rem;
  font-size: .875rem;
  color: var(--faint);
  pointer-events: none;
}
.control select + .control__unit { display: none; }

.field--invalid .control input { border-color: #8c2f39; }
.field__error {
  display: none;
  font-size: .8125rem;
  color: #8c2f39;
  margin-top: .3rem;
}
.field--invalid .field__error { display: block; }

.panel__note {
  font-size: .8125rem;
  color: var(--faint);
  border-top: 1px solid var(--rule);
  padding-top: .9rem;
  margin: 1.35rem 0 0;
  line-height: 1.6;
}

/* 결과 */

.result__headline { margin-bottom: 1.75rem; }
.result__label {
  font-size: .875rem;
  color: var(--muted);
  margin: 0 0 .25rem;
}
.result__figure {
  font-size: clamp(2rem, 1.3rem + 2.8vw, 3.25rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  line-height: 1.05;
  color: var(--navy-deep);
  margin: 0;
}
.result__figure .unit { font-size: .45em; font-weight: 600; margin-left: .18em; color: var(--navy-soft); }
.result__sub { font-size: .9375rem; color: var(--muted); margin: .55rem 0 0; max-width: 46ch; }

/* 결과가 갱신될 때의 단 하나의 연출 */
.result--updated .result__figure { animation: rise .5s var(--ease-out) both; }
.result--updated .bar { animation: grow .55s var(--ease-out) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(.3em); }
  to   { opacity: 1; transform: none; }
}
@keyframes grow {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .result--updated .result__figure, .result--updated .bar { animation: none; }
  * { transition-duration: .01ms !important; }
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2rem;
}
.breakdown div { background: var(--paper); padding: .85rem 1rem .95rem; }
.breakdown dt { font-size: .8125rem; color: var(--muted); margin-bottom: .2rem; }
.breakdown dd {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--navy-deep);
}

/* 그래프 */
.chart { margin-bottom: 2rem; }
.chart svg { display: block; width: 100%; height: auto; }
.bar { transform-origin: bottom; }
.bar--contributed { fill: var(--navy-soft); }
.bar--dividend { fill: var(--navy-deep); }
.chart__axis { font-size: 11px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 1.25rem; font-size: .8125rem; color: var(--muted); margin-top: .6rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* 표 */
.table-scroll { overflow-x: auto; margin-bottom: 1.25rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
  font-variant-numeric: tabular-nums;
  background: var(--paper);
}
caption {
  text-align: left;
  font-size: .875rem;
  color: var(--muted);
  padding-bottom: .6rem;
}
th, td { padding: .55rem .8rem; border-bottom: 1px solid var(--rule); text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead th {
  background: var(--navy-deep);
  color: #fff;
  font-weight: 600;
  font-size: .875rem;
  border-bottom: none;
  position: sticky;
  top: 0;
}
tbody tr:nth-child(even) td { background: var(--tint); }

/* ---------------- 고지·배너 ---------------- */

.notice {
  background: var(--tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  font-size: .875rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: var(--measure);
  margin: 2.5rem 0 0;
}
.notice h2, .notice h3 {
  font-size: .875rem;
  color: var(--navy-deep);
  margin: 0 0 .45rem;
}
.notice ul { margin: .5rem 0 0; padding-left: 1.1rem; }
.notice li { margin-bottom: .3rem; }
.notice p:last-child { margin-bottom: 0; }

.gate {
  background: var(--navy-deep);
  color: #fff;
  font-size: .875rem;
  line-height: 1.6;
  padding: .85rem 0;
}
.gate strong { color: #fff; }
.gate ul { margin: .45rem 0 0; padding-left: 1.15rem; max-width: none; }
.gate li { margin-bottom: .15rem; }

/* ---------------- 광고 자리 ---------------- */

.adslot { margin: 2.5rem 0; }
.adslot__placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--tint);
  color: var(--faint);
  font-size: .8125rem;
  text-align: center;
  padding: 2.25rem 1rem;
}
.adslot__placeholder span { display: block; font-variant-numeric: tabular-nums; }

/* ---------------- 본문 보조 ---------------- */

.formula {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 1.5rem 0;
  max-width: var(--measure);
  font-variant-numeric: tabular-nums;
}
.formula p { margin: 0 0 .5rem; font-weight: 600; color: var(--navy-deep); }
.formula p:last-child { margin-bottom: 0; }
.formula .where { font-weight: 400; color: var(--muted); font-size: .875rem; }

.unverified {
  border: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--tint);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1.25rem 0;
  max-width: var(--measure);
  font-size: .9375rem;
  color: var(--muted);
}
.unverified strong { color: var(--navy-deep); }

.footnotes {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: .875rem;
  color: var(--muted);
}
.footnotes ol { padding-left: 1.2rem; max-width: var(--measure); }
.footnotes li { margin-bottom: .55rem; }
a.fn {
  font-size: .75em;
  vertical-align: super;
  text-decoration: none;
  padding: 0 .1em;
}

.next-read {
  margin-top: 3.5rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--rule);
  max-width: var(--measure);
}
.next-read p { font-size: .875rem; color: var(--muted); margin-bottom: .5rem; }
.next-read ul { list-style: none; padding: 0; }
.next-read li { margin-bottom: .45rem; }
