/**
 * Webtron Docs — Content Prose Styles
 *
 * Typography for the main content area: headings, paragraphs, lists,
 * blockquotes, tables, code blocks, images/figures, and heading anchors.
 * Inspired by Stripe / Tailwind prose styling.
 *
 * @package WebtronDocs
 * @since   3.0.0
 */

/* ==========================================================================
   Article wrapper
   ========================================================================== */

.docs-article {
  /* F3c (2026-06-02): the article fills the wide content column (NOT capped here — a
     capped parent would also constrain wide tables/code). Instead the flow TEXT elements
     are capped + left-aligned below, so body text stays a readable ~80ch measure while
     block-level wide content (code/tables/figures) uses the full column width. Stripe model. */
  max-width: none;
  font-size: var(--docs-text-base);
  line-height: var(--docs-leading-normal);
  color: var(--docs-text);
}

/* (Removed) The former F3c rule capped flow text to var(--content-max). It was unnecessary —
   the content reads better using the full column width — so the clamp on
   .docs-article-body > p/ul/ol/h1-6/blockquote/dl and .docs-article-header is gone. */

/* ==========================================================================
   Headings
   ========================================================================== */

.docs-article h1 {
  font-size: var(--docs-text-3xl);
  font-weight: 700;
  letter-spacing: var(--docs-tracking-tight);
  line-height: var(--docs-leading-tight);
  color: var(--docs-heading);
  margin: 0 0 var(--space-4);
}

.docs-article h2 {
  font-size: var(--docs-text-2xl);
  font-weight: 700;
  letter-spacing: var(--docs-tracking-tight);
  line-height: var(--docs-leading-tight);
  color: var(--docs-heading);
  margin: var(--space-8) 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--docs-border-subtle);
}

.docs-article h3 {
  font-size: var(--docs-text-xl);
  font-weight: 600;
  line-height: var(--docs-leading-snug);
  color: var(--docs-heading);
  margin: var(--space-8) 0 var(--space-2);
}

.docs-article h4 {
  font-size: var(--docs-text-lg);
  font-weight: 600;
  line-height: var(--docs-leading-snug);
  color: var(--docs-heading);
  margin: var(--space-8) 0 var(--space-2);
}

.docs-article h5,
.docs-article h6 {
  font-size: var(--docs-text-base);
  font-weight: 600;
  line-height: var(--docs-leading-snug);
  color: var(--docs-heading);
  margin: var(--space-6) 0 var(--space-2);
}

/* First heading after article start — no top margin */
.docs-article > h2:first-child,
.docs-article > h3:first-child,
.docs-article > h4:first-child {
  margin-top: 0;
}

/* ==========================================================================
   Heading anchor links (hover-reveal #)
   ========================================================================== */

.docs-article h2[id],
.docs-article h3[id],
.docs-article h4[id] {
  position: relative;
  scroll-margin-top: calc(var(--header-height) + var(--space-6));
}

.docs-heading-anchor {
  position: absolute;
  left: -1.25em;
  top: 0;
  color: var(--docs-text-muted);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
  padding-right: var(--space-2);
}

.docs-article h2:hover .docs-heading-anchor,
.docs-article h3:hover .docs-heading-anchor,
.docs-article h4:hover .docs-heading-anchor,
.docs-heading-anchor:focus-visible {
  opacity: 1;
}

/* ==========================================================================
   Paragraphs & inline
   ========================================================================== */

.docs-article p {
  margin: 0 0 var(--space-4);
}

.docs-article a {
  color: var(--docs-link);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: text-decoration-color var(--duration-fast) ease,
              color var(--duration-fast) ease;
}

.docs-article a:hover {
  color: var(--docs-link-hover);
  text-decoration-color: currentColor;
}

.docs-article strong {
  font-weight: 600;
  color: var(--docs-heading);
}

.docs-article em {
  font-style: italic;
}

.docs-article mark {
  background: rgba(250, 204, 21, 0.25);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Lists
   ========================================================================== */

.docs-article ul,
.docs-article ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-6);
}

.docs-article li {
  margin-bottom: var(--space-2);
  line-height: var(--docs-leading-normal);
}

.docs-article li > ul,
.docs-article li > ol {
  margin-top: var(--space-2);
  margin-bottom: 0;
}

/* Custom bullet styling */
.docs-article ul > li::marker {
  color: var(--docs-text-muted);
}

.docs-article ol > li::marker {
  color: var(--docs-text-secondary);
  font-weight: 500;
}

/* ==========================================================================
   Blockquotes
   ========================================================================== */

.docs-article blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  border-left: 3px solid var(--docs-primary);
  background: var(--docs-bg-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--docs-text-secondary);
  font-style: normal;
}

.docs-article blockquote p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Inline code
   ========================================================================== */

.docs-article code:not(pre code) {
  font-family: var(--docs-font-mono);
  font-size: 0.875em;
  padding: 2px 6px;
  background: var(--docs-bg-muted);
  border-radius: var(--radius-sm);
  color: var(--docs-text);
  word-break: break-word;
}

/* ==========================================================================
   Code blocks
   ========================================================================== */

.docs-article pre {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-5);
  background: var(--docs-bg-code);
  color: #e2e8f0;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  font-family: var(--docs-font-mono);
  font-size: var(--docs-text-sm);
  line-height: 1.7;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.docs-article pre code {
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  background: none;
  border-radius: 0;
  color: inherit;
  word-break: normal;
}

/* Copy button target inside code blocks */
.docs-code-copy {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--docs-text-xs);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration-fast) ease,
              background var(--duration-fast) ease;
}

.docs-article pre:hover .docs-code-copy {
  opacity: 1;
}

.docs-code-copy:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.docs-code-copy.copied {
  color: var(--docs-success);
}

/* ==========================================================================
   Tables
   ========================================================================== */

.docs-article table {
  width: 100%;
  margin: var(--space-6) 0;
  border-collapse: collapse;
  font-size: var(--docs-text-sm);
  line-height: var(--docs-leading-normal);
}

.docs-article thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: var(--docs-bg-subtle);
  border-bottom: 2px solid var(--docs-border);
  font-weight: 600;
  font-size: var(--docs-text-xs);
  text-transform: uppercase;
  letter-spacing: var(--docs-tracking-wide);
  color: var(--docs-text-secondary);
}

.docs-article tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--docs-border-subtle);
  vertical-align: top;
}

.docs-article tbody tr:last-child td {
  border-bottom: none;
}

.docs-article tbody tr:hover {
  background: var(--docs-bg-subtle);
}

/* Responsive table wrapper */
.docs-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-6) 0;
}

.docs-table-wrap table {
  margin: 0;
}

/* ==========================================================================
   Images & figures
   ========================================================================== */

.docs-article img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--docs-border-subtle);
}

.docs-article figure {
  margin: var(--space-6) 0;
}

.docs-article figcaption {
  margin-top: var(--space-2);
  font-size: var(--docs-text-sm);
  color: var(--docs-text-muted);
  text-align: center;
}

/* ==========================================================================
   Horizontal rules
   ========================================================================== */

.docs-article hr {
  margin: var(--space-10) 0;
  border: none;
  border-top: 1px solid var(--docs-border);
}

/* ==========================================================================
   Definition lists
   ========================================================================== */

.docs-article dl {
  margin: var(--space-4) 0;
}

.docs-article dt {
  font-weight: 600;
  color: var(--docs-heading);
  margin-top: var(--space-4);
}

.docs-article dd {
  margin: var(--space-1) 0 0 var(--space-6);
  color: var(--docs-text-secondary);
}

/* ==========================================================================
   Meta bar (reading time, last updated, version)
   ========================================================================== */

.webtron-docs-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: var(--space-6);
  padding: 10px 16px;
  background: var(--docs-bg-subtle);
  border: 1px solid var(--docs-border-subtle);
  border-radius: var(--radius-md, 8px);
  font-size: var(--docs-text-sm);
  color: var(--docs-text-secondary);
}

.webtron-docs-meta > * + * {
  padding-left: 12px;
  border-left: 1px solid var(--docs-border-subtle);
}

.webtron-docs-reading-time,
.webtron-docs-last-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.webtron-docs-reading-time svg,
.webtron-docs-last-updated svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.webtron-docs-version {
  display: inline-flex;
  align-items: center;
}

.webtron-docs-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.webtron-docs-author-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.webtron-version-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--docs-version-bg, #3858e9);
  color: var(--docs-version-color, #fff);
  border-radius: 4px;
  line-height: 1.4;
}

@media screen and (max-width: 640px) {
  .webtron-docs-meta {
    gap: 8px;
    padding: 8px 12px;
  }

  .webtron-docs-meta > * + * {
    padding-left: 8px;
  }
}

/* ==========================================================================
   Chapters / children grid
   ========================================================================== */

.docs-chapters {
  margin: var(--space-8) 0;
}

.docs-chapters-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--docs-text-lg);
  font-weight: 600;
  color: var(--docs-heading);
  margin-bottom: var(--space-4);
}

.docs-chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.docs-chapter-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--docs-card-bg);
  border: 1px solid var(--docs-card-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease;
}

.docs-chapter-card:hover {
  border-color: var(--docs-card-hover-border);
  box-shadow: var(--shadow-md);
}

.docs-chapter-number {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--docs-primary-light);
  color: var(--docs-primary);
  font-weight: 700;
  font-size: var(--docs-text-sm);
  border-radius: var(--radius-full);
}

.docs-chapter-card-title {
  font-weight: 600;
  color: var(--docs-heading);
  display: block;
}

.docs-chapter-excerpt {
  font-size: var(--docs-text-sm);
  color: var(--docs-text-secondary);
  margin-top: var(--space-1);
  display: block;
}

.docs-chapter-meta {
  font-size: var(--docs-text-xs);
  color: var(--docs-text-muted);
  margin-top: var(--space-1);
  display: block;
}

.docs-chapter-arrow {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--docs-text-muted);
  transition: transform var(--duration-fast) ease,
              color var(--duration-fast) ease;
}

.docs-chapter-card:hover .docs-chapter-arrow {
  transform: translateX(2px);
  color: var(--docs-primary);
}

/* ==========================================================================
   Feedback widget placeholder
   ========================================================================== */

.docs-feedback-slot {
  margin: var(--space-10) 0;
  padding-top: var(--space-8);
  border-top: 1px solid var(--docs-border);
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  .docs-article {
    max-width: none;
    font-size: 11pt;
    line-height: 1.5;
  }

  .docs-article pre {
    white-space: pre-wrap;
    border: 1px solid #ccc;
    background: #f9f9f9;
    color: #000;
  }

  .docs-heading-anchor,
  .docs-code-copy {
    display: none;
  }

  .docs-article a {
    color: inherit;
    text-decoration: underline;
  }

  .docs-article a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .docs-article a[href^="#"]::after,
  .docs-article a[href^="javascript"]::after {
    content: "";
  }
}
