/*
 * Zoey Made — the shared character, and a character beside a message.
 *
 * Approved 2026-10-07 as WB-001. Two things live here and they are deliberately separate: the
 * **picture's size**, which is one declaration per named step, and the **composition**, which is a
 * wrapping row. `inc/content/character.php` explains why the renderer owns no layout; this file is
 * the layout it does not own.
 *
 * ## The caps are the same numbers the `sizes` attribute uses
 *
 * `zoey_made_character_sizes()` declares one length per step and uses it twice — as the `sizes`
 * attribute on the `<img>`, and as the cap below. G1 is explicit that ownership must not split so
 * that two rules compete for one size, so these numbers are not independent choices that happen to
 * agree: they are one table, mirrored, and `scripts/dev/wb-001.mjs` measures that the rendered width
 * matches the declared `sizes` rather than trusting this comment.
 *
 * They are **rem** so they grow with a reader's text settings, and the `sizes` attribute is rem for
 * the same reason — a px `sizes` understates the slot at 200% text and fetches a source too small
 * for the space it paints into.
 */

/*
 * The picture.
 *
 * Capped on the **block** axis with `inline-size: auto`, which is how every existing Bubble on this
 * site is already sized — the homepage's 22/30rem, Make's 3/11rem, the drawing stage's 3.1rem. The
 * aspect ratio stays off this file: it comes from the `width` and `height` the renderer puts on the
 * element, which is also what reserves the box before the bytes arrive.
 *
 * `max-inline-size: 100%` is the one guard that is not about the cap. A 3rem character inside a
 * container narrower than 3rem — a very narrow column at very large text — would otherwise push its
 * own row sideways.
 *
 * **`inline-size: auto` is load-bearing and was briefly removed, which broke Make.** WB-002 took it
 * out on the reasoning that `auto` is the initial value and therefore says nothing — and measured
 * the consequence immediately: the Make cameo rendered **453×176 instead of square**, its aspect
 * ratio gone. The reason is that these characters are block-level replaced elements inside a grid,
 * where an undeclared inline size does not stay intrinsic, and the rule this replaced
 * (`make-landing.css`'s own `inline-size: auto`) had been carrying it.
 *
 * The homepage hero genuinely does own its width — `inline-size: 100%` with `object-fit: contain`,
 * because a tall export would otherwise take most of a phone screen before the visitor reaches
 * Featured Creations. Two single-class selectors declaring one property would leave the cascade to
 * decide on stylesheet order, which is nobody's decision; so `homepage.css` qualifies its selector
 * with the element instead, and wins on specificity rather than on load order.
 */
.zoey-character {
  display: block;
  inline-size: auto;
  max-inline-size: 100%;
  block-size: auto;
}

.zoey-character--cameo {
  max-block-size: 3rem;
}

.zoey-character--inline {
  max-block-size: 6rem;
}

.zoey-character--panel {
  max-block-size: 9rem;
}

.zoey-character--feature {
  max-block-size: 11rem;
}

/*
 * The invitation step — the newsletter panel's Bubbles.
 *
 * Two caps, like `guidance` and `greeting`: 9rem while the panel is stacked, 11rem once it is
 * two-column and she sits beside the invitation with the stationery scenery behind her. The
 * number is paired with the `sizes` attribute in `zoey_made_character_sizes()`, which is the
 * invariant G1 protects — one length, declared once, used twice.
 *
 * The phone cap is deliberately unchanged at 9rem. Product asked for the desktop composition to
 * be given more prominence and for the phone size to be inspected first; it measured 144px in a
 * 316px panel, which is already a cameo rather than a dominant illustration.
 */
.zoey-character--invitation {
  max-block-size: 9rem;
}

@media (min-width: 48rem) {
  .zoey-character--invitation {
    max-block-size: 11rem;
  }
}

/*
 * The guidance step — WB-003's cameo beside an instruction inside a Learn step.
 *
 * Two numbers, and the small one is a **measurement rather than a taste**. The spelling practice's
 * active step has 84px of vertical room at 320x800 before `focusStep()`'s *"is this step genuinely
 * out of sight"* test starts firing on reveal — measured against the longest sentence the content
 * model allows, which is the case LRN-004 photographed and holds still. A 6rem cameo and its row
 * gap cost 112px and overshot it by 28; a 3rem cameo costs 64 and leaves 20 to spare. From 30rem
 * the same step has 164px of room and more, so the drawing is the 6rem the composition was
 * designed around.
 *
 * It is the narrow screen that gets the smaller drawing, which is also the right way round to look
 * at: below 30rem the composition stacks, so the cameo is sitting *above* the sentence it belongs
 * to rather than beside it, and a 96px drawing in that position reads as a picture with a caption.
 *
 * `max-block-size`, like every step except Make's: this is a ceiling, and a pose whose export is
 * smaller should paint smaller rather than be stretched.
 */
.zoey-character--guidance {
  max-block-size: 3rem;
}

@media (min-width: 30rem) {
  .zoey-character--guidance {
    max-block-size: 6rem;
  }
}

/*
 * The section step — SL-001's compact section-landing arrival.
 *
 * Two numbers, and both are **existing caps rather than new ones**: 6rem is `inline`'s and 9rem is
 * `panel`'s. `DESIGN-CONTRACT.md` §2 asks for roughly 120px of visible Bubble on a desktop and
 * 80px on a phone, and is careful to call those *optical* targets — a transparent square canvas is
 * not a body. So the targets were converted rather than guessed: the Make master's opaque body
 * fills **86.8%** of its 1254px canvas, measured as an alpha bounding box at alpha > 8, against the
 * accepted Welcome pose's 86.0%. 9rem of canvas paints about **125px** of Bubble and 6rem about
 * **83px**, both within 4% of what was asked for, and the nine approved masters span 84.5-90.2% so
 * the conversion holds for the four section poses still to come.
 *
 * 720px, because that is where `make-landing.css` takes the collection from one column to two. The
 * hero going side by side at the same width is what makes the page change shape **once**.
 *
 * `max-block-size`, not `block-size`: this is a ceiling. A pose whose committed export is smaller
 * should paint smaller rather than be stretched, which is the rule every step but Make's greeting
 * follows.
 */
.zoey-character--section {
  max-block-size: 6rem;
}

@media (min-width: 720px) {
  .zoey-character--section {
    max-block-size: 9rem;
  }
}

/*
 * The arrival step is the one responsive cap, and its two numbers are the homepage hero's own: 22rem
 * stacked under the copy, 35rem beside it from 900px. 900px is where `page-intro.css` and
 * `homepage.css` already change shape, so the page changes once rather than twice.
 *
 * **The desktop number was 30rem until SL-012**, and it is raised rather than joined by a new step
 * because this cap has exactly one consumer — the homepage hero — and that is what the paragraph
 * above has always said. A second step would have been a second owner of one surface's size.
 *
 * 35rem is the approved composition's own 560px box, measured off `hero-desktop.svg`: Bubbles is
 * placed at 560x560 there, against 350x350 in `hero-mobile.svg`, and 22rem is 352px — within two
 * pixels of the phone number, so only one of the two actually moved. The committed ladder reaches
 * 1120, which is 560 at 2x and 350 at 3x, and the master is 1254 wide, so neither slot upscales.
 */
.zoey-character--arrival {
  max-block-size: 22rem;
}

@media (min-width: 900px) {
  .zoey-character--arrival {
    max-block-size: 35rem;
  }
}

/*
 * The greeting step — Make's welcome cameo, adopted by WB-002.
 *
 * Two numbers, and they are Make's own: 3rem where the cameo shares a line with the words, and
 * 11rem from 64rem up, where `make-landing.css` records that *"Bubble is the welcome column, not a
 * footnote to it"* and an 11rem drawing is what stops the 38% column reading as an empty margin.
 * The numbers did not change when they moved here; what changed is that there is now **one** owner
 * of them, and the `sizes` attribute is generated from the same table rather than written twice.
 *
 * `block-size` rather than `max-block-size`, which is what Make had: this cameo is sized, not
 * capped, and the distinction is real — a `max` would let a smaller source paint smaller.
 */
.zoey-character--greeting {
  block-size: 3rem;
}

@media (min-width: 64rem) {
  .zoey-character--greeting {
    block-size: 11rem;
  }
}

/* --- Which way she faces ---------------------------------------------------------------------- */

/*
 * `D8`: Bubble faces the content she is beside.
 *
 * **One declaration on the image and nothing else.** `scaleX(-1)` rather than `rotateY(180deg)`,
 * which is the same picture by a shorter route — a Y rotation on a flat element is a mirror, and it
 * drags a 3D transform and its own stacking context along for no reason. The homepage hero uses the
 * rotation because it predates this rule; `COMPONENT-INVENTORY.md` records that as a follow-up for
 * the story that owns Home rather than a thing to change from here.
 *
 * It changes nothing about layout. A transform paints differently and measures identically, so a
 * mirrored character reserves exactly the box an unmirrored one does, and every stability
 * measurement in Learn is unaffected by which way she is looking.
 *
 * Only the **image** is mirrored, which is the whole of what `D8` authorizes. There is deliberately
 * no rule here that could reach a wrapper, a composition or a word: mirrored text is unreadable, and
 * the one way to be sure none is ever mirrored is for this selector to name the picture.
 *
 * No rule for `right`. It is the artwork's own direction, the renderer emits no class for it, and a
 * `transform: none` declaration would be a second owner of a property nobody is setting.
 */
.zoey-character--facing-left {
  transform: scaleX(-1);
}

/* --- A character beside a message ------------------------------------------------------------ */

/*
 * A wrapping row, and no breakpoint anywhere.
 *
 * `flex: 1 1 18rem` on the body is what decides whether this is one row or two. The message takes
 * its own line as soon as less than 18rem is left for it, and sits beside the character whenever
 * there is room. The thing that runs out of room is not the viewport — it is the space left after a
 * character whose size is in rem, so it is a reader's text setting and the column's own width that
 * decide, and a media query can see neither. 18rem is roughly forty characters at body size, which
 * is the point below which a line of instruction stops being comfortable to read.
 *
 * `min-inline-size: 0` on the body is the long-word guard `page-intro.css` documents for its own
 * content column: a flex item's automatic minimum is its min-content width, so without it a single
 * unbreakable word keeps asking for more space than the row has.
 */
.zoey-character-message {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wp--preset--spacing--40);
}

.zoey-character-message--center {
  align-items: center;
}

.zoey-character-message--top {
  align-items: flex-start;
}

.zoey-character-message__media {
  flex: 0 0 auto;
  min-inline-size: 0;
}

/*
 * `min-inline-size: 0` and `overflow-wrap: anywhere` are two halves of one fix, and the first on its
 * own is not enough — which this component proved rather than inherited.
 *
 * The zero minimum lets the flex item shrink below its min-content width, so one long word cannot
 * push the row sideways. But the *text* still has nowhere to break, so it overflows its own box
 * instead: measured at 320px with the root font at 32px, a 303px word in a 214px body, and 36px of
 * document scrolling sideways. The specimen written to probe exactly this is what caught it, and
 * `npm run library:test` failed on it.
 *
 * `anywhere` rather than `break-word`, for the reason `page-intro.css` records from STORE-013 and
 * PRODUCT-009: both break a word that cannot fit, but only `anywhere` also tells the layout that
 * the minimum width is a character rather than the longest word, which is what a shrink-to-fit
 * column asks for. A message whose words already fit is unaffected, so only a reader at very large
 * text on a narrow screen ever sees a word split.
 */
.zoey-character-message__body {
  flex: 1 1 18rem;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

/*
 * The message's own first and last children lose their outer margins, so the row's `align-items`
 * decides the alignment rather than a paragraph's margin collapsing against it. Scoped to the body
 * so a callout passed in as the message keeps its own padding untouched.
 */
.zoey-character-message__body > :first-child {
  margin-block-start: 0;
}

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

/* --- Forced colours --------------------------------------------------------------------------- */

/*
 * The approved masters are pale pastel with a thin outline on roughly 50% transparency, which is the
 * shape of artwork that can disappear when the system replaces the page's colours. The logo needed a
 * scoped white plate for exactly this reason (`header.css`), and the treatment here is **not** being
 * guessed at from an emulator: `DECISIONS.md` gate 4 holds it as Engineering evidence followed by
 * Product acceptance, and `VALIDATION.md` requires a real Windows High Contrast review rather than a
 * Chromium emulation or macOS Increase Contrast.
 *
 * So this file deliberately declares **no** forced-colours treatment yet. Stated rather than left as
 * an absence, so a later story does not read the silence as an oversight and add a plate nobody
 * reviewed.
 */

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

/*
 * The character goes, the words stay — the same call `page-intro.css` makes about its own media
 * region, and §11's economical ink. A drawing of a character is the most expensive thing in a
 * helper line to print and the one that carries least on paper. The message is untouched, so a
 * printed step keeps its instruction.
 */
@media print {
  .zoey-character {
    display: none;
  }
}
