/*
 * Shared article block styles for almcreate snippets.
 * SOURCE OF TRUTH: almdev/public/vendor/almcreate/article-blocks.css
 */

.prose-paper .article-callout,
.prose-paper .article-comment,
.prose-paper .code-panel,
.prose-paper .error-grid,
.prose-paper .article-figure,
.prose-paper .article-photo-gallery {
  margin-top: 1.15rem;
  margin-bottom: 1.15rem;
}

.prose-paper section > .article-callout,
.prose-paper section > .article-comment,
.prose-paper section > .code-panel,
.prose-paper section > .error-grid,
.prose-paper section > .article-figure,
.prose-paper section > .article-photo-gallery {
  margin-top: 1.15rem;
}

.prose-paper section > .article-callout:last-child,
.prose-paper section > .article-comment:last-child,
.prose-paper section > .code-panel:last-child,
.prose-paper section > .error-grid:last-child,
.prose-paper section > .article-figure:last-child,
.prose-paper section > .article-photo-gallery:last-child {
  margin-bottom: 0;
}

.article-figure {
  margin-left: 0;
  margin-right: 0;
  font-size: 1.075rem;
  line-height: 1.75;
}

.article-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-3, var(--paper-2));
  font-size: 1.075rem;
  line-height: 1.75;
}

.article-figure figcaption,
.code-panel figcaption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  line-height: 1.45;
  text-transform: uppercase;
  color: var(--muted);
}

.article-figure figcaption {
  margin-top: 0.65rem;
}

.article-callout,
.article-comment {
  --tone: #1e5c5a;
  border: 1px solid color-mix(in srgb, var(--tone) 34%, var(--rule));
  border-left: 3px solid var(--tone);
  background: color-mix(in srgb, var(--tone) 7%, var(--paper));
  border-radius: 8px;
  padding: 1rem 1.1rem;
  font-size: 1.075rem;
  line-height: 1.75;
}

.article-callout > * + *,
.article-comment > * + * {
  margin-top: 0.55rem;
}

.article-callout h3,
.article-comment h3 {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--tone);
}

.article-callout p,
.article-comment p {
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}

.article-callout--warning { --tone: #9a4f08; }
.article-callout--danger { --tone: #a33a2a; }
.article-callout--success { --tone: #2d754d; }
html.dark .article-callout--warning { --tone: #f2b173; }
html.dark .article-callout--danger { --tone: #f0a090; }
html.dark .article-callout--success { --tone: #87d8a7; }

.article-comment {
  --tone: var(--muted);
  background: var(--paper-2);
}

.code-panel {
  margin-left: 0;
  margin-right: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  background: var(--pre-bg);
  font-size: 1.075rem;
  line-height: 1.75;
}

.code-panel figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid color-mix(in srgb, var(--pre-fg) 16%, transparent);
  color: color-mix(in srgb, var(--pre-fg) 78%, var(--muted));
  background: color-mix(in srgb, var(--pre-bg) 84%, var(--paper-3, var(--paper-2)));
}

.code-panel pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0.9rem 1.1rem;
  background: var(--pre-bg);
  color: var(--pre-fg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.91375rem;
  line-height: 1.75;
}

.code-panel pre code {
  display: block;
  white-space: normal;
  padding: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

.prose-paper pre code .line,
.almdev-ckeditor .ck-content pre code .line,
.almblog-ckeditor .ck-content pre code .line,
.almnote-ckeditor .ck-content pre code .line {
  display: block;
  min-height: 1.45em;
  white-space: pre;
}

@media (max-width: 640px) {
  .prose-paper pre {
    font-size: 0.78em;
  }

  .prose-paper pre code .line,
  .almdev-ckeditor .ck-content pre code .line,
  .almblog-ckeditor .ck-content pre code .line,
  .almnote-ckeditor .ck-content pre code .line {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

.prose-paper pre code .line-mark,
.prose-paper pre code .line-warn,
.prose-paper pre code .line-error,
.almdev-ckeditor .ck-content pre code .line-mark,
.almdev-ckeditor .ck-content pre code .line-warn,
.almdev-ckeditor .ck-content pre code .line-error,
.almblog-ckeditor .ck-content pre code .line-mark,
.almblog-ckeditor .ck-content pre code .line-warn,
.almblog-ckeditor .ck-content pre code .line-error,
.almnote-ckeditor .ck-content pre code .line-mark,
.almnote-ckeditor .ck-content pre code .line-warn,
.almnote-ckeditor .ck-content pre code .line-error {
  margin: 0 -1.2em;
  padding: 0 1.2em;
  border-left: 3px solid var(--line-tone);
  background: color-mix(in srgb, var(--line-tone) 18%, transparent);
}

.prose-paper pre code .line-mark,
.almdev-ckeditor .ck-content pre code .line-mark,
.almblog-ckeditor .ck-content pre code .line-mark,
.almnote-ckeditor .ck-content pre code .line-mark { --line-tone: #1e5c5a; }
.prose-paper pre code .line-warn,
.almdev-ckeditor .ck-content pre code .line-warn,
.almblog-ckeditor .ck-content pre code .line-warn,
.almnote-ckeditor .ck-content pre code .line-warn { --line-tone: #f2b173; }
.prose-paper pre code .line-error,
.almdev-ckeditor .ck-content pre code .line-error,
.almblog-ckeditor .ck-content pre code .line-error,
.almnote-ckeditor .ck-content pre code .line-error { --line-tone: #f0a090; }

.error-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 0.5rem);
  font-size: 1.075rem;
  line-height: 1.75;
}

.error-card {
  --tone: #1e5c5a;
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 0.85rem 1.25rem;
  align-items: start;
  border: 1px solid color-mix(in srgb, var(--tone) 28%, var(--rule));
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone) 5%, var(--paper));
  padding: 0.95rem 1rem;
  font-size: 1.075rem;
  line-height: 1.75;
}

.error-card .error-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.35;
  color: var(--tone);
  word-break: break-word;
}

.error-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
}

@media (max-width: 640px) {
  .error-card {
    grid-template-columns: 1fr;
  }
}

.error-card--warning { --tone: #9a4f08; }
.error-card--danger { --tone: #a33a2a; }
.error-card--success { --tone: #2d754d; }
html.dark .error-card--warning { --tone: #f2b173; }
html.dark .error-card--danger { --tone: #f0a090; }
html.dark .error-card--success { --tone: #87d8a7; }

.article-photo-gallery {
  margin-left: 0;
  margin-right: 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1rem 1.05rem 1.1rem;
  background: color-mix(in srgb, var(--paper-2) 88%, var(--paper));
  font-size: 1.075rem;
  line-height: 1.75;
}

.article-photo-gallery__head {
  margin-bottom: 0.85rem;
}

.article-photo-gallery__title {
  margin: 0;
  font-family: 'Lora', Georgia, serif;
  font-weight: 400;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: 0;
}

.prose-paper .article-photo-gallery__title {
  margin: 0;
  font-family: 'Lora', Georgia, serif;
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: 0;
}

.article-photo-gallery__lede {
  margin: 0.45rem 0 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}

.prose-paper .article-photo-gallery__lede {
  margin: 0.45rem 0 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}

.article-photo-gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.65rem;
  margin-top: 0;
}

.prose-paper .article-photo-gallery__grid {
  margin-top: 0;
}

.article-photo-gallery__cell {
  margin: 0;
}

.article-photo-gallery__cell img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-3, var(--paper-2));
}

.article-photo-gallery__empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .article-photo-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.almdev-ckeditor .ck-content .article-figure,
.almblog-ckeditor .ck-content .article-figure,
.almnote-ckeditor .ck-content .article-figure,
.almdev-ckeditor .ck-content .code-panel,
.almblog-ckeditor .ck-content .code-panel,
.almnote-ckeditor .ck-content .code-panel,
.almdev-ckeditor .ck-content .article-callout,
.almblog-ckeditor .ck-content .article-callout,
.almnote-ckeditor .ck-content .article-callout,
.almdev-ckeditor .ck-content .article-comment,
.almblog-ckeditor .ck-content .article-comment,
.almnote-ckeditor .ck-content .article-comment,
.almdev-ckeditor .ck-content .error-grid,
.almblog-ckeditor .ck-content .error-grid,
.almnote-ckeditor .ck-content .error-grid,
.almdev-ckeditor .ck-content .article-photo-gallery,
.almblog-ckeditor .ck-content .article-photo-gallery,
.almnote-ckeditor .ck-content .article-photo-gallery {
  margin-top: 1.15rem;
  margin-bottom: 1.15rem;
}
