/*
 * CGM Share bar.
 * :where() keeps specificity at zero, so theme or Bricks styles always win.
 * Small-screen rules are in cgm-share-compact.css (added per breakpoint by PHP).
 * Tweak site-wide with the custom properties below.
 */
:root {
	--cgm-share-ink: #111;
	--cgm-share-muted: #6b6b6b;
	--cgm-share-accent: #e5192c;      /* CGM red: author link, focus, hover in mono styles */
	--cgm-share-paper: #fff;
	--cgm-share-line: #d9d9d9;
	--cgm-share-meta-font: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	--cgm-share-meta-size: 12px;
	--cgm-share-gap: 4px;              /* between share buttons */
	--cgm-share-seg-gap: 10px;         /* between segments and separators */
}

:where(.cgm-share) {
	--cgm-share-icon: 18px;
	--cgm-share-pad: 7px;
	box-sizing: border-box;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px var(--cgm-share-seg-gap);
	color: var(--cgm-share-ink);
	line-height: 1;
}
:where(.cgm-share *, .cgm-share *::before) { box-sizing: border-box; }
:where(.cgm-share--sm) { --cgm-share-icon: 14px; --cgm-share-pad: 6px; }
:where(.cgm-share--lg) { --cgm-share-icon: 22px; --cgm-share-pad: 9px; }
:where(.cgm-share--dark) {
	--cgm-share-ink: #f1f1f1;
	--cgm-share-muted: #a8a8a8;
	--cgm-share-paper: #161616;
	--cgm-share-line: #3a3a3a;
}

:where(.cgm-share--align-center) { justify-content: center; }
:where(.cgm-share--align-end) { justify-content: flex-end; }
:where(.cgm-share--align-between) { justify-content: space-between; }

/* Segments and separators */
:where(.cgm-share__seg) {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	min-width: 0;
}
:where(.cgm-share__sep) { flex: none; color: var(--cgm-share-muted); font-family: var(--cgm-share-meta-font); font-size: var(--cgm-share-meta-size); }
:where(.cgm-share--sep-pipe .cgm-share__sep)::before { content: "|"; }
:where(.cgm-share--sep-dot .cgm-share__sep)::before { content: "\00B7"; font-weight: 700; }
:where(.cgm-share--sep-slash .cgm-share__sep)::before { content: "/"; }
.cgm-share__sep.is-off { display: none; }
:where(.cgm-share--sep-line .cgm-share__sep) { align-self: stretch; width: 1px; min-height: 1.4em; background: currentColor; }

/* Meta: author, date, label... */
:where(.cgm-share__meta) {
	font-family: var(--cgm-share-meta-font);
	font-size: var(--cgm-share-meta-size);
	letter-spacing: .02em;
	text-transform: uppercase;
	color: var(--cgm-share-muted);
	white-space: nowrap;
}
/* Several authors may need more than one line on phones */
:where(.cgm-share__meta--author) { min-width: 0; white-space: normal; }
:where(.cgm-share__meta--author .cgm-author__name) { white-space: nowrap; }
:where(.cgm-share__meta--author .cgm-author__sep) { white-space: pre-wrap; }
:where(.cgm-share__meta a) { color: inherit; text-decoration: none; }
:where(.cgm-share__meta--author a) { color: var(--cgm-share-accent); }
:where(.cgm-share__meta a:hover) { text-decoration: underline; text-underline-offset: 2px; }
:where(.cgm-share__meta--label) { color: var(--cgm-share-ink); font-weight: 600; }

/* Button list */
:where(.cgm-share__nets) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--cgm-share-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}
:where(.cgm-share__net, .cgm-share__more-item) { display: flex; margin: 0; padding: 0; }
:where(.cgm-share__net, .cgm-share__more-item)::before, :where(.cgm-share__net, .cgm-share__more-item)::marker { content: none; }

/* Button base */
:where(.cgm-share__btn) {
	--cgm-fg: var(--cgm-share-ink);
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: calc(var(--cgm-share-icon) + var(--cgm-share-pad) * 2);
	height: calc(var(--cgm-share-icon) + var(--cgm-share-pad) * 2);
	margin: 0;
	padding: 0 var(--cgm-share-pad);
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--cgm-fg);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: color .2s, background-color .2s, border-color .2s, transform .2s, opacity .2s;
}
:where(.cgm-share__btn[hidden]) { display: none; }
:where(.cgm-share__btn:focus-visible) { outline: 2px solid var(--cgm-share-accent); outline-offset: 2px; }
:where(.cgm-share__ico) { display: inline-flex; flex: none; }
:where(.cgm-share__svg) { display: block; width: var(--cgm-share-icon); height: var(--cgm-share-icon); }
:where(.cgm-share__label) { white-space: nowrap; }
:where(.cgm-share--labels-hide .cgm-share__label) { display: none; }

/* Swap icons (copy -> check, more -> close) */
:where(.cgm-share__ico--close) { display: none; }
:where(.cgm-share__btn.is-done .cgm-share__ico--open, .cgm-share.is-open .cgm-share__more .cgm-share__ico--open) { display: none; }
:where(.cgm-share__btn.is-done .cgm-share__ico--close, .cgm-share.is-open .cgm-share__more .cgm-share__ico--close) { display: inline-flex; }

/* Style: icon (bare, single colour, brand colour on hover) */
:where(.cgm-share--icon .cgm-share__btn:hover) { --cgm-fg: var(--cgm-b, var(--cgm-share-accent)); }

/* Style: brand (bare, brand colours) */
:where(.cgm-share--brand .cgm-share__net .cgm-share__btn) { --cgm-fg: var(--cgm-b); }
:where(.cgm-share--brand .cgm-share__btn:hover) { opacity: .75; }

/* Styles: circle / square / pill (filled with brand colour) */
:where(.cgm-share--circle, .cgm-share--square, .cgm-share--pill) { --cgm-share-gap: 6px; }
:where(.cgm-share--circle .cgm-share__net .cgm-share__btn, .cgm-share--square .cgm-share__net .cgm-share__btn, .cgm-share--pill .cgm-share__net .cgm-share__btn) {
	--cgm-fg: #fff;
	background: var(--cgm-b);
}
:where(.cgm-share--circle .cgm-share__btn) { border-radius: 50%; }
:where(.cgm-share--square .cgm-share__btn) { border-radius: 6px; }
:where(.cgm-share--pill .cgm-share__btn) { border-radius: 999px; padding: 0 calc(var(--cgm-share-pad) + 5px); }
:where(.cgm-share--pill.cgm-share--labels-hide .cgm-share__btn) { padding: 0 var(--cgm-share-pad); }
:where(.cgm-share--circle .cgm-share__net .cgm-share__btn:hover, .cgm-share--square .cgm-share__net .cgm-share__btn:hover, .cgm-share--pill .cgm-share__net .cgm-share__btn:hover) {
	transform: translateY(-1px);
	filter: brightness(1.1);
}
/* "More" in filled styles */
:where(.cgm-share--circle .cgm-share__more, .cgm-share--square .cgm-share__more, .cgm-share--pill .cgm-share__more) {
	background: var(--cgm-share-paper);
	box-shadow: inset 0 0 0 1px var(--cgm-share-line);
}

/* Style: outline */
:where(.cgm-share--outline) { --cgm-share-gap: 6px; }
:where(.cgm-share--outline .cgm-share__btn) { border-radius: 50%; box-shadow: inset 0 0 0 1px var(--cgm-share-line); }
:where(.cgm-share--outline .cgm-share__net .cgm-share__btn:hover) { --cgm-fg: #fff; background: var(--cgm-b); box-shadow: inset 0 0 0 1px var(--cgm-b); }
:where(.cgm-share--outline.cgm-share--labels-show .cgm-share__btn) { border-radius: 999px; }

/* Black brand marks (X, Threads) on dark backgrounds */
/* Set on the button: the <li> carries the brand colour inline, so it has to be overridden one level down. */
:where(.cgm-share--dark :is(.cgm-share__net--x, .cgm-share__net--threads) .cgm-share__btn) { --cgm-b: #f1f1f1; }
:where(.cgm-share--dark:is(.cgm-share--circle, .cgm-share--square, .cgm-share--pill) :is(.cgm-share__net--x, .cgm-share__net--threads) .cgm-share__btn) { --cgm-fg: #111; }

/* "More" toggle and overflow (desktop limit) */
:where(.cgm-share__more) { display: none; }
:where(.cgm-share--has-xd .cgm-share__more) { display: inline-flex; }
:where(.cgm-share:not(.is-open) .cgm-share__net--xd) { display: none; }

/* Google Favorites inside the bar */
:where(.cgm-share__item--google) { display: inline-flex; }

/* Screen reader text */
.cgm-share__sr:not(:empty), .cgm-share__live {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
.cgm-share__sr:empty { display: none; }

/* Floating: vertical rail on large screens (bottom bar on small screens, see compact CSS) */
:where(.cgm-share--floating) {
	position: fixed;
	z-index: 9990;
	top: 50%;
	left: 12px;
	flex-direction: column;
	transform: translateY(-50%);
}
:where(.cgm-share--floating .cgm-share__nets) { flex-direction: column; }
:where(.cgm-share--floating .cgm-share__sep, .cgm-share--floating .cgm-share__meta, .cgm-share--floating .cgm-share__item--google) { display: none; }

@media (prefers-reduced-motion: reduce) {
	:where(.cgm-share__btn) { transition: none; }
}
@media print {
	.cgm-share { display: none !important; }
}
