/* ============================================
   Gather API Docs — Styles
   Tutorial-first, developer & AI-agent focused
   ============================================ */

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

:root {
  --bg: #121212;
  --bg-secondary: #1E1E1E;
  --bg-tertiary: #2C2C2C;
  --border: #3A3A3A;
  --text: #FFFFFF;
  --text-muted: #B0B0B0;
  --text-dim: #757575;
  --accent: #8E2DE2;
  --accent-light: #A567F4;
  --accent-gradient: linear-gradient(135deg, #A567F4, #DD2A7B);
  --blue: #42A5F5;
  --green: #66BB6A;
  --yellow: #EAB308;
  --red: #FF6B6B;
  --code-bg: #121212;
  --sidebar-width: 240px;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
  padding-bottom: 40px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.logo {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
}

.nav-list {
  list-style: none;
  padding: 0 8px;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 16px 10px 4px;
}

.nav-link {
  display: block;
  padding: 6px 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

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

.nav-link.active {
  color: var(--accent-light);
  background: rgba(142, 45, 226, 0.1);
}

/* ============================================
   Content
   ============================================ */
.content {
  margin-left: var(--sidebar-width);
  max-width: 780px;
  padding: 48px 48px 120px;
}

section {
  padding-top: 8px;
  margin-bottom: 56px;
}

/* ============================================
   Typography
   ============================================ */
h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 10px;
}

h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

p {
  color: var(--text-muted);
  margin-bottom: 14px;
  font-size: 15px;
}

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

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-light);
}

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

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.7;
  margin-bottom: 32px;
}

.step-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 0;
}

/* ============================================
   Hero — "What you'll build"
   ============================================ */
.hero-what-you-build {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.hero-what-you-build h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.build-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.build-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}

.build-icon {
  font-size: 28px;
}

.build-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.build-arrow {
  color: var(--text-dim);
  font-size: 20px;
  padding: 0 4px;
  margin-bottom: 20px;
}

/* ============================================
   Model Diagram (How it works)
   ============================================ */
.model-diagram {
  margin: 20px 0 24px;
}

.model-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
}

.model-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--accent-light);
}

.model-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.model-connector {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0;
  font-weight: 600;
}

/* ============================================
   Key Info (Auth section)
   ============================================ */
.key-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.key-item {
  display: flex;
  background: var(--bg-secondary);
  padding: 12px 16px;
  font-size: 14px;
}

.key-label {
  min-width: 80px;
  font-weight: 600;
  color: var(--text);
}

.key-value {
  color: var(--text-muted);
}

/* ============================================
   Tutorial Banner
   ============================================ */
.tutorial-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  margin: 48px 0 24px;
  border-top: 2px solid var(--accent);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.tutorial-badge {
  background: var(--accent-gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 4px;
}

/* ============================================
   Step Headers
   ============================================ */
.step-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.step-header h2 {
  margin-bottom: 4px;
  border-bottom: none;
  padding-bottom: 0;
}

.step-number-lg {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  margin-top: 2px;
}

/* ============================================
   Code Blocks
   ============================================ */
.code-block {
  margin-bottom: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}

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

.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

.code-block pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  background: var(--code-bg);
}

.code-block pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ============================================
   Response Preview
   ============================================ */
.response-preview {
  margin-bottom: 20px;
  border-radius: 8px;
  border: 1px solid rgba(102, 187, 106, 0.25);
  overflow: hidden;
}

.response-label {
  padding: 6px 14px;
  background: rgba(102, 187, 106, 0.08);
  border-bottom: 1px solid rgba(102, 187, 106, 0.25);
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.response-preview pre {
  margin: 0;
  padding: 14px;
  background: var(--code-bg);
}

.response-preview pre code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  background: none;
  padding: 0;
}

/* ============================================
   Field Guide
   ============================================ */
.field-guide {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.field-guide h4 {
  margin-bottom: 12px;
  color: var(--text);
}

.field-row {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  align-items: baseline;
}

.field-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.field-row code {
  min-width: 100px;
  font-size: 12px;
}

.field-row span {
  color: var(--text-muted);
}

/* ============================================
   Simple List
   ============================================ */
.simple-list {
  list-style: none;
  margin-bottom: 16px;
  padding-left: 0;
}

.simple-list li {
  padding: 4px 0 4px 20px;
  position: relative;
  font-size: 14px;
  color: var(--text-muted);
}

.simple-list li::before {
  content: '•';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}

/* ============================================
   Callouts
   ============================================ */
.callout {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
  border-left: 3px solid;
}

.callout strong {
  display: block;
  margin-bottom: 2px;
}

.callout-info {
  background: rgba(66, 165, 245, 0.06);
  border-color: var(--blue);
  color: var(--text-muted);
}

.callout-info strong { color: var(--blue); }

.callout-warning {
  background: rgba(234, 179, 8, 0.06);
  border-color: var(--yellow);
  color: var(--text-muted);
}

.callout-warning strong { color: var(--yellow); }

.callout-tip {
  background: rgba(102, 187, 106, 0.06);
  border-color: var(--green);
  color: var(--text-muted);
}

.callout-tip strong { color: var(--green); }

/* ============================================
   Success Box
   ============================================ */
.success-box {
  display: flex;
  gap: 14px;
  padding: 20px;
  background: rgba(102, 187, 106, 0.06);
  border: 1px solid rgba(102, 187, 106, 0.2);
  border-radius: 10px;
  margin-bottom: 24px;
}

.success-icon {
  font-size: 28px;
  line-height: 1;
}

.success-box strong {
  font-size: 16px;
  display: block;
  margin-bottom: 4px;
}

.success-box p {
  font-size: 14px;
  margin-bottom: 0;
}

/* ============================================
   Recap Table
   ============================================ */
.recap {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.recap h4 {
  margin-bottom: 12px;
}

.recap p {
  margin-top: 12px;
  margin-bottom: 0;
  font-size: 14px;
}

/* ============================================
   Section Divider
   ============================================ */
.section-divider {
  margin: 56px 0 32px;
  border-top: 2px solid var(--border);
  padding-top: 8px;
}

.section-divider span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* ============================================
   Expandable Details
   ============================================ */
.detail-expand {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.detail-expand summary {
  padding: 10px 14px;
  background: var(--bg-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
}

.detail-expand summary::-webkit-details-marker {
  display: none;
}

.detail-expand summary::before {
  content: '+ ';
  color: var(--accent);
}

.detail-expand[open] summary::before {
  content: '- ';
}

.detail-expand[open] summary {
  border-bottom: 1px solid var(--border);
}

.detail-expand table {
  margin-bottom: 0;
}

/* ============================================
   Action Grid
   ============================================ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.action-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  transition: border-color 0.15s;
}

.action-card:hover {
  border-color: var(--accent);
}

.action-card h4 {
  font-size: 13px;
  margin-bottom: 2px;
}

.action-card p {
  font-size: 12px;
  margin-bottom: 8px;
  color: var(--text-dim);
}

.action-card code {
  font-size: 11px;
  display: block;
}

/* ============================================
   Rarity List
   ============================================ */
.rarity-list {
  margin-bottom: 24px;
}

.rarity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.rarity-item:last-child {
  border-bottom: none;
}

.rarity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  min-width: 10px;
}

.rarity-common .rarity-dot { background: #757575; }
.rarity-uncommon .rarity-dot { background: var(--green); }
.rarity-rare .rarity-dot { background: var(--blue); }
.rarity-epic .rarity-dot { background: var(--accent); }
.rarity-legendary .rarity-dot { background: var(--yellow); }

.rarity-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  min-width: 110px;
}

.rarity-common .rarity-name { color: #757575; }
.rarity-uncommon .rarity-name { color: var(--green); }
.rarity-rare .rarity-name { color: var(--blue); }
.rarity-epic .rarity-name { color: var(--accent); }
.rarity-legendary .rarity-name { color: var(--yellow); }

.rarity-desc {
  color: var(--text-muted);
}

/* ============================================
   Finish Grid
   ============================================ */
.finish-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.finish-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

.finish-tag.holo {
  border-color: rgba(142, 45, 226, 0.3);
  color: var(--accent-light);
}

/* ============================================
   Template Grid
   ============================================ */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.template-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 14px 14px;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.template-card:hover {
  border-color: var(--accent);
}

.template-preview {
  width: 140px;
  height: 196px;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

.template-preview svg {
  width: 100%;
  height: 100%;
}

.template-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 2px;
  text-align: center;
}

.template-desc {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================
   Rate Limits
   ============================================ */
.limits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.limit-card {
  text-align: center;
  padding: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.limit-card.premium {
  border-color: rgba(142, 45, 226, 0.3);
}

.limit-tier {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.limit-card.premium .limit-tier {
  color: var(--accent);
}

.limit-value {
  font-size: 40px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.limit-unit {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================
   Tables
   ============================================ */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
}

thead {
  border-bottom: 2px solid var(--border);
}

th {
  text-align: left;
  padding: 8px 14px;
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 8px 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td code {
  font-size: 12px;
}

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

/* ============================================
   Footer
   ============================================ */
footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
}

/* ============================================
   Mobile
   ============================================ */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mobile-nav-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .content {
    margin-left: 0;
    padding: 64px 20px 80px;
  }

  .build-steps {
    gap: 2px;
  }

  .build-step {
    min-width: 60px;
  }

  .build-icon {
    font-size: 22px;
  }

  .build-arrow {
    font-size: 16px;
  }

  .action-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .template-preview {
    width: 120px;
    height: 168px;
  }

  .limits-grid {
    grid-template-columns: 1fr 1fr;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 500px) {
  .content {
    padding: 64px 14px 60px;
  }

  .build-steps {
    flex-wrap: wrap;
    justify-content: center;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }

  .template-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .template-preview {
    width: 100px;
    height: 140px;
  }

  .step-header {
    gap: 12px;
  }

  .step-number-lg {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 16px;
  }

  .code-block pre {
    padding: 10px;
  }

  .code-block pre code {
    font-size: 11.5px;
  }
}
