/* ============================================================================
   TeraSystemsAI — Unified Site Header (banner + primary navigation)
   Single source of truth. Include on a page with:
     <link rel="stylesheet" href="site-header.css">
     <script src="site-header.js" defer></script>
   The script injects the markup and removes the page's legacy header.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@600;700;800;900&display=swap');

/* Neutralize legacy page headers on pages that adopt the unified header
   (these selectors are header-specific and only loaded on adopting pages). */
.topbar, .secondary-nav, .top-nav, nav.navbar#navbar { display: none !important; }

.tsai-banner, .tsai-nav, .tsai-nav * { box-sizing: border-box; }

/* ── Banner ───────────────────────────────────────────────────────────────── */
.tsai-banner {
  background: linear-gradient(100deg, #08203f 0%, #114b86 55%, #1f7fd0 100%);
  color: #fff; display: flex; align-items: center; gap: 24px;
  padding: 16px 36px; font-family: 'Inter', system-ui, sans-serif;
}
.tsai-banner-logo { width: 64px; height: 64px; flex-shrink: 0; }
.tsai-banner-logo svg { width: 100%; height: 100%; display: block; }
.tsai-banner-center { flex: 1; text-align: center; min-width: 0; }
.tsai-banner-title {
  font-family: 'Outfit', system-ui, sans-serif; font-weight: 800;
  font-size: 30px; letter-spacing: .4px; line-height: 1;
}
.tsai-banner-tag { font-size: 14px; color: rgba(255,255,255,.82); margin-top: 7px; }
.tsai-banner-meta { text-align: right; flex-shrink: 0; }
.tsai-banner-meta .loc { color: #ffd166; font-weight: 700; font-size: 14px; }
.tsai-banner-meta .sub { color: #ffd166; font-weight: 600; font-size: 12.5px; margin-top: 5px; opacity: .92; }

/* ── Primary navigation bar ───────────────────────────────────────────────── */
.tsai-nav {
  background: #111418; border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 6px; padding: 0 22px; height: 54px;
  position: sticky; top: 0; z-index: 1000; font-family: 'Inter', system-ui, sans-serif;
}
.tsai-nav-logo { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 800; font-size: 15px; text-decoration: none; flex-shrink: 0; }
.tsai-nav-logo .sq { width: 9px; height: 9px; border-radius: 2px; background: #1f6feb; }
/* No overflow here: overflow-x:auto would force overflow-y:auto and clip the
   dropdown menus that extend below the bar (cutting off lower subpages). */
.tsai-nav-center { display: flex; align-items: center; gap: 1px; flex: 1; justify-content: center; flex-wrap: nowrap; min-width: 0; }
.tsai-nav-center > a, .tsai-dd > .tsai-dd-trigger {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 8px 12px; color: rgba(255,255,255,.78); font-weight: 600; font-size: 12px;
  letter-spacing: .07em; text-transform: uppercase; text-decoration: none; cursor: pointer;
  border-radius: 6px; transition: color .15s, background .15s; position: relative;
}
.tsai-nav-center > a:hover, .tsai-dd-trigger:hover { color: #fff; background: rgba(255,255,255,.05); }
.tsai-nav-center > a.tsai-active, .tsai-dd.tsai-active > .tsai-dd-trigger { color: #fff; }
.tsai-nav-center > a.tsai-active::after, .tsai-dd.tsai-active > .tsai-dd-trigger::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
  border-radius: 2px; background: #5ee7d7;
}
.tsai-chev { width: 11px; height: 11px; opacity: .6; transition: transform .15s; }
.tsai-dd:hover .tsai-chev, .tsai-dd.open .tsai-chev { transform: rotate(180deg); }
.tsai-dd { position: relative; }
.tsai-dd-menu {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(-4px);
  min-width: 222px; background: #fff; border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.30);
  padding: 6px; opacity: 0; visibility: hidden;
  transition: opacity .15s, transform .15s, visibility .15s; z-index: 1100;
}
.tsai-dd:hover > .tsai-dd-menu, .tsai-dd:focus-within > .tsai-dd-menu, .tsai-dd.open > .tsai-dd-menu {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
.tsai-dd-menu a {
  display: block; padding: 9px 12px; border-radius: 6px; color: #1a2230;
  font-size: 13px; font-weight: 500; text-decoration: none; text-transform: none; letter-spacing: 0;
}
.tsai-dd-menu a:hover { background: #eef3fb; color: #1657c0; }
.tsai-tei {
  flex-shrink: 0; margin-left: 4px; color: #5ee7d7; font-weight: 700; font-size: 12px;
  letter-spacing: .05em; text-decoration: none; white-space: nowrap;
  padding: 6px 15px; border-radius: 20px; background: rgba(0,137,123,.18);
  border: 1px solid rgba(0,137,123,.45); transition: background .15s;
}
.tsai-tei:hover { background: rgba(0,137,123,.30); }
.tsai-nav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.tsai-search { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.78); background: transparent; border: none; cursor: pointer; text-decoration: none; }
.tsai-search:hover { background: rgba(255,255,255,.10); color: #fff; }
.tsai-search svg { width: 17px; height: 17px; }
.tsai-cta { background: #1f6feb; color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; padding: 9px 16px; border-radius: 7px; text-decoration: none; white-space: nowrap; }
.tsai-cta:hover { background: #1657c0; }
.tsai-avatar { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.30); display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.78); text-decoration: none; }
.tsai-avatar:hover { border-color: #fff; color: #fff; }
.tsai-avatar svg { width: 16px; height: 16px; }
.tsai-burger { display: none; width: 40px; height: 40px; border-radius: 7px; border: 1px solid rgba(255,255,255,.30); background: transparent; color: #fff; cursor: pointer; align-items: center; justify-content: center; }
.tsai-burger svg { width: 20px; height: 20px; }

/* ── Mobile panel ─────────────────────────────────────────────────────────── */
.tsai-mnav { display: none; position: fixed; inset: 0; background: rgba(6,12,20,.6); z-index: 1200; padding: 12px; }
.tsai-mnav.open { display: block; }
.tsai-mnav-panel { background: #fff; border-radius: 14px; max-width: 440px; margin: 64px auto 0; max-height: calc(100vh - 84px); overflow: auto; padding: 6px 0; }
.tsai-mnav a, .tsai-mnav summary { display: block; padding: 13px 18px; color: #1a2230; font-weight: 600; font-size: 15px; text-decoration: none; border-bottom: 1px solid #eef0f3; }
.tsai-mnav details summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.tsai-mnav details summary::-webkit-details-marker { display: none; }
.tsai-mnav details summary::after { content: '+'; color: #1f6feb; font-weight: 700; }
.tsai-mnav details[open] summary::after { content: '\2212'; }
.tsai-mnav .sub a { padding-left: 34px; font-weight: 500; font-size: 14px; background: #f7f9fc; }
.tsai-mnav .tsai-mtei { color: #00897b; font-weight: 700; }

/* Mid-width: tighten spacing so all items fit without horizontal scrolling. */
@media (min-width: 981px) and (max-width: 1240px) {
  .tsai-nav { padding: 0 14px; gap: 2px; }
  .tsai-nav-center > a, .tsai-dd > .tsai-dd-trigger { padding: 8px 8px; letter-spacing: .03em; font-size: 11.5px; }
  .tsai-nav-right { gap: 8px; }
  .tsai-cta { padding: 8px 12px; }
}

@media (max-width: 980px) {
  .tsai-nav-center { display: none; }
  .tsai-nav-right .tsai-search, .tsai-nav-right .tsai-cta, .tsai-nav-right .tsai-avatar { display: none; }
  .tsai-burger { display: flex; }
  .tsai-banner { flex-direction: column; gap: 8px; text-align: center; padding: 14px 16px; }
  .tsai-banner-center, .tsai-banner-meta { text-align: center; }
  .tsai-banner-title { font-size: 24px; }
}
