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

:root {
  --bg: #1e1e2e;
  --bg-block: #181825;
  --bg-block-alt: #1e1e2e;
  --text: #cdd6f4;
  --text-muted: #6c7086;
  --border: #313244;
  --key: #89b4fa;
  --string: #a6e3a1;
  --number: #fab387;
  --boolean: #f38ba8;
  --null: #6c7086;
  --bracket: #cdd6f4;
  --http-method: #f38ba8;
  --http-path: #a6e3a1;
  --http-version: #6c7086;
  --http-status: #a6e3a1;
  --http-header-key: #89b4fa;
  --http-header-value: #cdd6f4;
  --label-bg: #313244;
  --label-text: #a6adc8;
  --line-number: #45475a;
  --link: #89dceb;
  --copy-bg: #313244;
  --copy-hover: #45475a;
}

[data-theme="light"] {
  --bg: #eff1f5;
  --bg-block: #e6e9ef;
  --bg-block-alt: #eff1f5;
  --text: #4c4f69;
  --text-muted: #8c8fa1;
  --border: #ccd0da;
  --key: #1e66f5;
  --string: #40a02b;
  --number: #fe640b;
  --boolean: #d20f39;
  --null: #8c8fa1;
  --bracket: #4c4f69;
  --http-method: #d20f39;
  --http-path: #40a02b;
  --http-version: #8c8fa1;
  --http-status: #40a02b;
  --http-header-key: #1e66f5;
  --http-header-value: #4c4f69;
  --label-bg: #ccd0da;
  --label-text: #5c5f77;
  --line-number: #9ca0b0;
  --link: #209fb5;
  --copy-bg: #ccd0da;
  --copy-hover: #bcc0cc;
}

html {
  font-size: 18px;
}

body {
  font-family: "JetBrains Mono", monospace;
  font-feature-settings: "liga" 1, "calt" 1;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 2rem;
}

.theme-toggle {
  font-family: inherit;
  font-size: 0.8rem;
  background: var(--label-bg);
  color: var(--label-text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  background: var(--copy-hover);
}

.block-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--label-text);
  background: var(--label-bg);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}

.endpoint-section {
  margin-bottom: 3rem;
}

.endpoint-section:last-child {
  margin-bottom: 1.5rem;
}

.request-block,
.response-block,
.json-block {
  margin-bottom: 1rem;
}

.request-block pre,
.response-block pre {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.95rem;
  line-height: 1.8;
  transition: background 0.3s, border-color 0.3s;
}

.http-method { color: var(--http-method); font-weight: 700; }
.http-path { color: var(--http-path); }
.http-version { color: var(--http-version); }
.http-status { color: var(--http-status); font-weight: 700; }
.http-header-key { color: var(--http-header-key); }
.http-header-value { color: var(--http-header-value); }

.json-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.copy-btn {
  font-family: inherit;
  font-size: 0.75rem;
  background: var(--copy-bg);
  color: var(--label-text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.15rem 0.6rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.copy-btn:hover {
  background: var(--copy-hover);
}

.json-container {
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  transition: background 0.3s, border-color 0.3s;
}

.json-container pre {
  margin: 0;
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  line-height: 1.8;
  counter-reset: line;
}

.json-container code {
  display: block;
}

.json-line {
  display: block;
}

.json-line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 2.5em;
  margin-right: 1.25em;
  text-align: right;
  color: var(--line-number);
  user-select: none;
  -webkit-user-select: none;
}

.json-key { color: var(--key); }
.json-string { color: var(--string); }
.json-number { color: var(--number); }
.json-boolean { color: var(--boolean); }
.json-null { color: var(--null); }
.json-bracket { color: var(--bracket); }
.json-punctuation { color: var(--text-muted); }

.json-link {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.json-link:hover {
  border-bottom-color: var(--link);
}

/* Article cards */
.articles-block {
  margin-top: 1.5rem;
}

.article-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.article-card {
  display: flex;
  background: var(--bg-block);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s, border-color 0.2s;
}

.article-card:hover {
  border-color: var(--link);
}

.article-card-image {
  width: 140px;
  min-height: 100px;
  object-fit: cover;
  flex-shrink: 0;
}

.article-card-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.article-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-host {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: auto;
}

@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  .container {
    padding: 1.5rem 1rem;
  }

  .request-block pre,
  .response-block pre,
  .json-container pre {
    font-size: 0.85rem;
    padding: 1rem 1rem;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .json-line::before {
    width: 2em;
    margin-right: 0.75em;
  }

  .article-card-image {
    width: 120px;
    min-height: 90px;
  }
}
