body {
  font-family: var(--font-main) !important;
  background-color: #f4f8fc;
  color: #03396c;
}

main {
  margin-top: 120px; /* 상단바 + 하단바 여백 확보 */
}

/* 상단 네비게이션 바 */
.custom-navbar {
  background-color: #0056b3 !important; /* 진한 파랑 */
  z-index: 1050; /* 서브바 위에 올라오지 않도록 */
}

/* Make the two lower bars visually same height as top */
.sub-topbar .nav-link,
.sub-subbar .nav-link { padding-top: .5rem; padding-bottom: .5rem; }
.sub-topbar, .sub-subbar { min-height: 56px; }
/* Ensure active state visibility */
.navbar .nav-link.active { font-weight: 600; text-decoration: underline; }

.nav-link{color:#fff;text-decoration:none;padding:6px 8px;border-radius:8px;display:inline-block}
.nav-link:hover{background:rgba(255,255,255,.12)}
/* Sub-topbar: lighter sky-blue and horizontal no-wrap */
.sub-topbar { background-color: #e3f2fd !important; }
.sub-topbar .navbar-nav { flex-direction: row !important; flex-wrap: nowrap !important; }
.sub-topbar .container-fluid { overflow-x: auto; }
.sub-topbar .nav-link { white-space: nowrap; }

/* Keep the two lower bars similar height */
.sub-topbar .nav-link,
.sub-subbar .nav-link { padding-top: .5rem; padding-bottom: .5rem; }
.sub-topbar, .sub-subbar { min-height: 56px; }

/* Active visibility */
.navbar .nav-link.active { font-weight: 600; text-decoration: underline; }


.sub-topbar { background-color: #e9ecef !important; }           /* gray */
.sub-subbar { background-color: #e3f2fd !important; }           /* light sky */
.sub-topbar .navbar-nav, .sub-subbar .navbar-nav { flex-direction: row !important; flex-wrap: nowrap !important; }
.sub-topbar .container-fluid, .sub-subbar .container-fluid { overflow-x: auto; }
.sub-topbar .nav-link, .sub-subbar .nav-link { white-space: nowrap; padding-top:.5rem; padding-bottom:.5rem; }

/* === Custom: sub-topbar & sub-subbar FINAL === */
/* 2단 바(sub-topbar): 회색, 가로고정, 줄바꿈 없음, 가로 스크롤 */
.sub-topbar { background-color: #e9ecef !important; }
.sub-topbar .navbar-nav { flex-direction: row !important; flex-wrap: nowrap !important; gap: .25rem; }
.sub-topbar .navbar-nav .nav-item { flex: 0 0 auto; }  /* shrink 방지 */
.sub-topbar .container-fluid { overflow-x: auto; }
.sub-topbar .nav-link { white-space: nowrap; color: #212529; padding-top: .5rem; padding-bottom: .5rem; }

/* 3단 바(sub-subbar): 연한 하늘색, 진한 글자색, 가로고정, 줄바꿈 없음, 가로 스크롤 */
.sub-subbar { background-color: #e3f2fd !important; }
.sub-subbar .navbar-nav { flex-direction: row !important; flex-wrap: nowrap !important; gap: .25rem; }
.sub-subbar .navbar-nav .nav-item { flex: 0 0 auto; }
.sub-subbar .container-fluid { overflow-x: auto; }
.sub-subbar .nav-link { white-space: nowrap; color: #0d47a1 !important; font-weight: 600; padding-top: .5rem; padding-bottom: .5rem; }

/* Active, hover 가독성 */
.sub-subbar .nav-link.active, .sub-subbar .nav-link:hover { text-decoration: underline; }
.sub-topbar .nav-link.active, .sub-topbar .nav-link:hover { text-decoration: underline; font-weight: 600; }

/* 높이 정렬(원하시면 숫자 조정 가능) */
.sub-topbar, .sub-subbar { min-height: 48px; }


/* === Global NAV Behavior: horizontal, no-wrap, scroll-x on overflow === */
.custom-navbar .navbar-collapse { display: flex !important; }
.custom-navbar .navbar-nav { flex-direction: row !important; flex-wrap: nowrap !important; gap: .25rem; }
.custom-navbar .container-fluid { overflow-x: auto; }
.custom-navbar .nav-link { white-space: nowrap; }

/* Secondary bars */
.sub-topbar .navbar-nav, .sub-subbar .navbar-nav { flex-direction: row !important; flex-wrap: nowrap !important; gap: .25rem; }
.sub-topbar .container-fluid, .sub-subbar .container-fluid { overflow-x: auto; }
.sub-topbar .nav-link, .sub-subbar .nav-link { white-space: nowrap; }

/* Footer bottom nav (if used as bar) */
.site-footer .bottom-nav,
.site-footer nav,
footer .navbar-nav { display: flex; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: .25rem; }
.site-footer .bottom-nav a,
footer .nav-link { white-space: nowrap; }


/* === Bottom bar dynamic + black text === */
.sub-subbar .navbar-nav { flex-direction: row !important; flex-wrap: nowrap !important; gap: .25rem; }
.sub-subbar .container-fluid { overflow-x: auto; }
.sub-subbar .nav-link { white-space: nowrap; color: #000 !important; padding-top:.5rem; padding-bottom:.5rem; }


/* === Bottom bar dynamic: black text, visible background & border, horizontal no-wrap scroll === */
.sub-subbar { background:#ffffff; border-top:1px solid rgba(0,0,0,.1); }
.sub-subbar .navbar-nav { flex-direction: row !important; flex-wrap: nowrap !important; gap:.25rem; }
.sub-subbar .container-fluid { overflow-x: auto; }
.sub-subbar .nav-link { white-space: nowrap; color:#000 !important; padding-top:.5rem; padding-bottom:.5rem; }
.sub-subbar .nav-link.active, .sub-subbar .nav-link:hover { text-decoration: underline; }


/* === FINAL NAV FIX === */
.sub-subbar { position: sticky; top: var(--topnav-h, 56px); z-index: 1029; background:#fff; border-top:1px solid rgba(0,0,0,.1); }
.sub-subbar .navbar-nav { flex-direction: row !important; flex-wrap: nowrap !important; gap:.25rem; }
.sub-subbar .container-fluid { overflow-x: auto; }
.sub-subbar .nav-link { white-space: nowrap; color:#000 !important; padding-top:.5rem; padding-bottom:.5rem; }
.sub-subbar .nav-link.active, .sub-subbar .nav-link:hover { text-decoration: underline; }


/* === FORCE BLACK TEXT ON BOTTOM BAR === */
nav.sub-subbar, .sub-subbar { --_navText:#000; }
.sub-subbar a, .sub-subbar .nav-link,
.sub-subbar .navbar-nav .nav-link,
nav.sub-subbar a.nav-link {
  color: var(--_navText) !important;
}
.sub-subbar a:link, .sub-subbar a:visited, .sub-subbar a:hover, .sub-subbar a:active,
.sub-subbar .nav-link:link, .sub-subbar .nav-link:visited, .sub-subbar .nav-link:hover, .sub-subbar .nav-link:active {
  color: var(--_navText) !important;
}
/* Override utility classes that might force light text */
.sub-subbar .text-white, .sub-subbar .text-light, .sub-subbar .link-light { color: var(--_navText) !important; }


/* === Top navbar fine-tuning === */
.custom-navbar .navbar-brand { font-weight: 700 !important; }
/* move top menu labels (계산기/부동산 임장/기타) slightly down */
.custom-navbar .navbar-nav .nav-link { margin-top: 2px; }

/* 서브 네비게이션 바 */
.subnav {
  background-color: #cce5ff !important; /* 하늘색 */
  border-bottom: 1px solid #99ccff !important;
  position: fixed; /* 상단 고정 */
  top: 56px; /* 상단바 높이만큼 띄움 */
  left: 0;
  width: 100%;
  z-index: 1040; /* 상단바 아래 */
  display: none;
}

.subnav .nav {
  padding-left: 100px; /* 텍스트 오른쪽으로 이동 */
}

.subnav .nav-link {
  color: #03396c !important; /* 글자색 진한 파랑 */
}

.subnav .nav-link:hover {
  text-decoration: underline;
  color: #00264d !important; /* hover 시 진한 남색 */
}

/* Active state styles */
.navbar .nav-link.active { 
  background-color: rgba(255,255,255,0.18);
  border-radius: 6px;
}
.subnav .nav-link.active {
  font-weight: 700;
  text-decoration: underline;
}

/* Ensure subnav visible when toggled */
.subnav { display: none; position: fixed; top: 56px; left: 0; right: 0; z-index: 1040; }
.navbar .nav-link.active { background: rgba(255,255,255,0.18); border-radius: 6px; }
.subnav .nav-link.active { font-weight: 700; text-decoration: underline; }



/* ====== Global Fixes (2025-09-07) ====== */
:root{
  --gfix-header-height: 64px;
  --gfix-subnav-height: 48px;
}

/* 제목이 고정바에 가려지지 않게 오프셋 */
h1, h2, h3 { scroll-margin-top: calc(var(--gfix-header-height) + 12px); }

/* 부동산 임장 하위바(공통 subnav 클래스 사용) 고정 & 줄바꿈 */
.subnav{
  position: sticky !important;
  top: var(--gfix-header-height) !important;
  z-index: 1040;
  background: #f1f5f9;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.subnav .nav{ display: flex; flex-wrap: wrap; gap: 6px; }
.subnav .nav .nav-link{ background: #fff; border-radius: 10px; padding: 6px 10px; }
.subnav .nav .nav-link:hover{ background: #e8f0ff; }
.subnav .nav .nav-link.active{ background: #e0edff; font-weight: 700; }

/* 상단 네비게이션 항목도 줄바꿈 허용 */
.navbar-nav{ flex-wrap: wrap; }

/* 작은 화면에서 서브바 패딩/정렬 */
@media (max-width: 768px){
  .subnav .container, .subnav .container-fluid{ padding-left: 10px; padding-right: 10px; }
  .subnav .nav{ gap: 4px; }
}

/* 본문 기본 여백 보정: 기존 margin-top이 과하면 줄여 균형 */
main{ margin-top: max(80px, 12vh); }


/* === Home mobile theme === */
.home-hero {
  background: linear-gradient(135deg, #0056b3, #3498db);
  border-radius: 18px;
  padding: 1.4rem 1.6rem;
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.25);
}

.home-hero-inner {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.home-hero .page-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.3;
}

.home-hero-lead {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.88);
}

.badge-text {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.28);
}

.home-hero .btn-main {
  font-weight: 600;
  border-radius: 999px;
  padding-inline: 1.1rem;
}

.home-hero .btn-sub {
  border-radius: 999px;
  padding-inline: 1.1rem;
}

.home-section {
  margin-top: 1.25rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.section-subtitle {
  font-size: 0.78rem;
  color: #64748b;
}

/* 카드 그리드: 모바일 1열, 태블릿 이상 2열 */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

@media (min-width: 576px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.feature-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.feature-title {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.feature-desc {
  font-size: 0.8rem;
  color: #4b5563;
  margin-bottom: 0.65rem;
}

.feature-card .btn {
  font-size: 0.78rem;
}



/* === Common page hero & cards (moamoa style) === */
.page-hero {
  padding: 1.5rem 1rem 1rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #f3f7ff, #ffffff);
  border: 1px solid rgba(0, 123, 255, 0.08);
  margin-bottom: 1.5rem;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.page-subtitle {
  font-size: 0.9rem;
  color: #6c757d;
  margin: 0;
}
.feature-card {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 6px 18px rgba(15, 35, 95, 0.06);
  border: 1px solid rgba(15, 35, 95, 0.04);
}

/* Fortune highlight block */
.fortune-highlight {
  background: linear-gradient(135deg, #fff7e6, #ffffff);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px dashed rgba(255, 193, 7, 0.4);
}

/* Kakao share button */
.btn-kakao-share {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: #fee500;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #191600;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.btn-kakao-share:hover {
  filter: brightness(0.97);
}
.kakao-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #000000;
  display: inline-block;
}

/* Scroll to top button */
.scroll-top-btn {
  position: fixed;
  right: 1rem;
  bottom: 1.25rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #0d6efd;
  color: #fff;
  font-size: 0.9rem;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  z-index: 1050;
}



/* top-right share button in hero sections */
.page-hero,
.home-hero {
  position: relative;
}
.page-hero-share {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  z-index: 10;
}
@media (max-width: 576px) {
  .page-hero-share {
    top: 0.5rem;
    right: 0.5rem;
    transform: scale(0.9);
  }
}
