/*
 * PureCSS.com
 * https://purecss.com/click-to-reveal/
 * Content that reveals on click using a checkbox as state.
 */

.demo-click-to-reveal {
	flex-direction: column;
	align-items: center;
}

.demo-click-to-reveal .reveal-check {
		display: none;
	}

.demo-click-to-reveal .reveal-btn {
		display: inline-flex;
		align-items: center;
		gap: .5rem;
		padding: .6rem 1.25rem;
		background: var(--surface-2);
		color: var(--text);
		border-radius: 8px;
		cursor: pointer;
		font-size: .9rem;
		user-select: none;
		border: 1px solid var(--border);
		transition: background .2s, color .2s, border-color .2s;
	}

.demo-click-to-reveal .reveal-icon { flex-shrink: 0; }

.demo-click-to-reveal .icon-lock   { display: none; }

.demo-click-to-reveal .reveal-panel {
		display: none;
		margin-top: 1rem;
		padding: 1.25rem;
		background: var(--accent-dim);
		border-radius: 10px;
		font-size: .95rem;
	}

.demo-click-to-reveal .reveal-check:checked ~ .reveal-btn {
		background: var(--accent);
		color: var(--bg);
		border-color: var(--accent);
	}

.demo-click-to-reveal .reveal-check:checked ~ .reveal-btn .icon-eye  { display: none; }

.demo-click-to-reveal .reveal-check:checked ~ .reveal-btn .icon-lock { display: block; }

.demo-click-to-reveal .reveal-check:checked ~ .reveal-panel {
		display: block;
	}

/* ── Variant: reveal that animates open ── */

.demo-click-to-reveal .reveal-anim {
		width: 100%;
		max-width: 420px;
	}

/* clipped rather than display:none, so the input keeps its place in the
   tab order and the reveal stays reachable from the keyboard. clip-path
   clips hit testing as well as painting, so the one pixel box cannot land
   on top of its own label and swallow the click. */
.demo-click-to-reveal .reveal-anim-check {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

.demo-click-to-reveal .reveal-anim-btn {
		display: inline-flex;
		align-items: center;
		gap: .5rem;
		padding: .6rem 1.25rem;
		background: var(--surface-2);
		color: var(--text);
		border: 1px solid var(--border);
		border-radius: 8px;
		cursor: pointer;
		font-size: .9rem;
		user-select: none;
		transition: background .2s, color .2s, border-color .2s;
	}

:is(.demo-click-to-reveal .reveal-anim-check):checked ~ .reveal-anim-btn {
			background: var(--accent);
			color: var(--bg);
			border-color: var(--accent);
		}

/* the input is invisible, so the focus ring has to sit on the label */
:is(.demo-click-to-reveal .reveal-anim-check):focus-visible + .reveal-anim-btn {
			outline: 2px solid var(--accent);
			outline-offset: 2px;
		}

.demo-click-to-reveal .reveal-anim-panel {
		display: grid;
		grid-template-rows: 0fr;
		transition: grid-template-rows .35s ease;
	}

:is(.demo-click-to-reveal .reveal-anim-check):checked ~ .reveal-anim-panel {
			grid-template-rows: 1fr;
		}

/* both declarations matter: the row can only shrink past the content once
   the child stops demanding its own minimum height */
.demo-click-to-reveal .reveal-anim-inner {
		overflow: hidden;
		min-height: 0;
	}

.demo-click-to-reveal .reveal-anim-body {
		margin-top: .75rem;
		padding: 1rem 1.25rem;
		background: var(--accent-dim);
		border-radius: 10px;
		font-size: .95rem;
		line-height: 1.6;
	}

/* ── Variant: spoiler blur, content stays in the layout ── */

.demo-click-to-reveal .reveal-spoiler {
		width: 100%;
		max-width: 420px;
		text-align: center;
	}

.demo-click-to-reveal .reveal-spoiler-check {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

.demo-click-to-reveal .reveal-spoiler-text {
		display: block;
		padding: 1rem 1.25rem;
		background: var(--surface-2);
		border: 1px solid var(--border);
		border-radius: 10px;
		font-size: .95rem;
		line-height: 1.6;
		cursor: pointer;
		filter: blur(6px);
		/* without this, dragging across the blur selects and reveals the text */
		user-select: none;
		transition: filter .3s ease;
	}

:is(.demo-click-to-reveal .reveal-spoiler-check):checked + .reveal-spoiler-text {
			filter: none;
			user-select: auto;
			cursor: default;
		}

:is(.demo-click-to-reveal .reveal-spoiler-check):focus-visible + .reveal-spoiler-text {
			outline: 2px solid var(--accent);
			outline-offset: 2px;
		}

.demo-click-to-reveal .reveal-spoiler-hint {
		margin-top: .5rem;
		font-size: .75rem;
		color: var(--text-muted);
	}

@media (prefers-reduced-motion: reduce) {
	.demo-click-to-reveal .reveal-anim-panel,
	.demo-click-to-reveal .reveal-spoiler-text {
		transition: none;
	}
}
