:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --color-primary: #0284c7;
  --color-primary-hover: #0369a1;
  --color-accent-emerald: #10b981;
  --color-accent-cyan: #38bdf8;
  --max-content-width: 1152px;
}

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

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

body {
  font-family: var(--font-sans);
  background-color: #060513;
  color: #ffffff;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Starry Cosmic Background & Drift Animation
   ========================================================================== */
.bg-wrapper {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-layer {
  position: absolute;
  top: -4%;
  left: -4%;
  width: 108%;
  height: 108%;
  background-image: url('assets/fluid-bg.webp');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 48% 44%, rgba(8, 7, 24, 0.05) 0%, rgba(6, 5, 18, 0.42) 65%, rgba(4, 3, 14, 0.88) 100%),
    linear-gradient(180deg, rgba(6, 5, 18, 0.3) 0%, rgba(6, 5, 18, 0.02) 35%, rgba(4, 3, 14, 0.76) 100%);
}

@media (max-width: 768px) {
  .bg-layer {
    background-image: url('assets/fluid-bg-mobile.webp');
  }
}

/* ==========================================================================
   Header & Fixed Top Navigation (64px)
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  z-index: 100;
  background: transparent;
  border-bottom: 0;
}

.nav-container {
  max-width: 1232px;
  height: 100%;
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-left {
  display: flex;
  align-items: center;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #ffffff;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: block;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
}

.nav-item {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  padding: 6px 12px;
  transition: color 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.btn-icon:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #ffffff;
  height: 32px;
  font-size: 12px;
  font-weight: 500;
  padding: 0 14px;
  border-radius: 16px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.38);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-signin:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.5);
}

/* Mobile Menu Toggle Button */
.mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
}

.hamburger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background-color: #ffffff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Mobile Menu Drawer */
.mobile-menu {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: #0a091a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 24px 28px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6);
}

.mobile-menu.open {
  display: block;
}

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

.mobile-nav-item {
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  display: block;
  padding: 6px 0;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  color: #ffffff;
}

.mobile-menu-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-btn-signin {
  width: 100%;
  padding: 10px 0;
}

/* ==========================================================================
   Main Content & Hero Section
   ========================================================================== */
.main-content {
  position: relative;
  z-index: 10;
  padding-top: 64px;
}

.hero-section {
  min-height: 782px;
  display: flex;
  align-items: flex-start;
  padding: 84px 0 20px;
}

.hero-container {
  max-width: var(--max-content-width);
  width: 100%;
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: 560px 552px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
}

/* Hero Left Column */
.hero-copy {
  flex: none;
  min-width: 0;
  max-width: 560px;
  position: relative;
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: -32px -64px -32px -84px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse at 36% 42%, rgba(4, 3, 14, 0.54) 0%, rgba(4, 3, 14, 0.24) 52%, transparent 76%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #38bdf8;
  font-size: 11.5px;
  font-weight: 500;
  margin-bottom: 20px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #38bdf8;
}

.hero-title {
  font-size: 52px;
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  background: linear-gradient(90deg, #5b7bff 0%, #9d5cff 50%, #d65cff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-slogan {
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 16px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.72);
}

.hero-desc {
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 47px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.82);
}

.hero-desc p + p {
  margin-top: 10px;
}

.hero-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.52);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-weight: 500;
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

/* Apps Section */
.hero-apps {
  margin-top: 4px;
}

.apps-meta {
  margin-bottom: 12px;
}

.apps-heading {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.52);
}

.apps-subheading {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.38);
  margin-top: 2px;
}

.apps-list {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.app-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}

.app-chip-icon {
  flex-shrink: 0;
}

/* ==========================================================================
   Terminal Panel (Hero Right)
   ========================================================================== */
.hero-terminal {
  flex: none;
  max-width: 552px;
  width: 100%;
  margin-top: 8px;
}

.terminal-card {
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.72), 0 0 35px rgba(56, 189, 248, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 518px;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.terminal-tabs {
  display: flex;
  gap: 0;
}

.terminal-tab {
  background: none;
  border: none;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.terminal-tab:hover {
  color: rgba(255, 255, 255, 0.85);
}

.terminal-tab.active {
  color: var(--color-accent-emerald);
}

.terminal-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--color-accent-emerald);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.terminal-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-family: var(--font-mono);
}

.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-accent-emerald);
  box-shadow: 0 0 8px var(--color-accent-emerald);
}

.terminal-endpoint-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 8px;
}

.badge-method {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #e2e8f0;
}

.terminal-body {
  padding: 8px 20px 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terminal-section {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.terminal-section:first-child {
  flex: 1 1 61%;
}

.terminal-section:last-child {
  flex: 0 0 33%;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.38);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.code-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.terminal-code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: #f8fafc;
  white-space: pre;
  margin: 0;
}

.terminal-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 14px 0;
}

.terminal-response {
  min-height: 54px;
}

.terminal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.18);
}

.terminal-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric-sep {
  opacity: 0.4;
}

.terminal-protocol {
  color: rgba(255, 255, 255, 0.45);
}

/* Syntax Highlighting Tokens */
.tok-cmd { color: #38bdf8; }
.tok-flag { color: #818cf8; }
.tok-str { color: #facc15; }
.tok-key { color: #38bdf8; }
.tok-punct { color: #94a3b8; }
.tok-kw { color: #a78bfa; }
.tok-num { color: #fb923c; }
.tok-comment { color: #64748b; font-style: italic; }

/* ==========================================================================
   API Key Usage Lookup
   ========================================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.key-lookup-section {
  max-width: var(--max-content-width);
  margin: 0 auto 40px;
  padding: 0 24px;
}

.key-lookup-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 24px 28px;
  border-radius: 18px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background:
    radial-gradient(circle at 8% 0%, rgba(2, 132, 199, 0.24), transparent 46%),
    linear-gradient(135deg, rgba(8, 20, 42, 0.86), rgba(5, 10, 26, 0.78));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.key-lookup-copy {
  min-width: 0;
}

.key-lookup-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--color-accent-cyan);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.key-lookup-copy h2 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 750;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.key-lookup-copy p {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13.5px;
}

.key-lookup-form {
  display: flex;
  flex: 0 1 470px;
  gap: 10px;
}

.key-lookup-form input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(3, 8, 20, 0.72);
  color: #ffffff;
  font-size: 14px;
  font-family: var(--font-mono);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.key-lookup-form input::placeholder {
  color: rgba(148, 163, 184, 0.58);
  font-family: var(--font-sans);
}

.key-lookup-form input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.72);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.key-lookup-form .btn {
  flex: 0 0 auto;
  height: 44px;
  white-space: nowrap;
}

/* ==========================================================================
   Stats Section (4-column grid)
   ========================================================================== */
.stats-section {
  max-width: var(--max-content-width);
  margin: 0 auto 20px;
  padding: 0 24px;
}

.stats-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.stat-card {
  padding: 0 8px;
}

.stat-number {
  font-size: 38px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-label {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.62);
  margin-top: 8px;
  font-weight: 400;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  max-width: var(--max-content-width);
  margin: 40px auto 0;
  padding: 24px 24px 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.footer-logo {
  border-radius: 4px;
}

.footer-tagline {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.48);
}

.footer-copy {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: #ffffff;
}

/* ==========================================================================
   Responsive Layout Breakpoints
   ========================================================================== */
@media (max-width: 1200px) {
  .hero-section {
    min-height: auto;
    padding: 36px 0 20px;
    align-items: stretch;
  }

  .hero-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
  }

  .hero-copy {
    max-width: 100%;
    flex: 1 1 auto;
  }

  .hero-terminal {
    max-width: 600px;
    flex: 1 1 auto;
    margin-top: 0;
  }

  .terminal-card {
    height: auto;
  }

  .terminal-body {
    overflow: visible;
  }

  .terminal-section:first-child,
  .terminal-section:last-child {
    flex: none;
  }
}

@media (max-width: 768px) {
  .site-header {
    height: 64px;
  }

  .nav-links,
  .nav-actions {
    display: none;
  }

  .mobile-toggle {
    display: flex;
  }

  .main-content {
    padding-top: 64px;
  }

  .hero-section {
    padding: 24px 0 16px;
    min-height: auto;
  }

  .hero-container {
    padding: 0 16px;
    gap: 32px;
  }

  .hero-title {
    font-size: 36px;
    line-height: 1.2;
  }

  .hero-slogan {
    font-size: 15px;
  }

  .hero-desc {
    font-size: 13.5px;
    line-height: 1.7;
  }

  .hero-buttons {
    flex-wrap: wrap;
    gap: 10px;
  }

  .btn {
    flex: 1 1 auto;
    padding: 10px 16px;
  }

  .hero-terminal {
    max-width: 100%;
  }

  .terminal-card {
    border-radius: 12px;
  }

  .terminal-tab {
    padding: 12px 10px;
    font-size: 12px;
  }

  .terminal-code {
    font-size: 11.5px;
  }

  .stats-section {
    margin: 28px auto 16px;
    padding: 0 16px;
  }

  .key-lookup-section {
    margin-bottom: 28px;
    padding: 0 16px;
  }

  .key-lookup-card {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 20px;
  }

  .key-lookup-copy h2 {
    font-size: 20px;
  }

  .key-lookup-form {
    flex: 1 1 auto;
  }

  .stats-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 12px;
  }

  .stat-number {
    font-size: 30px;
  }

  .stat-label {
    font-size: 12.5px;
  }

  .site-footer {
    margin: 32px auto 0;
    padding: 20px 16px 36px;
  }

  .footer-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }

  .footer-left {
    align-items: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
  }
}

@media (max-width: 420px) {
  .hero-title {
    font-size: 34px;
  }

  .terminal-header {
    padding: 0 10px;
  }

  .terminal-tab {
    padding: 10px 8px;
    font-size: 11.5px;
  }

  .terminal-body {
    padding: 8px 14px 14px;
  }

  .terminal-endpoint-bar {
    padding: 12px 14px 6px;
  }

  .terminal-footer {
    padding: 10px 14px;
    font-size: 10.5px;
  }
}
