/* ==========================================================================
   Hyperliquid Wiki & Knowledge Base - Design System
   Modern dark documentation theme inspired by Stripe Docs, GitBook, and Ethereum.org
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #0b1114;
  --bg-secondary: #0f191d;
  --bg-tertiary: #142228;
  --bg-card: #121e23;
  --bg-card-hover: #17272e;
  --bg-code: #080d0f;
  
  --border-subtle: #1a2a30;
  --border-medium: #243a43;
  --border-active: #50d2c1;
  
  --text-primary: #f6fefd;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;
  
  --accent-primary: #50d2c1;
  --accent-secondary: #1fa67d;
  --accent-glow: rgba(80, 210, 193, 0.15);
  --accent-blue: #38bdf8;
  --accent-amber: #fbbf24;
  --accent-purple: #c084fc;
  
  --sidebar-width: 280px;
  --toc-width: 240px;
  --header-height: 64px;
  --content-max-width: 860px;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: dark;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}

/* ─── Scrollbars ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ─── Top Header Bar ─── */
.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(11, 17, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: rgba(80, 210, 193, 0.08);
  border: 1px solid rgba(80, 210, 193, 0.35);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.brand-wrapper:hover .brand-logo {
  background: rgba(80, 210, 193, 0.18);
  border-color: #50d2c1;
  box-shadow: 0 0 14px rgba(80, 210, 193, 0.3);
}

.brand-logo svg {
  display: block;
}

.brand-text-group {
  display: flex;
  flex-direction: column;
}

.brand-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-subtext {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Header Search & Nav */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-container {
  position: relative;
  width: 280px;
}

.search-input {
  width: 100%;
  height: 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0 12px 0 36px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ─── Layout Structure ─── */
.wiki-layout {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  position: relative;
  min-height: calc(100vh - var(--header-height));
}

/* ─── Left Sidebar Navigation ─── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: 24px 16px 40px;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  font-weight: 400;
}

.nav-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent-primary);
  font-weight: 600;
  border-left: 3px solid var(--accent-primary);
}

.nav-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── Main Content Area ─── */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 40px 32px 80px;
}

.content-article {
  width: 100%;
  max-width: var(--content-max-width);
}

/* ─── Breadcrumbs ─── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumbs a,
.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumbs a:hover,
.breadcrumb a:hover {
  color: var(--accent-primary);
}

.breadcrumbs span.separator,
.breadcrumb .bc-sep {
  color: var(--border-medium);
}

.breadcrumbs span.current,
.breadcrumb .bc-current {
  color: var(--text-secondary);
}

/* ─── Typography & Article Elements ─── */
.article-header {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 24px;
}

.article-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 12px;
}

.article-lead,
.article-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 400;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Headings */
h2 {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  margin: 38px 0 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(26, 42, 48, 0.6);
  display: flex;
  align-items: center;
  gap: 8px;
}

h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 26px 0 12px;
}

p {
  font-size: 15px;
  color: #cbd5e1;
  margin-bottom: 18px;
  line-height: 1.75;
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul, ol {
  margin: 16px 0 24px 20px;
  color: #cbd5e1;
}

li {
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.7;
}

/* ─── Callout Boxes ─── */
.callout {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.65;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.callout-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.callout.info {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #bae6fd;
}

.callout.tip {
  background: rgba(80, 210, 193, 0.08);
  border: 1px solid rgba(80, 210, 193, 0.25);
  color: #c7f9f1;
}

.callout.warning {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: #fef08a;
}

/* ─── Tables ─── */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

th {
  background: var(--bg-secondary);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-medium);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.6px;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: #cbd5e1;
}

tr:last-child td {
  border-bottom: none;
}

/* ─── Code Blocks ─── */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 20px 0;
  position: relative;
}

code {
  font-family: var(--font-mono);
  font-size: 13.5px;
}

:not(pre) > code {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid var(--border-subtle);
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* ─── Architecture Diagram Card ─── */
.diagram-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 28px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.diagram-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Cards Grid ─── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
  text-decoration: none;
}

.feature-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.feature-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.feature-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* ─── Page Navigation Buttons (Prev / Next) ─── */
.page-nav-wrapper {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.2s;
  flex: 1;
}

.page-nav-link:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  text-decoration: none;
}

.page-nav-direction {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.page-nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
}

/* ─── Right On-Page Table of Contents ─── */
.right-toc,
.toc-sidebar {
  width: var(--toc-width);
  min-width: var(--toc-width);
  flex-shrink: 0;
  padding: 40px 0 40px 24px;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  border-left: 1px solid var(--border-subtle);
}

.toc-item {
  padding-left: 12px;
}

.toc-item a {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  transition: color 0.15s;
  line-height: 1.4;
}

.toc-item a:hover,
.toc-item.active a {
  color: var(--accent-primary);
}

.toc-item.active {
  border-left: 2px solid var(--accent-primary);
  margin-left: -1px;
}

/* ─── Dedicated Legal Callout Card ─── */
.legal-banner-card {
  background: rgba(26, 42, 48, 0.6);
  border: 1px solid var(--border-medium);
  border-left: 4px solid var(--accent-amber);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 28px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.legal-banner-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.legal-banner-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.legal-banner-text strong {
  color: #fff;
}

/* ─── Footer Disclaimer & Legal Navigation ─── */
.wiki-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 36px 24px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: auto;
}

.footer-legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.footer-legal-links a {
  color: var(--accent-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}

.footer-legal-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-divider {
  color: var(--border-medium);
}

.wiki-footer p {
  max-width: 900px;
  margin: 0 auto 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── Responsive Media Queries ─── */
@media (max-width: 1200px) {
  .right-toc {
    display: none;
  }
}

@media (max-width: 1200px) {
  .right-toc,
  .toc-sidebar {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-medium);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.7);
  }
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  .main-wrapper,
  .main-content {
    padding: 24px 16px 60px;
  }
  .search-container {
    width: 160px;
  }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--header-height);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  transition: opacity 0.2s ease;
}
.sidebar-backdrop.active {
  display: block;
}

/* ==========================================================================
   Language Selector (Custom Flag Dropdown & Google Translate Suppression)
   ========================================================================== */

/* 1. Strict suppression of Google Translate default banner, tooltips & body shift */
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-tooltip,
.goog-tooltip:hover {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  width: 0 !important;
}

body {
  top: 0px !important;
  position: static !important;
}

#google_translate_element {
  display: none !important;
}

.goog-text-highlight {
  background: none !important;
  box-shadow: none !important;
}

/* 2. Custom Premium Flag Selector UI */
.lang-selector-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.lang-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.lang-btn .lang-flag-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 14px;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 2px rgba(0,0,0,0.4);
}

.lang-btn .lang-flag-current svg {
  width: 100%;
  height: 100%;
  display: block;
}

.lang-btn .lang-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.lang-selector-wrapper.active .lang-btn .lang-arrow {
  transform: rotate(180deg);
}

/* 3. Dropdown Menu */
.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 170px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 1px rgba(80, 210, 193, 0.2);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  backdrop-filter: blur(12px);
  max-height: 320px;
  overflow-y: auto;
}

.lang-selector-wrapper.active .lang-dropdown-menu {
  display: flex;
  animation: langFadeIn 0.15s ease-out;
}

@keyframes langFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-option:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.lang-option.selected {
  background: rgba(80, 210, 193, 0.12);
  color: var(--accent-primary);
  font-weight: 600;
}

.lang-option .lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 14px;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 2px rgba(0,0,0,0.4);
  flex-shrink: 0;
}

.lang-option .lang-flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

.lang-option .lang-name {
  flex-grow: 1;
}

.lang-dropdown-menu::-webkit-scrollbar {
  width: 4px;
}
.lang-dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}


/* ==========================================================================
   STRICT GOOGLE TRANSLATE BANNER & FRAME ANNIHILATION
   ========================================================================== */
body > .skiptranslate,
body > div.skiptranslate,
div.skiptranslate,
.VIpgJd-ZVi9od-ORHb-OEVmcd,
.VIpgJd-ZVi9od-aZ2wEe-OEVmcd,
.VIpgJd-ZVi9od-xl07Ob-OEVmcd,
iframe.skiptranslate,
iframe[id*=":1.container"],
iframe[id*=":2.container"],
.goog-te-banner-frame,
#goog-gt-tt,
.VIpgJd-yAWNEb-L7lbkb {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  width: 0 !important;
  max-height: 0 !important;
  max-width: 0 !important;
  position: absolute !important;
  top: -9999px !important;
  left: -9999px !important;
  z-index: -99999 !important;
}

html, body {
  top: 0px !important;
  position: static !important;
}

#google_translate_element {
  display: none !important;
  position: absolute !important;
  top: -9999px !important;
}

.goog-text-highlight {
  background: none !important;
  box-shadow: none !important;
}
