/*
===========================================================================

settings.css - the Shard rules page, on the Jangan theme's tokens

Colours, frames and type come from theme.css. Each tone has one job: amber
marks a rule changed from its default, jade a live rule and a switch that
is on, sky a value set from this console. A chip always carries its words,
so no state is colour alone. Below 640px each rule stacks its value under
its name, for a phone.

===========================================================================
*/

.rules {
	padding-bottom: 32px;
}

.rules-note {
	margin: 0 0 12px;
	padding: 8px 14px;
	border: 1px solid var(--gold-soft);
	border-left: 4px solid var(--sky);
	border-radius: 6px;
	background: var(--surface);
	color: var(--text);
	font-size: 13px;
}

.rules-status {
	margin: 0 0 12px;
	color: var(--cream);
	font-size: 13px;
}

.rules-status:empty {
	display: none;
}

/* ----- Summary plaques ----- */

.rules-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 10px;
	margin-bottom: 14px;
}

.rules-tile {
	display: grid;
	gap: 2px;
	padding: 10px 14px;
	border: 1px solid var(--bronze);
	border-left: 4px solid var(--line);
	border-radius: 6px;
	background: var(--surface);
	box-shadow: var(--shadow);
}

.rules-tile strong {
	font: 700 26px/1.1 var(--serif);
	color: var(--heading);
	font-variant-numeric: tabular-nums;
}

.rules-tile span {
	color: var(--muted);
	font-size: 12px;
}

.rules-tile.amber {
	border-left-color: var(--amber);
}

/* ----- Filters ----- */

.rules-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 12px 16px;
	padding: 12px 16px;
	margin-bottom: 10px;
}

.rules-server,
.rules-search {
	display: grid;
	gap: 4px;
	color: var(--muted);
	font-size: 12px;
}

.rules-search {
	flex: 0 1 320px;
}

.rules-search input {
	width: 100%;
}

.rules-search input,
.rules-server select {
	padding: 7px 10px;
}

.rules-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.rules-group {
	padding: 5px 12px;
	border: 1px solid var(--bronze);
	border-radius: 999px;
	background: var(--wood);
	color: var(--text);
	font: 13px var(--serif);
	cursor: pointer;
}

.rules-group.active {
	background: linear-gradient(180deg, #c03a26, #8a1d12);
	border-color: var(--gold-soft);
	color: #fff2d6;
}

.rules-check {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--text);
	font-size: 13px;
}

.rules-check input {
	width: 16px;
	height: 16px;
	margin: 0;
	padding: 0;
	box-shadow: none;
	accent-color: var(--lacquer);
}

/* ----- Board ----- */

.rules-board {
	display: grid;
	gap: 14px;
	margin-bottom: 14px;
	min-width: 0;
}

.rules-group-panel {
	min-width: 0;
	margin-bottom: 14px;
}

.rules-rows {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The value sits beside its name, not across the page: the name column
   stops at a reading width and the value column follows it. */
.rules-row {
	display: grid;
	grid-template-columns: minmax(0, 60ch) minmax(180px, 1fr);
	gap: 10px 28px;
	padding: 12px 4px 12px 12px;
	border-top: 1px solid var(--line);
}

.rules-row:first-child {
	border-top: 0;
}

.rules-row.changed {
	box-shadow: inset 3px 0 0 var(--amber);
}

.rules-name {
	display: grid;
	gap: 4px;
	min-width: 0;
}

.rules-title {
	color: var(--heading);
	font: 700 16px var(--serif);
}

.rules-help,
.rules-native {
	margin: 0;
	color: var(--text);
	font-size: 13px;
	max-width: 62ch;
}

.rules-native {
	color: var(--muted);
	font-style: italic;
}

.rules-key {
	justify-self: start;
	padding: 1px 6px;
	border-radius: 4px;
	background: var(--surface-raised);
	color: var(--muted);
	font: 11px ui-monospace, Consolas, monospace;
	overflow-wrap: anywhere;
}

.rules-value {
	display: grid;
	align-content: start;
	justify-items: start;
	gap: 6px;
}

.rules-now {
	color: var(--heading);
	font: 700 18px var(--serif);
	font-variant-numeric: tabular-nums;
}

.rules-range {
	color: var(--muted);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.rules-chips-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.rules-chip {
	padding: 1px 8px;
	border: 1px solid;
	border-radius: 999px;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

.rules-chip.live,
.rules-chip.on {
	color: var(--jade);
	background: var(--jade-deep);
}

.rules-chip.restart,
.rules-chip.changed {
	color: var(--amber);
	background: #f6e4bd;
}

.rules-chip.entry {
	color: var(--teal);
	background: var(--teal-pale);
}

.rules-chip.store {
	color: var(--sky);
	background: #dbe6f2;
}

.rules-chip.off,
.rules-chip.value {
	color: var(--muted);
	background: var(--surface-raised);
}

.rules-empty {
	margin: 0;
	padding: 18px;
	color: var(--muted);
}

/* ----- Shard settings and fixed rules ----- */

.rules-flags {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	gap: 0 18px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 13px;
}

.rules-flags li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 10px;
	min-width: 0;
	padding: 6px 4px;
	border-bottom: 1px solid var(--line);
}

.rules-fixed-list {
	display: grid;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rules-fixed-list li {
	display: grid;
	grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
	gap: 4px 14px;
	color: var(--muted);
	font-size: 13px;
}

.rules-fixed-list strong {
	color: var(--text);
}

/* ----- Heading actions, legend, waiting changes ----- */

/* The theme's action box is dark lacquer, so its words are cream. */
main > .page-heading .rules-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 8px 12px;
	padding: 8px 12px;
}

.rules-actions .rules-server {
	color: var(--cream);
}

.rules-read {
	align-self: center;
	color: var(--cream);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

button.rules-tile {
	font: inherit;
	text-align: left;
	color: inherit;
	cursor: pointer;
}

button.rules-tile:disabled {
	cursor: default;
	opacity: 0.6;
}

button.rules-tile:not(:disabled):hover {
	background: var(--surface-raised);
}

button.rules-tile[aria-pressed="true"] {
	background: var(--surface-raised);
	border-color: var(--lacquer);
	box-shadow: inset 0 0 0 1px var(--lacquer);
}

button.rules-tile[aria-pressed="true"] span::after {
	content: " · showing only these";
	color: var(--lacquer);
}

/* Panel bodies line up with their heading, not the panel's edge. */
.rules-group-panel > .rules-help,
.rules-group-panel > .rules-flags,
.rules-group-panel > .rules-unset,
.rules-group-panel > .rules-fixed-list {
	margin-left: 16px;
	margin-right: 16px;
}

.rules-group-panel > .rules-help {
	margin-bottom: 8px;
}

.rules-group-panel > .rules-unset,
.rules-group-panel > .rules-fixed-list {
	margin-bottom: 14px;
}

.rules-tile.sky {
	border-left-color: var(--sky);
}

.rules-checks {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
}

.rules-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
	color: var(--cream);
	font-size: 12px;
}

.rules-legend li {
	display: flex;
	align-items: center;
	gap: 6px;
}

.rules-row.waiting {
	box-shadow: inset 3px 0 0 var(--sky);
}

.rules-pending {
	grid-column: 1 / -1;
	padding: 8px 12px;
	border: 1px solid var(--sky);
	border-radius: 6px;
	background: #dbe6f2;
	color: var(--text);
	font-size: 13px;
}

.rules-pending q {
	display: block;
	margin-top: 4px;
	font-style: italic;
}

.rules-chip.queued {
	color: var(--sky);
	background: #dbe6f2;
}

.rules-unset {
	margin-top: 10px;
}

.rules-unset summary {
	color: var(--muted);
	font-size: 13px;
	cursor: pointer;
}

.rules-unset[open] summary {
	margin-bottom: 6px;
}

/* ----- Narrow screens ----- */

@media (max-width: 640px) {
	.rules-tile:last-child:nth-child(odd) {
		grid-column: 1 / -1;
	}
	.rules-row,
	.rules-fixed-list li {
		grid-template-columns: minmax(0, 1fr);
	}
}
