/* article.small.css — the blog article below 768px
 *
 * From the Mobile view design setup mobile handoff →
 * `design_handoff_mobile_pages/Blog Article Mobile.dc.html`, designed at 375px.
 *
 * ── THE RAIL UNROLLS ────────────────────────────────────────────────────────
 * Desktop is `aside.ar__rail | article.ar__main`. The mobile design dissolves
 * the rail and threads its parts through the article: byline at the top,
 * contents under the lede, newsletter and share near the foot.
 *
 * `display: contents` on BOTH boxes is what makes that possible. It flattens
 * thirteen elements into one flex column on .ar__grid, and from there `order`
 * puts each exactly where the design wants it — which no amount of ordering
 * could do while the two containers still boxed their own children.
 *
 * THE <article> ROLE SURVIVES THIS. That was worth checking rather than
 * assuming: `display: contents` used to drop an element out of the
 * accessibility tree entirely, which would have been an unacceptable price for
 * a layout. The bug is long fixed — measured on this page through CDP's
 * Accessibility.getFullAXTree, the article role is present both with and
 * without the rule. If that ever regresses, the fallback is to box .ar__main
 * again and accept contents landing above the title.
 *
 * ORDER IS DECLARED FOR EVERY ITEM, not just the ones that move. With two
 * containers flattened into one column, source order describes nothing a reader
 * of this file would guess, so leaving any item on the default 0 would be a
 * trap rather than a saving.
 *
 * Unlike the design: the theme's contents is a <nav>, not a <details>, so it
 * renders open. There is no accordion to style.
 *
 * COLOURS ARE INHERITED, NOT RESTATED — see journal.small.css for the reason.
 * The one exception is #2b333b on body copy, which article.css already sets
 * itself, so the mobile value needs no change.
 */

@media (max-width: 767.98px) {

  .ar__grid {
    display: flex; flex-direction: column;
    gap: 0;
    padding: 26px 20px 40px;
  }

  /* Both containers stop being boxes, so all thirteen children become items of
     the one flex column and can be placed individually. */
  .ar__rail,
  .ar__main { display: contents; }

  .ar__author        { order:  1; }   /* byline: portrait, name, date         */
  .ar__bio,
  .ar__work          { order:  2; }   /* not in the design — kept, not hidden */
  .ar__progress-read { order:  3; }   /* read time and the live percentage    */
  .ar__kicker        { order:  4; }
  .ar__h1            { order:  5; }
  .ar__lede          { order:  6; }
  .ar__toc           { order:  7; }   /* under the lede, as drawn             */
  .ar__hero          { order:  8; }
  .ar__body          { order:  9; }
  .ar__tags          { order: 10; }
  .ar__nl            { order: 11; }   /* newsletter, then the two red panels  */
  .ar__quiz          { order: 12; }
  .ar__next          { order: 13; }


  /* --- byline -------------------------------------------------------------- */

  .ar__author {
    gap: 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--hair-2);
  }
  .ar__avatar { width: 44px; height: 52px; }
  .ar__bio { margin-top: 14px; }

  .ar__progress-read { margin-top: 16px; }
  .ar__progress-pct { font-size: 12px; letter-spacing: .1em; }


  /* --- contents ------------------------------------------------------------
     Closed by a border top and bottom, as the design draws it. The label takes
     the 44px row the design gives its <summary>, so the block reads the same
     even though this one cannot collapse. */

  .ar__toc {
    margin: 26px 0;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--hair-2);
  }
  .ar__toc-label {
    display: flex; align-items: center;
    min-height: 44px;
    margin-bottom: 4px;
  }


  /* --- kicker, title, lede ------------------------------------------------- */

  .ar__kicker { margin-top: 24px; }
  .ar__h1 {
    margin-top: 18px;
    max-width: none;
    font-size: 38px; line-height: 1;
  }
  .ar__lede {
    margin: 18px 0 26px;
    max-width: none;
    font-size: 17px; line-height: 1.6;
  }


  /* --- figures -------------------------------------------------------------
     Full-bleed to both edges, with the caption pulled back onto the gutter.
     The negative margin escapes .ar__main, which has no clipping of its own. */

  .ar__hero,
  .ar__body figure { margin-left: -20px; margin-right: -20px; }
  .ar__body figure { margin-top: 30px; margin-bottom: 0; }
  .ar__hero figcaption,
  .ar__body figcaption {
    margin-left: 20px; margin-right: 20px;
    font-size: 10.5px; line-height: 1.5;
  }


  /* --- body ---------------------------------------------------------------- */

  .ar__body { margin-top: 30px; }
  /* Every measure cap comes off: 68ch, 30ch and the rest are all wider than the
     335px column, so they never bite, and leaving them in only invites the next
     reader to wonder which one is doing something. */
  .ar__body p {
    margin-bottom: 20px;
    max-width: none;
    font-size: 16.5px; line-height: 1.72;
  }
  .ar__body h2 {
    margin: 32px 0 16px;
    max-width: none;
    font-size: 24px; line-height: 1.12;
  }
  .ar__body h3 {
    margin: 30px 0 14px;
    max-width: none;
    font-size: 19px;
  }

  .ar__body blockquote {
    margin: 30px 0;
    padding: 22px 20px;
    max-width: none;
  }
  .ar__body blockquote p { font-size: 20px; line-height: 1.32; }
  .ar__body blockquote.is-plain { padding: 0 0 0 20px; max-width: none; }
  .ar__body blockquote.is-plain p { font-size: 19px; line-height: 1.35; }

  .ar__body ul,
  .ar__body ol { margin: 24px 0; max-width: none; gap: 16px; }
  .ar__body li { font-size: 16px; line-height: 1.6; }

  /* The design redraws the table as a four-track grid. This is a real <table>,
     so the same result comes from the type sizes instead — at these values the
     four columns fit 335px and the sheet keeps its promise that nothing on this
     page scrolls sideways. */
  .ar__body table { font-size: 14px; }
  .ar__body thead th,
  .ar__body tr:first-child th { padding: 0 10px 10px 0; font-size: 9.5px; }
  .ar__body td { padding: 12px 10px 12px 0; font-size: 12.5px; }


  /* --- tags and share ------------------------------------------------------ */

  .ar__tags {
    margin-top: 28px;
    padding-top: 0;
    border-top: 0;                 /* the design closes the body without a rule */
  }
  .ar__tag { padding: 9px 12px; }

  /* --- panels: newsletter, quiz, next note ---------------------------------
     All three go full-bleed and stack their contents. */

  .ar__nl {
    margin: 26px -20px 0;
    padding: 26px 20px;
  }
  .ar__nl-h { font-size: 24px; }
  .ar__nl-p { margin-bottom: 16px; font-size: 13.5px; line-height: 1.55; }

  .ar__quiz {
    grid-template-columns: 1fr;
    gap: 0;                        /* the paragraph's own margin is the gap */
    margin: 16px -20px 0;
    padding: 26px 20px;
  }
  .ar__quiz-h { font-size: 26px; }
  .ar__quiz-p {
    margin-bottom: 20px;
    max-width: none;
    font-size: 12px;
  }
  .ar__quiz-cta {
    display: flex; justify-content: space-between;
    padding: 18px 16px;
    font-size: 11.5px;
  }

  .ar__next {
    margin: 16px -20px 0;
    padding: 22px 20px;
    gap: 16px;
  }
  .ar__next-idx { margin-bottom: 8px; font-size: 9.5px; }
  .ar__next-title { font-size: 19px; line-height: 1.16; }
  .ar__next-arrow { width: 44px; height: 44px; }
}
