/* packedplans/packing-list — APP-PLAN §4.7, DESIGN §6.
   The app's list, in the page's own geometry: one bordered stack, a hairline between rows, a
   real checkbox drawn as a box so it survives both dark mode and a printer. No colour beyond
   the accent on a ticked box. Only consumes --pp-* tokens; tokens.css defines them. */

.pp-pack {
	margin-block: var(--pp-space-8);
}

/* The section headings all carry the accent rule above the words (SPEC §9.4.4). */
.pp-pack__title {
	display: flex;
	flex-direction: column-reverse;
	align-items: flex-start;
	gap: var(--pp-space-3);
	margin: 0 0 var(--pp-space-4);
	font-family: var(--pp-font-display);
	font-size: var(--pp-fs-h2);
	font-weight: var(--pp-fw-display, 400);
	line-height: var(--pp-lh-heading);
	letter-spacing: -.02em;
	text-wrap: balance;
}

/* `display` beats the `hidden` attribute, so everything the script switches opts back out. */
.pp-pack__list[hidden],
.pp-pack__static[hidden],
.pp-pack__context[hidden],
.pp-pack__copy[hidden] {
	display: none;
}

.pp-pack__lead {
	margin: 0;
	max-inline-size: var(--pp-measure);
	color: var(--pp-text-muted);
	font-size: var(--pp-fs-sm);
	line-height: var(--pp-lh-body);
}

.pp-pack__context {
	margin: var(--pp-space-2) 0 0;
	color: var(--pp-text);
	font-size: var(--pp-fs-sm);
	font-weight: 600;
	line-height: var(--pp-lh-ui);
}

/* ------------------------------------------------------- the list, both renderings */

.pp-pack__static,
.pp-pack__list {
	margin: var(--pp-space-4) 0 0;
	padding: 0;
	max-inline-size: 32rem;
	list-style: none;
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-radius-md);
	background: var(--pp-surface);
	overflow: hidden;
}

.pp-pack__line,
.pp-pack__item {
	margin: 0;
}

.pp-pack__line + .pp-pack__line,
.pp-pack__item + .pp-pack__item {
	border-block-start: 1px solid var(--pp-border);
}

/* The no-JavaScript rendering: the city's own hints as plain lines (DESIGN §5.2 G4). */
.pp-pack__line {
	padding: var(--pp-space-3) var(--pp-space-4);
	font-size: var(--pp-fs-body);
	line-height: var(--pp-lh-body);
}

/* DESIGN §5.3: the whole row is the target, and it is at least 48px tall. */
.pp-pack__list .pp-pack__row {
	display: flex;
	align-items: center;
	gap: var(--pp-space-3);
	min-block-size: 48px;
	padding: var(--pp-space-2) var(--pp-space-4);
	cursor: pointer;
}

@media (hover: hover) {
	.pp-pack__list .pp-pack__row:hover {
		background: var(--pp-surface-2);
	}
}

.pp-pack__name {
	font-size: var(--pp-fs-body);
	line-height: var(--pp-lh-body);
}

.pp-pack__row.is-packed .pp-pack__name {
	color: var(--pp-text-muted);
	text-decoration: line-through;
}

/* ------------------------------------------------------- the box
   Drawn with borders rather than an image or a background glyph, so the empty box and the tick
   both come out of a printer that drops backgrounds (see the print block at the foot). */

.pp-pack__box {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	display: grid;
	place-content: center;
	inline-size: 22px;
	block-size: 22px;
	margin: 0;
	border: 1px solid var(--pp-border-strong);
	border-radius: var(--pp-radius-sm);
	background: var(--pp-surface);
	cursor: pointer;
}

.pp-pack__box::after {
	content: "";
	inline-size: 11px;
	block-size: 6px;
	margin-block-start: -3px;
	border-inline-start: 2px solid var(--pp-accent-text);
	border-block-end: 2px solid var(--pp-accent-text);
	transform: rotate(-45deg);
	opacity: 0;
}

.pp-pack__box:checked {
	border-color: var(--pp-accent);
	background: var(--pp-accent);
}

.pp-pack__box:checked::after {
	opacity: 1;
}

.pp-pack__box:focus-visible {
	outline: 2px solid var(--pp-focus);
	outline-offset: 2px;
}

/* ------------------------------------------------------- copy */

.pp-pack__copy {
	display: inline-flex;
	align-items: center;
	min-block-size: 44px;
	margin-block-start: var(--pp-space-4);
	padding-inline: var(--pp-space-4);
	border: 1px solid var(--pp-border-strong);
	border-radius: var(--pp-radius-pill);
	background: var(--pp-surface);
	color: var(--pp-text);
	font: inherit;
	font-size: var(--pp-fs-sm);
	line-height: var(--pp-lh-ui);
	cursor: pointer;
}

@media (hover: hover) {
	.pp-pack__copy:hover {
		border-color: var(--pp-accent);
		color: var(--pp-accent);
	}
}

.pp-pack__copy:focus-visible {
	outline: 2px solid var(--pp-focus);
	outline-offset: 2px;
}

/* ------------------------------------------------------- paper
   A printed list is something to tick with a pen, so the boxes stay and the fill goes: a
   browser that drops background colours would otherwise print a ticked box as an empty one. */

@media print {
	.pp-pack__copy {
		display: none;
	}

	.pp-pack__box,
	.pp-pack__box:checked {
		border-color: #000;
		background: none;
	}

	.pp-pack__box::after {
		border-color: #000;
	}

	.pp-pack__row.is-packed .pp-pack__name {
		color: inherit;
	}
}
