@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Noto+Sans+KR:wght@400;500;700&display=swap');

:root {
  color-scheme: light;
  --bg: #f5f1ea;
  --bg-2: #f1e9da;
  --ink: #1f1a14;
  --muted: #6c6053;
  --brand: #2a6f5a;
  --brand-2: #e3b04b;
  --accent: #16324f;
  --card: #fffaf3;
  --border: #e3d8c6;
  --shadow: 0 18px 40px rgba(20, 16, 10, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Noto Sans KR', system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 20%, #ffffff 0%, var(--bg) 48%, var(--bg-2) 100%);
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

main {
  display: block;
}

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

img {
  max-width: 100%;
  display: block;
}

.site-shell {
  position: relative;
  overflow: hidden;
}

.site-shell::before,
.site-shell::after {
  content: '';
  position: absolute;
  z-index: -1;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  background: rgba(227, 176, 75, 0.18);
  filter: blur(0px);
}

.site-shell::before {
  top: -140px;
  right: -120px;
}

.site-shell::after {
  bottom: -160px;
  left: -120px;
  background: rgba(42, 111, 90, 0.16);
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(245, 241, 234, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  gap: 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand strong {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  letter-spacing: 0.3px;
}

.brand span {
  font-size: 0.85rem;
  color: var(--muted);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-weight: 500;
  font-size: 0.95rem;
}

.site-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
  border-color: var(--accent);
  background: rgba(22, 50, 79, 0.08);
}

.hero {
  padding: 80px 0 60px;
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: center;
}

.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.4rem, 3.2vw, 3.4rem);
  margin: 0 0 16px;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
  margin: 0 0 20px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions + .hero-actions {
  margin-top: 8px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(22, 50, 79, 0.08);
  border: 1px solid rgba(22, 50, 79, 0.12);
  padding: 10px 14px;
  border-radius: 999px;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.toggle select {
  border: 1px solid rgba(22, 50, 79, 0.2);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.share {
  background: var(--brand);
  color: #fff;
  border: none;
  position: relative;
}

.btn.share.done {
  background: #1f4d3f;
}

.btn.share::before {
  content: 'LINK';
  margin-right: 8px;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.btn.share.done::before {
  content: 'OK';
}

.btn.share.fail::before {
  content: 'ERR';
}

.btn.tag {
  font-size: 0.9rem;
  border-color: transparent;
  background: rgba(22, 50, 79, 0.08);
  color: var(--accent);
  position: relative;
  overflow: hidden;
}

.btn.tag::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.btn.tag::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: -1;
}

.btn.tag:hover {
  color: #fff;
  transform: translateY(-2px) scale(1.03);
}

.btn.tag:hover::after {
  opacity: 1;
}

.btn.tag:hover::before {
  background: #fff;
}

.btn.tag.interest { color: #2a6f5a; }
.btn.tag.loan { color: #16324f; }
.btn.tag.savings { color: #c76e21; }
.btn.tag.percent { color: #8b5e3b; }
.btn.tag.exchange { color: #0f7a9e; }
.btn.tag.compound { color: #6b4d9b; }
.btn.tag.schedule { color: #aa3b38; }

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card h3 {
  margin-top: 0;
}

.section {
  padding: 60px 0;
}

.section.compact {
  padding-bottom: 16px;
}

.section.tight-top {
  padding-top: 16px;
}

.section h2 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.8rem, 2.6vw, 2.4rem);
  margin-bottom: 24px;
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid[data-schedule-summary] {
  margin-top: 12px;
}

.grid[data-schedule-summary] .card {
  box-shadow: none;
  background: rgba(22, 50, 79, 0.05);
}

.grid[data-schedule-summary] .result {
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
}

.calculator .table-wrap {
  margin-top: 12px;
}

.calculator .table-wrap + .table-wrap {
  margin-top: 12px;
}

.calculator.schedule {
  gap: 12px;
}

.calculator.schedule .grid[data-schedule-summary],
.calculator.schedule .table-wrap {
  margin-top: 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0;
}

.card p {
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 10px;
}

.card p:last-child {
  margin-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(42, 111, 90, 0.1);
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 600;
}

.hint {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.calculator {
  display: grid;
  gap: 14px;
}

.calculator label {
  font-weight: 600;
  display: grid;
  gap: 6px;
  line-height: 1.3;
}

.calculator input,
.calculator select,
.calculator textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

.calculator input.invalid,
.calculator select.invalid,
.calculator textarea.invalid {
  border-color: #aa3b38;
  box-shadow: 0 0 0 2px rgba(170, 59, 56, 0.15);
}

.validation {
  font-size: 0.85rem;
  color: #aa3b38;
  min-height: 18px;
}

.calculator button {
  justify-content: center;
  width: 100%;
  border: none;
  background: var(--brand);
  color: white;
  font-weight: 600;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
}

.result {
  padding: 14px;
  border-radius: 12px;
  background: rgba(22, 50, 79, 0.08);
  border: 1px dashed rgba(22, 50, 79, 0.3);
  color: var(--accent);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fffdf8;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 560px;
}

.schedule-table th,
.schedule-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

.schedule-table th {
  background: rgba(22, 50, 79, 0.08);
  color: var(--accent);
  position: sticky;
  top: 0;
  z-index: 1;
}

.schedule-table td:first-child,
.schedule-table th:first-child {
  text-align: left;
}

.blog-list article {
  padding: 24px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.blog-cta {
  margin-top: 16px;
  display: flex;
  justify-content: flex-start;
}

.blog-cta .btn {
  padding: 10px 16px;
  font-size: 0.95rem;
}

.blog-list h3 {
  margin-top: 0;
}

.blog-list p {
  line-height: 1.9;
  color: var(--muted);
}

.info-block {
  padding: 22px;
  border-left: 4px solid var(--brand);
  background: rgba(42, 111, 90, 0.08);
  border-radius: 12px;
  color: var(--muted);
  line-height: 1.8;
}

.footer {
  padding: 40px 0 60px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #16324f;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(92vw, 520px);
  white-space: normal;
  line-height: 1.5;
  text-align: center;
  overflow: hidden;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.auto {
  background: #2a6f5a;
}

.toast.show.shake {
  animation: shake 0.35s ease;
}

.toast.fail {
  background: #8b2d2b;
}

.toast::before {
  content: 'OK';
  font-weight: 700;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.toast.fail::before {
  content: 'ERR';
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 22, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 120;
  padding: 20px;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  width: min(420px, 90vw);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform: translateY(10px);
  opacity: 0;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop.show .modal-card {
  transform: translateY(0);
  opacity: 1;
}

.modal-card h3 {
  margin-top: 0;
}

.modal-card p {
  color: var(--muted);
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.fade-in {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.7s ease forwards;
}

.fade-delay-1 { animation-delay: 0.1s; }
.fade-delay-2 { animation-delay: 0.2s; }
.fade-delay-3 { animation-delay: 0.3s; }

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0% { transform: translateX(-50%) translateY(0); }
  25% { transform: translateX(calc(-50% - 6px)) translateY(0); }
  50% { transform: translateX(calc(-50% + 6px)) translateY(0); }
  75% { transform: translateX(calc(-50% - 4px)) translateY(0); }
  100% { transform: translateX(-50%) translateY(0); }
}

@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .toast {
    top: 16px;
    bottom: auto;
    transform: translateX(-50%) translateY(-10px);
  }

  .toast.show {
    transform: translateX(-50%) translateY(0);
  }
}
