/*
 * Zoey Made — the paper surface (VS-004).
 *
 * The three surfaces of STYLE-GUIDE-v1.md §6 — plain, soft paper, featured paper — and the
 * four things that are controlled separately on them: the variant, the tint, the grain and the
 * decoration (torn edges and tape). `inc/surface/surface.php` is the renderer and the
 * allowlists; this file is the appearance.
 *
 *   <div class="zoey-surface zoey-surface--soft-paper zoey-surface--edge-top">
 *     <span class="zoey-surface__tape zoey-surface__tape--top-left …" aria-hidden="true"></span>
 *     <div class="zoey-surface__content">…</div>
 *   </div>
 *
 * ## The layers, and why the content is not one of them
 *
 *   ::before   the paper: the tint, masked by whatever edges are on
 *   ::after    the grain: one tiled neutral texture, masked identically, own strength
 *   __content  the content, above both
 *   __tape     tape, above everything, inert
 *
 * Every decorative layer is `pointer-events: none`, and the two that carry the tint, the
 * texture and the tears are pseudo-elements — so there is nothing for a pointer to hit and
 * nothing in the accessibility tree, because there is nothing in the tree at all.
 *
 * **Nothing masks the surface itself.** A mask on the element clips its children, and a focus
 * ring drawn just outside a control sitting near a torn edge is exactly what would be clipped.
 * So the tear is applied to the decorative layers and the content box is left whole. Measured
 * in scripts/dev/materials.mjs rather than asserted here.
 *
 * ## Grain and tint are two layers on purpose
 *
 * They could be one — a tint in `background-color` with the grain as a `background-image` over
 * it — and that is one layer cheaper. They are two because the story asks for them to be
 * independently controlled, and sharing a layer means the grain's strength is baked into the
 * asset. Split, `--zoey-surface-grain` is a number a reviewer can be shown more or less of
 * without anything being redrawn.
 *
 * ## When the assets are not there
 *
 * Every decorative asset here is a `background-image` or a `mask-image` on a layer that is not
 * the surface. If one fails to load the tint, the padding, the radius and the border are
 * unaffected and the content is unmoved: the surface degrades to a plain tinted card, which is
 * a legitimate surface rather than a broken one. The one case that needs stating is the mask —
 * a mask whose image fails resolves to *nothing masked out*, so a torn edge that cannot load is
 * a straight edge, not a vanished card.
 *
 * ## Two adopters, and why they are named in this file rather than copied into another
 *
 * `SL-008`'s `D4`. The Cart's totals region has to be this material, and it is **not markup this
 * theme renders**: `.wc-block-cart__sidebar` is built by WooCommerce's React: it is absent from the
 * server response, and `SL-008`'s `G1` probe measured a server-rendered wrapper around
 * `cart-totals-block` destroyed at hydration and destroyed again on the filled-to-empty
 * transition. So `zoey_made_surface()` cannot reach it, and the only route left is a selector.
 *
 * The selector is **here**, in the material's own file, rather than a tint and a grain written
 * again in `components/commerce.css`. That is the whole of the decision: a second declaration of
 * the paper is a second paper, and the next change to the grain would move one of them. Every
 * property the adopter takes — the tint percentage, the grain strength and its tile size, the
 * padding, the radius, the containment, the forced-colors hairline and the print reset — is
 * declared exactly once, in the rule above that already declared it, with one more selector on it.
 * Nothing about `.zoey-surface` changes, and the two selectors can never match the same element.
 *
 * `components/commerce.css` owns the rest: where the panel sits in the Cart's two columns, what is
 * lifted above the paper, and where the accents go. Material here, composition there.
 *
 * **The one thing the adoption cannot have is the container query**, because the adopter *is* the
 * query container and an element cannot respond to its own. The narrow step is written as a media
 * query in the adopter's own section below, which is the honest version of that limitation rather
 * than a container query that silently never fires — `SL-007` shipped exactly that bug once.
 *
 * ## The second adopter — Checkout's order summary, `SL-009`'s `G2`
 *
 * `.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block`,
 * threaded through the same thirteen rules, with every property still declared exactly once.
 *
 * **Checkout's architecture is not the Cart's, and the Cart's conclusion does not transfer.**
 * `SL-008`'s `G1` found its sidebar absent from the server response with 12 of 15 scaffold nodes
 * destroyed at hydration. Checkout's summary wrapper **is** in the server response and **does**
 * survive: React re-uses the node and rewrites its `className`. Measured stable across hydration,
 * the billing expand and collapse, and the coupon panel opening.
 *
 * So why a selector here rather than `zoey_made_surface()`? Because what React owns is the
 * `className` string, which it rewrites — a class this theme adds to that node is not reliably
 * still there a moment later, and the renderer would have to wrap the node to apply its own markup
 * contract. A selector on the **block class WooCommerce itself writes** is the one hook that
 * survives both, which is the same conclusion the Cart reached by a different measurement.
 *
 * **Why the child and not the `totals-block` itself**, which is what `G2` names. They are the same
 * region — the panel is the block's only summary child — and the child is the honest box. At
 * `is-large` widths WooCommerce puts its column gutter *inside* the block as
 * `padding-inline-start`, measured 28px at 1440 and 16px at 768, so paper on the block would paint
 * a strip of cream in the gap between the two columns. The gutter cannot simply be moved to a
 * margin either: the layout is `flex-wrap: wrap` with `box-sizing: border-box` and computed widths,
 * so widening the sidebar past its basis risks wrapping the columns onto separate lines.
 *
 * **The `>` is load-bearing, and it is what keeps `G2`'s ruling true.** Below roughly 640px
 * WooCommerce renders a *second* order summary — a full one inside
 * `.wc-block-checkout__main > form > .wc-block-checkout__actions`, just above Place Order — and
 * `G2` leaves that one native white. The child combinator matches the sidebar's summary and never
 * the lower one, because the lower one is not a child of any `totals-block`. Measured: exactly one
 * match at 1440, 768, 600, 390 and 320, while the document holds two summaries at the last three.
 * A descendant selector would have papered both.
 *
 * **Its two pseudo-elements are spent here**, on the paper and the grain, so Checkout's star and
 * heart cannot also hang off this element. They hang off the summary's own heading instead — see
 * `components/decoration.css` and `components/doodle.css`, which adopt that host the same way.
 *
 * `components/commerce.css` owns the rest, as it does for the Cart: the white ground, the fields,
 * what is lifted above the paper, and where the accents go. Material here, composition there.
 */

.zoey-surface,
.woocommerce-cart .wc-block-cart__sidebar,
.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block {
  /*
   * The knobs. Every one of these is read by the layers below and by nothing outside this
   * component, which is what makes them component-local variables rather than tokens.
   */

  /* How much tint is mixed into white. The variants set it; nothing else should. */
  --zoey-surface-tint-strength: 0%;
  /* Which palette colour the tint is mixed from. */
  --zoey-surface-tint: var(--wp--preset--color--zoey-yellow);
  /*
   * Grain strength. 0 turns the grain off without changing anything else.
   *
   * It is an `opacity`, so the useful range is 0 to 1 and **a value above 1 is clamped to 1**.
   * Worth saying out loud: VS-004's first round set featured paper to 1.15 meaning "a little
   * more than soft paper's 1", and got exactly soft paper's 1. The two variants rendered
   * identical grain while the stylesheet and the report both said otherwise. Keep every value
   * here at or below 1, and keep the difference between two variants a real difference.
   */
  --zoey-surface-grain: 0;
  --zoey-surface-grain-size: 96px;
  /*
   * The tear's amplitude. The tile is 240 x 14, drawn at `auto <height>`, so this scales the
   * tear and the tile width together — the shape never distorts, and a bigger number is a
   * bigger tear rather than a stretched one.
   */
  --zoey-surface-edge-height: 16px;
  --zoey-surface-tape-length: 112px;
  /*
   * Masking tape. `cream` — Product's selection on 2026-10-02 from the two candidates VS-004 put
   * side by side on white and on paper. Warm enough to read as tape against both, light enough
   * to stay material rather than becoming an accent.
   *
   * This is the one place the default colour is written. `paper`, the cooler candidate it was
   * chosen over, is retained as an option and carries the class; the default needs none.
   */
  --zoey-surface-tape-color: color-mix(in srgb, var(--wp--preset--color--zoey-yellow) 22%, var(--wp--preset--color--border-soft));

  /*
   * Derived, not set by callers. The paper's colour is one mix, so a variant changes a
   * percentage rather than restating a `color-mix`, and a tint changes a hue without touching
   * the strength. This is the whole of "grain, tint, tape and edges are independent".
   */
  --zoey-surface-paper: color-mix(in srgb, var(--zoey-surface-tint) var(--zoey-surface-tint-strength), var(--wp--preset--color--surface));

  position: relative;
  /*
   * Isolated so the surface's own stacking order is its own. Without it, a page that gives a
   * sibling a z-index decides whether this surface's tape is above or below its content, which
   * is not a decision a page should be able to make.
   */
  isolation: isolate;
  border-radius: var(--wp--custom--radius--large);

  /*
   * A container, so the surface reacts to **its own** width rather than the window's.
   *
   * This is the case docs/CSS-AND-ASSETS.md names: a card in a two-column grid is half the
   * width of the window, and a media query cannot tell. A surface in a narrow column should
   * bring its padding and its tape in whether the window is 320px or 1440px. It is also what
   * makes the 320px specimen on the showcase honest — it is a real narrow surface on a desktop
   * screen rather than a picture of one — and a container query in `rem` sees a reader at 200%
   * text, which a media query never does.
   *
   * The cost, worth stating because it is a real constraint on callers: inline-size containment
   * means a surface's width is computed without looking at its contents, so a surface takes the
   * width it is given and does not shrink to hug its content. That is what a card should do —
   * §5: layouts own grids, cards own their internal content — but a caller that drops one into
   * a flex row expecting it to be as wide as its text will get a surface that is not.
   */
  container: zoey-surface / inline-size;
}

/*
 * The paper, and the grain, drawn identically except for what they paint.
 *
 * Both are pinned to the surface's own box. Neither is in the tab order or the accessibility
 * tree, because a pseudo-element cannot be in either.
 */
.zoey-surface::before,
.zoey-surface::after,
.woocommerce-cart .wc-block-cart__sidebar::before,
.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block::before,
.woocommerce-cart .wc-block-cart__sidebar::after,
.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
}

.zoey-surface::before,
.woocommerce-cart .wc-block-cart__sidebar::before,
.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block::before {
  background-color: var(--zoey-surface-paper);
}

.zoey-surface::after,
.woocommerce-cart .wc-block-cart__sidebar::after,
.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block::after {
  background-image: url("../../svg/paper/grain.svg");
  background-repeat: repeat;
  background-size: var(--zoey-surface-grain-size) var(--zoey-surface-grain-size);
  opacity: var(--zoey-surface-grain);
}

/*
 * The content sits above both layers. Wrapped, so a child's top margin cannot escape the
 * padding.
 *
 * The padding is here rather than on the surface because the surface is the query container,
 * and an element cannot respond to its own container query — the thing being sized has to be a
 * descendant. Visually it is the same padding: the paper layer is inset to the surface's whole
 * box, so where the inset is declared changes nothing about what is painted.
 */
.zoey-surface__content,
.woocommerce-cart .wc-block-cart__sidebar,
.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block {
  position: relative;
  z-index: 1;

  /*
   * A surface is never widened by what is put on it (VS-006).
   *
   * The surface declares inline-size containment, so it takes the width it is given — but its
   * *content* has no such promise, and an unbreakable token inside it pushes the content box past
   * the card. VS-004's own size specimen has carried the word *supercalifragilistic* since it was
   * written, precisely to test this; at 320px with a reader's text at 200% it laid out 248px of
   * paragraph in a 150px box and the showcase page scrolled sideways because of it. The test case
   * was right and nothing was checking it.
   *
   * Inherited, so it is a floor rather than a ceiling: a component placed on a surface that sets
   * its own `overflow-wrap` still wins, and every one of VS-005's does. `anywhere` breaks a token
   * only when it cannot fit, so nothing moves at ordinary text sizes.
   */
  overflow-wrap: anywhere;
}

/*
 * The padding, split in two because one consumer cannot afford it in rem.
 *
 * Every property of this material is declared exactly once, which is why this is two rules rather
 * than one rule and an override: each consumer's padding is stated in exactly one place.
 *
 * **The surface and the Cart take the token.** Both are given their width by this theme — a
 * `--wp--custom--layout--content` column or the Cart's own sidebar — so a padding that grows with
 * the reader's text grows inside a box that grew with it too.
 *
 * **Checkout's adopter cannot**, and `SL-009`'s correction pass is where that was measured rather
 * than assumed. WooCommerce sizes the checkout sidebar in **pixels**: 406px at 1440, 309px at
 * 1024 and **231px at 768**, and those numbers do not move when a reader doubles their text. The
 * token does. At a 32px root `--wp--preset--spacing--50` resolves to 48px, so 96px of a 231px
 * column was padding and the summary had **135px** left to lay out a thumbnail, a product name, a
 * description and a price in. Measured: the content overflowed the paper by up to 147px and the
 * page itself scrolled sideways by 68px.
 *
 * `min()` against a percentage is the fix, and the percentage is the point: a padding expressed
 * as a share of the containing block **cannot** take more of the column than it is given, whatever
 * the root font does. The token still wins wherever there is room for it — 24px at 1440, which is
 * why the accepted desktop design is pixel-for-pixel unchanged — and the percentage takes over
 * exactly where the token would have started eating the content: 21.6px at 1024, 16.2px at 768.
 *
 * 7% was chosen by measurement, not taste. It is the largest share that leaves the 768px sidebar
 * (the narrowest two-column case WooCommerce produces) enough width to lay out its summary rows
 * without breaking a word or a price, with the row rules in `components/commerce.css`.
 *
 * **Only the inline axis is capped**, and that distinction was earned the hard way: capping both
 * took 48px of block padding down to 28px at a 32px root, and the summary's star and heart live in
 * exactly that band above the heading — so the marks stepped off the top of the paper and five
 * accent-clearance checks failed. Block padding costs a narrow column nothing, so it keeps the
 * token and the band the decorations need stays the size the decorations are.
 *
 * This is a cap on an existing token, not a second token and not a new supported option: no
 * consumer can set it, and nothing outside this file knows it exists.
 */
.zoey-surface__content,
.woocommerce-cart .wc-block-cart__sidebar {
  padding: var(--wp--preset--spacing--50);
}

.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block {
  padding-block: var(--wp--preset--spacing--50);
  padding-inline: min(var(--wp--preset--spacing--50), 7%);
}

/*
 * The content's own rhythm. A surface is given rendered markup by whatever composes it, and
 * that markup's first and last elements arrive with margins of their own; collapsing them to
 * the padding is what keeps a surface's top and bottom spacing equal to what it asked for.
 */
.zoey-surface__content > :first-child {
  margin-block-start: 0;
}

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

/* --- The three surfaces ------------------------------------------------------------------ */

/*
 * Plain. §6: products, forms and checkout. White, a hairline, and no texture at all — the
 * surface a price and a buy button belong on, and the one that must never compete with them.
 */
.zoey-surface--plain {
  --zoey-surface-tint-strength: 0%;
  --zoey-surface-grain: 0;

  border: 1px solid var(--wp--preset--color--border-soft);
}

/*
 * Soft paper. §6: making and learning content.
 *
 * 8% of Zoey Yellow is the cream `make-landing.css` already mixes for the Make feature card,
 * reached here through the same `color-mix` shape. That is not a coincidence to be tidied
 * later: this surface has to be able to replace that rule without the Make page changing
 * appearance, and VS-005 is where that replacement happens.
 */
/*
 * **Checkout's adopter is not a container, and this override is the whole reason it is written.**
 *
 * The base rule above makes every surface `container-type: inline-size`, which is right for a card:
 * it lets the surface react to its own width. On Checkout it caused a real regression, measured
 * rather than predicted — at 1440 the desktop order summary **collapsed to its heading**, its
 * content computing `display: none`, where the unchanged base showed the line items and totals.
 *
 * WooCommerce's `checkout.css` is built on **unnamed** container queries —
 * `@container (min-width: 700px) { … }` — and it makes its own checkout root the container. An
 * unnamed query resolves against the *nearest* container ancestor, so the moment the summary panel
 * became a container, every WooCommerce rule inside it started asking the 406px **panel** how wide
 * the page was instead of the 1340px checkout root. The answer was "narrow", so the mobile branch
 * fired on a desktop: the summary collapsed, and the sidebar's own
 * `@container (min-width: 700px) { .wc-block-checkout__sidebar.is-sticky { position: sticky } }`
 * stopped matching too.
 *
 * `normal` hands the question back to WooCommerce's own container. Nothing is lost: the adopter
 * could never use the material's own container query anyway — it *is* the element being queried —
 * which the header above already records for the Cart. The Cart's adopter keeps its container
 * because nothing inside it asks a container query; Checkout's cannot, because WooCommerce's
 * layout is made of them.
 *
 * `SL-007` shipped a container query that silently never fired. This is the same defect seen from
 * the other side: a container that silently started answering queries that were never meant for it.
 */
.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block {
  container-type: normal;
}

.zoey-surface--soft-paper,
.woocommerce-cart .wc-block-cart__sidebar,
.zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block {
  --zoey-surface-tint-strength: 8%;
  /*
   * 0.5, reduced from the first round's 1 after review: the grain was reading as fine sand
   * behind a paragraph rather than as the tooth of a sheet of paper. Half the strength keeps the
   * handmade texture and takes the noise off the text. The first round's value is preserved on
   * the showcase as a labelled comparison for Product to choose between.
   */
  --zoey-surface-grain: 0.5;

  border: 1px solid var(--wp--preset--color--border-soft);
}

/*
 * Featured paper. §6: a selected introduction or an important activity.
 *
 * More tint and the lifted shadow, which is how it reads as the one card on a page that matters
 * most without needing a second colour or a badge. The grain is slightly stronger, because a
 * stronger tint can carry it.
 */
.zoey-surface--featured-paper {
  --zoey-surface-tint-strength: 22%;
  /*
   * A quarter more than soft paper's, because a stronger tint carries more texture before it
   * starts competing with the text — and now genuinely more, rather than the first round's 1.15
   * which clamped to the same 1 soft paper had.
   */
  --zoey-surface-grain: 0.62;

  border: 1px solid color-mix(in srgb, var(--zoey-surface-tint) 38%, var(--wp--preset--color--border-soft));
  box-shadow: var(--wp--preset--shadow--lifted);
}

/* --- Tint -------------------------------------------------------------------------------- */

/*
 * Independent of the variant: a tint changes which pastel the paper is mixed from and nothing
 * else, so soft paper and featured paper in the same tint are the same hue at two strengths.
 * Yellow is the default and so needs no class.
 */
.zoey-surface--tint-yellow {
  --zoey-surface-tint: var(--wp--preset--color--zoey-yellow);
}

.zoey-surface--tint-pink {
  --zoey-surface-tint: var(--wp--preset--color--zoey-pink);
}

.zoey-surface--tint-lavender {
  --zoey-surface-tint: var(--wp--preset--color--zoey-lavender);
}

.zoey-surface--tint-aqua {
  --zoey-surface-tint: var(--wp--preset--color--zoey-aqua);
}

.zoey-surface--tint-mint {
  --zoey-surface-tint: var(--wp--preset--color--zoey-mint);
}

.zoey-surface--tint-sky {
  --zoey-surface-tint: var(--wp--preset--color--zoey-sky);
}

/* --- Torn edges -------------------------------------------------------------------------- */

/*
 * A torn edge is a mask on the two decorative layers, in three parts: the tear tile along the
 * edge, and a solid rectangle for everything the tear does not reach. The solid part is what
 * makes the surface any height at all — the tear keeps its 16px and the rectangle takes the
 * rest, so a short card and a tall card have the same tear.
 *
 * `auto <height>` on the tile is the scallop frame's trick and the reason the tear does not
 * stretch: the tile's width follows from its own aspect ratio, so what changes with the width
 * of a surface is how many tear segments fit.
 *
 * A torn edge squares off the corner it is on. A radius and a tear are two different ideas
 * about the same corner, and drawing both leaves a rounded shape with a ragged bite out of it.
 */
.zoey-surface--edge-top::before,
.zoey-surface--edge-top::after,
.zoey-surface--edge-both::before,
.zoey-surface--edge-both::after {
  mask-image: url("../../svg/paper/torn-edge-top.svg"), linear-gradient(#000 0 0);
  mask-position: top left, left var(--zoey-surface-edge-height);
  mask-size: auto var(--zoey-surface-edge-height), 100% calc(100% - var(--zoey-surface-edge-height));
  mask-repeat: repeat-x, no-repeat;
}

.zoey-surface--edge-bottom::before,
.zoey-surface--edge-bottom::after {
  mask-image: url("../../svg/paper/torn-edge-bottom.svg"), linear-gradient(#000 0 0);
  mask-position: bottom left, left 0;
  mask-size: auto var(--zoey-surface-edge-height), 100% calc(100% - var(--zoey-surface-edge-height));
  mask-repeat: repeat-x, no-repeat;
}

.zoey-surface--edge-both::before,
.zoey-surface--edge-both::after {
  mask-image:
    url("../../svg/paper/torn-edge-top.svg"),
    url("../../svg/paper/torn-edge-bottom.svg"),
    linear-gradient(#000 0 0);
  mask-position: top left, bottom left, left var(--zoey-surface-edge-height);
  mask-size:
    auto var(--zoey-surface-edge-height),
    auto var(--zoey-surface-edge-height),
    100% calc(100% - (2 * var(--zoey-surface-edge-height)));
  mask-repeat: repeat-x, repeat-x, no-repeat;
}

/*
 * A torn surface has no border and no shadow on the torn side.
 *
 * The border is on the element and the tear is on the layers inside it, so the two do not know
 * about each other: a torn top under a hairline reads as a card with a ragged picture in it.
 * Dropping the border entirely is the honest answer — the tear is the edge — and the
 * forced-colors rule below is what keeps the surface a region when the tear is not drawn.
 */
.zoey-surface--edge-top,
.zoey-surface--edge-bottom,
.zoey-surface--edge-both {
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

/*
 * Enough room for the tear plus the surface's own breathing space, so the deepest bite never
 * reaches the first line of text. The tear is 16px; this adds the whole of it on top of the
 * padding the content already had, on the torn side only.
 */
.zoey-surface--edge-top > .zoey-surface__content,
.zoey-surface--edge-both > .zoey-surface__content {
  padding-block-start: calc(var(--wp--preset--spacing--50) + var(--zoey-surface-edge-height));
}

.zoey-surface--edge-bottom > .zoey-surface__content,
.zoey-surface--edge-both > .zoey-surface__content {
  padding-block-end: calc(var(--wp--preset--spacing--50) + var(--zoey-surface-edge-height));
}

/* --- Tape -------------------------------------------------------------------------------- */

/*
 * One strip, masked from one silhouette, coloured by a gradient.
 *
 * The gloss is the gradient rather than something in the file, which is what keeps it one file
 * for every colour: the mask decides the shape, the background decides what the shape is made
 * of. `mask-size: contain` is what stops it ever stretching — a longer piece of tape is a
 * longer piece of the same tape, set by `--zoey-surface-tape-length`.
 *
 * Inert in both the ways that matter. `aria-hidden` is on the element in the markup; this is
 * the other half.
 */
/*
 * **A third adopter: the editorial pages' notes** — Meet Zoey's five favourites, and Contact's
 * three social cards after them. They are core Group blocks wearing this
 * material, because every word on that page stays editable in WordPress — so there is no
 * `zoey_made_surface()` call to pass `tape` to, and a core block cannot emit
 * `<span class="zoey-surface__tape">`. The Cart could not have tape because its region is
 * destroyed at hydration; these cannot because their markup is the block editor's. Either way the
 * strip becomes a pseudo-element, named on the rules that already declare the silhouette, the
 * gloss, the ratio, the opacity and the inertness.
 *
 * Two things follow. **The placement cannot be adopted** — a real strip is positioned against
 * `.zoey-surface` and this one against `.zoey-surface__content`, so `components/meet-zoey.css`
 * owns `content` and the insets, exactly as `commerce.css` does. And **`aria-hidden` is both
 * unnecessary and unavailable**, which is the one way this is better than the markup it replaces:
 * there is no node, so there is nothing to hide.
 */
.zoey-surface__tape,
.zoey-meet-zoey__card > .zoey-surface__content::before,
.zoey-contact__social-card > .zoey-surface__content::before,
.zoey-contact__art > .zoey-surface__content::before,
.zoey-contact__note-panel > .zoey-surface__content::before {
  position: absolute;
  z-index: 2;
  inline-size: var(--zoey-surface-tape-length);
  /* 160 x 44 is the silhouette's own ratio; the height follows the length rather than leading it. */
  block-size: calc(var(--zoey-surface-tape-length) * 44 / 160);
  background-image: linear-gradient(
    168deg,
    color-mix(in srgb, var(--zoey-surface-tape-color) 72%, var(--wp--preset--color--surface)) 0%,
    var(--zoey-surface-tape-color) 42%,
    color-mix(in srgb, var(--zoey-surface-tape-color) 86%, var(--wp--preset--color--ink)) 100%
  );
  mask-image: url("../../svg/paper/tape.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  /* Tape is stuck on top of paper, not printed into it. */
  opacity: 0.88;
  pointer-events: none;
}

/*
 * The five placements, and the rule they exist to keep: §6 says tape must not cover text or
 * controls, so every one of them straddles an edge — half on the paper, half off it — where
 * the surface's own padding guarantees there is nothing to cover.
 */
.zoey-surface__tape--top-left {
  inset-block-start: calc(var(--zoey-surface-tape-length) * -0.11);
  inset-inline-start: var(--wp--preset--spacing--50);
  rotate: -5deg;
}

.zoey-surface__tape--top-right {
  inset-block-start: calc(var(--zoey-surface-tape-length) * -0.11);
  inset-inline-end: var(--wp--preset--spacing--50);
  rotate: 4deg;
}

.zoey-surface__tape--top-center {
  inset-block-start: calc(var(--zoey-surface-tape-length) * -0.11);
  inset-inline-start: 50%;
  translate: -50% 0;
  rotate: -1.5deg;
}

.zoey-surface__tape--bottom-left {
  inset-block-end: calc(var(--zoey-surface-tape-length) * -0.11);
  inset-inline-start: var(--wp--preset--spacing--50);
  rotate: 3deg;
}

.zoey-surface__tape--bottom-right {
  inset-block-end: calc(var(--zoey-surface-tape-length) * -0.11);
  inset-inline-end: var(--wp--preset--spacing--50);
  rotate: -4deg;
}

/*
 * Tape colours.
 *
 * `cream` is the default and is set on the component above, so it needs no class of its own —
 * the same arrangement `paper` had before Product's selection, with the two swapped.
 *
 * `paper` is the cooler candidate, mixed from Border Soft, which carries the palette's faint
 * violet. It was not chosen as the default and is **retained as an option** rather than removed:
 * a surface that wants the cooler neutral asks for it by name.
 *
 * Neither is a new design token. Both are mixed from palette colours the way every other value
 * on a surface is, which is why the choice between them changed one declaration.
 */
.zoey-surface__tape--color-paper {
  --zoey-surface-tape-color: color-mix(in srgb, var(--wp--preset--color--border-soft) 55%, var(--wp--preset--color--surface));
}

.zoey-surface__tape--color-yellow {
  --zoey-surface-tape-color: var(--wp--preset--color--zoey-yellow);
}

.zoey-surface__tape--color-pink,
.zoey-contact__note-panel > .zoey-surface__content::before,
.zoey-contact__social-card--instagram > .zoey-surface__content::before,
.zoey-meet-zoey__card--making > .zoey-surface__content::before,
.zoey-meet-zoey__card--discovering > .zoey-surface__content::before {
  --zoey-surface-tape-color: var(--wp--preset--color--zoey-pink);
}

.zoey-surface__tape--color-lavender,
.zoey-contact__art > .zoey-surface__content::before,
.zoey-contact__social-card--youtube > .zoey-surface__content::before,
.zoey-meet-zoey__card--reading > .zoey-surface__content::before,
.zoey-meet-zoey__card--imagination > .zoey-surface__content::before {
  --zoey-surface-tape-color: var(--wp--preset--color--zoey-lavender);
}

.zoey-surface__tape--color-aqua,
.zoey-contact__social-card--tiktok > .zoey-surface__content::before,
.zoey-meet-zoey__card--games > .zoey-surface__content::before {
  --zoey-surface-tape-color: var(--wp--preset--color--zoey-aqua);
}

.zoey-surface__tape--color-mint {
  --zoey-surface-tape-color: var(--wp--preset--color--zoey-mint);
}

/* --- Narrow screens ---------------------------------------------------------------------- */

/*
 * At the narrow end the padding comes in and the tape comes down, because tape sized for a
 * 760px column is a third of the width of a 320px one. The breakpoint is where the content
 * actually needs it rather than a device width, which is the house rule: below 26rem a
 * 112px strip plus two 24px gutters leaves too little paper between the two top corners for
 * the eye to read them as separate pieces.
 *
 * A container query, so this is about how wide the *surface* is. A surface in a narrow column
 * of a wide page gets it; a wide surface on a phone does not.
 */
@container zoey-surface (max-width: 26rem) {
  .zoey-surface__content {
    padding: var(--wp--preset--spacing--40);
  }

  .zoey-surface--edge-top > .zoey-surface__content,
  .zoey-surface--edge-both > .zoey-surface__content {
    padding-block-start: calc(var(--wp--preset--spacing--40) + var(--zoey-surface-edge-height));
  }

  .zoey-surface--edge-bottom > .zoey-surface__content,
  .zoey-surface--edge-both > .zoey-surface__content {
    padding-block-end: calc(var(--wp--preset--spacing--40) + var(--zoey-surface-edge-height));
  }

  .zoey-surface__tape {
    --zoey-surface-tape-length: 84px;
  }

  .zoey-surface__tape--top-left,
  .zoey-surface__tape--bottom-left {
    inset-inline-start: var(--wp--preset--spacing--30);
  }

  .zoey-surface__tape--top-right,
  .zoey-surface__tape--bottom-right {
    inset-inline-end: var(--wp--preset--spacing--30);
  }
}

/*
 * The adopter's narrow step — the same token change the query above makes, reached the only way it
 * can be.
 *
 * The Cart's totals panel is the query container, so it cannot read its own width; and it is the
 * one surface on the site whose width is genuinely a function of the viewport, because below
 * WooCommerce's own sidebar-layout breakpoint the panel stops being a column and becomes the full
 * content width. Measured on the route: 406px at 1440, 350px at 390 and 280px at 320 — so the
 * panel is inside the 26rem the query uses exactly when the viewport is small, and a media query
 * says the same thing here without pretending to be a container query.
 *
 * `30em` rather than a device width: 480px is where `components/commerce.css` already re-grids the
 * line item, so the Cart tightens in one step rather than two.
 */
@media (max-width: 30em) {
  .woocommerce-cart .wc-block-cart__sidebar {
    padding: var(--wp--preset--spacing--40);
  }

  /* Capped on the inline axis for the same reason, against the same containing block. See above. */
  .zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block {
    padding-block: var(--wp--preset--spacing--40);
    padding-inline: min(var(--wp--preset--spacing--40), 7%);
  }
}

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

/*
 * A tint is a background colour, a grain is a background image and a tear is a mask, and
 * forced-colors mode removes the meaning of all three: the system paints its own canvas, and a
 * masked shape is simply not there. The same thing `make-landing.css` and `make-activity.css`
 * already handle, handled the same way — a hairline in the system's own colour, so the surface
 * is still a region with a boundary even though it is no longer paper.
 *
 * The hairline goes back on the torn variants too, which is the whole reason this rule has to
 * name them: they dropped their border *because* the tear was the edge, and here there is no
 * tear.
 */
@media (forced-colors: active) {
  .zoey-surface,
  .woocommerce-cart .wc-block-cart__sidebar,
  .zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block {
    border: 1px solid CanvasText;
  }

  /* Decoration that cannot be drawn should not leave a ghost of itself behind. */
  .zoey-surface__tape {
    display: none;
  }
}

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

/*
 * §11: readable text, white backgrounds, economical ink.
 *
 * A page of tinted, grained, taped paper is a page of ink a family pays for to print a
 * worksheet, so on paper a surface is a surface again: white, no texture, no tape, and a
 * hairline so a card is still visibly a card. The content is untouched — it was never part of
 * the decoration, which is what makes this four lines rather than a second layout.
 */
@media print {
  .zoey-surface,
  .woocommerce-cart .wc-block-cart__sidebar,
  .zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block {
    --zoey-surface-grain: 0;
    --zoey-surface-tint-strength: 0%;

    border: 1px solid #767680;
    border-radius: 0;
    box-shadow: none;
  }

  /*
   * Named as specifically as the torn-edge rules are, so the room those reserve for a tear is
   * given back when there is no tear to draw. A blank 16px band at the top of a printed card is
   * paper nobody asked for.
   */
  .zoey-surface__content,
  .zoey-surface--edge-top > .zoey-surface__content,
  .zoey-surface--edge-bottom > .zoey-surface__content,
  .zoey-surface--edge-both > .zoey-surface__content,
  .woocommerce-cart .wc-block-cart__sidebar,
  .zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block {
    padding: var(--wp--preset--spacing--40);
  }

  .zoey-surface::before,
  .zoey-surface::after,
  .woocommerce-cart .wc-block-cart__sidebar::before,
  .zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block::before,
  .woocommerce-cart .wc-block-cart__sidebar::after,
  .zoey-checkout .wp-block-woocommerce-checkout-totals-block > .wp-block-woocommerce-checkout-order-summary-block::after {
    /* No mask either: a torn edge printed in low ink is a wobbly line and nothing else. */
    mask-image: none;
    background-color: transparent;
    background-image: none;
  }

  .zoey-surface__tape {
    display: none;
  }
}
