/* ==========================================================================
   Language Switcher — Dropdown & Content Visibility
   ========================================================================== */

/* ---------- 1. Dropdown component ---------- */

/* Hide site-branding (title already hidden, remove container space too) */
.site-branding-container .site-branding {
  display: none;
}

/* Shrink logo and its container to 2/3 of original (500px -> 333px) */
.site-logo {
  width: 333px !important;
  max-width: 333px !important;
}

.site-logo .header-image {
  width: 333px !important;
  max-width: 333px !important;
  height: auto !important;
}

/* Remove nav-float-right gap: pull navigation next to logo, let it fill remaining space */
.nav-float-right #site-navigation {
  margin-left: 0 !important;
  flex: 1;
}

/* Align menu items to the left, close to logo */
.main-navigation .inside-navigation {
  justify-content: flex-start !important;
}

/* Place switcher at end of nav bar */
.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.lang-switcher-btn {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.lang-switcher-btn:hover,
.lang-switcher-btn:focus {
  background: var(--accent);
  color: #fff;
  outline: none;
}

.lang-switcher-btn .chevron {
  font-size: 10px;
  transition: transform 0.2s;
}

.lang-switcher.open .chevron {
  transform: rotate(180deg);
}

.lang-switcher-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  list-style: none;
  padding: 4px 0;
  margin: 0;
  min-width: 140px;
  z-index: 10001;
}

.lang-switcher.open .lang-switcher-menu {
  display: block;
}

.lang-switcher-menu li {
  margin: 0;
  padding: 8px 16px;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.lang-switcher-menu li:hover {
  background: #f0f4f8;
  color: var(--accent);
}

.lang-switcher-menu li.active {
  font-weight: 600;
  color: var(--accent);
  background: #f0f4f8;
}

/* ---------- 2. Language content visibility ---------- */

/*
 * Before JS runs (no .lang-active on body), everything stays as-is.
 * The existing <details> elements remain functional as a no-JS fallback.
 */

/* Default (zh): hide translated blocks, show Chinese wrapper */
body.lang-active details.lang-en,
body.lang-active details.lang-ja {
  display: none !important;
}

body.lang-active .lang-zh {
  display: block;
}

/* Hide WordPress page title (content already has its own title/hero) */
body.lang-active .entry-header {
  display: none;
}

/* English active */
body.show-en .lang-zh {
  display: none !important;
}

body.show-en details.lang-en {
  display: block !important;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
}

body.show-en details.lang-en > summary {
  display: none;
}

/* Japanese active */
body.show-ja .lang-zh {
  display: none !important;
}

body.show-ja details.lang-ja {
  display: block !important;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
}

body.show-ja details.lang-ja > summary {
  display: none;
}

/* ---------- 3. Lockdown notice ---------- */

.notice-lockdown {
  max-width: 760px;
  margin: 1.5em auto;
  padding: 1.2em 1.5em;
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  font-size: 0.95em;
  line-height: 1.7;
  color: #92400e;
}

.notice-lockdown p:first-child {
  margin-top: 0;
  font-size: 1.1em;
}

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

.notice-lockdown a {
  color: #d97706;
  text-decoration: underline;
}

.notice-lockdown a:hover {
  color: #92400e;
}

/* ---------- 4. Mobile responsive ---------- */

@media (max-width: 768px) {
  /* Enlarge hamburger menu button for better touch target */
  button.menu-toggle {
    padding: 12px 16px !important;
    font-size: 18px !important;
    min-width: 48px;
    min-height: 48px;
  }

  button.menu-toggle .gp-icon {
    font-size: 22px !important;
  }

  /* On mobile, nav is hidden; place switcher in header */
  .lang-switcher {
    position: fixed;
    top: 12px;
    right: 60px;
    margin-left: 0;
    z-index: 1000;
  }

  .lang-switcher-btn {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px;
  }
}
