/* 전 페이지 공통 헤더: 제목 · 검색 · 메뉴 + YouTube 광고판 */
:root {
  --yt-billboard-height: 88px;
}

.site-masthead.navbar,
.site-masthead.navbar.bg-primary,
.site-masthead.navbar.fixed-top {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  background-color: #1e4e8c !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0 !important;
  overflow: visible;
}

.site-masthead-brand {
  text-align: center;
  padding: 0.55rem 1rem 0.2rem;
}

.site-masthead-brand a {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff !important;
  text-decoration: none;
  line-height: 1.25;
}

.site-title-ko {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.site-title-en {
  font-family: 'Poppins', 'Noto Sans KR', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.92;
  margin-top: 0.12rem;
}

.site-masthead .site-masthead-search {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 16px 8px;
  z-index: 1040;
}

.site-masthead .site-search-form {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 340px;
  height: 36px;
  margin: 0 auto;
  gap: 8px;
  box-sizing: border-box;
}

.site-masthead .site-search-input,
.site-masthead .site-search-input[type="search"] {
  flex: 1 1 auto;
  width: auto !important;
  max-width: 248px;
  min-width: 0;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 999px !important;
  padding: 0 14px !important;
  font-size: 14px !important;
  font-weight: 400;
  line-height: 36px !important;
  color: #1e3a5f !important;
  background: #fff !important;
  outline: none;
  box-sizing: border-box !important;
  appearance: none;
  -webkit-appearance: none;
}

.site-masthead .site-search-input::-webkit-search-decoration,
.site-masthead .site-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.site-masthead .site-search-submit {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 58px;
  height: 36px !important;
  min-height: 36px !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 999px !important;
  padding: 0 14px !important;
  font-size: 14px !important;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: #fff !important;
  background: #4b5563 !important;
  cursor: pointer;
  box-sizing: border-box !important;
}

.site-masthead .site-search-submit:hover {
  background: #374151 !important;
}

.site-search-results {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, calc(100% - 2rem));
  margin: 0.3rem 0 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 40, 70, 0.2);
  max-height: min(58vh, 22rem);
  overflow-y: auto;
  z-index: 1100;
}

.site-search-results[hidden] {
  display: none;
}

.site-search-results a {
  display: block;
  padding: 0.5rem 0.85rem;
  text-decoration: none;
  color: #1f2937;
  font-size: 0.86rem;
}

.site-search-results a:hover,
.site-search-results a.is-active {
  background: #eef4fc;
}

.site-search-empty {
  padding: 0.7rem 0.85rem;
  font-size: 0.84rem;
  color: #667;
}

.site-masthead .container-fluid {
  justify-content: center;
  flex-wrap: nowrap !important;
  gap: 0;
  height: auto !important;
  min-height: 0;
  padding-top: 0.12rem !important;
  padding-bottom: 0.2rem !important;
  background: transparent !important;
}

.site-primary-nav {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 0.05rem 0.15rem;
}

.site-primary-nav .nav-link {
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.32rem 0.42rem !important;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.site-primary-nav .nav-link:hover,
.site-primary-nav .nav-link:focus {
  opacity: 0.88;
}

.site-primary-nav .nav-link.active {
  text-decoration: underline;
  text-underline-offset: 0.28em;
}

.site-primary-nav .nav-more {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.site-primary-nav .nav-more-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #fff;
  border-radius: 8px;
}

.site-primary-nav .nav-more-toggle::after {
  content: '더보기';
  position: absolute;
  right: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  background: rgba(12, 24, 44, 0.88);
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.site-primary-nav .nav-more-toggle:hover::after,
.site-primary-nav .nav-more-toggle:focus-visible::after {
  opacity: 1;
}

.site-primary-nav .nav-more.is-open .nav-more-toggle::after {
  opacity: 0;
}

.site-primary-nav .nav-more-toggle:hover,
.site-primary-nav .nav-more.is-open .nav-more-toggle,
.site-primary-nav .nav-more.has-active .nav-more-toggle {
  background: rgba(255, 255, 255, 0.12);
}

.site-primary-nav .nav-more-icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 18px;
  height: 13px;
}

.site-primary-nav .nav-more-icon span {
  display: block;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}

.site-primary-nav .nav-more-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 168px;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.site-primary-nav .nav-more-menu .nav-link {
  display: block;
  color: #1e334d !important;
  padding: 0.48rem 0.95rem !important;
  font-size: 0.88rem;
}

.site-primary-nav .nav-more-menu .nav-link:hover,
.site-primary-nav .nav-more-menu .nav-link:focus,
.site-primary-nav .nav-more-menu .nav-link.active {
  background: #eef4fc;
  text-decoration: none;
}

.nav-tone-home { color: #dce3ff !important; }
.nav-tone-wotd { color: #ffc4ae !important; }
.nav-tone-news { color: #9fecc0 !important; }
.nav-tone-quiz { color: #d4ee9a !important; }
.nav-tone-popular { color: #ffd56a !important; }
.nav-tone-sit { color: #e0ccff !important; }
.nav-tone-cook { color: #ffc08a !important; }
.nav-tone-culture { color: #ffb6d9 !important; }
.nav-tone-syn { color: #8ef0e8 !important; }
.nav-tone-rank { color: #ffb0b0 !important; }
.nav-tone-photo { color: #9ed4ff !important; }
.nav-tone-pros { color: #d7dee8 !important; }
.nav-tone-opine { color: #f3c77a !important; }
.nav-tone-dir { color: #b8d8ff !important; }

#yt-billboard-bar {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  margin: 10px 12px 14px;
  padding: 0.7rem 1rem;
  box-sizing: border-box;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a1a1a 0%, #2b0a0a 48%, #111 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

#yt-billboard-bar:hover {
  color: #fff;
  filter: brightness(1.06);
}

#yt-billboard-bar .yt-billboard__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 970px;
  width: 100%;
  justify-content: center;
}

#yt-billboard-bar .yt-billboard__icon {
  flex-shrink: 0;
  width: 48px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ff0000;
  border-radius: 10px;
}

#yt-billboard-bar .yt-billboard__icon svg {
  width: 16px;
  height: 16px;
  margin-left: 2px;
  display: block;
}

#yt-billboard-bar .yt-billboard__title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

#yt-billboard-bar .yt-billboard__handle {
  font-size: 0.82rem;
  opacity: 0.9;
}

@media (max-width: 600px) {
  .site-title-ko {
    font-size: 1.08rem;
  }

  .site-masthead .container-fluid {
    padding-left: 6px !important;
    padding-right: 4px !important;
  }

  .site-primary-nav {
    gap: 0;
  }

  .site-primary-nav .nav-link {
    font-size: 0.72rem;
    padding: 0.26rem 0.2rem !important;
  }

  .site-primary-nav .nav-more-toggle::after {
    display: none;
  }

  #yt-billboard-bar {
    min-height: 56px;
    margin: 8px 10px 12px;
    padding: 0.55rem 0.85rem;
  }

  #yt-billboard-bar .yt-billboard__title {
    font-size: 0.82rem;
  }
}

/* 고정 헤더 해제: 스크롤하면 제목·검색·메뉴·날씨·시간·YouTube가 함께 올라감 */
html.has-site-masthead .navbar.fixed-top,
html.has-site-masthead .site-masthead.navbar.fixed-top {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
}

html.has-site-masthead .weather-banner,
html.has-site-masthead .world-clock-bar {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  z-index: 1;
  width: 100%;
}

html.has-site-masthead body,
html.has-site-masthead.has-weather-banner body,
html.has-site-masthead.has-weather-banner:not(.page-with-main-content) body,
html.has-site-masthead.has-world-clock.has-weather-banner body,
html.has-site-masthead.has-world-clock.has-weather-banner:not(.page-with-main-content) body,
html.has-site-masthead.has-yt-billboard.has-world-clock.has-weather-banner:not(.page-with-main-content) body {
  padding-top: 0 !important;
}

html.has-site-masthead .main-content,
html.has-site-masthead.has-weather-banner.page-with-main-content .main-content,
html.has-site-masthead.has-world-clock.has-weather-banner.page-with-main-content .main-content,
html.has-site-masthead.has-yt-billboard.has-world-clock.has-weather-banner.page-with-main-content .main-content {
  margin-top: 20px !important;
}

html.has-site-masthead .dir-page {
  padding-top: 28px !important;
}

html.has-site-masthead .vocabulary-quiz-main {
  margin-top: 28px !important;
}

html.has-site-masthead .se-page .se-section-nav {
  top: 0;
}

@media (max-width: 600px) {
  html.has-site-masthead .main-content,
  html.has-site-masthead.has-weather-banner.page-with-main-content .main-content,
  html.has-site-masthead.has-world-clock.has-weather-banner.page-with-main-content .main-content,
  html.has-site-masthead.has-yt-billboard.has-world-clock.has-weather-banner.page-with-main-content .main-content {
    margin-top: 16px !important;
  }

  html.has-site-masthead .vocabulary-quiz-main {
    margin-top: 20px !important;
  }
}
