:root {
  /* Light Theme - Vibrant & Soft */
  --bg-color: #f0f4f8;
  --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
  --panel-bg: rgba(255, 255, 255, 0.85);
  --panel-border: rgba(255, 255, 255, 0.6);
  --panel-shadow: 0 8px 32px rgba(31, 38, 135, 0.05);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  
  --accent: #d97706;
  --accent-hover: #b45309;
  --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --accent-light: rgba(217, 119, 6, 0.1);
  
  --code-bg: #1e293b;
  --code-text: #f8fafc;
  --code-accent: #38bdf8;
  
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Theme - Sleek & Deep */
    --bg-color: #0f172a;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --panel-bg: rgba(30, 41, 59, 0.6);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent: #fbbf24;
    --accent-hover: #f59e0b;
    --accent-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    --accent-light: rgba(251, 191, 36, 0.15);
    
    --code-bg: #0b1120;
    --code-text: #e2e8f0;
    --code-accent: #38bdf8;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .brand-mark, .language-tab {
  font-family: 'Outfit', system-ui, sans-serif;
}

a {
  color: inherit;
  transition: all 0.3s ease;
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-up {
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 72px;
  padding: 14px max(24px, calc((100vw - 920px) / 2));
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.brand:hover .brand-mark {
  transform: scale(1.05) rotate(5deg);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.25;
}

.brand strong {
  font-size: 16px;
  font-weight: 700;
}

.brand small {
  color: var(--text-muted);
  font-size: 13px;
}

.top-nav {
  display: flex;
  gap: 24px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
}

.top-nav a {
  text-decoration: none;
  position: relative;
  padding: 4px 0;
}

.top-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.top-nav a:hover {
  color: var(--text-main);
}

.top-nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.language-switcher {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
}

.language-choice {
  min-width: 36px;
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: 700 12px 'Outfit', system-ui, sans-serif;
  cursor: pointer;
}

.language-choice:hover,
.language-choice.active {
  background: var(--accent-gradient);
  color: #fff;
}

main {
  width: min(920px, calc(100% - 48px));
  margin: 0 auto;
  padding: 60px 0 100px;
}

.hero {
  margin-bottom: 50px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeUp 0.8s ease backwards;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h1 {
  max-width: 820px;
  margin-bottom: 24px;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.1;
  letter-spacing: -1.5px;
  font-weight: 800;
  background: linear-gradient(to right, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  margin-bottom: 16px;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.5px;
  font-weight: 700;
}

h3 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 600;
}

.lead {
  max-width: 680px;
  margin-bottom: 40px;
  font-size: 20px;
  color: var(--text-muted);
}

.base-url {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 32px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.base-url:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(31, 38, 135, 0.08);
}

.base-url span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.base-url code {
  color: var(--accent);
  font-size: 20px;
  font-weight: 600;
  background: none;
  padding: 0;
  border: none;
}

/* Sections */
.section {
  margin-top: 40px;
  padding: 48px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  animation: fadeUp 0.8s ease backwards;
}

.section:hover {
  box-shadow: 0 12px 40px rgba(31, 38, 135, 0.08);
}

.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.2s; }
.section:nth-child(4) { animation-delay: 0.3s; }
.section:nth-child(5) { animation-delay: 0.4s; }
.section:nth-child(6) { animation-delay: 0.5s; }

.section-copy {
  max-width: 720px;
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 24px;
}

/* Notes */
.note {
  margin: 16px 0 24px;
  padding: 16px 20px;
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  color: var(--text-main);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 15px;
  font-weight: 500;
}

/* Steps */
.steps {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.steps::before {
  content: '';
  position: absolute;
  top: 44px;
  bottom: 44px;
  left: 44px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--accent), rgba(217, 119, 6, 0.18));
}

.steps article {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  min-width: 0;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(217, 119, 6, 0.04));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.steps article:hover {
  transform: translateX(4px);
  background: var(--accent-light);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.1);
}

@media (prefers-color-scheme: dark) {
  .steps article { background: rgba(0, 0, 0, 0.2); }
  .steps article:hover { background: var(--accent-light); border-color: var(--accent); }
}

.steps article > span {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
  border: 4px solid var(--panel-bg);
}

.steps article > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.steps article pre {
  margin-top: 12px;
}

.steps p {
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Endpoints */
.endpoint-list {
  display: grid;
  gap: 12px;
}

.endpoint-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

@media (prefers-color-scheme: dark) {
  .endpoint-list article { background: rgba(0, 0, 0, 0.2); }
}

.endpoint-list article:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.endpoint-list strong {
  grid-column: 1;
  color: var(--text-main);
  font-size: 17px;
  font-weight: 600;
}

.endpoint-list small {
  grid-column: 1;
  color: var(--text-muted);
  font-size: 14px;
}

/* Code & Pre */
pre {
  position: relative;
  margin: 16px 0 0;
  padding: 20px;
  overflow: auto;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

code {
  font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
}

p code,
td code,
small code,
.steps code,
.endpoint-list code {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.9em;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.endpoint-list code {
  grid-column: 1;
  min-width: 0;
  color: var(--code-accent);
}

.copy-curl {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  justify-self: end;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  font: 700 12px 'Outfit', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.copy-curl:hover {
  border-color: var(--accent);
  background: var(--accent-gradient);
  color: #fff;
}

/* Tabs */
.language-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 32px 0 24px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 20px;
}

.language-tab {
  min-height: 42px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 0 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

@media (prefers-color-scheme: dark) {
  .language-tab { background: rgba(0, 0, 0, 0.2); }
}

.language-tab:hover {
  border-color: var(--accent);
  color: var(--text-main);
  background: var(--accent-light);
}

.language-tab.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

/* Copy Button */
.copy-code {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.copy-code:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.copy-code:active {
  transform: scale(0.95);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--panel-border);
  text-align: left;
}

th {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  th { background: rgba(0, 0, 0, 0.2); }
}

tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

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

/* Media Queries */
@media (max-width: 768px) {
  .site-header {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  main {
    padding: 40px 0 80px;
    width: calc(100% - 32px);
  }

  .hero {
    text-align: left;
    align-items: flex-start;
  }

  h1 {
    font-size: 40px;
  }

  .section {
    padding: 32px 24px;
    margin-top: 24px;
  }

  .steps::before {
    top: 40px;
    bottom: 40px;
    left: 38px;
  }

  .steps article {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    padding: 18px 16px;
  }

  .steps article > span {
    width: 44px;
    height: 44px;
  }
}

/* Hierarchy Section */
.hierarchy-diagram {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  overflow: visible;
  padding: 4px 0 8px;
}
.h-node {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 138px;
  padding: 18px 12px;
  background: linear-gradient(145deg, var(--panel-bg), var(--accent-light));
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.08);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.h-node:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 26px rgba(217, 119, 6, 0.16);
}
.h-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--panel-bg);
  font-size: 23px;
  line-height: 1;
}
.h-text strong {
  display: block;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-main);
}
.h-text small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}
.h-arrow {
  position: relative;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 0;
}
.h-arrow::before {
  content: '';
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.55;
}
.h-arrow::after {
  content: '›';
  position: absolute;
  right: -1px;
  padding-bottom: 2px;
  background: var(--panel-bg);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
@media (max-width: 768px) {
  .hierarchy-diagram {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding-top: 4px;
  }
  .h-node {
    flex: none;
    min-height: 88px;
    padding: 14px 16px;
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
  }
  .h-icon {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
  .h-text small {
    margin-top: 3px;
  }
  .h-arrow {
    flex: 0 0 20px;
    width: 24px;
    margin-left: 25px;
  }
  .h-arrow::before {
    width: 2px;
    height: 100%;
  }
  .h-arrow::after {
    right: auto;
    bottom: -3px;
    transform: rotate(90deg);
  }
}

/* Demo Section */
.demo-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
  align-items: stretch;
  min-width: 0;
}
@media (max-width: 768px) {
  .demo-card {
    grid-template-columns: minmax(0, 1fr);
  }
}
.demo-form {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 24px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
  min-width: 0;
}
.form-group {
  min-width: 0;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}
.demo-select {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--bg-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  min-height: 46px;
}
.demo-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--accent-light);
  color: var(--accent);
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 700;
  min-height: 46px;
}
.demo-input::placeholder {
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 400;
}
.demo-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.demo-code-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.demo-code-preview pre {
  flex: 1;
  min-height: 240px;
  max-height: 520px;
  min-width: 0;
  margin-top: 0;
}
.preview-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  color: var(--accent);
  margin-bottom: 8px;
  font-family: 'SF Mono', monospace;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .demo-code-preview pre {
    min-height: 200px;
    max-height: 360px;
  }
}
