/* NoteyStuff — component layer.
 *
 * Reusable, mobile-first, token-driven. Each component maps onto the WooCommerce and
 * Kadence classes it will style in later phases, so R2-R5 mostly compose these rather
 * than writing new CSS.
 *
 * Contrast rule enforced throughout: rose/lavender fills carry PLUM labels (4.96);
 * white labels only ever sit on --ns-color-cta-solid (5.75).
 */

/* ===============================================================
 * Buttons
 * =============================================================== */

.ns-btn,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ns-space-2);
	min-height: var(--ns-tap-min);
	padding: var(--ns-space-3) var(--ns-space-5);
	border: 1px solid transparent;
	border-radius: var(--ns-radius-pill);
	background-color: var(--ns-color-cta);
	color: var(--ns-color-text-on-brand);
	font-family: var(--ns-font-body);
	font-size: var(--ns-text-base);
	font-weight: var(--ns-weight-medium);
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--ns-transition), border-color var(--ns-transition),
		transform var(--ns-transition), box-shadow var(--ns-transition);
}

.ns-btn:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.wp-block-button__link:hover {
	background-color: var(--ns-color-cta-hover);
	color: var(--ns-color-text-on-brand);
	transform: translateY(-1px);
	box-shadow: var(--ns-shadow-md);
}

.ns-btn:active {
	transform: translateY(0);
	box-shadow: var(--ns-shadow-sm);
}

.ns-btn[disabled],
.ns-btn.is-disabled,
.woocommerce button.button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

/* Solid variant — the only place a white label is permitted. */
.ns-btn--solid {
	background-color: var(--ns-color-cta-solid);
	color: var(--ns-color-text-inverse);
}

.ns-btn--solid:hover {
	background-color: var(--ns-color-cta-solid-hover);
	color: var(--ns-color-text-inverse);
}

.ns-btn--secondary {
	background-color: transparent;
	border-color: var(--ns-color-border-strong);
	color: var(--ns-color-text);
}

.ns-btn--secondary:hover {
	background-color: var(--ns-color-surface-accent);
	border-color: var(--ns-color-accent-ink);
	color: var(--ns-color-text);
}

.ns-btn--ghost {
	background-color: transparent;
	color: var(--ns-color-link);
	padding-inline: var(--ns-space-3);
}

.ns-btn--ghost:hover {
	background-color: var(--ns-color-surface-warm);
	color: var(--ns-color-link-hover);
}

.ns-btn--danger {
	background-color: var(--ns-color-danger);
	color: var(--ns-color-text-inverse);
}

.ns-btn--sm {
	min-height: 36px;
	padding: var(--ns-space-2) var(--ns-space-4);
	font-size: var(--ns-text-sm);
}

.ns-btn--lg {
	min-height: 52px;
	padding: var(--ns-space-4) var(--ns-space-6);
	font-size: var(--ns-text-lg);
}

.ns-btn--block {
	display: flex;
	width: 100%;
}

/* --ns-btn--sm is for dense desktop/inline use only. Never use it for a primary touch
 * action; the 44px default exists for that. */

/* Loading state — the label stays in place so the button does not resize. */
.ns-btn.is-loading {
	pointer-events: none;
	color: transparent;
	position: relative;
}

.ns-btn.is-loading::after {
	content: '';
	position: absolute;
	inset: 50% auto auto 50%;
	width: 1.1em;
	height: 1.1em;
	margin: -0.55em 0 0 -0.55em;
	border: 2px solid currentcolor;
	border-top-color: var(--ns-plum);
	border-radius: 50%;
	color: var(--ns-color-text-on-brand);
	animation: ns-spin 700ms linear infinite;
}

@keyframes ns-spin {
	to { transform: rotate(360deg); }
}

/* ===============================================================
 * Forms
 * =============================================================== */

.ns-field {
	display: flex;
	flex-direction: column;
	gap: var(--ns-space-2);
	margin-bottom: var(--ns-space-4);
}

.ns-label,
.woocommerce form .form-row label {
	font-size: var(--ns-text-sm);
	font-weight: var(--ns-weight-medium);
	color: var(--ns-color-text);
}

.ns-required {
	color: var(--ns-color-danger);
}

.ns-input,
.ns-select,
.ns-textarea,
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='number'],
input[type='password'],
input[type='search'],
textarea,
select {
	width: 100%;
	min-height: var(--ns-tap-min);
	padding: var(--ns-space-3) var(--ns-space-4);
	border: 1px solid var(--ns-color-border-strong);
	border-radius: var(--ns-radius-md);
	background-color: var(--ns-color-surface);
	color: var(--ns-color-text);
	font-family: var(--ns-font-body);
	font-size: var(--ns-text-base); /* never below 16px — iOS zooms the viewport otherwise */
	line-height: 1.4;
	transition: border-color var(--ns-transition), box-shadow var(--ns-transition);
}

/* R6: Kadence sets every placeholder to palette6 (#9B6EB2, 3.89:1). Every form on this site has a
 * real label, so a placeholder is never the only cue — but it should still be readable. */
.ns-input::placeholder,
input::placeholder,
textarea::placeholder {
	color: var(--ns-color-text-muted);
	opacity: 1;
}

.ns-input:hover,
textarea:hover,
select:hover {
	border-color: var(--ns-color-accent-ink);
}

.ns-input:focus,
.ns-select:focus,
.ns-textarea:focus,
input:focus,
textarea:focus,
select:focus {
	border-color: var(--ns-color-focus);
	/* R6: the halo was 12% and barely registered on a keyboard pass. At 24% it reads clearly
	 * against every surface in the palette while still looking like a focus state rather than
	 * an error state. The border darkening to plum does the rest of the work. */
	box-shadow: 0 0 0 3px rgb(45 33 53 / 0.24);
	outline: none; /* replaced by the ring above; :focus-visible still applies for keyboard */
}

.ns-textarea,
textarea {
	min-height: 8rem;
	resize: vertical;
}

.ns-select,
select {
	appearance: none;
	padding-inline-end: var(--ns-space-7);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%232d2135' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right var(--ns-space-4) center;
	background-size: 1rem;
}

.ns-help {
	font-size: var(--ns-text-sm);
	color: var(--ns-color-text-muted);
}

.ns-error-text {
	font-size: var(--ns-text-sm);
	font-weight: var(--ns-weight-medium);
	color: var(--ns-color-danger);
}

.ns-field.has-error .ns-input,
.ns-field.has-error .ns-select,
.ns-field.has-error .ns-textarea,
.woocommerce form .form-row.woocommerce-invalid input.input-text {
	border-color: var(--ns-color-danger);
	background-color: var(--ns-color-danger-wash);
}

/* Checkbox and radio — larger hit area than the control itself. */
.ns-check {
	display: flex;
	align-items: flex-start;
	gap: var(--ns-space-3);
	min-height: var(--ns-tap-min);
	padding-block: var(--ns-space-2);
	cursor: pointer;
	font-size: var(--ns-text-sm);
}

.ns-check input[type='checkbox'],
.ns-check input[type='radio'] {
	width: 1.25rem;
	height: 1.25rem;
	min-height: 0;
	margin: 0.15rem 0 0;
	flex: none;
	accent-color: var(--ns-color-cta-solid);
	cursor: pointer;
}

/* The `input:focus { outline: none }` rule above swaps the outline for a box-shadow ring, which
 * works on a text field but leaves a native checkbox or radio with no focus indication at all —
 * `input:focus` (0,1,1) outranks base.css's bare `:focus-visible` (0,1,0). These two get the
 * outline back explicitly. Found on checkout, where the Terms checkbox is a required step. */
input[type='checkbox']:focus-visible,
input[type='radio']:focus-visible {
	outline: var(--ns-focus-width) solid var(--ns-color-focus);
	outline-offset: var(--ns-focus-offset);
	box-shadow: none;
}

/* Quantity stepper */
.ns-qty {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--ns-color-border-strong);
	border-radius: var(--ns-radius-pill);
	overflow: hidden;
	background: var(--ns-color-surface);
}

.ns-qty__btn {
	width: var(--ns-tap-min);
	min-height: var(--ns-tap-min);
	border: 0;
	background: transparent;
	color: var(--ns-color-text);
	font-size: var(--ns-text-lg);
	line-height: 1;
	cursor: pointer;
	transition: background-color var(--ns-transition);
}

.ns-qty__btn:hover {
	background-color: var(--ns-color-surface-warm);
}

.ns-qty__input {
	width: 3.25rem;
	min-height: var(--ns-tap-min);
	border: 0;
	border-inline: 1px solid var(--ns-color-border);
	border-radius: 0;
	text-align: center;
	font-weight: var(--ns-weight-medium);
	background: transparent;
}

.ns-qty__input:focus {
	box-shadow: none;
}

/* ===============================================================
 * Notices — also mapped onto WooCommerce message classes
 * =============================================================== */

.ns-notice,
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	display: flex;
	align-items: flex-start;
	gap: var(--ns-space-3);
	padding: var(--ns-space-4) var(--ns-space-5);
	border: 1px solid transparent;
	border-inline-start: 4px solid var(--ns-color-accent);
	border-radius: var(--ns-radius-md);
	background-color: var(--ns-color-surface-accent);
	color: var(--ns-color-text);
	font-size: var(--ns-text-sm);
	list-style: none;
	margin-block: 0 var(--ns-space-5);
}

/* R6: these three needed the extra `.woocommerce` to outrank
 * `.woocommerce .woocommerce-message, .woocommerce .woocommerce-error, .woocommerce
 * .woocommerce-info { background-color: var(--global-palette7) }`. Until then every notice on the
 * site was rendering on Kadence's #EFD9E2 rather than its own wash, which dropped a link inside
 * one to 4.29:1 — the only contrast failure found in the R6 sweep. */
.ns-notice--success,
.woocommerce .woocommerce-message {
	background-color: var(--ns-color-success-wash);
	border-inline-start-color: var(--ns-color-success);
}

.ns-notice--info,
.woocommerce .woocommerce-info {
	background-color: var(--ns-color-info-wash);
	border-inline-start-color: var(--ns-color-info);
}

.ns-notice--warning {
	background-color: var(--ns-color-notice-wash);
	border-inline-start-color: var(--ns-color-notice);
}

.ns-notice--error,
.woocommerce .woocommerce-error {
	background-color: var(--ns-color-danger-wash);
	border-inline-start-color: var(--ns-color-danger);
}

/* A link inside a notice sits on a tinted ground, so it takes the darker of the two link
 * colours: 7.11:1 on the rose wash against 5.22:1 for the standard link. */
.ns-notice a,
.woocommerce .woocommerce-message a:not(.button),
.woocommerce .woocommerce-info a:not(.button),
.woocommerce .woocommerce-error a:not(.button) {
	color: var(--ns-color-link-hover);
}

.ns-notice__title {
	font-weight: var(--ns-weight-medium);
	display: block;
}

/* ===============================================================
 * Card and product card
 * =============================================================== */

.ns-card {
	display: flex;
	flex-direction: column;
	background-color: var(--ns-color-surface);
	border: 1px solid var(--ns-color-border);
	border-radius: var(--ns-radius-lg);
	overflow: hidden;
	transition: transform var(--ns-transition), box-shadow var(--ns-transition),
		border-color var(--ns-transition);
}

.ns-card__body {
	padding: var(--ns-space-5);
	display: flex;
	flex-direction: column;
	gap: var(--ns-space-2);
	flex: 1;
}

.ns-card--interactive:hover {
	transform: translateY(-2px);
	box-shadow: var(--ns-shadow-lg);
	border-color: var(--ns-color-accent);
}

.ns-product-card {
	position: relative;
}

.ns-product-card__media {
	position: relative;
	background-color: var(--ns-color-surface-warm);
	aspect-ratio: 4 / 5;
	overflow: hidden;
}

.ns-product-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 400ms var(--ns-ease);
}

.ns-product-card:hover .ns-product-card__media img {
	transform: scale(1.04);
}

.ns-product-card__title {
	font-family: var(--ns-font-display);
	font-size: var(--ns-text-lg);
	font-weight: var(--ns-weight-medium);
	line-height: var(--ns-leading-snug);
	margin: 0;
}

.ns-product-card__title a {
	color: var(--ns-color-text);
	text-decoration: none;
}

.ns-product-card__title a:hover {
	color: var(--ns-color-link-hover);
}

/* The whole card is clickable, but the real link keeps the accessible name. */
.ns-product-card__title a::after {
	content: '';
	position: absolute;
	inset: 0;
}

.ns-product-card__meta {
	font-size: var(--ns-text-sm);
	color: var(--ns-color-text-muted);
}

.ns-price {
	font-family: var(--ns-font-display);
	font-size: var(--ns-text-lg);
	font-weight: var(--ns-weight-display);
	color: var(--ns-color-link);
}

.ns-price del {
	color: var(--ns-color-text-muted);
	font-weight: var(--ns-weight-body);
	font-size: var(--ns-text-sm);
	margin-inline-end: var(--ns-space-2);
}

.ns-product-card__actions {
	margin-top: auto;
	padding-top: var(--ns-space-3);
	position: relative;
	z-index: 1; /* sits above the card-wide title overlay link */
}

/* ===============================================================
 * Badges, chips, breadcrumbs, pagination
 * =============================================================== */

.ns-badge {
	display: inline-flex;
	align-items: center;
	gap: var(--ns-space-1);
	padding: 0.2rem var(--ns-space-3);
	border-radius: var(--ns-radius-pill);
	background-color: var(--ns-color-cta);
	color: var(--ns-color-text-on-brand);
	font-size: var(--ns-text-xs);
	font-weight: var(--ns-weight-medium);
	letter-spacing: var(--ns-tracking-wide);
	text-transform: uppercase;
}

.ns-badge--sale { background-color: var(--ns-color-notice); }
.ns-badge--new { background-color: var(--ns-color-aqua, var(--ns-aqua)); }
.ns-badge--soldout { background-color: var(--ns-periwinkle); }

.ns-badge--floating {
	position: absolute;
	top: var(--ns-space-3);
	inset-inline-start: var(--ns-space-3);
	z-index: 2;
	box-shadow: var(--ns-shadow-sm);
}

.ns-chip {
	display: inline-flex;
	align-items: center;
	min-height: var(--ns-tap-min); /* category chips are primary touch nav — full 44px */
	padding: var(--ns-space-2) var(--ns-space-4);
	border: 1px solid var(--ns-color-border-strong);
	border-radius: var(--ns-radius-pill);
	background: var(--ns-color-surface);
	color: var(--ns-color-text);
	font-size: var(--ns-text-sm);
	text-decoration: none;
	transition: background-color var(--ns-transition), border-color var(--ns-transition);
}

.ns-chip:hover,
.ns-chip.is-active {
	background-color: var(--ns-color-cta);
	border-color: var(--ns-color-cta);
	color: var(--ns-color-text-on-brand);
}

.ns-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ns-space-2);
	font-size: var(--ns-text-sm);
	color: var(--ns-color-text-muted);
	padding-block: var(--ns-space-4);
}

.ns-breadcrumb a {
	color: var(--ns-color-text-muted);
}

.ns-breadcrumb a:hover {
	color: var(--ns-color-link-hover);
}

.ns-breadcrumb__sep {
	opacity: 0.6;
}

.ns-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ns-space-2);
	justify-content: center;
	padding-block: var(--ns-space-6);
}

.ns-pagination a,
.ns-pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--ns-tap-min);
	min-height: var(--ns-tap-min);
	padding-inline: var(--ns-space-3);
	border-radius: var(--ns-radius-pill);
	border: 1px solid var(--ns-color-border);
	color: var(--ns-color-text);
	text-decoration: none;
	font-size: var(--ns-text-sm);
}

.ns-pagination .is-current {
	background-color: var(--ns-color-cta);
	border-color: var(--ns-color-cta);
	color: var(--ns-color-text-on-brand);
	font-weight: var(--ns-weight-medium);
}

/* ===============================================================
 * Tabs
 * =============================================================== */

.ns-tabs__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ns-space-2);
	border-bottom: 1px solid var(--ns-color-border);
	margin: 0 0 var(--ns-space-5);
	padding: 0;
	list-style: none;
}

.ns-tabs__tab {
	min-height: var(--ns-tap-min);
	padding: var(--ns-space-3) var(--ns-space-4);
	border: 0;
	background: none;
	color: var(--ns-color-text-muted);
	font-family: var(--ns-font-body);
	font-size: var(--ns-text-base);
	font-weight: var(--ns-weight-medium);
	cursor: pointer;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.ns-tabs__tab[aria-selected='true'] {
	color: var(--ns-color-text);
	border-bottom-color: var(--ns-color-cta);
}

/* ===============================================================
 * Empty state and skeleton
 * =============================================================== */

.ns-empty {
	text-align: center;
	padding: var(--ns-space-8) var(--ns-space-5);
	background-color: var(--ns-color-surface-quiet);
	border-radius: var(--ns-radius-lg);
}

.ns-empty__title {
	font-family: var(--ns-font-display);
	font-size: var(--ns-h3);
	margin-bottom: var(--ns-space-2);
}

.ns-empty p {
	color: var(--ns-color-text-muted);
	margin-inline: auto;
	max-width: var(--ns-measure-narrow);
}

.ns-skeleton {
	background: linear-gradient(
		90deg,
		var(--ns-color-surface-warm) 25%,
		var(--ns-rose-wash) 37%,
		var(--ns-color-surface-warm) 63%
	);
	background-size: 400% 100%;
	animation: ns-shimmer 1.4s ease infinite;
	border-radius: var(--ns-radius-sm);
	min-height: 1rem;
}

@keyframes ns-shimmer {
	0% { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

/* ===============================================================
 * Floating WhatsApp — positioned so it can never cover a primary action
 * =============================================================== */

.ns-whatsapp {
	position: fixed;
	inset-block-end: max(var(--ns-space-5), env(safe-area-inset-bottom));
	inset-inline-end: var(--ns-space-5);
	z-index: var(--ns-z-float);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background-color: #1da851; /* WhatsApp brand green — white glyph 3.6:1, non-text UI */
	color: var(--ns-white);
	box-shadow: var(--ns-shadow-lg);
	transition: transform var(--ns-transition);
}

.ns-whatsapp:hover {
	transform: scale(1.06);
	color: var(--ns-white);
}

/* Woo's sticky mobile bars live at the bottom; lift the button clear of them. */
body.woocommerce-cart .ns-whatsapp,
body.woocommerce-checkout .ns-whatsapp,
body.single-product .ns-whatsapp {
	inset-block-end: calc(var(--ns-space-8) + env(safe-area-inset-bottom));
}

/* ===============================================================
 * Instagram section
 *
 * Two rendering paths, one visual result:
 *   1. Smash Balloon output — `[instagram-feed feed=1]` renders #sb_instagram
 *      with .sbi_item children. Styled below so the plugin inherits our grid,
 *      radius and hover instead of its own look.
 *   2. .ns-ig markup — the curated fallback used until the Instagram account is
 *      connected, so the section is never an empty box.
 *
 * Layout: 3-up square grid from 640px. Below that it becomes a scroll-snap strip
 * with 62vw tiles — three 90px thumbnails on a 320px phone would be unreadable.
 * =============================================================== */

.ns-ig {
	background-color: var(--ns-color-surface-warm);
}

.ns-ig__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--ns-space-4);
	margin-bottom: var(--ns-space-5);
}

.ns-ig__handle {
	display: inline-flex;
	align-items: center;
	gap: var(--ns-space-2);
	font-family: var(--ns-font-display);
	font-size: var(--ns-h3);
	color: var(--ns-color-text);
	text-decoration: none;
}

.ns-ig__handle svg {
	width: 1em;
	height: 1em;
	color: var(--ns-color-link);
}

.ns-ig__sub {
	color: var(--ns-color-text-muted);
	font-size: var(--ns-text-sm);
	margin: var(--ns-space-1) 0 0;
}

/* Two different layouts, because the two sources hold different numbers of tiles.
 *
 * `.ns-ig__grid` is the curated fallback (three hand-picked images, used while the Instagram
 * account was not connected): three tiles read best as a scroll-snap strip on a phone, because
 * three 90px thumbnails on a 320px screen are unreadable.
 *
 * `#sbi_images` is the live Smash Balloon feed. It is set to three posts for the same reason the
 * curated grid held three — and because every tile is a third-party request to cdninstagram.com,
 * which is the one kind of request the performance floor in CLAUDE.md tells us to keep down. Six
 * tiles measured mobile Page Speed 91 against a 95 baseline.
 *
 * Smash Balloon nests the tiles one level deeper than a first reading suggests —
 * #sb_instagram > #sbi_images > .sbi_item > .sbi_photo_wrap > a.sbi_photo — so the grid belongs on
 * #sbi_images, which is also where the plugin writes an inline `gap`. It sets its own
 * `grid-template-columns` there too: leaving `grid-auto-flow: column` on top of that put items 4-6
 * in implicit tracks and collapsed the three explicit ones to 0px.
 */
.ns-ig__grid {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 62vw;
	gap: var(--ns-space-3);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	padding-bottom: var(--ns-space-2);
	margin-inline: calc(var(--ns-gutter) * -1);
	padding-inline: var(--ns-gutter);
}

.ns-ig__grid::-webkit-scrollbar {
	display: none;
}

#sb_instagram #sbi_images {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 62vw;
	/* The plugin writes its own `grid-template-columns` here from the feed's column setting.
	 * Leaving it in place while asking for column flow puts the tiles in implicit tracks and
	 * collapses the explicit ones to 0px — measured, see KADENCE-NOTES.md §13. */
	grid-template-columns: none !important;
	gap: var(--ns-space-3) !important; /* overrides the plugin's inline gap on #sbi_images */
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	padding-bottom: var(--ns-space-2);
	margin-inline: calc(var(--ns-gutter) * -1);
	padding-inline: var(--ns-gutter);
}

#sb_instagram #sbi_images::-webkit-scrollbar {
	display: none;
}

#sb_instagram {
	padding-bottom: 0 !important; /* overrides the plugin's inline padding-bottom */
}

@media (min-width: 640px) {
	/* Desktop/tablet: the curated strip becomes a real 3-up grid, and the feed gets more air. */
	.ns-ig__grid {
		grid-auto-flow: row;
		grid-template-columns: repeat(3, 1fr);
		grid-auto-columns: auto;
		gap: var(--ns-space-4);
		overflow: visible;
		margin-inline: 0;
		padding-inline: 0;
	}

	#sb_instagram #sbi_images {
		grid-auto-flow: row;
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important; /* beats the plugin's own value */
		grid-auto-columns: auto;
		gap: var(--ns-space-4) !important; /* overrides the plugin's inline gap */
		overflow: visible;
		margin-inline: 0;
		padding-inline: 0;
	}
}

.ns-ig__item,
#sb_instagram #sbi_images .sbi_item {
	position: relative;
	scroll-snap-align: start;
	aspect-ratio: 1 / 1;
	border-radius: var(--ns-radius-lg);
	overflow: hidden;
	background-color: var(--ns-color-surface-accent);
	display: block;
	/* Smash Balloon sets inline padding/width on .sbi_item for its own grid maths;
	 * ours is a CSS grid, so those need clearing. */
	width: auto !important;  /* overrides the plugin's inline width */
	padding: 0 !important;   /* overrides the plugin's inline padding */
}

/* The tile is a wrapper around an anchor; both have to fill the square or the photo
 * collapses to the plugin's own padding-box height. */
#sb_instagram #sbi_images .sbi_item .sbi_photo_wrap,
#sb_instagram #sbi_images .sbi_item a.sbi_photo {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	background-size: cover;
	background-position: center;
}

.ns-ig__item img,
#sb_instagram #sbi_images .sbi_item img,
#sb_instagram #sbi_images .sbi_photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
	transition: transform 400ms var(--ns-ease);
}

.ns-ig__item:hover img,
#sb_instagram #sbi_images .sbi_item:hover img {
	transform: scale(1.05);
}

/* Hover/focus wash, so a tile reads as a link rather than a picture. */
.ns-ig__item::after,
#sb_instagram #sbi_images .sbi_item::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgb(45 33 53 / 0.32);
	opacity: 0;
	transition: opacity var(--ns-transition);
	border-radius: inherit;
	pointer-events: none;
}

.ns-ig__item:hover::after,
.ns-ig__item:focus-visible::after,
#sb_instagram #sbi_images .sbi_item:hover::after,
#sb_instagram #sbi_images .sbi_item:focus-within::after {
	opacity: 1;
}

.ns-ig__item-icon {
	position: absolute;
	inset: 50% auto auto 50%;
	translate: -50% -50%;
	z-index: 1;
	color: var(--ns-white);
	opacity: 0;
	transition: opacity var(--ns-transition);
	pointer-events: none;
}

.ns-ig__item:hover .ns-ig__item-icon,
.ns-ig__item:focus-visible .ns-ig__item-icon {
	opacity: 1;
}

/* Keyboard users need to see which tile they are on; the wash alone is not a focus ring. */
#sb_instagram #sbi_images .sbi_item a.sbi_photo:focus-visible {
	outline: var(--ns-focus-width) solid var(--ns-color-focus);
	outline-offset: calc(var(--ns-focus-offset) * -1);
}

.ns-ig__foot {
	margin-top: var(--ns-space-5);
	display: flex;
	justify-content: center;
}

/* Not-yet-connected state — shown to admins only, never to shoppers. */
.ns-ig__notice {
	margin-top: var(--ns-space-4);
	text-align: center;
	font-size: var(--ns-text-sm);
	color: var(--ns-color-text-muted);
}

/* Smash Balloon chrome we replace with our own header and follow button. Both are also switched
 * off in the feed's own settings (Customize -> Header / Load More / Follow Button); this is the
 * belt to that braces, because the plugin re-renders the feed from JS after the initial paint. */
#sb_instagram .sb_instagram_header,
#sb_instagram #sbi_load {
	display: none !important; /* replaced by .ns-ig__head and the section's own follow button */
}
