/*
 * PureCSS.com
 * https://purecss.com/neumorphism/
 * Soft UI from paired light and dark shadows on one pinned surface: a raised card, a button that presses in, a toggle that stays down.
 */

/* the surface is pinned, not themed: the effect only works when every piece
   shares this one background, so both site themes show the same panel */
.demo-neumorphism .nm-surface {
	--nm-bg: #e0e5ec;
	--nm-hi: #ffffff;
	--nm-lo: #a3b1c6;
	--nm-ink: #2d3748;
	--nm-soft: #56627a;
	--nm-accent: #2f5bd3;
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 100%;
	max-width: 34rem;
	padding: 3rem 1.5rem;
	border-radius: 16px;
	overflow: hidden;
	color: var(--nm-ink);
	background: var(--nm-bg);
}

.demo-neumorphism .nm-card {
	box-sizing: border-box;
	display: grid;
	gap: 1.25rem;
	width: 100%;
	max-width: 17rem;
	padding: 1.5rem;
	border-radius: 24px;
	background: var(--nm-bg);
	box-shadow: 10px 10px 24px var(--nm-lo), -10px -10px 24px var(--nm-hi);
}

.demo-neumorphism .nm-label {
	margin: 0;
	font-size: .8rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--nm-soft);
}

/* the same two shadows turned inward make a well */
.demo-neumorphism .nm-well {
	margin: 0;
	padding: 1rem;
	border-radius: 16px;
	font-size: 2.6rem;
	font-weight: 700;
	line-height: 1.1;
	text-align: center;
	font-variant-numeric: tabular-nums;
	box-shadow: inset 6px 6px 12px var(--nm-lo), inset -6px -6px 12px var(--nm-hi);
}

.demo-neumorphism .nm-row {
	display: flex;
	gap: 1rem;
}

/* four shadows in both states, in the same order and with inset in the same
   slots, so the press animates instead of jumping */
.demo-neumorphism .nm-btn,
.demo-neumorphism .nm-latch {
	position: relative;
	box-sizing: border-box;
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	min-height: 3rem;
	padding: .75rem 1rem;
	border: 0;
	border-radius: 999px;
	font: inherit;
	font-weight: 700;
	color: var(--nm-ink);
	background: var(--nm-bg);
	cursor: pointer;
	box-shadow: 6px 6px 12px var(--nm-lo), -6px -6px 12px var(--nm-hi), inset 0 0 0 var(--nm-lo), inset 0 0 0 var(--nm-hi);
	transition: box-shadow .2s ease, color .2s ease;
}

.demo-neumorphism .nm-btn:active,
.demo-neumorphism .nm-latch:has(:checked) {
	box-shadow: 0 0 0 var(--nm-lo), 0 0 0 var(--nm-hi), inset 5px 5px 10px var(--nm-lo), inset -5px -5px 10px var(--nm-hi);
}

.demo-neumorphism .nm-latch:has(:checked) {
	color: var(--nm-accent);
}

/* the checkbox stays focusable, it is only moved out of sight */
.demo-neumorphism .nm-latch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.demo-neumorphism .nm-latch svg {
	width: 1rem;
	height: 1rem;
}

.demo-neumorphism .nm-btn:focus-visible,
.demo-neumorphism .nm-latch:has(:focus-visible) {
	outline: 2px solid var(--nm-accent);
	outline-offset: 4px;
}

/* home card: the timer card on the full pane, Start pressing in on a loop */
.card-preview .demo-neumorphism {
	width: 100%;
	height: 100%;
}

.card-preview .demo-neumorphism .nm-surface {
	max-width: none;
	height: 100%;
	padding: 0;
	border-radius: 0;
}

.card-preview .demo-neumorphism .nm-card {
	gap: .7rem;
	max-width: 13.5rem;
	padding: .9rem 1rem;
	border-radius: 18px;
	box-shadow: 7px 7px 16px var(--nm-lo), -7px -7px 16px var(--nm-hi);
}

.card-preview .demo-neumorphism .nm-label {
	font-size: .62rem;
}

.card-preview .demo-neumorphism .nm-well {
	padding: .45rem;
	border-radius: 12px;
	font-size: 1.6rem;
	box-shadow: inset 4px 4px 8px var(--nm-lo), inset -4px -4px 8px var(--nm-hi);
}

.card-preview .demo-neumorphism .nm-row {
	gap: .7rem;
}

.card-preview .demo-neumorphism .nm-btn,
.card-preview .demo-neumorphism .nm-latch {
	min-height: 2.1rem;
	padding: .4rem .6rem;
	font-size: .78rem;
	box-shadow: 4px 4px 8px var(--nm-lo), -4px -4px 8px var(--nm-hi), inset 0 0 0 var(--nm-lo), inset 0 0 0 var(--nm-hi);
}

.card-preview .demo-neumorphism .nm-btn {
	animation: nm-press 2.4s ease-in-out infinite;
}

.card-preview .demo-neumorphism .nm-on {
	color: var(--nm-accent);
	box-shadow: 0 0 0 var(--nm-lo), 0 0 0 var(--nm-hi), inset 3px 3px 6px var(--nm-lo), inset -3px -3px 6px var(--nm-hi);
}

@keyframes nm-press {
	0%, 35%, 75%, 100% {
		box-shadow: 4px 4px 8px var(--nm-lo), -4px -4px 8px var(--nm-hi), inset 0 0 0 var(--nm-lo), inset 0 0 0 var(--nm-hi);
	}
	45%, 65% {
		box-shadow: 0 0 0 var(--nm-lo), 0 0 0 var(--nm-hi), inset 3px 3px 6px var(--nm-lo), inset -3px -3px 6px var(--nm-hi);
	}
}

/* ── Variant: dark palette ── */

/* the same shapes: only the four colors change */
.demo-neumorphism .nm-surface.nm-dark {
	--nm-bg: #292d34;
	--nm-hi: #353a43;
	--nm-lo: #1a1d21;
	--nm-ink: #e4e8ee;
	--nm-soft: #a3adbd;
	--nm-accent: #8fb0ff;
}

/* ── Variant: icon buttons, one stays selected ── */

.demo-neumorphism .nm-editor {
	display: grid;
	gap: 1.5rem;
	width: 100%;
	max-width: 20rem;
}

.demo-neumorphism .nm-tools {
	display: flex;
	justify-content: space-between;
	gap: .75rem;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.demo-neumorphism .nm-tools legend {
	margin-bottom: 1rem;
	padding: 0;
	font-size: .8rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--nm-soft);
}

.demo-neumorphism .nm-icon {
	position: relative;
	display: grid;
	place-items: center;
	width: 3.25rem;
	height: 3.25rem;
	border-radius: 14px;
	color: var(--nm-soft);
	background: var(--nm-bg);
	cursor: pointer;
	box-shadow: 5px 5px 10px var(--nm-lo), -5px -5px 10px var(--nm-hi), inset 0 0 0 var(--nm-lo), inset 0 0 0 var(--nm-hi);
	transition: box-shadow .2s ease, color .2s ease;
}

.demo-neumorphism .nm-icon:has(:checked) {
	color: var(--nm-accent);
	box-shadow: 0 0 0 var(--nm-lo), 0 0 0 var(--nm-hi), inset 4px 4px 8px var(--nm-lo), inset -4px -4px 8px var(--nm-hi);
}

.demo-neumorphism .nm-icon input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.demo-neumorphism .nm-icon svg {
	width: 1.1rem;
	height: 1.1rem;
}

.demo-neumorphism .nm-icon:has(:focus-visible) {
	outline: 2px solid var(--nm-accent);
	outline-offset: 4px;
}

.demo-neumorphism .nm-sample {
	margin: 0;
	padding: 1.1rem 1.25rem;
	border-radius: 16px;
	line-height: 1.6;
	box-shadow: inset 5px 5px 10px var(--nm-lo), inset -5px -5px 10px var(--nm-hi);
}

/* the checked radio sets the paragraph's alignment */
.demo-neumorphism .nm-editor:has([value="center"]:checked) .nm-sample {
	text-align: center;
}

.demo-neumorphism .nm-editor:has([value="right"]:checked) .nm-sample {
	text-align: right;
}

.demo-neumorphism .nm-editor:has([value="justify"]:checked) .nm-sample {
	text-align: justify;
}

/* ── Variant: contrast fixes ── */

.demo-neumorphism .nm-pair {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	gap: 1rem;
	width: 100%;
	max-width: 40rem;
}

.demo-neumorphism .nm-case {
	display: grid;
	gap: .5rem;
}

.demo-neumorphism .nm-case-name {
	font-family: var(--font-mono);
	font-size: .78rem;
	color: var(--text);
}

.demo-neumorphism .nm-pair .nm-surface {
	padding: 2rem 1.5rem;
}

.demo-neumorphism .nm-pair .nm-card {
	gap: 1rem;
	padding: 1.25rem;
}

.demo-neumorphism .nm-note {
	margin: 0;
	font-size: .95rem;
	line-height: 1.5;
	color: var(--nm-soft);
}

/* darker text, a border that marks the edge without the shadows, a checked
   state that changes color, and a ring that stands out on the surface */
.demo-neumorphism .nm-surface.nm-a11y {
	--nm-ink: #1a202c;
	--nm-soft: #3b4556;
	--nm-edge: #6b778a;
}

.demo-neumorphism .nm-a11y .nm-btn,
.demo-neumorphism .nm-a11y .nm-latch {
	border: 1px solid var(--nm-edge);
}

.demo-neumorphism .nm-a11y .nm-latch:has(:checked) {
	border-color: var(--nm-accent);
	color: #ffffff;
	background: var(--nm-accent);
}

.demo-neumorphism .nm-a11y .nm-btn:focus-visible,
.demo-neumorphism .nm-a11y .nm-latch:has(:focus-visible) {
	outline: 3px solid var(--nm-ink);
	outline-offset: 3px;
}

/* last in the file, so it outranks the variant rules above it */
@media (prefers-reduced-motion: reduce) {
	.demo-neumorphism .nm-btn,
	.demo-neumorphism .nm-latch,
	.demo-neumorphism .nm-icon {
		transition: none;
	}

	.card-preview .demo-neumorphism .nm-btn {
		animation: none;
	}
}
