/* Rok Custom Night Light Switch
 * Real dark theme (no colour inversion): dmt-script.js reads the colours of every
 * element once, calculates a dark equivalent and stores it in CSS custom properties
 * (--dmt-*) plus data-dmt-* attributes. The rules below apply those values only
 * while <html data-dmt="dark"> is set, so light mode is never touched.
 */

/* ---------- Dark mode base ---------- */
html[data-dmt="dark"] {
	color-scheme: dark;
	background-color: #000;
}

html[data-dmt="dark"] body {
	background-color: #000 !important;
	color: #fff;
}

html[data-dmt="dark"] ::placeholder {
	color: #9ca3af;
	opacity: 1;
}

/* ---------- Colours calculated by the script ---------- */
html[data-dmt="dark"] [data-dmt-bg] {
	background-color: var(--dmt-bg) !important;
}

html[data-dmt="dark"] [data-dmt-bi] {
	background-image: var(--dmt-bi) !important;
}

html[data-dmt="dark"] [data-dmt-fg] {
	color: var(--dmt-fg) !important;
}

html[data-dmt="dark"] [data-dmt-bc] {
	border-color: var(--dmt-bc) !important;
}

html[data-dmt="dark"] [data-dmt-fl] {
	fill: var(--dmt-fl) !important;
}

html[data-dmt="dark"] [data-dmt-st] {
	stroke: var(--dmt-st) !important;
}

/* Sections with a background image keep their original text colour. */
html[data-dmt="dark"] [data-dmt-kc] {
	color: var(--dmt-kc) !important;
}

/* ---------- Floating button ---------- */
.dmt-toggle {
	all: initial;
	box-sizing: border-box;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border: 2px solid rgba(255, 255, 255, 0.25);
	border-radius: 50%;
	background: #1f2937;
	color: #fff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease;
}

/* Hidden until JavaScript is running (the button is useless without it). */
html:not(.dmt-js) .dmt-toggle {
	display: none;
}

.dmt-toggle:hover {
	transform: scale(1.08);
}

.dmt-toggle:focus-visible {
	outline: 3px solid #3b82f6;
	outline-offset: 2px;
}

/* Dark mode active: light button. */
.dmt-toggle[aria-pressed="true"] {
	border-color: rgba(0, 0, 0, 0.15);
	background: #f9fafb;
	color: #111827;
}

/* Icons: moon in light mode (click -> dark), sun in dark mode (click -> light). */
.dmt-icon {
	display: block;
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	pointer-events: none;
}

.dmt-icon--sun {
	display: none;
}

html[data-dmt="dark"] .dmt-icon--moon {
	display: none;
}

html[data-dmt="dark"] .dmt-icon--sun {
	display: block;
}

/* ---------- Mobile: 80px from the bottom ---------- */
@media (max-width: 768px) {
	.dmt-toggle {
		bottom: 80px;
	}
}

/* ---------- Accessibility / print ---------- */
@media (prefers-reduced-motion: reduce) {
	.dmt-toggle {
		transition: none;
	}
}

@media print {
	.dmt-toggle {
		display: none !important;
	}
}
