/* ========== HEADER ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px; /* 헤더 시각 높이는 고정. 모바일 --header-height(=헤더+탭바) 와 분리 */
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo a {
  display: inline-flex;
  align-items: center;
  /* 이미지 없을 때 fallback 텍스트 스타일 유지 */
  font-size: 20px;
  font-weight: 300;
  letter-spacing: var(--letter-spacing-logo);
  color: var(--color-text-heading);
}
.logo a img {
  height: 22px;
  width: auto;
  max-width: 100%;
  display: block;
}
.nav-list {
  display: flex;
  gap: 40px;
}
.nav-list a {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--color-text-heading);
  transition: color var(--transition);
  position: relative;
}
.nav-list a:hover,
.nav-list a.active {
  color: var(--color-brand-beige);
}
/* active 표시는 색상 + bold로 처리 (밑줄 제거) */
.nav-list a.active {
  font-weight: 700;
}

/* Menu EN ↔ KO crossfade (Option A) */
.nav-list a.menu-item {
  display: inline-block;
  position: relative;
}
.nav-list a.menu-item .en,
.nav-list a.menu-item .ko {
  display: block;
  transition: opacity 260ms ease;
}
.nav-list a.menu-item .ko {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.nav-list a.menu-item:hover .en,
.nav-list .nav-item.has-dropdown:hover .menu-item .en {
  opacity: 0;
}
.nav-list a.menu-item:hover .ko,
.nav-list .nav-item.has-dropdown:hover .menu-item .ko {
  opacity: 1;
}

/* Header Dropdown (LNB on hover) */
.nav-list .nav-item {
  position: relative;
}
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding-top: 14px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 200ms ease,
    transform 200ms ease;
  z-index: 101;
}
.nav-item.has-dropdown:hover .nav-dropdown,
.nav-item.has-dropdown:focus-within .nav-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.nav-dropdown-inner {
  background: #fff;
  border: 1px solid #e5e1d6;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  padding: 8px 0;
  min-width: 150px;
  border-radius: 2px;
}
.nav-dropdown a {
  display: block;
  padding: 10px 22px;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: #8a8376;
  white-space: nowrap;
  text-align: center;
  transition:
    color 160ms ease,
    background 160ms ease;
}
.nav-dropdown a:hover {
  color: var(--color-text-heading);
  background: #fbf9f3;
}
.nav-dropdown a.active {
  color: var(--color-text-heading);
  font-weight: 600;
}

/* Mobile Menu */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-heading);
  transition: var(--transition);
}
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 99;
}
.mobile-nav.open {
  display: block;
}
.mobile-nav a {
  display: block;
  padding: 16px 40px;
  font-size: 14px;
  letter-spacing: 1px;
  border-bottom: 1px solid #f0f0f0;
}

/* ========== FOOTER ========== */
.footer {
  background: var(--color-brand-grey);
  color: #fff;
  padding: 60px 40px 40px;
}
.footer-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
}
.footer-logo {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: var(--letter-spacing-logo);
  display: flex;
  align-items: center;
}
.footer-logo img {
  height: 24px;
  width: auto;
  max-width: 100%;
  display: block;
  /* 푸터 배경(#5a5448)과 로고 컬러(동일)가 겹쳐 안 보이는 문제 해결 */
  filter: brightness(0) invert(1);
}
.footer-nav {
  display: flex;
  gap: 40px;
}
.footer-nav a {
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0.9;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.footer-nav a:hover {
  opacity: 1;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-social {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  opacity: 0.9;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}
.footer-social a:hover {
  opacity: 1;
}
.footer-social img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  /* 네이버 블로그 등 비정사각 아이콘도 비율 유지 */
  flex-shrink: 0;
}
.footer-info {
  font-size: 12px;
  line-height: 2;
  opacity: 0.7;
}
.footer-info p {
  margin-bottom: 4px;
}
.footer-credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 11px;
  opacity: 0.5;
}
.footer-credit a {
  color: inherit;
  text-decoration: none;
}
.footer-credit a:hover {
  text-decoration: underline;
  opacity: 0.85;
}
.footer-credit span[aria-hidden] {
  opacity: 0.5;
}

/* ========== POPUP ========== */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
}
.popup-overlay.hidden {
  display: none;
}
/* parallel 모드 (데스크탑) — dim 없는 플로팅 박스, 페이지 상호작용 허용 */
.popup-overlay--floating {
  background: transparent;
  pointer-events: none;
  padding-top: 0;
}
.popup-overlay--floating .popup {
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.popup {
  background: #fff;
  max-width: 520px;
  width: 90%;
  position: relative;
}
.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  z-index: 1;
}
.popup-content {
  padding: 40px 36px 24px;
}
.popup-content h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-heading);
  margin-bottom: 4px;
}
.popup-content .popup-subtitle {
  font-size: 14px;
  color: var(--color-brand-beige);
  font-weight: 600;
  margin-bottom: 16px;
}
.popup-content .popup-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.7;
  margin-bottom: 20px;
}
.popup-branches {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}
.popup-branch {
  flex: 1;
}
.popup-branch h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.popup-branch h3 .new-badge {
  color: #c5371a;
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
}
.popup-branch .branch-map {
  width: 100%;
  aspect-ratio: 4/3;
  background: #f5f5f5;
  margin-bottom: 8px;
  border: 1px solid #eee;
}
.popup-branch .branch-map img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.popup-branch .branch-addr {
  font-size: 11px;
  color: #666;
  line-height: 1.6;
}
.popup-hours {
  text-align: center;
  font-size: 13px;
  color: #555;
  margin-bottom: 16px;
}
.popup-hours p {
  margin-bottom: 2px;
}
.popup-consult {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-heading);
  margin-bottom: 8px;
}
.popup-consult-note {
  text-align: center;
  font-size: 11px;
  color: #999;
}
.popup-footer {
  display: flex;
  border-top: 1px solid #eee;
}
.popup-footer button {
  flex: 1;
  padding: 14px;
  font-size: 13px;
  color: #fff;
  background: var(--color-brand-beige);
  transition: var(--transition);
}
.popup-footer button:hover {
  opacity: 0.9;
}
.popup-footer button:first-child {
  background: var(--color-brand-grey);
}

/* ========== UTILITY ========== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 40px;
}
.section {
  padding: var(--section-padding) 0;
}
.section-title {
  font-size: var(--font-size-xl);
  font-weight: 300;
  letter-spacing: var(--letter-spacing-heading);
  text-align: center;
  color: var(--color-brand-beige);
  margin-bottom: 12px;
}
.section-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  text-align: center;
  letter-spacing: 1px;
}
.divider {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  height: 1px;
  background: var(--color-divider);
}
.btn-primary {
  display: inline-block;
  padding: 14px 40px;
  background: var(--color-brand-beige);
  color: #fff;
  font-size: 14px;
  letter-spacing: 1px;
  border-radius: 2px;
  transition: var(--transition);
}
.btn-primary:hover {
  opacity: 0.85;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991px) {
  .nav-list {
    display: none;
  }
  .hamburger {
    display: flex;
  }
  .header-inner {
    padding: 0 20px;
    position: relative;
  }
  /* 모바일: 로고를 헤더 가운데 고정 (햄버거는 우측 유지) */
  .logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  .container {
    padding: 0 20px;
  }
  .footer {
    padding: 40px 20px 30px;
  }
  :root {
    --section-padding: 60px;
    --font-size-hero: 32px;
    --font-size-2xl: 26px;
    --font-size-xl: 20px;
  }
}
@media (max-width: 767px) {
  .logo a {
    letter-spacing: 3px;
    font-size: 17px;
  }
  .logo a img {
    height: 16px;
  }
  .footer-logo img {
    height: 20px;
  }
  .popup-branches {
    flex-direction: column;
  }
  :root {
    --section-padding: 48px;
    --font-size-hero: 26px;
  }
}

/* 모바일 가로 스크롤 절대 금지: 어떤 요소가 오버플로해도 body가 스크롤 생성하지 않도록 고정 안전장치.
   (가로 스크롤은 모바일 UX 최악 요소 — 원인 요소 발견 시 별도 수정하되 이 안전장치는 항상 유지) */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ========== 한글 타이포 기본 방어 ==========
 * 한글은 어절 단위 줄바꿈(keep-all), 긴 영문/URL은 break-word.
 * 세로 텍스트(break-all) 방지 기본 정책. */
body {
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 제목·리드 텍스트 고아(orphan) 방지 — 브라우저 지원 시 자동 균형 줄바꿈 */
h1,
h2,
h3,
.section-title,
.section-subtitle,
.brandfilm-lead,
.brandfilm-desc,
.about-lead {
  text-wrap: pretty;
}
h1,
.section-title {
  text-wrap: balance;
}

/* 유틸: PC 전용 <br>을 모바일에서 제거 → 모바일에서 어색한 강제 줄바꿈 방지 */
@media (max-width: 767px) {
  br.pc-br,
  .pc-br {
    display: none;
  }
}

/* ========== BOTTOM NAV (모바일 상단 탭바 — 헤더(로고) 아래) ========== */
/* 변수 트릭: 모바일에서는 --header-height 가 헤더(70) + 탭바(58) 합산값.
   페이지마다 자체 padding-top: calc(var(--header-height) + N) 으로 헤더 가림을
   보정하던 코드들이 모바일에서는 탭바까지 같이 보정되도록. */
@media (max-width: 991px) {
  :root {
    --header-height: 128px; /* 70 + 58 */
  }
}
.bottom-nav {
  display: none;
}
@media (max-width: 991px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    top: 70px; /* 헤더 시각 높이 바로 아래. 변수에 의존하지 않음(=128 이 아니라 70 기준) */
    left: 0;
    right: 0;
    height: 58px;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
    z-index: 99;
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1.2px;
    color: var(--color-text-primary);
    transition: color 0.2s ease;
  }
  .bottom-nav a {
    position: relative;
    padding-bottom: 10px; /* active indicator(하단 막대)용 여유 */
  }
  .bottom-nav a.active {
    color: var(--color-brand-beige);
    font-weight: 700;
  }
  /* active indicator: 하단 중앙 막대 + 은은한 배경. 탭바 아래에 표식이 떨어지도록 */
  .bottom-nav a.active::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--color-brand-beige);
    border-radius: 3px 3px 0 0;
  }
  .bottom-nav a.active::after {
    content: "";
    position: absolute;
    inset: 4px 4px 4px 4px;
    background: rgba(90, 84, 72, 0.06);
    border-radius: 8px;
    z-index: -1;
  }
  .bottom-nav a + a {
    border-left: 1px solid rgba(0, 0, 0, 0.05);
  }
  /* 햄버거/드롭다운 대체: 상단 탭바로 통일 */
  .hamburger {
    display: none !important;
  }
  .mobile-nav {
    display: none !important;
  }
  /* body 자체에는 별도 padding-top을 두지 않는다.
     각 페이지가 .community-header / .project-section / .portfolio-header 등에서
     padding-top: calc(var(--header-height) + N) 으로 자체 보정 중이며,
     모바일에선 --header-height 가 128 이라 헤더(70)+탭바(58) 모두 자동 보정됨. */
  /* 모바일 푸터: 메뉴(PC 전용) 숨김 + SNS/텍스트 레이아웃 재정리 */
  .footer-nav {
    display: none;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
  }
  .footer-social,
  .footer-social a,
  .footer-social img {
    width: 32px;
    height: 32px;
  }
  /* 헤더 fixed와 본문 사이 여백 확보 — 히어로 없는 페이지의 첫 섹션에 상단 여유.
     히어로가 있는 페이지(index, about)는 hero 자체가 공간 차지해 영향 없음. */
  .community-header,
  .project-section,
  .estimate-header {
    padding-top: 20px;
  }
}
@media (max-width: 767px) {
  .footer-info {
    font-size: 11px;
    line-height: 1.75;
  }
  .footer-info p {
    margin-bottom: 2px;
  }
  .footer-credit {
    font-size: 10px;
  }
}

/* ========== BOTTOM NAV · Popover LNB ========== */
/* ABOUT/PORTFOLIO 탭 클릭 시 탭 바로 아래에 떨어지는 서브메뉴 팝오버
   탭바가 상단(헤더 아래)으로 이동했으므로 popover도 아래 방향 */
.bn-popover {
  position: fixed;
  /* top 좌표는 JS(positionPopover)에서 트리거 위치 기준으로 동적 설정 */
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 6px;
  z-index: 200;
  min-width: 180px;
  max-width: 220px;
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  display: none;
}
.bn-popover.open {
  display: block;
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.bn-popover a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: var(--color-text-primary);
  border-radius: 8px;
  transition: background 0.15s ease;
}
.bn-popover a:hover,
.bn-popover a.active {
  background: rgba(90, 84, 72, 0.08);
  color: var(--color-brand-beige);
  font-weight: 600;
}
.bn-popover .bn-pop-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 4px 2px;
}
/* 화살표 (위로 트리거 탭을 가리킴) — popover가 뷰포트 경계로 밀려도 화살표는 탭 중앙 고정 */
.bn-popover::after {
  content: "";
  position: absolute;
  top: -6px;
  left: calc(50% + var(--bn-arrow-x, 0px));
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
/* popover 열린 상태에서 해당 트리거 탭 강조 */
.bottom-nav a.submenu-open {
  color: var(--color-brand-beige);
  font-weight: 700;
}
/* PC(992+)에선 popover 숨김 (하단탭바 자체가 안 보임) */
@media (min-width: 992px) {
  .bn-popover {
    display: none !important;
  }
}

/* ========== BRAND FILM (공통: 메인 + about us 등) ========== */
.brandfilm-section {
  background: var(--color-bg-cream);
}
.brandfilm-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
.brandfilm-media {
  display: flex;
  flex-direction: column;
}
.brandfilm-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}
.brandfilm-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.brandfilm-element {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brandfilm-player {
  cursor: pointer;
}
.brandfilm-player::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.18), transparent 34%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.brandfilm-player.controls-visible::after {
  opacity: 1;
}
.brandfilm-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}
.brandfilm-player.controls-visible .brandfilm-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.brandfilm-control {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: background 160ms ease;
}
.brandfilm-control:hover {
  background: rgba(255, 255, 255, 0.16);
}
.brandfilm-control svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brandfilm-control svg path:not(.sound-wave):not(.sound-x),
.brandfilm-control svg .play-shape,
.brandfilm-control svg .pause-shape path {
  fill: currentColor;
  stroke: none;
}
.brandfilm-player.is-loaded .brandfilm-control {
  display: inline-flex;
}
.brandfilm-play-toggle.is-playing .play-shape,
.brandfilm-play-toggle:not(.is-playing) .pause-shape,
.brandfilm-sound-toggle.is-muted .sound-wave,
.brandfilm-sound-toggle:not(.is-muted) .sound-x {
  display: none;
}
.brandfilm-player.is-mobile-muted .brandfilm-sound-toggle {
  display: none;
}
.brandfilm-caption {
  margin-top: 16px;
  font-family: var(--font-en), var(--font-kr);
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--color-text-light);
}
.brandfilm-copy {
  padding-left: 8px;
}
.brandfilm-lead {
  font-size: var(--font-size-xl);
  font-weight: 300;
  color: var(--color-text-heading);
  line-height: 1.5;
  letter-spacing: 1px;
  margin-bottom: 20px;
}
.brandfilm-desc {
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  line-height: 1.8;
  margin-bottom: 36px;
}
.brandfilm-cta {
  display: inline-block;
}
@media (max-width: 991px) {
  .brandfilm-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .brandfilm-copy {
    padding-left: 0;
    text-align: center;
  }
}
@media (max-width: 767px) {
  .brandfilm-lead {
    font-size: var(--font-size-lg);
  }
  .brandfilm-lead br,
  .brandfilm-desc br {
    display: none;
  }
}
