@font-face {
  font-family: "Pretendard";
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  src: local("Pretendard Variable"), url("./fonts/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  color-scheme: dark;
  --estate-bg: #0b1015;
  --estate-bg-2: #111922;
  --estate-surface: #15202a;
  --estate-border: rgba(255, 255, 255, 0.11);
  --estate-text: #f0f4f6;
  --estate-dim: #aebbc2;
  --estate-faint: #83929a;
  --estate-accent: #e4b75c;
  --estate-accent-soft: rgba(228, 183, 92, 0.12);
  --estate-link: #9ebaff;
  --estate-positive: #6fd4ad;
  --estate-negative: #ff9a91;
  --estate-font: "Pretendard", system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --border: var(--estate-border);
}

html[data-theme="light"] {
  color-scheme: light;
  --estate-bg: #f4f1ea;
  --estate-bg-2: #ebe5d9;
  --estate-surface: #fffdf8;
  --estate-border: rgba(48, 40, 24, 0.16);
  --estate-text: #282419;
  --estate-dim: #5f594c;
  --estate-faint: #746d5f;
  --estate-accent: #8a5d12;
  --estate-accent-soft: rgba(138, 93, 18, 0.09);
  --estate-link: #2d56a8;
  --estate-positive: #08765c;
  --estate-negative: #b33a30;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--estate-text);
  background:
    radial-gradient(900px 520px at 82% -10%, rgba(228, 183, 92, 0.13), transparent 62%),
    linear-gradient(180deg, var(--estate-bg-2), var(--estate-bg) 34rem);
  font-family: var(--estate-font);
  letter-spacing: -0.01em;
}

body[data-i18n-loading] [data-i18n],
body[data-i18n-loading] [data-i18n-html] { visibility: hidden; }

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(228, 183, 92, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(228, 183, 92, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(#000, transparent 42rem);
  content: "";
  pointer-events: none;
}

.estate-topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid var(--estate-border);
  background: color-mix(in srgb, var(--estate-bg) 84%, transparent);
  backdrop-filter: blur(16px) saturate(1.25);
}

.estate-topbar__inner {
  display: flex;
  width: min(calc(100% - 2rem), 70rem);
  min-height: 3.75rem;
  margin-inline: auto;
  align-items: center;
  gap: 1rem;
}

.estate-back {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.55rem;
  color: var(--estate-dim);
  font-size: 0.875rem;
  font-weight: 750;
  text-decoration: none;
}

.estate-back:hover { color: var(--estate-text); }

.estate-wordmark {
  margin-right: auto;
  color: var(--estate-faint);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.lang-toggle {
  display: flex;
  padding: 0.2rem;
  border: 1px solid var(--estate-border);
  border-radius: 999px;
  background: var(--estate-surface);
}

.lang-toggle button,
.theme-toggle {
  border: 0;
  color: var(--estate-dim);
  background: transparent;
  font: 800 0.72rem/1 var(--estate-font);
  cursor: pointer;
}

.lang-toggle button {
  min-width: 2.25rem;
  min-height: 2rem;
  border-radius: 999px;
}

.lang-toggle button.active { color: var(--estate-text); background: var(--estate-accent-soft); }

.theme-toggle {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--estate-border);
  border-radius: 50%;
  place-items: center;
  font-size: 1rem;
}

:where(.estate-back, .lang-toggle button, .theme-toggle):focus-visible {
  outline: 2px solid var(--estate-accent);
  outline-offset: 3px;
}

.estate-page { padding-block: clamp(3.5rem, 8vw, 6.5rem) 5rem; }

.estate-hero {
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
  border-bottom: 1px solid var(--estate-border);
}

.estate-kicker {
  margin: 0 0 0.8rem;
  color: var(--estate-accent);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.estate-hero h1 {
  max-width: 13ch;
  margin: 0;
  color: var(--estate-text);
  font-size: clamp(2.5rem, 7vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
  text-wrap: balance;
  word-break: keep-all;
}

.estate-hero .content-lead {
  max-width: 41rem;
  margin: 1.5rem 0 0;
  color: var(--estate-dim);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.75;
  word-break: keep-all;
}

.estate-meta {
  margin: 1.35rem 0 0;
  color: var(--estate-faint);
  font-size: 0.82rem;
}

.estate-intro {
  margin-top: 2rem;
  padding: 1.15rem 1.25rem;
  border-left: 3px solid var(--estate-accent);
  color: var(--estate-dim);
  background: var(--estate-accent-soft);
  font-size: 1rem;
  line-height: 1.75;
  word-break: keep-all;
}

.estate-intro strong { color: var(--estate-text); }

.estate-layout { margin-top: clamp(3rem, 6vw, 5rem); }

.estate-toc {
  padding: 1.15rem;
  border: 1px solid var(--estate-border);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--estate-surface) 88%, transparent);
}

.estate-toc__title {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--estate-faint);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.estate-toc ol {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 0.25rem;
}

.estate-toc a {
  display: grid;
  min-height: 2.7rem;
  padding: 0.55rem 0.65rem;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  border-radius: 0.55rem;
  color: var(--estate-dim);
  font-size: 0.9rem;
  font-weight: 720;
  line-height: 1.35;
  text-decoration: none;
}

.estate-toc a span:first-child { color: var(--estate-faint); font-size: 0.72rem; }
.estate-toc a:hover,
.estate-toc a.is-current { color: var(--estate-text); background: var(--estate-accent-soft); }
.estate-toc a.is-current span:first-child { color: var(--estate-accent); }

:where(.estate-toc a, .estate-steps a, .estate-source-note a, .estate-table-wrap):focus-visible {
  outline: 2px solid var(--estate-accent);
  outline-offset: 3px;
}

.estate-section {
  padding-block: clamp(2.75rem, 5vw, 4.5rem);
  border-top: 1px solid var(--estate-border);
}

.estate-section:first-child { padding-top: 0; border-top: 0; }

.estate-section .content-section__header {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
}

.section-number { color: var(--estate-accent); font-size: 0.78rem; font-weight: 850; letter-spacing: 0.08em; }

.estate-section h2 {
  margin: 0;
  color: var(--estate-text);
  font-size: clamp(1.65rem, 3.5vw, 2.35rem);
  line-height: 1.22;
  letter-spacing: -0.035em;
}

.estate-section > p { color: var(--estate-dim); }

.estate-answer {
  margin: 0 0 0.85rem;
  color: var(--estate-text) !important;
  font-size: 1.08rem;
  font-weight: 760;
  line-height: 1.68;
}

.estate-table-wrap { width: 100%; margin: 1.75rem 0 0; overflow-x: auto; border-block: 1px solid var(--estate-border); }
.estate-matrix { width: 100%; border-collapse: collapse; color: var(--estate-dim); font-size: 0.93rem; line-height: 1.55; }
.estate-matrix th,
.estate-matrix td { padding: 0.9rem 0.75rem; border-bottom: 1px solid var(--estate-border); text-align: left; vertical-align: top; }
.estate-matrix tr:last-child td { border-bottom: 0; }
.estate-matrix th { color: var(--estate-faint); font-size: 0.75rem; font-weight: 820; letter-spacing: 0.04em; }
.estate-matrix td:first-child { color: var(--estate-text); font-weight: 760; }

.estate-steps { display: grid; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.estate-steps li { display: grid; grid-template-columns: 2.35rem minmax(0, 1fr); gap: 1rem; padding: 1.25rem 0; border-top: 1px solid var(--estate-border); }
.estate-steps li:last-child { border-bottom: 1px solid var(--estate-border); }
.estate-step-number { color: var(--estate-accent); font-size: 0.78rem; font-weight: 850; }
.estate-steps strong { display: block; color: var(--estate-text); font-size: 1rem; }
.estate-steps p { margin: 0.35rem 0 0.45rem; color: var(--estate-dim); font-size: 0.95rem; line-height: 1.7; }
.estate-steps a,
.estate-source-note a { color: var(--estate-link); font-size: 0.88rem; font-weight: 720; text-underline-offset: 0.18em; }

.estate-rights-list { color: var(--estate-dim); }
.estate-rights-list dt { color: var(--estate-text); font-weight: 780; }
.estate-source-note { margin-top: 1.25rem !important; }

.investment-calculator {
  margin-top: 1.75rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--estate-border);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--estate-surface) 88%, transparent);
}

.investment-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.investment-fields label { display: grid; gap: 0.45rem; color: var(--estate-dim); font-size: 0.82rem; font-weight: 720; }

.money-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--estate-border);
  border-radius: 0.65rem;
  background: var(--estate-bg);
  overflow: hidden;
}

.money-input:focus-within { border-color: var(--estate-accent); box-shadow: 0 0 0 3px var(--estate-accent-soft); }
.money-input input { width: 100%; min-height: 3rem; padding: 0.7rem 0.8rem; border: 0; outline: 0; color: var(--estate-text); background: transparent; font: 720 1rem/1 var(--estate-font); }
.money-input > span { padding-right: 0.8rem; color: var(--estate-faint); font-size: 0.75rem; }

.investment-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 1.25rem;
  border: 1px solid var(--estate-border);
  border-radius: 0.75rem;
  background: var(--estate-border);
  overflow: hidden;
}

.investment-results > div { display: grid; gap: 0.35rem; padding: 1rem; background: var(--estate-bg-2); }
.investment-results span { color: var(--estate-faint); font-size: 0.75rem; }
.investment-results strong { color: var(--estate-text); font-size: clamp(1.05rem, 2vw, 1.25rem); }
.investment-results strong.is-positive { color: var(--estate-positive); }
.investment-results strong.is-negative { color: var(--estate-negative); }

.stress-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.75rem; border-top: 1px solid var(--estate-border); }
.stress-grid > div { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 0.2rem 0.7rem; padding: 1.15rem 0; border-bottom: 1px solid var(--estate-border); }
.stress-grid > div:nth-child(odd) { padding-right: 1rem; }
.stress-grid > div:nth-child(even) { padding-left: 1rem; border-left: 1px solid var(--estate-border); }
.stress-grid span { grid-row: 1 / span 2; color: var(--estate-accent); font-size: 0.72rem; font-weight: 850; }
.stress-grid strong { color: var(--estate-text); font-size: 0.95rem; }
.stress-grid p { margin: 0; color: var(--estate-dim); font-size: 0.9rem; line-height: 1.65; }

.estate-decision { margin-top: 1.5rem; padding: 1rem 1.15rem; border-left: 3px solid var(--estate-accent); background: var(--estate-accent-soft); }
.estate-decision strong { color: var(--estate-text); font-size: 0.82rem; }
.estate-decision p { margin: 0.35rem 0 0; color: var(--estate-dim); font-size: 0.95rem; line-height: 1.72; }
.estate-footer { padding: 1.5rem 0 2rem; border-top: 1px solid var(--estate-border); color: var(--estate-faint); font-size: 0.78rem; line-height: 1.65; }

@media (max-width: 62.5rem) {
  .estate-layout { gap: 0; }
  .estate-toc { margin-bottom: 3rem; }
  .estate-toc ol { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .estate-toc a { grid-template-columns: 1fr; gap: 0.2rem; }
}

@media (max-width: 48rem) {
  .estate-toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .estate-section .content-section__header { grid-template-columns: 1fr; gap: 0.35rem; }
  .investment-fields,
  .investment-results,
  .stress-grid { grid-template-columns: 1fr; }
  .stress-grid > div:nth-child(odd),
  .stress-grid > div:nth-child(even) { padding-inline: 0; border-left: 0; }
}

@media (max-width: 40rem) {
  .estate-wordmark { display: none; }
  .estate-topbar__inner { gap: 0.55rem; }
  .estate-back { margin-right: auto; }
  .estate-page { padding-block: 3rem 4rem; }
  .estate-hero h1 { font-size: clamp(2.35rem, 13vw, 3.8rem); }
  .estate-toc ol { grid-template-columns: 1fr; }
  .estate-table-wrap { border: 0; overflow: visible; }
  .estate-matrix thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .estate-matrix,
  .estate-matrix tbody,
  .estate-matrix tr,
  .estate-matrix td { display: block; width: 100%; }
  .estate-matrix tr { padding: 0.7rem 0; border-top: 1px solid var(--estate-border); }
  .estate-matrix tr:last-child { border-bottom: 1px solid var(--estate-border); }
  .estate-matrix td { display: grid; grid-template-columns: minmax(6rem, 36%) minmax(0, 1fr); gap: 0.75rem; padding: 0.35rem 0; border: 0; }
  .estate-matrix td::before { color: var(--estate-faint); font-size: 0.72rem; font-weight: 800; content: attr(data-label); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
