/**
 * Cookie banner (cookie-notice.js) and the cookie policy tables.
 *
 * Kept out of skin.css so the banner ships on its own. Colours come from the theme
 * presets that skin.css remaps for dark mode, so the banner follows the theme toggle.
 */

.ms-cookie-notice {
	position: fixed;
	z-index: 100;
	left: 1rem;
	bottom: 1rem;
	box-sizing: border-box;
	width: min(26rem, calc(100vw - 2rem));
	padding: 1.125rem 1.25rem;
	border: 1px solid var(--wp--preset--color--accent-6);
	border-radius: var(--ms-radius, 18px);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	box-shadow: var(--ms-site-shadow);
	font-size: 0.875rem;
	line-height: 1.5;
}

.ms-cookie-notice[hidden] {
	display: none;
}

.ms-cookie-notice__text {
	margin: 0 0 0.875rem;
}

.ms-cookie-notice__text a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.ms-cookie-notice__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ms-cookie-notice__button {
	flex: 1 1 auto;
	padding: 0.5rem 1rem;
	border: 1px solid var(--ms-accent);
	border-radius: 999px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.ms-cookie-notice__button--primary {
	background: var(--ms-accent);
	color: var(--ms-accent-text);
}

.ms-cookie-notice__button--secondary {
	background: transparent;
	color: var(--wp--preset--color--contrast);
}

.ms-cookie-notice__button:focus-visible {
	outline: 2px solid var(--ms-accent);
	outline-offset: 2px;
}

@media (max-width: 600px) {

	.ms-cookie-notice {
		left: 0.75rem;
		bottom: 0.75rem;
		width: calc(100vw - 1.5rem);
	}
}

/* Cookie policy page: a cookie name is one unbreakable token, so its column never wraps it. */

.ms-cookie-table {
	font-size: 0.875rem;
}

.ms-cookie-table td:first-child {
	white-space: nowrap;
}

/* Core's table can lay out columns evenly, which squeezes the names; size the first two. */
.ms-cookie-table :is(th, td):first-child {
	width: 15rem;
}

.ms-cookie-table :is(th, td):nth-child(2) {
	width: 8.5rem;
}

/* On a phone four columns leave a word per line, so each cookie becomes a stacked card. */
@media (max-width: 600px) {

	.ms-cookie-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	.ms-cookie-table :is(table, tbody, tr, td),
	.ms-cookie-table :is(th, td):is(:first-child, :nth-child(2)) {
		display: block;
		width: auto;
	}

	.ms-cookie-table tr {
		padding: 0.875rem 1rem;
	}

	.ms-cookie-table td {
		padding: 0;
		border: 0;
	}

	.ms-cookie-table td + td {
		margin-top: 0.25rem;
	}

	.ms-cookie-table td:nth-child(2),
	.ms-cookie-table td:nth-child(4) {
		color: var(--wp--preset--color--accent-4);
		font-size: 0.8125rem;
	}
}
