/* ==========================================================================
   Cross-site country switching (market-switch.js): the hero's country picker
   and the navbar's "Calling Japan?" / "Calling US/Canada?" link. The same file
   is served on both sites (landing/ and landing-us/); keep the copies
   identical.
   ========================================================================== */

/* ── Hero: a native <select> laid invisibly over the flag + dial code ── */
.phone-country {
  position: relative;
  cursor: pointer;
  color: var(--text-secondary);
}

.phone-country-caret {
  width: 10px;
  height: 10px;
  opacity: 0.6;
}

.phone-country-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  /* 16px keeps iOS from zooming in when the picker opens */
  font-size: 16px;
}

.phone-country:hover,
.phone-country:focus-within {
  color: var(--text);
}

/* ── Navbar link to the other site ── */
.nav a.market-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}

.nav a.market-switch:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}

.nav-has-market .nav-links a {
  white-space: nowrap;
}

@media (min-width: 1081px) {
  .nav-has-market .nav-links {
    gap: 24px;
  }
}

/* Narrower than this the inline links don't fit: the link sits next to the
   hamburger, where the theme toggle was, and everything else, the toggle
   included, goes in the menu. */
.nav a.market-switch-mobile {
  display: none;
}

@media (max-width: 1080px) {
  .nav-has-market .container {
    gap: 8px;
  }

  .nav-links a.market-switch {
    display: none !important;
  }

  .nav a.market-switch-mobile {
    display: inline-flex;
    margin-left: auto;
    margin-right: 8px;
  }

  .nav-has-market .nav-links .theme-toggle {
    display: flex;
  }
}

/* style-v2.css switches to the menu layout at 768px; do the same here
   for the wider range. */
@media (min-width: 769px) and (max-width: 1080px) {
  .nav-has-market .nav-hamburger {
    display: flex;
  }

  .nav-has-market .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background: var(--nav-mobile-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }

  .nav-has-market .nav-links.nav-open {
    display: flex;
  }

  .nav-has-market .nav-links a {
    font-size: 16px;
    padding: 8px 0;
  }

  .nav-has-market .nav-links a.btn {
    padding: 10px 24px;
  }
}

/* Small phones: logo, link and hamburger still have to fit on one line. */
@media (max-width: 380px) {
  .nav-has-market .container {
    padding: 0 14px;
  }

  .nav-has-market .nav-brand {
    font-size: 18px;
  }

  .nav a.market-switch-mobile {
    padding: 5px 9px;
    font-size: 12px;
    margin-right: 0;
  }

  .market-switch-arrow {
    display: none;
  }
}
