/* ============================================================================
   YEMMA CORE — the contact page

   Four rules, and every one of them carries something the theme could not know.
   The theme's own `contact.css` has dressed this page since before the plugin
   could print it: `.chans`, `.chan`, `.atelier`, `.hours`, `.copybtn`, `.oi`,
   `.cform`, `.subj`, `.team` and every `mp-` class are all in it, and none of
   them is restated here. The test a rule has to pass to be in this file is the
   one `assets/public/css/story.css` set: it must be about something only the
   plugin knows, which on this page means *how many* of a thing a shop switched
   on, and whether a browser can do what a button says.

   ## The cascade, and why every override is inside a media query

   **The plugin's sheet prints BEFORE the theme's chain.** The plugin boots on
   `plugins_loaded`, so its `wp_enqueue_scripts` callback is registered first;
   both run at priority 10, this sheet declares no dependency on the theme's, and
   the printed order follows registration. `story.css` found this the hard way and
   says so at length.

   That makes specificity the only thing standing between these rules and the
   theme's, and `:has()` is generous with it: `.chans:has(> .chan:nth-child(3):last-child)`
   is 0-4-0 against the theme's `@media (max-width: 1100px) { .chans }` at 0-1-0.
   Left bare, a three-column rule meant for a wide screen would beat the theme's
   own collapse and hand a shop with three doors three columns on a 375px phone —
   which is the exact bug `usp.css` still has, and is why its `:has()` block is
   not the part of that file to copy.

   So every column rule below is inside the media query it is true in, and the
   theme's collapse is left to win everywhere else.
   ========================================================================== */

/*
 * The doors, when there are not four of them.
 *
 * `ContactView` drops a channel whose fact the shop has not filled in — no
 * WhatsApp number, no WhatsApp card — so the count here is not a setting anybody
 * typed and there is no number the plugin could print into a class. `:has()` asks
 * the DOM how many cards actually rendered, which is the one question a
 * stylesheet could not previously ask, and the answer is right whether a card is
 * missing because it was switched off or because its number is blank.
 *
 * Four needs no rule: it is the theme's own default and the common case.
 */
@media (min-width: 1101px) {
	.chans:has(> .chan:nth-child(1):last-child) {
		grid-template-columns: minmax(0, 1fr);
	}

	.chans:has(> .chan:nth-child(2):last-child) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.chans:has(> .chan:nth-child(3):last-child) {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	/*
	 * The people, when there are fewer than three.
	 *
	 * The theme's `.team` is `repeat(3, minmax(0, 1fr))`, which is right where it
	 * was written — the prototype shows three. Two people in a three-column grid
	 * are two cards and a hole; one is a card occupying the left third of the
	 * band with two thirds of nothing beside it. Below 1101px the theme already
	 * collapses `.team` to a single column, so there is nothing to correct there.
	 */
	.team:has(> .tmem:nth-child(1):last-child) {
		grid-template-columns: minmax(0, 1fr);
	}

	.team:has(> .tmem:nth-child(2):last-child) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/*
 * The middle band, where the theme gives `.chans` two columns.
 *
 * Two cards and three cards are both right there — three is two and one, which
 * reads as a row that wrapped rather than as a mistake — so the only count that
 * needs correcting between 621px and 1100px is one, which would otherwise be a
 * single card at half the width of the band with an empty cell beside it.
 *
 * The upper bound matters as much as the lower: without it this rule would beat
 * the wide-screen block above at every width, because they are the same
 * specificity and this one comes later.
 */
@media (min-width: 621px) and (max-width: 1100px) {
	.chans:has(> .chan:nth-child(1):last-child) {
		grid-template-columns: minmax(0, 1fr);
	}
}

/*
 * An uploaded map fills the slot the way the drawing does.
 *
 * `base.css` already blocks and caps every image on the site, so this is not
 * about layout going wrong — it is one decision, and it is that the stage is a
 * frame rather than a mount. The drawn SVG is `width: 100%` in the theme's own
 * `.atelier__stage svg`; an upload narrower than the column would otherwise sit
 * to one side of a bordered box, and the shop that replaced the drawing would be
 * told, wrongly, that its photograph was the wrong size.
 */
.atelier__stage img {
	width: 100%;
}

/*
 * The copy button is born `hidden` and stays hidden without a clipboard.
 *
 * `.copybtn` sets `display: inline-flex`, and a class beats the browser's own
 * `[hidden]` rule, so the attribute alone does nothing at all — the button would
 * be printed, styled, visible, and inert on every browser that cannot copy.
 *
 * The theme's `base.css` carries `[hidden] { display: none !important; }` and
 * would in fact cover this, and that is exactly why the rule is still here: the
 * theme is not ours to depend on. This page renders under whatever theme is
 * active, and a plugin that borrows another project's reset has a button that
 * lies the day someone trims it. The `!important` version wins over this one
 * wherever both load, and both say the same thing, so there is no conflict to
 * resolve — only a promise this file makes on its own.
 */
.copybtn[hidden] {
	display: none;
}
