/* Single question page (templates/single-lwn-question.html) */

.lwn-q-page {
  --lwn-q-navy: var(--wp--preset--color--primary-color);
  --lwn-q-coral: var(--wp--preset--color--secondary-color);
  --lwn-q-green: var(--wp--preset--color--success);
  --lwn-q-text: var(--wp--preset--color--gray-darker);
  --lwn-q-muted: var(--wp--preset--color--gray-light);
  --lwn-q-line: #e4e7ec;
  --lwn-q-soft: var(--wp--preset--color--ghost-white);
  color: var(--lwn-q-text);
  padding-bottom: 64px;
}

.lwn-q-page > * {
  padding-inline: 16px;
}

/* Head: kicker, topic chips, title */
.lwn-q-head {
  background: var(--lwn-q-soft);
  border-bottom: 1px solid var(--lwn-q-line);
  padding-block: 40px 32px;
}

.lwn-q-head__meta {
  gap: 8px;
  align-items: center;
}

.lwn-q-head__kicker {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.lwn-q-head__kicker a {
  color: var(--lwn-q-coral);
  text-decoration: none;
}

.lwn-q-head__kicker::after {
  content: "·";
  margin-inline-start: 8px;
  color: var(--lwn-q-muted);
}

.lwn-q-head__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  font-size: 13px;
}

.lwn-q-head__topics a {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--lwn-q-line);
  color: var(--lwn-q-muted);
  text-decoration: none;
}

.lwn-q-head__topics a:hover {
  color: var(--lwn-q-navy);
  border-color: var(--lwn-q-navy);
}

.lwn-q-head__title {
  margin-block: 16px 0;
  color: var(--lwn-q-navy);
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 700;
  line-height: 1.5;
}

/* Body */
.lwn-q-body {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-top: 32px;
}

.lwn-q-body > * {
  width: 100%;
  margin-block: 0 !important;
}

/* The question text. Old questions carry an empty heading, an empty
   paragraph and the options list inside their content; hide those. */
.lwn-q-body__content {
  font-size: 18px;
  line-height: 1.9;
}

.lwn-q-body__content:not(:has(:not(:empty):not(.wp-block-group):not(.wp-block-learnwithnaw-lwn-quiz-question-desc))) {
  display: none;
}

.lwn-q-body__content h2:empty,
.lwn-q-body__content p:empty,
.lwn-q-body__content .is-lwn-question-possible-answers {
  display: none;
}

.lwn-q-body__content pre,
.lwn-q-body__content .wp-block-kevinbatdorf-code-block-pro {
  direction: ltr;
  border-radius: 10px;
  overflow: hidden;
}

/* Answer card */
.lwn-q-answer {
  border: 1px solid var(--lwn-q-line);
  border-inline-start: 4px solid var(--lwn-q-green);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(16 24 40 / 5%);
  overflow: hidden;
}

.lwn-q-answer__label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 20px 24px 0;
  color: #067647;
  font-size: 14px;
  font-weight: 700;
}

.lwn-q-answer__check {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--lwn-q-green);
  color: #fff;
  font-size: 13px;
  line-height: 1;
}

.lwn-q-answer__text {
  margin: 8px 0 0;
  padding: 0 24px 20px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--lwn-q-navy);
}

.lwn-q-answer__explain {
  padding: 20px 24px 24px;
  background: var(--lwn-q-soft);
  border-top: 1px solid var(--lwn-q-line);
}

.lwn-q-answer__explain:first-child {
  border-top: 0;
}

.lwn-q-answer__explain-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--lwn-q-navy);
}

.lwn-q-answer__explain p {
  margin: 0;
  font-size: 17px;
  line-height: 1.9;
}

/* Related questions */
.lwn-q-related__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--lwn-q-navy);
}

.lwn-q-related__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--lwn-q-line);
}

.lwn-q-related__list li {
  border-bottom: 1px solid var(--lwn-q-line);
}

.lwn-q-related__list a {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px;
  color: var(--lwn-q-text);
  text-decoration: none;
  line-height: 1.6;
}

.lwn-q-related__list a::after {
  content: "←";
  color: var(--lwn-q-coral);
  flex-shrink: 0;
}

.lwn-q-related__list a:hover {
  color: var(--lwn-q-coral);
}

/* Quiz call to action */
.lwn-q-cta {
  gap: 16px;
  padding: 24px;
  border-radius: 12px;
  background: var(--lwn-q-navy);
  color: #fff;
}

.lwn-q-cta__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.lwn-q-cta__desc {
  margin: 4px 0 0;
  font-size: 15px;
  opacity: 0.8;
}

@media (max-width: 600px) {
  .lwn-q-head {
    padding-block: 28px 24px;
  }

  .lwn-q-answer__label,
  .lwn-q-answer__text,
  .lwn-q-answer__explain {
    padding-inline: 16px;
  }

  .lwn-q-answer__text {
    font-size: 19px;
  }

  .lwn-q-cta .wp-block-buttons,
  .lwn-q-cta .wp-block-button,
  .lwn-q-cta .wp-block-button__link {
    width: 100%;
  }
}

/* Code in rewritten question pages: plain <pre><code class="language-x">, until a highlighter is added */
.lwn-q-body__content pre {
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  margin: 16px 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: #1f2732;
  color: #e6edf3;
  font-size: 14px;
  line-height: 1.7;
}

.lwn-q-body__content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.lwn-q-body__content :not(pre) > code {
  direction: ltr;
  unicode-bidi: isolate;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--lwn-q-soft);
  color: var(--lwn-q-navy);
  font-size: 0.9em;
}

.lwn-q-body__content h2 {
  margin: 28px 0 8px;
  font-size: 1.25rem;
  color: var(--lwn-q-navy);
}
