/**
 * GM Cookie Consent — self-contained styles.
 *
 * No host design-system dependency. All colors come from CSS variables that
 * gm-cookie-consent.php sets from the theme config (with sensible defaults),
 * so a new site only needs to pass its brand values. Scoped under .gm-cc /
 * .gm-cc-fab so it cannot leak into the host site.
 *
 * Variables (set on .gm-cc, .gm-cc-fab):
 *   --gmcc-bg --gmcc-text --gmcc-text-muted --gmcc-accent --gmcc-accent-text
 *   --gmcc-accent-hover --gmcc-link --gmcc-focus --gmcc-radius --gmcc-font
 */

.gm-cc {
	--gmcc-bg: #1b1f2a;
	--gmcc-text: #ffffff;
	--gmcc-text-muted: #a7b0bd;
	--gmcc-accent: #ffc145;
	--gmcc-accent-text: #15171c;
	--gmcc-accent-hover: #ffd37a;
	--gmcc-link: #7cc6ff;
	--gmcc-focus: #3b82f6;
	--gmcc-radius: 16px;
	--gmcc-font: inherit;

	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 2147483600;
	padding: 0 4% 1rem;
	pointer-events: none;
	transform: translateY(120%);
	opacity: 0;
	transition: transform 0.32s ease-out, opacity 0.32s ease-out;
	font-family: var(--gmcc-font);
}
@media (min-width: 768px) {
	.gm-cc { padding: 0 2% 1.25rem; }
}
.gm-cc[hidden] { display: block; visibility: hidden; } /* kept in flow for the slide; JS toggles .is-visible. visibility (v1.6.2) takes the slid-out bar out of the tab order and the accessibility tree */
.gm-cc.is-visible { transform: none; opacity: 1; }
/* v1.6.4: keyboard focus landed on something the bar covered at the bottom (WCAG 2.4.11), so it sits at the top edge */
.gm-cc.gm-cc--top { top: 0; bottom: auto; padding-top: 1rem; padding-bottom: 0; }
.gm-cc.gm-cc--top:not(.is-visible) { transform: translateY(-120%); }
@media (min-width: 768px) {
	.gm-cc.gm-cc--top { padding-top: 1.25rem; padding-bottom: 0; }
}
.gm-cc:focus { outline: none; } /* v1.6.3: focus lands on the bar itself when it reopens, a landing point, not a control */
@media (prefers-reduced-motion: reduce) {
	.gm-cc { transition: none; }
}

.gm-cc__card {
	margin-inline: auto;
	max-width: 56rem;
	padding: 1.5rem;
	pointer-events: auto;
	background: var(--gmcc-bg);
	color: var(--gmcc-text);
	border-radius: var(--gmcc-radius);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
@media (min-width: 768px) {
	.gm-cc__card { padding: 1.75rem 2rem; }
}

.gm-cc__top {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}
@media (min-width: 900px) {
	.gm-cc__top { flex-direction: row; align-items: center; justify-content: space-between; gap: 2rem; }
}
.gm-cc__title { margin: 0 0 0.25rem; font-size: 20px; line-height: 1.25; font-weight: 600; color: var(--gmcc-text); }
.gm-cc__body { margin: 0; max-width: 62ch; font-size: 14px; line-height: 1.5; color: var(--gmcc-text-muted); }
.gm-cc__link { color: var(--gmcc-link); text-decoration: underline; text-underline-offset: 2px; }
.gm-cc__link:hover { color: var(--gmcc-text); }

.gm-cc__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	flex-shrink: 0;
}

/* Buttons (module's own — no host .btn dependency) */
.gm-cc__btn {
	font: 500 16px/1.4 var(--gmcc-font);
	border-radius: 9999px;
	padding: 0.7rem 1.6rem;
	border: 1px solid transparent;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.2s ease-out, color 0.2s ease-out, border-color 0.2s ease-out;
}
.gm-cc__btn--primary { background: var(--gmcc-accent); color: var(--gmcc-accent-text); border-color: var(--gmcc-accent); }
.gm-cc__btn--primary:hover { background: var(--gmcc-accent-hover); border-color: var(--gmcc-accent-hover); }
.gm-cc__btn--outline { background: transparent; color: var(--gmcc-text); border-color: var(--gmcc-text); }
.gm-cc__btn--outline:hover { background: var(--gmcc-text); color: var(--gmcc-bg); }
.gm-cc__btn:focus-visible { outline: 2px solid var(--gmcc-focus); outline-offset: 2px; }
.gm-cc__btn-text {
	background: none;
	border: 0;
	color: var(--gmcc-text);
	font: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
	padding: 0.5rem 0.25rem;
}
.gm-cc__btn-text:hover { color: var(--gmcc-link); }
.gm-cc__btn-text:focus-visible { outline: 2px solid var(--gmcc-focus); outline-offset: 2px; border-radius: 4px; }

.gm-cc__prefs {
	margin-top: 1.25rem;
	padding-top: 1.25rem;
	border-top: 1px solid rgba(127, 127, 127, 0.3);
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	align-items: flex-start;
}
.gm-cc__prefs[hidden] { display: none; }
.gm-cc__cats {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.85rem 2.5rem;
	width: 100%;
	grid-template-columns: 1fr;
}
@media (min-width: 700px) {
	.gm-cc__cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.gm-cc__cat { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.gm-cc__cat-text { display: flex; flex-direction: column; }
.gm-cc__cat-name { font-size: 15px; line-height: 1.3; }
.gm-cc__cat-note { font-size: 13px; color: var(--gmcc-text-muted); }

/* Toggle switch (native checkbox, custom track) */
.gm-cc__switch { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; cursor: pointer; }
.gm-cc__switch input { position: absolute; inset: 0; width: 44px; height: 24px; margin: 0; opacity: 0; cursor: pointer; }
.gm-cc__track { width: 44px; height: 24px; border-radius: 9999px; background: var(--gmcc-text-muted); position: relative; transition: background 0.2s ease-out; }
.gm-cc__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 9999px; background: #ffffff; transition: transform 0.2s ease-out; }
.gm-cc__switch input:checked + .gm-cc__track { background: var(--gmcc-accent); }
.gm-cc__switch input:checked + .gm-cc__track::after { transform: translateX(20px); }
.gm-cc__switch input:focus-visible + .gm-cc__track { outline: 2px solid var(--gmcc-focus); outline-offset: 2px; }
.gm-cc__switch--locked { opacity: 0.65; cursor: not-allowed; }
.gm-cc__switch--locked input { cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) {
	.gm-cc__track, .gm-cc__track::after { transition: none; }
}

/* Persistent reopen button */
.gm-cc-fab {
	--gmcc-bg: #1b1f2a;
	--gmcc-accent: #ffc145;
	--gmcc-focus: #3b82f6;
	position: fixed;
	left: 1rem;
	bottom: 1rem;
	z-index: 2147483550;
	width: 46px;
	height: 46px;
	border-radius: 9999px;
	border: 0;
	background: var(--gmcc-bg);
	color: #ffffff;
	display: grid;
	place-items: center;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
	transition: background 0.2s ease-out, transform 0.2s ease-out;
}
.gm-cc-fab:hover { background: var(--gmcc-accent); color: var(--gmcc-accent-text, #15171c); transform: translateY(-1px); }
.gm-cc-fab:focus-visible { outline: 2px solid var(--gmcc-focus); outline-offset: 3px; }
.gm-cc-fab svg { width: 24px; height: 24px; display: block; }
.gm-cc-fab[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
	.gm-cc-fab { transition: none; }
}

/* ── Theme-proofing (2026-06-29) ─────────────────────────────────────────────────
   A drop-in widget must render the same on any host theme. Two things break that:
   (1) themes that change the root font-size silently shrink rem-based layout (e.g.
   Plumb sets a 10px root, so 56rem collapses from 896px to 560px), and (2) generic
   h2/p theme rules inflate the banner's title/body (e.g. h2 -> 40px). Lock the
   layout-critical sizing in px at #id specificity + !important so the banner is the
   same standardized size everywhere. */
#gm-cc .gm-cc__card { max-width: 896px !important; padding: 28px 32px !important; }
#gm-cc .gm-cc__title { font-size: 20px !important; line-height: 1.25 !important; margin: 0 0 4px !important; }
#gm-cc .gm-cc__body { font-size: 14px !important; line-height: 1.5 !important; }
#gm-cc .gm-cc__btn { font-size: 16px !important; line-height: 1.4 !important; }
