/*
  GRAPHQL DEMO (projects/2026/live-graphql-countries.md, js/graphql.js)
  The country explorer: the choices, the country card drawn from the answer, and the
  query/answer/REST inspector under "Behind the scenes". The field checkboxes reuse dg-check
  from diagrams.css, which the page also loads.
*/

.gql-app {
  display: grid;
  gap: 1.75rem;
  padding: clamp(1.25rem, 3vw, 2rem);
}
@media (min-width: 860px) {
  .gql-app { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; gap: 2.5rem; }
}

/* ---- The country card ---- */
.gql-card {
  position: relative;
  min-height: 16rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border-radius: 20px;
  background: var(--navy);
  color: #fff;
  overflow: hidden;
  transition: opacity 0.25s ease;
}
.gql-card::after {
  content: "";
  position: absolute;
  right: -4rem;
  bottom: -5rem;
  width: 14rem;
  height: 14rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--primary-color-rgb), 0.35), transparent 70%);
  pointer-events: none;
}
.gql-card[aria-busy="true"] { opacity: 0.6; }
.gql-card-kicker {
  margin: 0;
  color: rgb(255 255 255 / 0.65);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.gql-card-head { display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0 1.25rem; }
.gql-flag { font-size: 2.6rem; line-height: 1; }
.gql-name { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; color: #fff; }
.gql-facts { position: relative; z-index: 1; display: grid; gap: 0.6rem; margin: 0; }
@media (min-width: 480px) { .gql-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gql-facts > div {
  padding: 0.65rem 0.85rem;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 12px;
  background: rgb(255 255 255 / 0.06);
}
.gql-facts dt { color: rgb(255 255 255 / 0.65); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.gql-facts dd { margin: 0.15rem 0 0; color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.gql-empty { margin: 0; color: rgb(255 255 255 / 0.75); }
.gql-error {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 14px;
  background: var(--card-solid);
  color: var(--font-color);
}
.gql-noscript { margin: 0; font-size: 0.9rem; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .gql-card.is-new .gql-card-head, .gql-card.is-new .gql-facts > div { animation: gql-rise 0.35s ease both; }
  .gql-card.is-new .gql-facts > div:nth-child(2) { animation-delay: 0.05s; }
  .gql-card.is-new .gql-facts > div:nth-child(3) { animation-delay: 0.1s; }
  .gql-card.is-new .gql-facts > div:nth-child(4) { animation-delay: 0.15s; }
  .gql-card.is-new .gql-facts > div:nth-child(5) { animation-delay: 0.2s; }
  .gql-card.is-new .gql-facts > div:nth-child(6) { animation-delay: 0.25s; }
}
@keyframes gql-rise { from { opacity: 0; transform: translateY(8px); } }

/* ---- Behind the scenes ---- */
.gql-endpoint { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1rem 0 0; font-size: 0.8rem; }
.gql-endpoint code { color: var(--title-color); overflow-wrap: anywhere; }
.gql-code {
  margin: 0.75rem 0 0;
  max-height: 340px;
  overflow: auto;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--image-border-color);
  border-radius: 12px;
  background: var(--card-solid);
  color: var(--title-color);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.gql-status { margin: 1rem 0 0; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.gql-status.is-ok { color: var(--text-link); }
.gql-status.is-bad { color: var(--error); }

.gql-rest { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.gql-rest li {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.75rem;
  border-left: 4px solid var(--navy);
  border-radius: 10px;
  background: var(--card-solid);
  font-size: 0.8rem;
}
:root:not([data-theme="light"]) .gql-rest li { border-left-color: #7b7bd6; }
.gql-rest code { color: var(--title-color); font-weight: 700; overflow-wrap: anywhere; }
.gql-rest span { color: var(--muted); }
.gql-rest-sum { margin: 0.75rem 0 0; font-size: 0.875rem; font-weight: 700; color: var(--title-color); }
