/*
 * Zoey Made — one discovery's page (SL-005).
 *
 * Layout only, and the same discipline the landing's file keeps: every piece here belongs to a
 * component that already styles itself — the page introduction, the paper surface, the character
 * composition, the action, the icon — and this file places them. A rule that would change how one
 * of those *looks* rather than where it *sits* belongs in that component instead.
 *
 * Loaded with the `zoey-made/discover-detail` block, so it reaches a discovery and no other route.
 *
 * ## What is deliberately not here
 *
 * **No page width and no gutter.** Structural width is `--wp--custom--layout--content` from the
 * template, which is `SPL-001`'s column.
 *
 * **No page-level opening or closing space.** That is `components/page-layout.css`, which this
 * template now receives — `D10`, one line in the loader rather than a second set of values here.
 */

/*
 * **The reading measure, and why it is a constraint on the prose rather than a layout.**
 *
 * `SL-005` `AC-03` asks that the prose measure be *independent of the structural column*, and
 * `SPL-001` is the record of what happens when the two are confused: `page.html` sets its layout
 * `contentSize` to `var(--wp--custom--measure)` — `56ch` — and `ch` resolves against **each
 * element's own font size**, so one "column" measured about 1478px on a page title and about 470px
 * on body text. It was never a column at all.
 *
 * So the template's content size stays the structural `48rem`, and the measure is applied **here**,
 * to the running prose, where `ch` means what it says because every element in it is body text.
 * `--wp--custom--measure` is the same token the rest of the site reads for exactly this purpose.
 *
 * **The alignment exclusions are written out rather than wrapped in `:where()`, and that is a
 * measurement rather than a preference.** The first version used `:where()` to keep the specificity
 * at zero, and the prose rendered at **768px** — the structural column — because core's own
 * constrained-layout rule is `.wp-container-… > :where(:not(.alignleft):not(.alignright):not(.alignfull))`
 * at the same specificity, inlined *after* this file, so it won on source order. Naming the
 * exclusions the way core names them raises this above that rule without an `!important` and keeps
 * the intent it was reaching for: **a parent's own aligned block still takes the width its alignment
 * asks for**, and only the running prose is held to the measure.
 */
.zoey-discover-detail .wp-block-post-content > :not( .alignleft ):not( .alignright ):not( .alignfull ):not( .alignwide ) {
  max-inline-size: var(--wp--custom--measure);

  /*
   * **`!important` here, and only here, because core uses it.** Its constrained-layout rule is
   * `margin-left: auto !important; margin-right: auto !important`, so a measure-capped paragraph is
   * **centred inside the column** — measured at 1440 as the explanation starting 115px to the right
   * of the title above it, which reads as a mistake because it is one. `make-landing.css` records
   * the same about core's `!important` on the same property.
   *
   * The start margin is the one that matters; the end stays `auto` so nothing is stretched.
   */
  margin-inline-start: 0 !important;
}

/*
 * **The rhythm between the page's regions is the template's, not this file's.**
 *
 * `main` is a **constrained** group carrying `blockGap: var:custom|layout|section` — `SPL-001`'s own
 * *between sections* role, the same value the four landings share for the gap between their hero and
 * their content, so a discovery reads at the same pace as the page it came from. **No number is
 * written here**, and core's own flow rule applies it.
 *
 * ## Two wrong turns on the way to that, both worth keeping
 *
 * **The first put `display: flex` on this element.** Core's constrained layout puts `max-width` and
 * `margin-inline: auto` on every child; as flex items those regions were capped *and* centred, and
 * the activity's paper collapsed to a strip about one character wide with its heading running
 * vertically. `make-landing.php` had already written the warning — *"constrained would put
 * `margin-inline: auto !important` on every child and collapse the regions to their content width"*
 * — and it was rediscovered by looking at the rendered page rather than by reading it.
 *
 * **The second made `main` flow layout** to escape that, which fixed the collapse and lost the
 * width: `components/page-layout.css` carries the page's top and bottom padding and **not** its
 * column, so every region spread to the full 1440px and the hero grew to 684px beside a 538px
 * paragraph. Establishing a width here instead would have broken the component-library contract's
 * *Page layout* rule in as many words — **a feature stylesheet never establishes a page width.**
 *
 * So the template supplies the column, exactly as `page-standard.html` does for every other reading
 * page on this site, and this file places what sits inside it.
 *
 * ## And the gap is declared here, because the template could not carry it
 *
 * The template asked for it first — `blockGap: var:custom|layout|section` on the group — and core
 * **silently dropped it**. Measured: core emitted the group's constrained-width rule and **no gap
 * rule at all**, while other groups on the same page got theirs, because `blockGap` is serialised
 * from **preset** spacing and this is a `custom` token. Every region sat flush against the next.
 *
 * So it is declared here, in the shape `components/section-landing.css` already uses for the same
 * role and the same token: **the value is `SPL-001`'s, this file holds no copy of it**, and the
 * component-library contract's *Page layout* rule is kept — width and page padding stay the
 * template's, and what this owns is the rhythm between the regions it draws.
 *
 * `page-layout.css`'s `.zoey-page > .wp-block-post-content` rule is two classes to this one's, so the
 * **intro-to-content** role still wins where it belongs: the gap from the title to the explanation
 * is `--wp--custom--layout--intro`, and the gaps between the other regions are
 * `--wp--custom--layout--section`. That is `SPL-001`'s role model, applied rather than re-stated.
 */
/*
 * **The `:root` prefix is load-bearing**, and this file is the third place in this theme to learn it.
 * Core emits `:root :where(.is-layout-constrained) > *` with its own block gap; `:where()` makes
 * that exactly one pseudo-class, the same specificity a bare `.zoey-discover-detail > * + *` has,
 * and core's styles are inlined **after** this file — so the equal-specificity rule lost on source
 * order and every gap measured **24px** instead of the 48px the token resolves to.
 * `section-landing.css` records the identical finding in the identical words. `:root` makes this
 * two, which wins by a class rather than by an `!important`.
 */
:root .zoey-discover-detail > * + * {
  margin-block-start: var(--wp--custom--layout--section);
}


/*
 * The two Back links sit closer to what they belong to than a section gap.
 *
 * The top one is a quiet text link above the title — part of the page's opening, not a region of its
 * own — and the bottom one is the end of the reading rather than a new section after it.
 */
/*
 * **The block margins are core's flow gap and are deliberately not zeroed here.** The first version
 * set `margin: 0` on both links, which silently removed the template's `blockGap` from them — the
 * bottom link ended up tight against Bubble's tip. Only the inline margins are the page's business.
 */
.zoey-discover-detail__back {
  margin-inline: 0;
}

/*
 * The top link sits at the page's own rhythm, like every other region.
 *
 * An earlier version pulled it half a rhythm closer to the title. It did not work — core sets
 * `margin-block-end: 0` on flow children and won — and once measured it was not wanted either: at
 * the full gap the link reads as the page's first line rather than as something stuck to the
 * heading. The rule is removed rather than fixed, because a rule that has to be argued for twice is
 * usually not earning its place.
 */

.zoey-discover-detail__back--top a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

/*
 * The glyph takes the line's own size rather than a number of its own, so it tracks a reader's text
 * settings with the words beside it.
 */
.zoey-discover-detail__back-icon {
  inline-size: 1em;
  block-size: 1em;
}

/*
 * The hero picture keeps its own proportions.
 *
 * `aspect-ratio` is deliberately **not** set: a parent's photograph is whatever shape it is, and
 * forcing it into a ratio would crop something they chose. `height: auto` with a maximum width is
 * what keeps it undistorted at every width — `AC-03`'s *media keeps aspect ratio*.
 */
.zoey-discover-detail__hero {
  inline-size: 100%;
  block-size: auto;
  border-radius: var(--wp--custom--radius--medium);
}

/*
 * **The activity, `D15`: two columns on a wide screen, stacked on a narrow one.**
 *
 * The approved board puts the heading, the introduction and the numbered steps **left** of the
 * picture, and stacks them on a phone with the picture after the steps. The first implementation
 * stacked at every width — it satisfied the contract's sentence and not the picture beside it.
 *
 * The grid is on the **surface's own content wrapper**, because that is the element whose children
 * the two columns are; the surface keeps its padding, its tint and its grain, and this file adds no
 * second box inside it.
 *
 * **Document order is words, then picture**, which is what a stacked screen and a screen reader get,
 * and what a child needs: what to do before what it looks like. The grid changes where they sit and
 * never the order they are read in.
 */
.zoey-discover-detail__activity .zoey-surface__content {
  display: grid;
  gap: var(--wp--preset--spacing--40, 1rem);
}

/*
 * **Only the illustrated shape gets a second column**, which is why the renderer puts a modifier on
 * the surface rather than leaving the stylesheet to guess from the DOM. With no picture there is one
 * child, one column, and **no empty track** — `D15` in as many words.
 *
 * `48rem` is the theme's established cutover for a two-column content region, and `minmax(0, …)` on
 * both tracks is the long-word guard every other grid in this theme carries. The picture column is
 * the smaller of the two: the steps are the thing being read.
 */
@media ( min-width: 48rem ) {
  .zoey-discover-detail__activity--illustrated .zoey-surface__content {
    grid-template-columns: minmax( 0, 1.2fr ) minmax( 0, 1fr );
    align-items: start;
  }
}

.zoey-discover-detail__activity-words > * + * {
  margin-block-start: var(--wp--preset--spacing--30, 0.75rem);
}

.zoey-discover-detail__activity-heading {
  margin-block: 0;
}

.zoey-discover-detail__activity-intro {
  margin-block: 0;
  max-inline-size: var(--wp--custom--measure);
}

.zoey-discover-detail__activity-figure {
  margin: 0;
}

.zoey-discover-detail__activity-image {
  inline-size: 100%;
  block-size: auto;
  border-radius: var(--wp--custom--radius--medium);
}

/*
 * The steps.
 *
 * **An ordinary ordered list, with its numbers left alone.** The order is the meaning — the third
 * thing to do is not the first — and `<ol>`'s own numbering says so to a reader, a screen reader and
 * a printer without a single class. Make's instruction markup is deliberately not borrowed: those
 * classes are read by its publication readiness checks, and wearing them for appearance would make
 * this page an input to another feature's gate.
 */
.zoey-discover-detail__steps {
  margin-block: 0;
  padding-inline-start: 1.25em;
  display: flex;
  flex-direction: column;
  gap: var(--wp--preset--spacing--30, 0.75rem);
}

.zoey-discover-detail__step {
  max-inline-size: var(--wp--custom--measure);
}

/*
 * **Bubble's tip, `D16`: one panel, with one owner for its padding and its edge.**
 *
 * The surface is the panel — its tint, its radius, its grain and its padding — and the
 * character-and-message composition is the row that sits on it. Neither is reimplemented here and
 * nothing is nested inside a second box, which is the *no duplicated padding, border or competing
 * surface rule* the decision asks for.
 *
 * ## Why the body's basis is adjusted, and why that is not reaching into a component
 *
 * The composition wraps when its message cannot hold `18rem`, which is right for an instruction
 * beside a word and too eager for a tip on a 390px phone: the cameo dropped below the words at a
 * width where `D16` asks for it **beside** them. A composing surface adjusting that composition
 * **within its own scope** is an accepted, precedented pattern in this theme —
 * `components/learn-session.css`, from the accepted `WB-003`, scopes rules at
 * `.zoey-character-message__body` and `.zoey-character-message__media` for exactly this reason. The
 * gap question was asked before this rule was written and answered **no API is missing**; nothing is
 * copied from the component and nothing about its defaults changes anywhere else.
 *
 * At enlarged text, or on a screen genuinely too narrow for both, the composition's own wrapping
 * still takes over and the two stack — **inside the same panel**, which is what keeps them one
 * thing.
 */
.zoey-discover-detail__tip-row .zoey-character-message__body {
  flex-basis: 11rem;
}

.zoey-discover-detail__tip-heading {
  margin-block: 0 0.25rem;
  font-size: var(--wp--preset--font-size--medium, 1.125rem);
}

.zoey-discover-detail__tip-message {
  margin-block: 0;
  max-inline-size: var(--wp--custom--measure);
}

/*
 * Printing.
 *
 * **Nothing is invented for paper** — `AC-05` — and nothing about Make's or Learn's printables is
 * touched. The one thing done here is the one thing a reader would ask for: the two navigation
 * links are not printed, because a link is not a thing paper can offer. Everything a child would
 * want on the page — the title, the picture, the explanation, the steps, the tip — prints.
 */
@media print {
  .zoey-discover-detail__back {
    display: none;
  }
}
