/*
 * LL Docs — Scribe-style rendering for Outline guides.
 *
 * Structure this relies on (produced by the LL Docs recorder and the Scribe importer):
 *   h2  = section divider
 *   h3  = one step; its text is the instruction only
 *   p   = the step's screenshot, immediately after its h3
 *
 * Step numbers come from a CSS counter rather than the document text, so
 * reordering or inserting a step can never leave a stale number behind.
 *
 * Colours are mixed from currentColor wherever possible so the cards work in
 * both of Outline's themes without knowing which one is active.
 */

:root {
  --ll-blue: #3487c7;
  --ll-blue-deep: #04476f;
  --ll-radius: 14px;
}

.ProseMirror {
  counter-reset: ll-step;
}

/* ---------- Step card ---------- */

.ProseMirror h3.heading-content {
  counter-increment: ll-step;
  position: relative;
  margin: 20px 0 0;
  padding: 18px 20px 16px 64px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  border-bottom: none;
  border-radius: var(--ll-radius) var(--ll-radius) 0 0;
  background: color-mix(in srgb, currentColor 2.5%, transparent);
}

/* A step with no screenshot is a card on its own. */
.ProseMirror h3.heading-content:not(:has(+ p)) {
  border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  border-radius: var(--ll-radius);
  margin-bottom: 4px;
}

/*
 * The numbered circle.
 *
 * Outline already uses ::before on headings for its own level badge ("H3"),
 * injected at runtime so it lands after this stylesheet in the cascade. Every
 * declaration here has to win outright, hence !important.
 */
.ProseMirror h3.heading-content::before {
  content: counter(ll-step) !important;
  position: absolute !important;
  left: 18px !important;
  top: 15px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--ll-blue) 18%, transparent) !important;
  color: var(--ll-blue-deep) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums;
  opacity: 1 !important;
}

/* Steps that navigate somewhere get a link glyph, driven by the link in the text. */
.ProseMirror h3.heading-content:has(a[href^="http"])::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 7px;
  vertical-align: -2px;
  opacity: 0.5;
  background-color: currentColor;
  -webkit-mask: var(--ll-link-icon) center / contain no-repeat;
  mask: var(--ll-link-icon) center / contain no-repeat;
}

:root {
  --ll-link-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E");
}

/* The per-heading anchor button would collide with the number. */
.ProseMirror h3.heading-content .heading-anchor {
  display: none;
}

/* ---------- Screenshot: the bottom half of the card ---------- */

.ProseMirror h3.heading-content + p {
  margin: 0 0 4px;
  padding: 0 20px 20px;
  border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  border-top: none;
  border-radius: 0 0 var(--ll-radius) var(--ll-radius);
  background: color-mix(in srgb, currentColor 2.5%, transparent);
}

.ProseMirror h3.heading-content + p .component-image img,
.ProseMirror h3.heading-content + p img {
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

/* ---------- Section divider ---------- */

.ProseMirror h2.heading-content {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 36px 0 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0.7;
}

.ProseMirror h2.heading-content::before,
.ProseMirror h2.heading-content::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.22;
}

/* ---------- Intro meta line ---------- */

.ProseMirror > p > em:only-child {
  font-style: normal;
  font-size: 13px;
  opacity: 0.6;
}

/* Outline's dark theme is applied at runtime rather than through a class we can
 * see, so the number only adapts when the OS itself is dark. Everything else is
 * mixed from currentColor and works either way. */
@media (prefers-color-scheme: dark) {
  :root {
    --ll-blue-deep: #9ecbee;
  }
}

/* ---------- Outline's own badge ---------- */

a[href*="getoutline.com"] {
  display: none !important;
}
