:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dde7;
  --brand: #0f766e;
  --brand-2: #b45309;
  --accent: #365b9b;
  --shadow: 0 20px 60px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 249, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-size: 15px;
}

.language {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.language button,
.tool-button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.language button {
  width: 44px;
}

.language button.is-active,
.tool-button {
  background: var(--ink);
  color: #ffffff;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 42px clamp(16px, 4vw, 48px) 20px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(36px, 7vw, 88px);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero p {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  width: min(620px, 100%);
}

.stat {
  min-height: 80px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat strong {
  display: block;
  font-size: 24px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.presets,
.toolbar {
  display: grid;
  gap: 10px;
}

.presets {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  padding: 12px clamp(16px, 4vw, 48px) 0;
}

.toolbar {
  grid-template-columns: minmax(260px, 1.3fr) repeat(6, minmax(132px, 1fr)) auto;
  padding: 12px clamp(16px, 4vw, 48px);
  border-block: 1px solid var(--line);
  background: #eef1f5;
}

.field {
  min-width: 0;
}

.field input,
.field select,
.presets button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.presets button {
  cursor: pointer;
  font-weight: 720;
  color: var(--muted);
}

.presets button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 48px) 40px;
}

.list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.api-card {
  min-height: 186px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.api-card:hover,
.api-card:focus,
.api-card.is-selected {
  outline: 0;
  border-color: var(--brand);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.api-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.api-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.api-card__top span,
.details__head span {
  align-self: start;
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8f5f3;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.api-card p {
  min-height: 48px;
  margin: 14px 0;
  color: var(--muted);
  line-height: 1.45;
}

.api-card__meta,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.api-card__meta span,
.tags span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.details {
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 104px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.details__head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.group-label {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.details h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.details__actions {
  display: flex;
  gap: 8px;
  margin: 18px 0;
}

.details__actions a {
  min-height: 40px;
  padding: 10px 13px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-weight: 720;
}

.details__actions a + a {
  background: var(--brand);
}

.details__row {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.details__row h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.details__row p,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.empty,
.error {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

.error {
  margin: 18px clamp(16px, 4vw, 48px) 0;
  color: #9f1239;
}

.site-footer {
  padding: 0 clamp(16px, 4vw, 48px) 32px;
}

.site-footer p {
  max-width: 980px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .hero,
  .content {
    grid-template-columns: 1fr;
  }

  .presets,
  .toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .field:first-child {
    grid-column: 1 / -1;
  }

  .details {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
  }

  .hero {
    padding-top: 28px;
  }

  .stats,
  .presets,
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .field,
  .field:first-child,
  .tool-button {
    grid-column: 1 / -1;
  }

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