/*
 * Zoey Made — the shared callout (VS-005).
 *
 * `inc/content/callout.php` is the renderer, the four roles and the long form of why the Make
 * guide's existing regions keep their class names. This file is the appearance, and it is the
 * **one** declaration of each role's treatment for every markup that wears it:
 *
 *   .zoey-callout--preparation   zoey_made_callout()  ·  .zoey-make-ready
 *   .zoey-callout--hint          zoey_made_callout()  ·  .zoey-make-try
 *   .zoey-callout--challenge     zoey_made_callout()
 *   .zoey-callout--tinker        zoey_made_callout()  ·  .zoey-make-tinker
 *   .zoey-callout--aside         zoey_made_callout()  ·  .zoey-make-why
 *
 * Those four legacy names are core blocks **already saved into published activity guides**, and
 * three of the four are hashed by `inc/make/fingerprint.php` to decide whether a physical
 * walkthrough still applies. They are not renamed, nothing saved was rewritten, and the Make
 * editorial architecture is untouched. What moved is where the tint is written down: it used to
 * be in two stylesheets and is now in one.
 *
 * The Make landing's challenge note has **no legacy name in this file**, and the difference is
 * worth noticing: it is rendered by this theme's own PHP rather than saved into a page, so it was
 * converted to call `zoey_made_callout()` outright. `zoey-make-challenge` survives on it only as
 * the class `make-landing.css` places it on the workbench grid by.
 *
 * Every tint is **unchanged to the percentage point**, including the two pale yellows that are
 * four points apart. None of them is the surface component's, and the renderer's header sets out
 * why: of the Make surfaces, only the feature card's cream is reachable from
 * `zoey_made_surface()`'s variants, and adopting the surface for the rest would mean changing
 * approved tints in order to add a texture. The feature card did adopt it; these did not.
 *
 * What stays in `make-activity.css` is everything about the *guide*: which regions are 48rem
 * wide, the scroll offset the sticky header owes their fragment links, and the one specificity
 * correction core's nested-padding reset requires. Those are facts about a page, not about a
 * callout.
 */

/*
 * The shape every callout shares.
 *
 * `--zoey-callout-tint` is the component's one knob, set by each role below and read by nothing
 * outside this file. A role sets a colour; the shape is stated once.
 *
 * 1rem of padding on a phone, because it is spent out of a 320px screen on top of the root
 * gutter: at 1.5rem a tinted region left 232px for a folding diagram, and MAKE-ACTIVITY-PROD-001
 * §5 asks a diagram to stay legible at that width rather than be pinched. Measured, not guessed.
 */
/*
 * The tint, the radius and the long-word rule, at **one class** of specificity.
 *
 * The weight here is the whole reason this rule and the padding rule below are separate, and
 * VS-005 got it wrong the first time in a way worth writing down. The padding needs two classes
 * to beat a rule of core's (see below). The *tint* must not, because the four role rules further
 * down set `--zoey-callout-tint` at one class each — so a two-class base rule would out-weigh
 * every one of them and every callout on the site would render the default.
 *
 * That is exactly what happened: the first version of this file set the custom property in the
 * two-class rule, and the activity guide's four regions all rendered Surface Soft. The Why region
 * passed its check by coincidence, because Surface Soft is what it was supposed to be. Measured
 * by `scripts/dev/content.mjs`, which reads the painted tint of a role and of the saved core
 * block it shares and fails when they differ — which is the check that caught it.
 */
.zoey-callout,
.zoey-make-ready,
.zoey-make-try,
.zoey-make-tinker,
.zoey-make-why {
  --zoey-callout-tint: var(--wp--preset--color--surface-soft);

  border-radius: var(--wp--custom--radius--large);
  background-color: var(--zoey-callout-tint);

  /*
   * A long single word — a paper size, a URL an editor pasted — must grow the layout rather than
   * break it. MAKE-ACTIVITY-PROD-001 §11, and the case that overflows a 320px screen.
   */
  overflow-wrap: break-word;
}

/*
 * The padding, at **two classes**, and the `.wp-block-group` is load-bearing rather than
 * decorative. A guide section is a constrained `core/group`, so core tags it
 * `has-global-padding` — and core then zeroes the horizontal padding of any `has-global-padding`
 * container nested inside another one:
 *
 *   .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(…))
 *     { padding-right: 0; padding-left: 0 }
 *
 * That reset is right for a plain group, which would otherwise indent twice from the root gutter,
 * and wrong for a tinted band, which needs its type held off its own colour. `:where()` weighs
 * nothing, so core's rule is one class — exactly what a bare `.zoey-make-ready` weighs, and it is
 * printed later, so it won. The symptom was a region whose text sat flush against the tint while
 * its top and bottom padding looked fine, because core only resets left and right.
 *
 * One more selector component, and no `!important`. Padding only: nothing in these two rules is
 * a value a role overrides, which is what keeps the weight difference harmless.
 *
 * 1rem on a phone, because the padding is spent out of a 320px screen on top of the root gutter:
 * at 1.5rem a tinted region left 232px for a folding diagram, and MAKE-ACTIVITY-PROD-001 §5 asks
 * a diagram to stay legible at that width rather than be pinched. Measured, not guessed.
 */
.zoey-callout,
.wp-block-group.zoey-make-ready,
.wp-block-group.zoey-make-try,
.wp-block-group.zoey-make-tinker,
.wp-block-group.zoey-make-why {
  padding: var(--wp--preset--spacing--40);
}

@media (min-width: 48rem) {
  .zoey-callout,
  .wp-block-group.zoey-make-ready,
  .wp-block-group.zoey-make-try,
  .wp-block-group.zoey-make-tinker,
  .wp-block-group.zoey-make-why {
    padding: var(--wp--preset--spacing--50);
  }
}


/* --- The four roles ---------------------------------------------------------------------- */

/*
 * Preparation and hint: pale lavender.
 *
 * MAKE-ACTIVITY-PROD-001 §12 asks for pale lavender preparation and Try regions, and the palette
 * has the preset for it. Two roles, one tint, deliberately: *what to gather* and *what to try if
 * it is not working* are both the page helping rather than instructing, and they are never
 * adjacent, so one colour reads as one voice rather than as two regions that failed to differ.
 */
.zoey-callout--preparation,
.zoey-callout--hint,
.zoey-make-ready,
.zoey-make-try {
  --zoey-callout-tint: var(--wp--preset--color--zoey-lavender-pale);
}

/*
 * Challenge and tinker: pale yellow, and the two tints in this file with no preset behind them.
 *
 * Both are mixed the way `theme.json` mixes its own pale tints — the preset colour against the
 * surface — rather than typed as a hex.
 *
 * **They are four percentage points apart and they stay four percentage points apart.** 34% is
 * Bubble's note on the Make landing; 30% is the guide's Tinker region. Collapsing them to one
 * value would have been the tidier stylesheet and a change to two approved surfaces for no
 * reason anybody asked for — the story's direction is to preserve the intended tint, and these
 * are the intended tints. Whether one pale yellow should serve both roles is a design question
 * with a visible answer, so it is written up as a gap note in the VS-005 report for Product
 * rather than decided here. Nothing depends on it.
 *
 * Consolidation still happened: each value is declared once, where it used to be declared in a
 * different stylesheet from the other, and `zoey_made_callout()` can now ask for either by role
 * name instead of a caller copying a `color-mix` out of `make-activity.css`.
 */
.zoey-callout--challenge {
  --zoey-callout-tint: color-mix(in srgb, var(--wp--preset--color--zoey-yellow) 34%, var(--wp--preset--color--surface));
}

.zoey-callout--tinker,
.zoey-make-tinker {
  --zoey-callout-tint: color-mix(in srgb, var(--wp--preset--color--zoey-yellow) 30%, var(--wp--preset--color--surface));
}

/* Aside: Surface Soft. The calm one — §12's *"a calm Why section"*. Also the default. */
.zoey-callout--aside,
.zoey-make-why {
  --zoey-callout-tint: var(--wp--preset--color--surface-soft);
}

/* --- The body, the label and the tilt ----------------------------------------------------- */

/*
 * The body exists so a child's top margin cannot escape the padding, and so the tilt has one
 * element to counter-rotate. It is this component's own markup only — the Make guide's regions
 * hold core blocks directly, and core's own block gap spaces them.
 */
.zoey-callout__body {
  max-inline-size: var(--wp--custom--measure);
}

.zoey-callout__body > :first-child {
  margin-block-start: 0;
}

.zoey-callout__body > :last-child {
  margin-block-end: 0;
}

/*
 * The label names who is speaking — *"Bubble's challenge:"* — and is deliberately not a heading.
 * It is half a sentence; an `<h3>` around it would put half a sentence in the document outline
 * and in every screen reader's heading list.
 */
.zoey-callout__label {
  font-weight: 700;
}

/*
 * The tilt: a note that reads as a piece of paper dropped on the page.
 *
 * §7 asks that paper content stay level and selectable even where the paper itself is not, so the
 * rotation is on the band and the counter-rotation is on the body. Nobody reads at an angle, and a
 * selection drag across the note selects straight text.
 *
 * It is `rotate` rather than a `transform`, so it composes with anything a page adds and cannot be
 * silently overwritten by a sibling rule that only wanted to translate something.
 */
.zoey-callout--tilt {
  rotate: -0.6deg;
}

.zoey-callout--tilt > .zoey-callout__body {
  rotate: 0.6deg;
}

/* --- Forced colors ---------------------------------------------------------------------- */

/*
 * A tint is decoration, and decoration is replaced by the system's own colours in forced-colors
 * mode — so without this every callout is a region that has stopped looking like one. A hairline
 * in `CanvasText` follows whatever palette the reader has chosen rather than insisting on ours.
 */
@media (forced-colors: active) {
  .zoey-callout,
  .zoey-make-ready,
  .zoey-make-try,
  .zoey-make-tinker,
  .zoey-make-why {
    border: 1px solid CanvasText;
  }
}

/* --- Print ------------------------------------------------------------------------------- */

/*
 * §11's economical ink: no fill, a hairline instead, and the tilt straightened. A rotated block is
 * a rotated block on paper too, and a printed page of a guide is a reference rather than a
 * performance.
 */
@media print {
  .zoey-callout,
  .zoey-make-ready,
  .zoey-make-try,
  .zoey-make-tinker,
  .zoey-make-why {
    border: 1px solid #000;
    background-color: transparent;
  }

  .zoey-callout--tilt,
  .zoey-callout--tilt > .zoey-callout__body {
    rotate: none;
  }
}
