/*
 * ART-INDEX-01 PR2 (ART-D1-D6) - the public article index only (loaded by its head_extra).
 *
 * The same isolation as TUT-01's tutorials.css, storefront.css and my-services.css: every rule is
 * scoped to `body.article-index-ui`, so the tutorial index, the home page's cards, the shared band
 * and card partials and the article page itself are untouched. Colours are the platform's and the
 * brand's own tokens, read and never redefined, so both themes follow. Nothing here moves, so
 * reduced motion needs no rule; the card's focus ring is the shared one.
 */

/* -- the band: compact, from the reading start (ART-D1) ---------------------------------------- */

/* The height comes from what the editor wrote, not from a fixed minimum. A long introduction
   makes a taller band; nothing is clipped or shortened. The artwork, its veil, the eyebrow and the
   one H1 are the shared band's own. */
.article-index-ui .content-hero__inner {
  min-block-size: 0;
  padding-block: clamp(1.2rem, 0.8rem + 1vw, 1.75rem);
  justify-content: flex-start;
  align-items: center;
}

.article-index-ui .content-hero__copy {
  inline-size: min(100%, 46rem);
  margin-inline: 0;
}

/* The title and introduction carry their own direction (`editorial_dir`), so they are aligned to
   the page's reading start physically: right on the Persian page, left on the English one. */
html[dir="rtl"] .article-index-ui .content-hero__copy,
html[dir="rtl"] .article-index-ui .content-hero__copy > * {
  text-align: right;
}

html[dir="ltr"] .article-index-ui .content-hero__copy,
html[dir="ltr"] .article-index-ui .content-hero__copy > * {
  text-align: left;
}

.article-index-ui .content-hero__eyebrow {
  margin-block-end: 0.35rem;
}

.article-index-ui .content-hero__title {
  font-size: clamp(1.75rem, 1.25rem + 1.5vw, 2.4rem);
  margin-block-end: 0.45rem;
}

.article-index-ui .content-hero__lede {
  margin: 0;
  max-inline-size: 62ch;
  line-height: 1.85;
}

/* The text now starts at the reading side rather than the middle, so that side of the picture is
   deepened with the band's own ground colour; the rest of the artwork shows as before. Measured
   against the artwork's own pixels in both themes, so the introduction keeps 4.5:1 or better. */
.article-index-ui .content-hero::after {
  background:
    linear-gradient(var(--article-band-towards, to left),
      color-mix(in srgb, var(--content-hero-ground) 90%, transparent) 0%,
      color-mix(in srgb, var(--content-hero-ground) 62%, transparent) 50%,
      transparent 85%),
    var(--content-hero-veil);
}

html[dir="ltr"] .article-index-ui .content-hero::after {
  --article-band-towards: to right;
}

/* A phone: no fixed minimum either; the copy sits at the band's foot over the mobile artwork. */
@media (max-width: 900px) {
  .article-index-ui .content-hero__inner {
    min-block-size: 0;
    align-items: flex-end;
    padding-block: 1.6rem 1.25rem;
  }

  /* The shorter band puts the brightest part of the mobile picture behind the eyebrow, so the
     band's own ground deepens the top as the shared veil deepens the foot. */
  .article-index-ui .content-hero::after {
    background:
      linear-gradient(to bottom,
        color-mix(in srgb, var(--content-hero-ground) 84%, transparent) 0%,
        color-mix(in srgb, var(--content-hero-ground) 50%, transparent) 55%,
        transparent 85%),
      var(--content-hero-veil-mobile);
  }
}

/* -- the card: the title leads, the summary previews (ART-D2) ---------------------------------- */

.article-index-ui .content-card__title {
  font-size: 1.15rem;
  line-height: 1.6;
}

/* Three lines at most on the card, then an ellipsis. The whole summary is still in the HTML (for a
   screen reader and a search engine alike) and on the article's own page; titles are never
   clamped. */
.article-index-ui .content-card__summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* -- the editorial date, named (ART-D3) -------------------------------------------------------- */

/* The label the article page already gives the same date, in the quieter ink; the date itself is
   the unchanged <time> beside it. */
.article-index-ui .content-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.4rem;
}

.article-index-ui .content-card__date-label {
  color: var(--ink-soft);
  font-weight: 600;
}

/* -- the subjects: three, then "+N" (ART-D4) --------------------------------------------------- */

/* One row that wraps when it must: a long Persian subject takes the next line instead of being
   squeezed or cut. */
.article-index-ui .content-card__taxonomy {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.article-index-ui .content-tag {
  padding: 0.05rem 0.55rem;
  font-size: 0.74rem;
}

/* "+N": the number of the article's subjects not shown here. Plain words in the soft ink, with no
   border or fill, so it never looks like a control. */
.article-index-ui .content-tags__more {
  display: inline-flex;
  align-items: center;
  padding-inline: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.75;
  white-space: nowrap;
}

/* -- an article with no lead image (ART-D5) ---------------------------------------------------- */

/* The same 16:9 frame, so a row of cards stays even, on a quiet ground of the theme's own colours
   with the same document mark this index's empty state already draws (the tutorial index draws a
   book). The mark is decoration on a frame already hidden from assistive technology: no picture,
   no file, no request and no alternative text is invented. */
.article-index-ui .content-card__media--empty {
  background:
    radial-gradient(120% 90% at 50% 115%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 62%),
    linear-gradient(180deg, var(--surface-sunken), color-mix(in srgb, var(--accent-2) 5%, var(--surface-sunken)));
}

.article-index-ui .content-card__media--empty::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  background-color: color-mix(in srgb, var(--accent-2) 45%, var(--ink-soft));
  opacity: 0.75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l3 3v15H6z'/%3E%3Cpath d='M15 3v3h3'/%3E%3Cpath d='M9 11h6M9 15h6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l3 3v15H6z'/%3E%3Cpath d='M15 3v3h3'/%3E%3Cpath d='M9 11h6M9 15h6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* -- keyboard focus clear of the sticky header (ART-D6) ---------------------------------------- */

/* The focus ring is drawn on the whole card, but the element that takes focus is the title link
   below the picture. When the browser scrolls a focused link into view it keeps room above it for
   the sticky header (4.75rem), this card's own 16:9 picture (56.25% of the card's width, read
   through the card as a size container) and the date line (3.25rem), so the top of the ring is
   not left under the header on a short or zoomed screen. */
.article-index-ui .content-card {
  container-type: inline-size;
}

.article-index-ui .content-card__link {
  scroll-margin-block-start: calc(4.75rem + 56.25cqi + 3.25rem);
}

/* -- a phone (ART-D6) -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .article-index-ui .content-index__head {
    margin-block-end: 0.8rem;
  }

  .article-index-ui .content-card__title {
    font-size: 1.08rem;
  }
}

/* -- search and one Subject (CONTENT-DISCOVERY-01 PR1, CD-D3 and CD-D7) ----------------------- */

/* Above the cards, never in the band. The search field is the platform's own `discovery-search`
   (the games catalog's), so it already shrinks below 375 px and shows its focus on the whole
   field. Subjects are links that wrap onto as many lines as they need; nothing scrolls sideways. */
.article-index-ui .article-discovery {
  display: grid;
  gap: 0.85rem;
  margin-block-end: 1.5rem;
}

.article-index-ui .article-discovery__search {
  max-inline-size: 40rem;
}

.article-index-ui .article-discovery__subjects {
  min-inline-size: 0;
}

.article-index-ui .article-discovery__label {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--ink-soft);
}

.article-index-ui .article-discovery__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A 44 px target. The chosen Subject is marked by more than colour: a heavier weight, an inset
   rule along its foot and a tick, as the games catalog marks its chosen filter. */
.article-index-ui .article-discovery__choice {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-block-size: 2.75rem;
  max-inline-size: 100%;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.article-index-ui .article-discovery__choice:hover {
  border-color: var(--accent-edge);
  color: var(--ink);
}

.article-index-ui .article-discovery__choice--selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-sunken));
  color: var(--ink);
  font-weight: 800;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.article-index-ui .article-discovery__check {
  flex: 0 0 auto;
  inline-size: 1rem;
  block-size: 1rem;
  color: var(--accent);
}

/* What is shown, in words, and the one way back to every article. */
.article-index-ui .article-discovery__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin: 0;
  color: var(--ink-soft);
}

.article-index-ui .article-discovery__summary bdi {
  color: var(--ink);
  font-weight: 700;
}

.article-index-ui .article-discovery__clear {
  font-weight: 700;
  white-space: nowrap;
}
