/* === RSG site — shared header components ===
   Uses CSS variables defined on each page (--bg, --bg-1, --cyan, etc.) */

/* ---- CONTACT BAR (above topstrip) ---- */
.contactbar {
  background: #050810;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
  position: relative;
  z-index: 6;
}
.contactbar-inner {
  display: flex;
  align-items: center;
  height: 34px;
  gap: 22px;
  flex-wrap: wrap;
}
.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  transition: color 0.15s;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.contact-item:hover { color: var(--cyan); }
.contact-item svg {
  width: 12px;
  height: 12px;
  color: var(--cyan-deep);
  flex-shrink: 0;
}
.contact-item .channel-pills {
  display: inline-flex;
  gap: 4px;
  margin-left: 4px;
}
.contact-item .channel-pill {
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text-3);
  text-transform: uppercase;
}
.contactbar-inner .addr { margin-left: auto; opacity: 0.85; }

/* ---- LANG SWITCHER ---- */
.lang-switcher-wrap {
  position: relative;
}
.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-1);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.lang-trigger:hover { border-color: var(--line-strong); }
.lang-trigger[aria-expanded="true"] {
  border-color: var(--cyan-deep);
  background: var(--bg-2);
}
.lang-flag {
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 1.5px;
  flex-shrink: 0;
  display: block;
}
.lang-code {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-2);
}
.lang-chev {
  color: var(--text-3);
  transition: transform 0.2s;
}
.lang-trigger[aria-expanded="true"] .lang-chev {
  transform: rotate(180deg);
}

/* panel */
.lang-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  max-height: 460px;
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(120,200,230,0.04);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: all 0.18s ease;
  z-index: 100;
  overflow: hidden;
}
.lang-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.lang-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.lang-search svg { color: var(--text-3); flex-shrink: 0; }
.lang-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 2px 0;
}
.lang-search input::placeholder { color: var(--text-3); }

.lang-list {
  overflow-y: auto;
  padding: 6px 0;
  flex: 1;
}
.lang-list::-webkit-scrollbar { width: 6px; }
.lang-list::-webkit-scrollbar-track { background: transparent; }
.lang-list::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
.lang-list::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }

.lang-group + .lang-group { margin-top: 4px; }
.lang-group-h {
  padding: 8px 14px 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-3);
}
.lang-item {
  width: 100%;
  display: grid;
  grid-template-columns: 22px 1fr auto 14px;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  color: var(--text-2);
  transition: background 0.12s;
}
.lang-item:hover { background: rgba(120,200,230,0.04); color: var(--text); }
.lang-item-active { color: var(--cyan); }
.lang-item-active .lang-mark::after {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7l3 3 5-7' fill='none' stroke='%2318E1F0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.lang-item .lang-name {
  font-size: 13.5px;
  font-weight: 500;
}
.lang-item .lang-en {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.lang-item-active .lang-en { color: var(--cyan-deep); }

.lang-empty {
  padding: 18px 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
  display: none;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 720px) {
  .contactbar-inner {
    height: auto;
    padding: 9px 0 8px;
    font-size: 11px;
    gap: 12px 16px;
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .contact-item .channel-pills { display: none; }
  .contactbar-inner .addr {
    margin-left: 0;
    flex-basis: 100%;
    font-size: 10.5px;
    color: var(--text-3);
    padding-top: 4px;
    border-top: 1px dashed var(--line);
  }
  .lang-panel {
    width: 280px;
    right: 0;
  }
}

/* Patch: trial download moved next to pricing after hero */
.trial-inline {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 24px;
  border: 1px solid rgba(34, 211, 238, 0.26);
  border-radius: 24px;
  background:
    radial-gradient(circle at 16% 10%, rgba(34, 211, 238, 0.18), transparent 42%),
    rgba(8, 13, 22, 0.78);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(255,255,255,0.04);
}
.trial-inline h3 {
  margin: 6px 0 6px;
  font-size: clamp(24px, 2.4vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.trial-inline p {
  max-width: 720px;
  margin: 0;
  color: var(--text-2);
  line-height: 1.65;
}
.trial-inline .btn {
  min-width: 220px;
  justify-content: center;
  flex-shrink: 0;
}
@media (max-width: 760px) {
  .trial-inline {
    align-items: stretch;
    flex-direction: column;
  }
  .trial-inline .btn { width: 100%; }
}

/* ============================================================
   MOBILE NAVIGATION (hamburger + drawer)
   The hamburger button is auto-injected by site.js into every
   <header class="site"> on load. On screens > 720px it is
   hidden; on smaller screens nav.primary collapses behind it.
   ============================================================ */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}
.nav-toggle:hover { border-color: var(--cyan-deep); }
.nav-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.nav-toggle .nti {
  position: relative;
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: background 0.15s;
}
.nav-toggle .nti::before,
.nav-toggle .nti::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, top 0.2s ease;
}
.nav-toggle .nti::before { top: -6px; }
.nav-toggle .nti::after  { top:  6px; }
.nav-toggle[aria-expanded="true"] .nti { background: transparent; }
.nav-toggle[aria-expanded="true"] .nti::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nti::after  { top: 0; transform: rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  /* Hide brand version subline on tiny screens to save space */
  .brand-name span { display: none; }
  /* Hide secondary "Sign in" CTA in header on phones — it stays inside the menu */
  header.site .nav-actions .btn-ghost { display: none; }
  /* Mobile drawer: nav.primary becomes a panel below the header */
  header.site nav.primary {
    display: none;
  }
  header.site.menu-open {
    background: rgba(5, 8, 16, 0.97);
  }
  header.site.menu-open nav.primary {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 6px 16px 16px;
    background: var(--bg-1);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line-strong);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    max-height: calc(100vh - 76px);
    overflow-y: auto;
    z-index: 40;
  }
  header.site.menu-open nav.primary > a,
  header.site.menu-open nav.primary > .dropdown {
    width: 100%;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
    color: var(--text);
  }
  header.site.menu-open nav.primary > .dropdown button {
    width: 100%;
    text-align: left;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
  }
  header.site.menu-open nav.primary > *:last-child { border-bottom: 0; }
  header.site.menu-open .mobile-cta {
    display: flex;
    width: 100%;
    margin-top: 14px;
    justify-content: center;
    padding: 14px 16px;
    border-radius: 6px;
  }
  /* Lock body scroll when menu is open */
  body.menu-locked { overflow: hidden; }
}

/* ============================================================
   GLOBAL OVERFLOW SAFETY
   Prevents long URLs / code from causing horizontal page scroll
   ============================================================ */
@media (max-width: 720px) {
  html, body { overflow-x: hidden; }
  pre, code { word-break: break-word; }
  pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { display: block; max-width: 100%; overflow-x: auto; }
  img, video, svg { max-width: 100%; height: auto; }
}

/* ============================================================
   TINY PHONES (≤480px) — keep header from overflowing.
   At this width we hide the brand text (logo alone is enough),
   compact the Buy CTA, and trim contactbar to phone+menu only.
   ============================================================ */
@media (max-width: 480px) {
  .brand-name { display: none; }
  header.site .nav-actions .btn-primary {
    padding: 8px 10px;
    font-size: 12px;
  }
  header.site .nav-actions .btn-primary .arr { display: none; }
  header.site .nav-actions { gap: 6px; }
  /* Tighten contactbar — drop the address line, it's not actionable */
  .contactbar-inner .addr { display: none; }
  /* Lang panel hugs the right edge of the screen */
  .lang-panel {
    width: calc(100vw - 24px);
    max-width: 320px;
  }
}
