/**
 * Artwork ARCHIVE view system — chrome for the three-mode viewer on
 * /artworks/ and /invited/ (inc/artwork-views.php, archive-artwork.php).
 *
 * THIS FILE IS ADDITIVE ONLY. The relative (true-scale wall) and group
 * (size-section) modes are rendered by the UNMODIFIED /real-dimensions
 * engine — p1-realdim.css supplies every wall, item, figure, legend and
 * group rule, and this file must never restate them. What lives here:
 *
 *   1. the mode swap: which of the two containers is on screen;
 *   2. neutralising the borrowed .p1-rd-page page-scaffold box (the archive
 *      wrapper already owns the 1400px column and its padding);
 *   3. the floating bottom-right switcher (.p1-av-switcher) — the only
 *      genuinely new component here.
 *
 * Loaded after p1-realdim.css (wp dependency), so single-class overrides
 * would already win; the paired selectors below (.p1-av-x.p1-rd-y) are
 * deliberate anyway — they say "archive variant of an engine part" and stay
 * safe if the load order ever changes.
 */

/* ── Mode swap ───────────────────────────────────────────────────────────
   `data-p1-archive-view` is stamped on <html> by the pre-paint boot script
   (p1_artwork_views_boot) BEFORE the grids are parsed, so a deep-linked
   /artworks/#relative never paints a frame of masonry. NO attribute (JS off,
   or the boot script never ran) = masonry, so the archive degrades to
   exactly what it shipped as: the grid, the shuffle, the contact tile.

   The embed keeps `display:none` in masonry mode rather than
   `visibility:hidden` — hidden containers do not fetch lazy images, so a
   visitor who never opens the dropdown pays no image cost for the wall. */
.p1-av-embed { display: none; }

html[data-p1-archive-view='relative'] .p1-av-embed,
html[data-p1-archive-view='group'] .p1-av-embed { display: block; }

html[data-p1-archive-view='relative'] .p1-av-mode--masonry,
html[data-p1-archive-view='group'] .p1-av-mode--masonry { display: none; }

/* Borrowed scaffold, neutralised: .p1-rd-page carries the /real-dimensions
   page column (1400px + 40/20/80 padding). Inside .p1-archive-artwork that
   column already exists, and double padding would shift the wall off the
   masonry's optical line — the two modes must occupy the SAME box so
   switching reads as a re-hang, not a re-layout. The class is still needed:
   the engine hangs `data-rd-mode` on the nearest .p1-rd-page. */
.p1-av-embed.p1-rd-page {
	max-width: none;
	margin: 0;
	padding: 0;
}

/* The relative-mode intro (same-scale sentence + 12in scale bar) replaces
   the /real-dimensions .p1-rd-header block, which the archive has no
   equivalent of. Both are hidden outside relative mode by p1-realdim.css's
   own data-rd-mode rules — they would be lies elsewhere. 36px = the
   engine's own header step. */
.p1-av-embed .p1-rd-header__sub { margin: 0; }
.p1-av-embed .p1-rd-legend { margin: 14px 0 36px; }

/* Floor clearance for the floating switcher, so the last masonry row / wall
   band is never parked under the pill. Applied only when the boot script ran
   (i.e. the switcher actually exists); 100px is the established page-column
   bottom step (§3.1). */
html[data-p1-archive-view] .p1-archive-artwork { padding-bottom: 100px; }

/* ── Floating view switcher ──────────────────────────────────────────────
   The house floating-island idiom (catalog §4, .p1-floating-nav): glass
   pill, 1px glass hairline, 0 10px 30px shadow (doubled in dark),
   backdrop blur, --p1-radius-pill, 30px from the corner. Reads as a sibling
   of the artwork pages' prev/next island rather than a new species.

   CORNER: bottom-right is FREE on the archive — .p1-floating-nav renders on
   artwork singles and /end/ only, and the jc-art-chat widget is
   `is_singular()`-gated and inline (never fixed). Verified by screenshot at
   1280 and 390.

   Z-INDEX 300 — a new documented step between site chrome (200) and the
   mobile nav overlay (400/401): above page content, and deliberately UNDER
   the nav overlay, the modals (9000 / 9999) and the floating island (9990),
   so nothing this control does can trap a visitor behind it.

   The element is <label class="p1-rd-view"> from the engine's contract, so
   it inherits the select skin, the chevron and the `hidden` reveal for
   free — only the positioning box is new. `position: fixed` blockifies the
   inline-block, which is why `display` is never set here: the engine's
   `.p1-rd-view[hidden]` rule (equal specificity, earlier file) must keep
   winning until JS reveals the control. */
.p1-rd-view.p1-av-switcher {
	position: fixed;
	right: 30px;
	bottom: calc(30px + env(safe-area-inset-bottom, 0px));
	z-index: 300;
	padding: 6px;
	background: var(--p1-glass-bg);
	border: 1px solid var(--p1-glass-border);
	border-radius: var(--p1-radius-pill);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
	backdrop-filter: blur(10px);
}
html.dark .p1-rd-view.p1-av-switcher {
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
/* Belt for the reveal: the engine flips `hidden` off on init. */
.p1-rd-view.p1-av-switcher[hidden] { display: none; }

/* The pill IS the frame — the select drops its own hairline and rounds to
   match. Keeps the ≥44px target and the §5.3 accent focus ring from
   p1-realdim.css. */
.p1-av-switcher .p1-rd-view__select {
	border-color: transparent;
	border-radius: var(--p1-radius-pill);
	padding: 0 34px 0 16px;
	max-width: 100%;
}
.p1-av-switcher .p1-rd-view__select:hover { border-color: transparent; }
.p1-av-switcher::after { right: 20px; }

/* Mobile: closer to the corner, still clear of the home indicator via the
   safe-area inset, and width-capped so the longest option label can never
   push the pill off-screen at 390px. */
@media (max-width: 700px) {
	.p1-rd-view.p1-av-switcher {
		right: 16px;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
		max-width: calc(100vw - 32px);
	}
	.p1-av-switcher .p1-rd-view__select { padding: 0 30px 0 12px; }
	.p1-av-switcher::after { right: 16px; }
}
