/* first-screen buy-button batch (item a), 28 Nov 2026.
   New file only. styles.css, qa.css, pick-card.css and header/site-header rules are not edited
   (the header gap and pick-card colour bug stay in Mike's batch b).
   Scoped to body.rd. Layout only: CSS order and 44px tap targets. No copy, links, folds or
   restyling of Black Friday / ending-soon / 18+ / correction blocks. Those blocks keep their
   source order whenever they sit above a buy button, except an 18+ notice may sit directly
   under the H1 (still visible, never folded) so it is seen before the button. */
@media (max-width: 640px) {

  /* ========== pick-card: CTA under the title (file pick-card.css is not edited) ========== */
  body.rd-guide article.pick-card,body.rd-review article.stack > article.pick-card{display:flex;flex-direction:column}
  body.rd article.pick-card:not(.rd-verdict article.pick-card) > .pick-card__header{display:contents}
  body.rd .rd-verdict article.pick-card > .pick-card__header{display:block}
  body.rd article.pick-card .pick-card__eyebrow{order:0}
  body.rd article.pick-card .pick-card__title{order:1}
  body.rd article.pick-card > .pick-card__actions{order:2;margin:6px 0 10px}
  body.rd article.pick-card > .pick-card__meta{order:3}
  body.rd article.pick-card .pick-card__verdict{order:4}
  body.rd article.pick-card > *{order:5}
  body.rd .rd-verdict article.pick-card > .pick-card__header{display:block}
  body.rd article.pick-card .pick-card__cta{width:100%;justify-content:center;text-align:center;min-height:44px;display:inline-flex;align-items:center;box-sizing:border-box}

  /* ========== VidLab / review-hero templates ========== */
  body.rd-guide article.stack{display:flex;flex-direction:column}
  body.rd-guide article.stack > *{order:10}
  /* explode the hero only when the pick-card / qa / verdict is a sibling, and the hero has no promo or 18+ block */
  /* reviews already have a verdict CTA on the first screen; exploding the hero on those pages pushed it down */
  body.rd-guide article.stack:has(> .pick-card, > .panel.rd-qa, > .review-hero-actions):not(:has(.review-hero [class*="hf-bf"], .review-hero [class*="pp-bf"], .review-hero [class*="q253"], .review-hero .notice, .review-hero .content-warning, .review-hero [data-live-until])) > .review-hero{display:contents}
  body.rd-guide article.stack > .review-hero:first-of-type{order:1}
  /* later review-hero blocks (e.g. q161-cont) stay at order 10 */
  body.rd-guide article.stack > aside.qa-box,
  body.rd-guide article.stack > .qa-box,
  body.rd-guide article.stack > .rd-qa-cta{order:6}
  body.rd-guide article.stack > .review-hero > .updated-badge,
  body.rd-guide article.stack > .review-hero > .reading-time,
  body.rd-guide .review-hero > .updated-badge,
  body.rd-guide .review-hero > .reading-time{order:1}
  body.rd-guide article.stack > .review-hero > .eyebrow,
  body.rd-guide .review-hero > .eyebrow{order:2}
  body.rd-guide article.stack > .review-hero > h1,
  body.rd-guide .review-hero > h1{order:3}
  /* sibling pick-card / actions come right after the H1 */
  body.rd-guide article.stack > .pick-card,
  body.rd-guide article.stack > .review-hero-actions{order:4}
  body.rd-guide article.stack > .rd-verdict{order:4}
  body.rd-guide article.stack > .panel.rd-qa,
  body.rd-guide article.stack > p.rd-short{order:6}

  /* inside a flex review-hero (pick-card already in the hero): pull the card after the H1
     only when no promo / 18+ node precedes it. Promo and 18+ nodes keep source order (order:10). */
  body.rd-guide .review-hero > *{order:10}
  body.rd-guide .review-hero > .updated-badge,
  body.rd-guide .review-hero > .reading-time{order:1}
  body.rd-guide .review-hero > .eyebrow{order:2}
  body.rd-guide .review-hero > h1{order:3}
  body.rd-guide .review-hero:not(:has([class*="hf-bf"] ~ .pick-card, [class*="pp-bf"] ~ .pick-card, [class*="q253"] ~ .pick-card, .notice ~ .pick-card, .content-warning ~ .pick-card, [data-live-until] ~ .pick-card, aside.qa-box ~ .pick-card, .qa-box ~ .pick-card, .rd-qa-cta ~ .pick-card)) > .pick-card{order:4}
  /* when a qa CTA already sits in the hero, put that CTA under the H1 instead of jumping the pick-card over it */
  body.rd-guide .review-hero:not(:has([class*="hf-bf"] ~ :is(.rd-qa-cta, aside.qa-box, .qa-box), [class*="q253"] ~ :is(.rd-qa-cta, aside.qa-box, .qa-box), .notice ~ :is(.rd-qa-cta, aside.qa-box, .qa-box))) > :is(.rd-qa-cta, aside.qa-box, .qa-box){order:4}
  /* promo/18+ precedes the card: keep the note in source order (4.5-ish) and sit the card just after it */
  body.rd-guide .review-hero:has([class*="hf-bf"] ~ .pick-card, [class*="q253"] ~ .pick-card) > [class*="hf-bf"],
  body.rd-guide .review-hero:has([class*="hf-bf"] ~ .pick-card, [class*="q253"] ~ .pick-card) > [class*="q253"]{order:4}
  body.rd-guide .review-hero:has([class*="hf-bf"] ~ .pick-card, [class*="q253"] ~ .pick-card) > .pick-card{order:5}
  body.rd-guide .review-hero:has([class*="hf-bf"] ~ .pick-card) > :is(p.verdict-line, p.rd-qa){order:6}
  body.rd-guide .review-hero:not(:has([class*="hf-bf"] ~ .review-hero-actions, [class*="q253"] ~ .review-hero-actions, .notice ~ .review-hero-actions)) > .review-hero-actions{order:4}
  body.rd-guide .review-hero:not(:has([class*="hf-bf"] ~ .rd-verdict, .notice ~ .rd-verdict)) > .rd-verdict{order:4}
  body.rd-guide .review-hero > .panel.rd-qa,
  body.rd-guide .review-hero > p.rd-short{order:6}
  /* reviewer-box is not promo/18+; drop it below the card so the button can fit */
  body.rd-guide .review-hero > .reviewer-box{order:15}

  /* ========== riftgrind.com guides / hubs ========== */
  /* hubs: the top-picks section was left at default order, so the TOC sat between the quick answer and the button */
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#top-picks{order:4;margin:0 0 20px;padding-top:0;border-top:0}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#top-picks > h2{margin-top:0}
  /* first top-picks / top-pick card: button under the name */
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > :is(section#top-picks,section#top-pick,section#starting-point) .tool-grid > .tool-card:first-child,
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > :is(section#top-picks,section#top-pick,section#starting-point) .tool-card:first-child{display:flex;flex-direction:column}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > :is(section#top-picks,section#top-pick,section#starting-point) .tool-card:first-child > *{order:3}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > :is(section#top-picks,section#top-pick,section#starting-point) .tool-card:first-child > .badge{order:0;align-self:flex-start}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > :is(section#top-picks,section#top-pick,section#starting-point) .tool-card:first-child > h3{order:1}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > :is(section#top-picks,section#top-pick,section#starting-point) .tool-card:first-child > .link-cluster{order:2;margin:4px 0 12px}
  /* shave a few pixels so pages ~12–20px short of the fold fit */
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#quick-answer{margin:0 0 6px!important;padding-top:0!important}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#quick-answer > *{margin-top:0}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#quick-answer .quick-answer,
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#quick-answer > div{padding:10px 12px}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > :is(section#top-pick,section#top-picks,section#starting-point){margin:0 0 8px!important;padding-top:0!important;border-top:0}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > :is(section#top-pick,section#top-picks,section#starting-point) > h2{margin:0 0 6px;font-size:1.15rem}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > :is(section#top-pick,section#starting-point,section#top-picks) .tool-card{padding:10px 12px}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > header.page-header > h1{margin-bottom:10px}


  /* Forge comparison heroes: qa-box right after the H1; Higgsfield strip stays after it */
  body.rd-guide .comp-hero{display:flex;flex-direction:column}
  body.rd-guide .comp-hero > *{order:10}
  body.rd-guide .comp-hero > .comp-badge{order:1}
  body.rd-guide .comp-hero > h1{order:2}
  body.rd-guide .comp-hero > aside.qa-box{order:4}
  body.rd-guide .comp-hero > :is([class*="hf-bf"],[class*="q253"],[class*="pp-bf"]){order:6}
  body.rd-guide .comp-hero > .reviewer-box{order:15}
  /* riftgrind hub: tool grid (with the buy button) sits under the heading, intro note follows */
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#top-picks{display:flex;flex-direction:column}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#top-picks > *{order:10}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#top-picks > h2{order:0}
  body.rd:is(.rd-guide,.rd-hub) main .wrap.narrow > section#top-picks > .tool-grid{order:1}

  /* tighter gaps for first-screen */

  /* beat redesign.css specificity so ~12–20px-short guides actually move */
  body.rd:is(.rd-guide,.rd-hub,.rd-deals) main .wrap.narrow:not(:has(> aside.qa-box)) > :is(section#quick-answer,section#verdict){margin-bottom:0!important}
  body.rd:is(.rd-guide,.rd-hub,.rd-deals) main .wrap.narrow:is(:has(> aside.qa-box),:has(> section#quick-answer),:has(> section#verdict)) > header.page-header > h1{margin-bottom:8px!important}
  body.rd:is(.rd-guide,.rd-hub,.rd-deals) main .wrap.narrow:not(:has(> aside.qa-box)) > :is(section#top-pick,section#top-picks,section#starting-point) > h2{margin:0 0 2px!important;font-size:1.1rem}
  body.rd:is(.rd-guide,.rd-hub,.rd-deals) main .wrap.narrow:not(:has(> aside.qa-box)) > :is(section#top-pick,section#starting-point) .tool-grid > .tool-card:first-child{padding:8px 10px}
  body.rd:is(.rd-guide,.rd-hub,.rd-deals) main .wrap.narrow:is(:has(> section#quick-answer)) > header.page-header + *{margin-top:0}

  /* Q344: riftgrind.com/about tap targets are 28px; raise to 44px. Legal pages only. */
  body.rd-legal main a.card-cta,
  body.rd-legal main a.btn,
  body.rd-legal main .page-cta .btn{min-height:44px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box}

  /* ========== Forge category / alternatives hubs (div.wrap > section.hero + section.section) ========== */
  body.rd-guide .wrap:has(> section.hero):has(> section.section){display:flex;flex-direction:column}
  body.rd-guide .wrap:has(> section.hero):has(> section.section) > *{order:10;min-width:0}
  body.rd-guide .wrap:has(> section.hero):has(> section.section) > nav.breadcrumb{order:0}
  body.rd-guide .wrap:has(> section.hero):has(> section.section) > section.hero{display:contents}
  body.rd-guide .wrap section.hero > .eyebrow{order:1}
  body.rd-guide .wrap section.hero > h1{order:2;margin-bottom:10px}
  /* 18+ notice stays visible, un-folded, directly under the H1 (before the buy button) */
  body.rd-guide .wrap section.hero > :is(.notice,.content-warning){order:3;margin:0 0 12px}
  body.rd-guide .wrap section.hero > :is(.page-byline,.prices-checked,.lede,.rd-qa){order:6}
  /* first tools section (quick picks) comes after the H1 / 18+ notice */
  body.rd-guide .wrap > section.hero + section.section,
  body.rd-guide .wrap > section.hero + .disclosure + section.section{order:4;margin-top:0;padding-top:0}
  body.rd-guide .wrap > section.hero + section.section > h2,
  body.rd-guide .wrap > section.hero + .disclosure + section.section > h2{margin-top:0;font-size:1.15rem;margin-bottom:8px}
  body.rd-guide .wrap:has(> section.hero):has(> section.section) > .disclosure{order:3}
  /* first quick-pick card: button under the tool name */
  body.rd-guide .wrap > section.section .grid > article.card:first-child{display:flex;flex-direction:column}
  body.rd-guide .wrap > section.section .grid > article.card:first-child > *{order:3}
  body.rd-guide .wrap > section.section .grid > article.card:first-child > :is(.tag,.badge){order:0;align-self:flex-start}
  body.rd-guide .wrap > section.section .grid > article.card:first-child > h3{order:1}
  body.rd-guide .wrap > section.section .grid > article.card:first-child > .actions{order:2;margin:6px 0 10px}
  body.rd-guide .wrap > section.section .grid > article.card:first-child .btn{min-height:44px}

  /* ========== Forge / Compass / VidLab deals & qa-box: CTA under the title ========== */
  body.rd aside.qa-box{display:flex;flex-direction:column}
  body.rd aside.qa-box > *{order:2}
  body.rd aside.qa-box > .qa-box__title{order:0}
  body.rd aside.qa-box > :is(.qa-box__cta,.q260-qa-ctas){order:1;margin:6px 0 12px}
  body.rd aside.qa-box .qa-box__cta{min-height:44px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box}
  body.rd-deals aside.qa-box .qa-box__cta{width:100%}
}

/* desktop/tablet: no first-screen reordering; 44px about buttons still apply at every width */
body.rd-legal main a.card-cta,
body.rd-legal main a.btn,
body.rd-legal main .page-cta .btn{min-height:44px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box}
