/*
 * Zoey Made — the Make activity guide.
 *
 * One readable page: an overview, what to gather, the numbered folds, a flight, one change,
 * and a short explanation. MAKE-ACTIVITY-PROD-001 §4, §5 and §6 are what this lays out, and
 * §5's step order is the rule the whole file is arranged around:
 *
 *   below 48rem   number and title -> illustration -> explanatory text, always
 *
 * That order is the document's own. Nothing here floats, grids or reorders anything at a
 * narrow width, so a diagram cannot end up beside the sentence that explains it — the failure
 * §1 tells us the generated concept gets wrong. The two-column step row exists only from
 * 48rem up, where both halves still have room to be read.
 *
 * Loaded with the zoey-made/activity-facts block, which renders only on an activity guide, so
 * none of this reaches the shop, the cart or checkout. Design values come from theme.json;
 * the one exception is commented where it is made. See docs/CSS-AND-ASSETS.md.
 */

/*
 * The guide's four tinted regions are no longer styled here.
 *
 * MAKE-ACTIVITY-PROD-001 §12 asks for pale lavender preparation and Try regions, a pale yellow
 * Tinker region and a calm Why section, and VS-005 moved all four treatments into
 * `components/callout.css`, which is now the one place any callout's tint, radius, padding,
 * forced-colors hairline and print behaviour is written down — for this guide's saved core blocks
 * and for `zoey_made_callout()` alike. **Every tint is unchanged to the percentage point**,
 * including the pale yellow, which stays at 30% rather than being collapsed into the Make
 * landing's 34%; that is a design question for Product and is a gap note in the VS-005 report.
 *
 * The marker classes are untouched, which matters here more than anywhere else on the site:
 * `zoey-make-ready`, `zoey-make-try` and `zoey-make-tinker` are hashed by
 * `inc/make/fingerprint.php`, so a rename would reset physical-walkthrough validation on an
 * accepted guide. Nothing saved was rewritten.
 *
 * What stays in this file is everything about the *guide* rather than about a callout: how wide
 * each region is, the scroll offset the sticky header owes its fragment links, and the long-word
 * rule. See docs/MAKE-EDITORIAL-ARCHITECTURE.md.
 */

/*
 * What the sticky header owes this page's fragment links.
 *
 * components/header.css already gives `[id]:target` the offset, which covers a link being
 * followed. This repeats it for the guide's own headings unconditionally, because the browser
 * also scrolls to them without :target ever matching — restoring a position on Back, and
 * re-following a fragment the URL is already on, which is exactly what "Try another flight"
 * does from inside Try it. The measurement is the header's own variable, so the two cannot
 * drift apart.
 */
.zoey-make-ready :is(h2, h3)[id],
.zoey-make-steps :is(h2, h3)[id],
.zoey-make-try :is(h2, h3)[id],
.zoey-make-tinker :is(h2, h3)[id],
.zoey-make-why :is(h2, h3)[id] {
  scroll-margin-block-start: calc(var(--zoey-site-header-height) + var(--wp--preset--spacing--40));
}

/*
 * The guide reads down one column, and the title is part of it.
 *
 * Every section is a `wide` block so that it can escape the reading measure, and then this is
 * the width they all share: one 48rem column, from the title to the last link. Measured before
 * it existed, the title spanned 1360px on a 1440px screen against a 768px article and read as
 * two pages. §5 asks the main article not to exceed roughly 52rem. All of it is scoped to this
 * stylesheet, so it is true on a guide and changes nothing anywhere else.
 */
main .wp-block-post-content > :is(
  .zoey-make-intro,
  .zoey-make-contents,
  .zoey-make-ready,
  .zoey-make-steps,
  .zoey-make-try,
  .zoey-make-tinker,
  .zoey-make-why,
  .zoey-make-continue
) {
  max-inline-size: 48rem;
  margin-inline: auto;
}

/*
 * Both selectors above are written against core's generated layout rules rather than at their
 * natural weight, and the weights are the reason. The title's cap is
 * `var(--wp--custom--measure)` — 56 *characters of the title's own type*, 1478px at 2.75rem,
 * which constrains nothing — at the same specificity as a bare `.wp-block-post-title`; the
 * sections' cap is the container's `> .alignwide` rule at two classes. Each rule here carries
 * one more component than the rule it is correcting, and no `!important`.
 */
main > .wp-block-post-title {
  max-inline-size: 48rem;
  margin-inline: auto;
}

/*
 * A title is content, not a measurement. §11 requires a long one to grow the layout rather
 * than break it, and a single unbroken word — a paper size, a URL an editor pasted — is the
 * case that overflows a 320px screen. Scoped to this stylesheet, so it applies on a guide and
 * changes nothing anywhere else.
 */
.wp-block-post-title,
.zoey-make-ready,
.zoey-make-steps,
.zoey-make-try,
.zoey-make-tinker,
.zoey-make-why {
  overflow-wrap: break-word;
}

/*
 * The overview: the back link, the invitation, the finished result and the two facts.
 *
 * Back to Make, Try another flight and the section links are §8's navigation contract, so they
 * are major controls and carry §12's 44px target in their own box. Measured before the padding
 * existed, the back link was 19px tall. The padding is vertical only: these are links in a
 * line of text, not buttons, and widening them would break the line.
 */
.zoey-make-back {
  font-size: var(--wp--preset--font-size--body-small);
  margin-block-end: var(--wp--preset--spacing--30);
}

.zoey-make-invitation {
  font-size: var(--wp--preset--font-size--section-small);
  color: var(--wp--preset--color--ink);
}

/*
 * On this page.
 *
 * §5 is explicit that these are ordinary wrapping links and not a horizontally scrolling tab
 * bar, so they stay in normal flow at every width. The padding is what gives each one a
 * 44px-tall target without turning a sentence of links into a row of buttons — §12's target
 * size, met by the link box rather than by a control drawn around it.
 */
.zoey-make-contents {
  font-size: var(--wp--preset--font-size--body-small);
}

.zoey-make-contents a,
.zoey-make-back a,
.zoey-make-continue a {
  display: inline-block;
  padding-block: var(--wp--preset--spacing--30);
}

/*
 * The facts, in both of their placements.
 *
 * A description list of label/value pairs, laid out as rows that wrap. Nothing here is a
 * table: these are pairs, not a grid of data, and a wrapping list survives 320px and 400%
 * zoom without a scroll container.
 */
.zoey-make-facts__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--50);
  margin: 0;
}

.zoey-make-facts__fact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--wp--preset--spacing--20);
  min-inline-size: 0;
}

.zoey-make-facts__label {
  color: var(--wp--preset--color--ink-soft);
  font-size: var(--wp--preset--font-size--body-small);
}

.zoey-make-facts__value {
  margin: 0;
}

.zoey-make-facts__jump {
  display: inline-block;

  /* Same 44px target: 1.5rem of line plus 0.75rem above and below. */
  padding-block: var(--wp--preset--spacing--30);
}

/*
 * The finished result sits above its facts on a phone and beside them from 48rem, which is the
 * same stacking promise the steps make. The image keeps the dimensions core wrote onto it, so
 * the space it will occupy is reserved before it arrives and §11's image-network-failure row
 * costs no layout shift.
 */
.zoey-make-facts--summary {
  display: flex;
  flex-direction: column;
  gap: var(--wp--preset--spacing--50);
}

.zoey-make-facts__result {
  margin: 0;
}

.zoey-make-facts__result-image {
  border-radius: var(--wp--custom--radius--medium);
}

@media (min-width: 48rem) {
  .zoey-make-facts--summary {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .zoey-make-facts--summary .zoey-make-facts__result {
    flex: 0 1 20rem;
  }

  .zoey-make-facts--summary .zoey-make-facts__list {
    flex: 1 1 14rem;
    flex-direction: column;
  }
}

/* Get ready: the list of things to gather, then the paper and the help level, then the PDF. */
.zoey-make-facts--ready {
  display: flex;
  flex-direction: column;
  gap: var(--wp--preset--spacing--40);
}

.zoey-make-facts__heading {
  font-size: var(--wp--preset--font-size--card-title);
  margin: 0;
}

.zoey-make-facts__materials {
  margin: 0;
  padding-inline-start: var(--wp--preset--spacing--50);
}

.zoey-make-facts__material {
  margin-block: var(--wp--preset--spacing--10);
}

/*
 * Print the guide.
 *
 * A native link to a file, the whole of §8's contract for it, with the format and size beside it
 * rather than inside its name. When there is no valid printable the block renders nothing at all,
 * so there is no disabled state to style — by design.
 *
 * The control itself is `zoey_made_action()` at `secondary`, `compact` (VS-005), so its pill, its
 * 44px box, its hover and focus behaviour, its forced-colors border and its print treatment are
 * `components/action.css`'s. `.zoey-make-facts__print-link` survives as a positioning hook with no
 * declarations of its own. One visible change came with it, recorded in the VS-005 report: the
 * control gained §8's *visible* outline in Ink Soft, where before it was a white pill with no
 * border on a lavender region.
 */
.zoey-make-facts__printable {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--wp--preset--spacing--30);
  margin: 0;
}

.zoey-make-facts__print-note {
  color: var(--wp--preset--color--ink-soft);
  font-size: var(--wp--preset--font-size--body-small);
}

/*
 * The steps.
 *
 * The number is a CSS counter rather than a typed digit, so adding, removing or reordering a
 * fold cannot leave a wrong number behind — §11's "numbers and navigation remain correct",
 * and the reason docs/MAKE-AUTHORING.md tells an author not to type one.
 *
 * It is generated content, which means it is presentation: the step's own heading still says
 * what the fold does in words, and the explanatory text still describes the action completely,
 * so a reader who never receives the counter has lost an ordinal and nothing else. The visual
 * order is the document order either way.
 */
.zoey-make-steps {
  counter-reset: zoey-make-step;
}

.zoey-make-step {
  counter-increment: zoey-make-step;
  margin-block-start: var(--wp--preset--spacing--60);
}

.zoey-make-step > .wp-block-heading::before {
  content: counter(zoey-make-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 2rem;
  min-block-size: 2rem;
  margin-inline-end: var(--wp--preset--spacing--30);
  padding-inline: var(--wp--preset--spacing--20);
  border-radius: var(--wp--custom--radius--pill);
  background-color: var(--wp--preset--color--zoey-pink-pale);
  color: var(--wp--preset--color--ink);
  font-size: var(--wp--preset--font-size--body);
}

/*
 * No fixed height and no clipping: a step is as tall as what is in it. §5 and §11 both ask for
 * that in so many words, and it is the default — it is written down so a later change cannot
 * quietly introduce one.
 */
.zoey-make-step {
  block-size: auto;
  overflow: visible;
}

.zoey-make-step > .wp-block-image {
  margin-block: var(--wp--preset--spacing--40);
}

/*
 * From 48rem, and only from 48rem, a step may put its diagram beside its instruction.
 *
 * Flex with wrapping rather than a grid of named areas, because the number of elements in a
 * step is the author's: a second paragraph, a note, a second diagram. Each one keeps a 17rem
 * basis and wraps to its own row when the space is not there, so nothing overlaps and nothing
 * is clipped whatever an author adds. Below this width the rule does not exist at all, which
 * is what makes §5's stacking order structural rather than a thing to remember.
 */
@media (min-width: 48rem) {
  .zoey-make-step {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    column-gap: var(--wp--preset--spacing--50);
    row-gap: var(--wp--preset--spacing--40);
  }

  .zoey-make-step > * {
    flex: 1 1 17rem;
    min-inline-size: 0;
  }

  .zoey-make-step > .wp-block-image {
    flex: 0 1 17rem;
    margin-block: 0;
  }

  .zoey-make-step > .wp-block-heading {
    flex: 1 1 100%;
  }
}
