/* Articles (/articles/, /articles/<slug>/): templates/articles/*.html. Mobile first, logical
   properties only (RTL), the shared design tokens of site.css (light and dark themes). */

.article-page {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-4);
}

.article-head {
  display: grid;
  gap: var(--space-3);
}

.article-kicker {
  justify-self: start;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}

.page-shell .article-title {
  margin: 0;
  font-size: clamp(var(--fs-2xl), 6vw, var(--fs-3xl));
  line-height: 1.12;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.page-shell .article-lead {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-lg);
  line-height: 1.5;
}

.page-shell .article-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.article-byline__author {
  color: var(--ink);
  font-weight: var(--fw-semibold);
}

.page-shell .article-note {
  margin: 0;
  justify-self: start;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
}

.article-cover {
  margin: 0 calc(var(--space-4) * -1);
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 16 / 9;
}

.article-cover picture,
.article-cover img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

/* The body: only the tags of the allowlist (apps/articles/sanitize.py). */
.article-body {
  display: grid;
  gap: var(--space-4);
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: 1.7;
  overflow-wrap: anywhere;
  hyphens: manual;
}

.article-body > * {
  margin: 0;
}

.page-shell .article-body p {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
}

.page-shell .article-body h2 {
  margin: var(--space-3) 0 0;
  font-size: var(--fs-xl);
  line-height: 1.25;
}

.page-shell .article-body h3 {
  margin: var(--space-2) 0 0;
  font-size: var(--fs-lg);
  line-height: 1.3;
}

.article-body ul,
.article-body ol {
  display: grid;
  gap: var(--space-2);
  padding-inline-start: 1.4em;
}

.article-body li > p {
  margin: 0;
}

.article-body a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body blockquote {
  padding: var(--space-3) var(--space-4);
  border-inline-start: 4px solid var(--ok);
  border-radius: var(--radius-sm);
  background: var(--ok-soft);
}

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

.article-body img {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
  border-radius: var(--radius-md);
}

.article-body figcaption {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.article-body hr {
  inline-size: 100%;
  border: 0;
  border-block-start: 1px solid var(--line);
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.article-share {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target);
}

.page-shell .article-share-status {
  margin: 0;
  font-size: var(--fs-sm);
}

.article-recipes {
  display: grid;
  gap: var(--space-3);
  padding-block-start: var(--space-4);
  border-block-start: 1px solid var(--line);
}

.page-shell .article-recipes__title {
  margin: 0;
  font-size: var(--fs-xl);
}

.article-recipes__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.article-recipe {
  display: grid;
  gap: var(--space-2);
  align-content: start;
}

.article-recipe__media {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.article-recipe__media picture,
.article-recipe__media img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.page-shell .article-recipe__name {
  margin: 0;
  font-size: var(--fs-md);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.article-recipe__name a {
  color: var(--ink);
  text-decoration: none;
}

/* Card links: the title is the only link, its ::after covers the card. */
.card-linked {
  position: relative;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card-link:focus-visible {
  outline: none;
}

.card-link:focus-visible::after {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* /articles/ */
.articles-feed {
  padding: var(--space-4);
}

.articles-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-5);
}

.article-item {
  display: grid;
  gap: var(--space-3);
  padding-block-end: var(--space-5);
  border-block-end: 1px solid var(--line);
}

.article-item:last-child {
  padding-block-end: 0;
  border-block-end: 0;
}

.article-item__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.article-item__media picture,
.article-item__media img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.article-item__body {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.page-shell .article-item__title {
  margin: 0;
  font-size: var(--fs-xl);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.article-item__title a {
  color: var(--ink);
  text-decoration: none;
}

@media (hover: hover) {
  .card-linked:hover .card-link {
    color: var(--accent-deep);
  }
}

.page-shell .article-item__note {
  font-size: var(--fs-xs);
}

.articles-pager {
  margin-block-start: var(--space-4);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-2);
}

.articles-pager__end {
  display: flex;
  justify-content: flex-end;
}

.articles-pager__status {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.articles-empty {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
}

@media (min-width: 861px) {
  .article-page {
    padding: var(--space-7);
    max-inline-size: 860px;
    margin-inline: auto;
  }

  .article-cover {
    margin: 0;
    border-radius: var(--radius-lg);
  }

  .article-recipes__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .article-item {
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
  }
}
