/**
 * Sponsor and affiliate placements — 22-sponsor-placements.md §2A.
 *
 * The design problem is specific. This site's proposition is that its numbers
 * are independent. A placement that looks like advertising on a page of
 * published data cheapens the data; one that looks like EDITORIAL is worse,
 * because that is a disclosure failure. The target is the third thing —
 * visibly commercial, unmistakably separate, and quiet. Closer to a journal's
 * back-page supporter notice than to a banner.
 *
 * No class name here contains `ad`, `ads`, `banner` or `sponsor` as a
 * standalone token, and that is not evasion: a 728x90 in a `div.ad-banner` is
 * removed by every content blocker in wide use, so the sponsor would be paying
 * for impressions that never rendered. There is no blocker detection and no
 * circumvention anywhere in this subsystem — the point is not to be shaped
 * like the thing being blocked.
 */

.pem-placement {
	/*
	 * >=48px clear of the nearest number, chart or table. The separation is
	 * the disclosure: a placement that crowds a figure reads as annotating it.
	 */
	margin: 3rem 0 2rem;
	padding: 1rem 1.15rem 1.15rem;
	max-width: var(--measure-wide, 78ch);

	/* One step separated from the page, never flush with it. */
	background: var(--paper, #fff);
	border: 1px solid var(--rule-soft, #e6e6e6);
	border-radius: var(--radius, 2px);

	/*
	 * No shadow. `--shadow` is reserved for data tiles, and a raised sponsor
	 * card outranks the numbers visually — which is the one thing this
	 * component must never do.
	 */
	box-shadow: none;
}

/* The hairline above, which is what makes it read as separated furniture. */
.pem-placement::before {
	content: "";
	display: block;
	height: 1px;
	background: var(--rule-soft, #e6e6e6);
	margin: 0 0 .85rem;
}

/*
 * The label, above the creative in the DOM as well as on screen. `--ink-2` and
 * not `--ink-3`: ink-3 fails 4.5:1 on paper, and a disclosure that fails
 * contrast is not a disclosure.
 */
.pem-placement__label {
	margin: 0 0 .75rem;
	font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	font-size: .72rem;
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--ink-2, #4a4a4a);
}

.pem-placement__body {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 1.25rem;
}

.pem-placement__creative img {
	display: block;
	max-width: 100%;
	height: auto;
}

/*
 * One creative for both themes sits on a fixed white tile with its own border,
 * in BOTH themes. Never inverted and never filtered: running a logo through a
 * CSS invert is a trademark alteration.
 */
.pem-placement__creative--tile {
	background: #ffffff;
	border: 1px solid var(--rule, #d8d8d8);
	padding: .5rem;
	border-radius: var(--radius, 2px);
}

.pem-placement__text { flex: 1 1 16rem; min-width: 0; }

.pem-placement__name {
	margin: 0 0 .25rem;
	font-size: var(--step-0, 1rem);
	color: var(--ink, #1a1a1a);
}

.pem-placement__copy {
	margin: 0 0 .4rem;
	font-size: var(--step--1, .9rem);
	line-height: 1.45;
	color: var(--ink-2, #4a4a4a);
}

.pem-placement__link { margin: 0; font-size: var(--step--1, .9rem); }
.pem-placement__link a { text-decoration: underline; }

/*
 * Nothing moves and nothing covers. DO-NOT 34.
 *
 * Stated as rules rather than left to discipline: a later edit that adds a
 * transition or a sticky position has to delete one of these lines to do it,
 * and deleting a line that says why is a visible act in a diff.
 */
.pem-placement,
.pem-placement * {
	animation: none !important;
	transition: none !important;
	position: static !important;
}

/* Below 640px the mobile variant loads, or the creative is dropped entirely —
   a wide creative letterboxed into an illegible strip serves nobody. */
@media (max-width: 639px) {
	.pem-placement__body { gap: .85rem; }
	.pem-placement__creative { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.pem-placement, .pem-placement * { animation: none !important; transition: none !important; }
}

/* -----------------------------------------------------------------------
 * Placeholders — 22-sponsor-placements.md 8.1, mark two of three.
 *
 * The word "placeholder" sits in --warn beside the disclosure. It is the only
 * place --warn appears in this component, and it is here precisely because it
 * carries a warning meaning everywhere else on the site: this is not a real
 * advertisement.
 *
 * The other two marks are in the artwork (a SPECIMEN band) and in the alt
 * text. Three independent places, any one of which survives if the others are
 * lost — and the alt text is the one that survives image blocking, which is
 * exactly when a reader is least able to tell.
 * --------------------------------------------------------------------- */

.pem-placement__specimen {
	color: var(--warn, #a2621c);
	font-weight: 700;
}

/* -----------------------------------------------------------------------
 * The supporter row — 2A.5.
 *
 * Six marks, all visible at once, alphabetical, no motion. It exists because
 * the alternative people ask for is a carousel, and a carousel sells five
 * placements while delivering roughly one.
 *
 * Wraps rather than scrolls: a sideways-scrolling row hides sponsors four to
 * six from most readers, which is the same failure as a carousel in a
 * different shape.
 * --------------------------------------------------------------------- */

.pem-placement-row {
	margin: 3rem 0 2rem;
	padding: 1rem 0 0;
	border-top: 1px solid var(--rule-soft, #e6e6e6);
}

.pem-placement-row__label {
	margin: 0 0 .85rem;
	font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	font-size: .72rem;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--ink-2, #4a4a4a);
}

.pem-placement-row__label a { color: inherit; text-decoration: underline; }

.pem-placement-row__list {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem 1.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
	/* Never sideways. */
	overflow: visible;
}

.pem-placement-row__item { flex: 0 0 auto; text-align: center; }

.pem-placement-row__item img {
	display: block;
	width: 180px;
	height: 72px;
	object-fit: contain;
	/* Greyscale-normalised so no single mark shouts louder than the others. */
	filter: grayscale(1);
	opacity: .85;
}

.pem-placement-row__name {
	display: block;
	margin-top: .3rem;
	font-size: var(--step--2, .78rem);
	color: var(--ink-2, #4a4a4a);
}

.pem-placement-row__item--specimen .pem-placement-row__name { color: var(--warn, #a2621c); }

@media (max-width: 900px) { .pem-placement-row__list { gap: 1rem 1.25rem; } }

.pem-placement-row,
.pem-placement-row * {
	animation: none !important;
	transition: none !important;
	position: static !important;
}

/*
 * The reserved panel — §8.8, new in v3.1.
 *
 * A slot held open with nothing in it: no text, no image, no link, no label.
 * It exists so the design is complete before the first sale and so nothing on
 * the page shifts when a sponsor arrives.
 *
 * It keeps the component's own framing — the hairline, the margins, the 48px
 * clearance — because the space it holds must be the space a real placement
 * will occupy. What it drops is the padding and the border of the inner card:
 * a reserved slot is an absence, and drawing it as a fully realised empty box
 * makes it look like a placement that failed to load.
 */
.pem-placement--reserved {
	padding: 0;
	background: none;
	border: 0;
}

.pem-placement__reserved {
	/*
	 * Neutral grey, and deliberately NOT `--warn`. §8.2 of the dashboard spec
	 * is explicit that a reserved slot is shown "neutral grey, not amber —
	 * nothing is wrong with a reserved slot". The same reasoning applies on the
	 * page: amber says something needs attention, and this needs none.
	 */
	background: var(--rule-soft, #e6e6e6);
	border-radius: var(--radius, 2px);
	width: 100%;

	/*
	 * `aspect-ratio` is set inline from the slot's real dimensions, so the
	 * panel holds exactly the height the sold creative will. A fixed height
	 * here would be a second source for that number and would drift from
	 * `dimensions()`.
	 */
	opacity: .55;
}

/*
 * At 55% on the soft rule colour the panel sits below the page's own furniture
 * in contrast, which is correct: it is the quietest thing on the page, and it
 * must not compete with a figure or a chart for attention.
 */
