/* ==========================================================================
   Articles: the list at /articles/ and the reading page at /articles/slug/.
   Loaded after home.css (header, footer, .posts, .draft-badge, .more-link).
   Everything inside .prose comes from Markdown, so it styles plain tags.
   ========================================================================== */

/* --- The list ------------------------------------------------------------- */

.articles-index {
  min-block-size: 50svh;
}

/* One column, bigger, on the dedicated page. */
.posts--index {
  display: block;
  max-inline-size: 48rem;
}

.posts--index .post {
  padding-block: var(--space-6);
  border-block-start: 0;
  border-block-end: var(--border-thin) solid var(--rule);
}

.posts--index .post__title {
  font-family: var(--font-naskh);
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
  font-weight: var(--weight-regular);
  line-height: 1.4;
}

.post__draft,
.articles-empty {
  color: var(--muted);
}

.post__draft {
  padding: 0.05em 0.6em;
  border: var(--border-thin) dashed var(--rule-strong);
  border-radius: var(--radius-pill);
}

.articles-empty {
  padding-block: var(--space-6);
  font-size: var(--text-lg);
}

/* --- The reading page --------------------------------------------------------- */

.article {
  max-inline-size: 46rem;
  padding-block: var(--space-6) var(--space-7);
}

.article__head {
  display: grid;
  gap: var(--space-4);
  padding-block-end: var(--space-6);
  border-block-end: var(--border-thin) solid var(--rule);
}

.article__head .draft-badge {
  justify-self: start;
}

.article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* The view count joins the meta row's own spacing once it has loaded. */
.article__views:not([hidden]) {
  display: contents;
}

.article__meta a {
  color: var(--tomato);
  font-weight: var(--weight-bold);
  text-decoration: none;
}

.article__title {
  font-family: var(--font-naskh);
  font-size: clamp(2.25rem, 1.4rem + 3.4vw, 3.75rem);
  font-weight: var(--weight-regular);
  line-height: 1.35;
  text-wrap: balance;
}

.article__lede {
  font-size: var(--text-lg);
  line-height: 1.8;
  color: var(--muted);
  text-wrap: pretty;
}

.article__cover {
  margin-block-start: var(--space-6);
}

.article__cover img {
  inline-size: 100%;
  border-radius: 1rem;
}

/* --- The text -------------------------------------------------------------------
   Long-form Arabic: generous size and line height, a comfortable measure. */

.prose {
  padding-block-start: var(--space-6);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 2;
  text-wrap: pretty;
  overflow-wrap: break-word;
}

.prose > * + * {
  margin-block-start: 1.15em;
}

.prose h2 {
  margin-block-start: 2em;
  font-family: var(--font-naskh);
  font-size: 1.7em;
  font-weight: var(--weight-regular);
  line-height: 1.45;
}

.prose h3 {
  margin-block-start: 1.8em;
  font-size: 1.2em;
  font-weight: var(--weight-bold);
  line-height: 1.6;
}

.prose h2 + *,
.prose h3 + * {
  margin-block-start: 0.6em;
}

.prose strong {
  font-weight: var(--weight-bold);
}

.prose a {
  color: var(--tomato);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

@media (hover: hover) and (pointer: fine) {
  .prose a:hover {
    text-decoration-thickness: 2px;
  }
}

/* Quotes: the naskh, a tomato rule at the start. */
.prose blockquote {
  margin-inline: 0;
  padding-inline-start: 1.1em;
  border-inline-start: 3px solid var(--tomato);
  font-family: var(--font-naskh);
  font-size: 1.25em;
  line-height: 1.9;
}

.prose blockquote > * + * {
  margin-block-start: 0.6em;
}

/* base.css strips list styles; prose gets them back. */
.prose ul,
.prose ol {
  padding-inline-start: 1.4em;
}

.prose ul {
  list-style: disc;
}

.prose ol {
  list-style: decimal;
}

.prose li + li {
  margin-block-start: 0.4em;
}

.prose li::marker {
  color: var(--tomato);
}

.prose img {
  inline-size: 100%;
  border-radius: 0.75rem;
}

.prose figure {
  display: grid;
  gap: var(--space-2);
}

.prose figcaption {
  font-size: var(--text-xs);
  color: var(--muted);
  text-align: center;
}

/* A break: three dots, the circle motif. */
.prose hr {
  border: 0;
  block-size: 6px;
  margin-block: 2.5em;
  background:
    radial-gradient(circle, var(--ink) 2.5px, transparent 3px) center / 22px 6px repeat-x;
  inline-size: 66px;
  margin-inline: auto;
}

.prose code {
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
  background: var(--paper-raised);
  font-size: 0.9em;
}

.prose pre {
  overflow-x: auto;
  padding: var(--space-4);
  border-radius: 0.75rem;
  background: var(--paper-raised);
  direction: ltr;
  text-align: left;
}

.prose pre code {
  padding: 0;
  background: none;
}

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9em;
}

.prose th,
.prose td {
  padding: 0.5em 0.8em;
  border-block-end: var(--border-thin) solid var(--rule);
  text-align: start;
}

.article__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-block-start: var(--space-7);
  padding-block-start: var(--space-5);
  border-block-start: var(--border-thin) solid var(--rule);
  font-size: var(--text-sm);
}

