/* =========================================================================
   articles.css - the two article pages (loaded after theme.css):
     Reason's Greetings (/reasons-greetings/) and Clear as Mud (/clear-as-mud/).

   Three parts:
     1. The list: filter chips, then a grid of cards (chibi, kind, title, dek). The
        whole card is one link; on a phone the picture sits beside the words.
     2. One article: title, the chibi with its caption, the sections, the quotes, the
        box with the other side's answer, and the numbered references.
     3. Quotes: a checked quote is a gold pull-quote; a disputed or misattributed one,
        and every line in the "Often misquoted" box, wears a warning style (dashed red
        edge, hatching, its verdict first) so it can never pass for a genuine quote.
   Colours come from theme.css (--gold, --red, ...) plus the three quote verdicts below.
   tests/style.test.mjs checks every small-text colour here is readable (4.5:1), every
   button and number link is thumb-sized (44px), and the picture boxes match the sizes
   articles.js tells the browser.
   ========================================================================= */

/* The "hidden" attribute always wins on these pages (some boxes below set their own
   display, which would otherwise un-hide them). */
.page-articles [hidden] { display: none !important; }

/* The three verdicts a quote can carry (Reason's Greetings), as text colours. */
.page-articles {
  --ok: #7ddc9a;            /* verified */
  --doubt: var(--gold);     /* disputed */
  --wrong: var(--red-text); /* misattributed, and the "Often misquoted" box */
}

/* ---- Top of the page ------------------------------------------------------ */

.art-intro {
  max-width: 62ch;
  margin: 14px auto 0;
  color: var(--cream);
}

/* ============================== 1. The list ================================ */

.art-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.chip-count {
  font-size: 0.8rem;
  color: var(--muted);
}
.chip[aria-pressed="true"] .chip-count { color: var(--cream); }

.art-count {
  margin: 10px 0 18px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.art-item { display: flex; } /* every card in a row as tall as the tallest */

.art-card {
  position: relative; /* the stretched link below covers the whole card */
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}
.art-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
/* The quote wall is the odd one out: a gold edge. */
.art-card.kind-quotes { border-color: var(--line-strong); }

/* The picture box. Keep in step with CARD_BOXES in articles.js (tests check). */
.art-card-pic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 240px;
  height: 150px;
  margin: 0 auto 10px;
}
.art-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain; /* the whole chibi, never cropped or squashed */
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

.art-card-kind {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-text);
}
.art-card-title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  overflow-wrap: break-word;
}
.art-card-link {
  color: var(--gold);
  text-decoration: none;
}
/* The link stretches over the whole card, so the card is one big tap target. */
.art-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.art-card-link:hover { color: #f3cf74; }
.art-card-link:focus-visible { outline: none; }
.art-card-link:focus-visible::after { outline: 3px solid var(--gold); outline-offset: 3px; }
.art-card-dek {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
}

/* Phones: the picture beside the words, so 20 cards are not 20 screens long. */
@media (max-width: 559px) {
  .art-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    column-gap: 12px;
    align-content: start;
    padding: 12px;
  }
  .art-card-pic { grid-row: 1 / span 3; width: 88px; height: 88px; margin: 0; }
  .art-card-title { font-size: 1.12rem; }
}

/* Still being drawn: a soft glowing frame the size of the picture. */
.art-soon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 6px;
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 38%, rgba(179, 38, 47, 0.35), transparent 65%),
    var(--panel-2);
  text-align: center;
}
.art-soon-text {
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--cream);
}

.art-loading {
  padding: 30px 0;
  text-align: center;
  color: var(--muted);
}

/* ============================ 2. One article =============================== */

.art-view { padding-top: 8px; }
.art-article,
.art-back-row {
  max-width: 760px; /* long reads stay readable on big screens */
  margin-inline: auto;
}
.art-article { overflow-wrap: break-word; }
.art-back-row { margin-block: 0 16px; }
.art-back-bottom { margin-top: 32px; }
.art-back {
  flex-direction: row;
  min-height: 44px;
  padding: 0.45em 1.1em;
  font-size: 1rem;
}

.art-head { text-align: center; margin-bottom: 20px; }
.art-kind {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-text);
}
.art-title {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  text-shadow: 0 0 24px rgba(179, 38, 47, 0.55);
}
.art-dek {
  max-width: 60ch;
  margin: 0 auto;
  font-size: 1.12rem;
  color: var(--muted);
}

/* The big chibi, its name and what it stands for. Keep the picture box in step with
   ARTICLE_BOXES in articles.js (tests check). */
.art-chibi {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin: 0 0 24px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.art-chibi-pic { width: 220px; height: 220px; }
.art-chibi-caption {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
}
.art-chibi-name {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--gold);
}
@media (max-width: 559px) {
  .art-chibi { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 12px; }
  .art-chibi-pic { width: 160px; height: 160px; }
}

.art-section h3,
.art-quotes h3,
.art-misquoted h3,
.art-reply h3,
.art-refs h3 {
  margin: 28px 0 10px;
  font-size: 1.4rem;
}
.art-bullets { margin: 0 0 1em; padding-left: 1.3em; }
.art-bullets li { margin-bottom: 0.5em; }

/* A [3] in the text: a small raised link to reference 3. */
.cite-sup {
  font-size: 0.72em;
  line-height: 0;
  vertical-align: super;
}
.cite {
  color: var(--gold);
  text-decoration: none;
  padding: 0 1px;
}
.cite:hover { text-decoration: underline; }

/* The other side's answer ("What believers say" / "What the Church says"). */
.art-reply {
  margin-top: 32px;
  padding: 4px 20px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}
.art-reply h3 { margin-top: 18px; }

/* The numbered references. */
.art-ref-list {
  margin: 0;
  padding-left: 1.9em;
  font-size: 0.92rem;
  overflow-wrap: anywhere; /* a long title never pushes the page sideways */
}
.art-ref-list li { margin-bottom: 0.9em; border-radius: 6px; }
.art-ref-list li::marker { font-weight: 700; color: var(--gold); }
.art-ref-list li:focus { outline: 2px solid var(--gold); outline-offset: 4px; }
.ref-title { font-weight: 700; }
.ref-by {
  display: block;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}

.art-small-print {
  max-width: 70ch;
  margin: 40px auto 0;
  font-size: 0.8rem;
  text-align: center;
  color: var(--muted);
}
.art-small-print + .art-small-print { margin-top: 10px; }

/* ================================ 3. Quotes ================================ */

.quote-list {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* The quote wall: a gallery, two side by side where there is room. */
.quote-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }

.quote {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
}
.quote-text { margin: 0 0 10px; font-size: 1.06rem; }
.quote-text p { margin: 0; }
/* A checked quote gets a big gold opening quote mark (for the eye only). */
.quote.is-genuine .quote-text p::before {
  content: "\201C";
  content: "\201C" / "";
  margin-right: 3px;
  font-family: var(--font-display);
  font-size: 2.2em;
  line-height: 0;
  vertical-align: -0.4em;
  color: var(--gold);
}
.quote-who { margin: 0; font-weight: 700; color: var(--gold); }
.quote-lived { font-weight: 400; color: var(--muted); }
.quote-what,
.quote-src,
.quote-tr {
  margin: 2px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}
.quote-label { color: var(--gold); }
.quote-note { margin: 10px 0 0; font-size: 0.9rem; line-height: 1.5; }
.quote-refs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
/* A source number under a quote: a little round button, big enough for a thumb. */
.cite-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  font-weight: 700;
}
.cite-chip:hover { background: var(--panel-2); text-decoration: none; }

/* The verdict on a quote: "verified", "disputed", "misattributed" (the content's words). */
.quote-status { margin: 0 0 8px; }
.qbadge,
.mq-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 10px;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.25);
  font-family: var(--font-display);
  font-size: 0.8rem;
  line-height: 1.6;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.qbadge-verified { color: var(--ok); }
.qbadge-disputed { color: var(--doubt); }
.qbadge-misattributed,
.mq-badge { color: var(--wrong); }

/* A disputed or misattributed quote: a warning, not a pull-quote. Dashed edge in its
   verdict's colour, faint hatching, no big quote mark, the words in italics. */
.quote.is-doubtful {
  border: 2px dashed var(--wrong);
  background:
    repeating-linear-gradient(135deg, rgba(234, 96, 104, 0.07) 0 10px, transparent 10px 20px),
    var(--panel);
}
.quote.is-doubtful.status-disputed {
  border-color: var(--doubt);
  background:
    repeating-linear-gradient(135deg, rgba(230, 184, 79, 0.07) 0 10px, transparent 10px 20px),
    var(--panel);
}
.quote.is-doubtful .quote-text { font-style: italic; }

/* "Often misquoted": its own box, well apart from the quotes above it. */
.art-misquoted {
  margin-top: 40px;
  padding: 4px 16px 16px;
  border: 2px dashed var(--wrong);
  border-radius: var(--radius);
  background: rgba(142, 27, 34, 0.12);
}
.art-misquoted h3 { margin-top: 18px; color: var(--red-text); }
.mq-intro { margin: 0 0 14px; font-size: 0.95rem; }
.mq-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mq-card {
  padding: 14px 16px;
  border: 1px solid rgba(234, 96, 104, 0.5);
  border-radius: 12px;
  background:
    repeating-linear-gradient(135deg, rgba(234, 96, 104, 0.08) 0 10px, transparent 10px 20px),
    var(--panel);
}
.mq-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 8px;
  font-size: 0.88rem;
}
/* The line as it goes round: italic, with a red wavy line under it like a spelling
   mistake, so even a cropped screenshot shows it is marked as wrong. */
.mq-text { margin: 0 0 10px; font-style: italic; }
.mq-text p {
  margin: 0;
  text-decoration: underline wavy rgba(234, 96, 104, 0.8);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.mq-facts { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.mq-facts dt {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--gold);
}
.mq-facts dd { margin: 0 0 8px; }
