/**
 * Shared components: panels, notices, rows, cards, dialogs, toasts, empty
 * states, the homepage sections and the tool page furniture.
 *
 * @package ActivityMaker
 */

/* --------------------------------------------------------------- Panels. */

.am-panel {
	background: var(--am-bg-raised);
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius-lg);
	margin-bottom: var(--am-4);
}

.am-panel__head {
	display: flex;
	align-items: center;
	gap: var(--am-3);
	padding: var(--am-3) var(--am-4);
	border-bottom: 1px solid var(--am-border);
}

.am-panel__title {
	margin: 0;
	font-size: var(--am-text-md);
	font-weight: 640;
}

.am-panel__step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	margin-left: auto;
	border-radius: 50%;
	background: var(--am-bg-sunken);
	color: var(--am-text-faint);
	font-size: var(--am-text-xs);
	font-weight: 700;
	flex: none;
}

.am-panel__body {
	padding: var(--am-4);
}

/* --------------------------------------------------------------- Notices. */

.am-notice {
	display: flex;
	gap: var(--am-3);
	padding: var(--am-3);
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius);
	background: var(--am-bg-sunken);
	font-size: var(--am-text-sm);
	line-height: 1.55;
	margin-bottom: var(--am-3);
}

.am-notice:last-child {
	margin-bottom: 0;
}

.am-notice svg,
.am-notice .am-icon-wrap {
	flex: none;
	margin-top: 2px;
}

.am-notice__body {
	flex: 1;
	min-width: 0;
}

.am-notice p {
	margin: 0;
}

.am-notice--info {
	border-color: var(--am-accent-line);
	background: var(--am-accent-soft);
	color: var(--am-text);
}

.am-notice--info svg {
	color: var(--am-accent);
}

.am-notice--warn {
	border-color: #e6d3a8;
	background: var(--am-warning-soft);
	color: #4a3505;
}

.am-notice--warn svg {
	color: var(--am-warning);
}

.am-notice--error {
	border-color: #e8c1bf;
	background: var(--am-danger-soft);
	color: #5c1a19;
}

.am-notice--error svg {
	color: var(--am-danger);
}

.am-notice--success {
	border-color: #bcdcc9;
	background: var(--am-success-soft);
	color: #123f29;
}

.am-notice__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-2);
	margin-top: var(--am-2);
}

/* --------------------------------------------------------------- Rows. */

.am-rows {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius-lg);
	overflow: hidden;
	background: var(--am-bg-raised);
}

.am-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--am-3);
	padding: var(--am-4);
	margin: 0;
	border-bottom: 1px solid var(--am-border);
}

.am-row:last-child {
	border-bottom: 0;
}

.am-row:hover {
	background: var(--am-bg-sunken);
}

.am-row__main {
	flex: 1 1 16rem;
	min-width: 0;
}

.am-row__title {
	margin: 0 0 2px;
	font-size: var(--am-text-md);
	font-weight: 620;
}

.am-row__title a {
	color: var(--am-text);
	text-decoration: none;
}

.am-row__title a:hover {
	color: var(--am-accent);
	text-decoration: underline;
}

.am-row__meta {
	margin: 0;
	font-size: var(--am-text-sm);
	color: var(--am-text-muted);
}

.am-row__desc {
	margin: var(--am-1) 0 0;
	font-size: var(--am-text-sm);
	color: var(--am-text-faint);
}

.am-row__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-1);
	align-items: center;
}

/* --------------------------------------------------------------- Cards. */

.am-cards {
	display: grid;
	gap: var(--am-3);
	grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.am-card {
	display: flex;
	gap: var(--am-3);
	padding: var(--am-4);
	margin: 0;
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius-lg);
	background: var(--am-bg-raised);
	text-decoration: none;
	color: inherit;
	transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.am-card:hover {
	border-color: var(--am-accent-line);
	box-shadow: var(--am-shadow-1);
	color: inherit;
}

.am-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	flex: none;
	border-radius: var(--am-radius);
	background: var(--am-accent-soft);
	color: var(--am-accent);
}

.am-card__body {
	min-width: 0;
}

.am-card__title {
	margin: 0 0 2px;
	font-size: var(--am-text-base);
	font-weight: 640;
	color: var(--am-text);
}

.am-card__text {
	margin: 0;
	font-size: var(--am-text-sm);
	color: var(--am-text-muted);
	line-height: 1.5;
}

/* --------------------------------------------------------------- Empty states. */

.am-empty {
	padding: var(--am-7) var(--am-5);
	text-align: center;
	border: 1px dashed var(--am-border-strong);
	border-radius: var(--am-radius-lg);
	background: var(--am-bg-sunken);
}

.am-empty__title {
	font-size: var(--am-text-lg);
	margin-bottom: var(--am-2);
}

.am-empty__text {
	max-width: 34rem;
	margin: 0 auto var(--am-4);
	color: var(--am-text-muted);
}

.am-empty__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-2);
	justify-content: center;
}

/* --------------------------------------------------------------- Dialog. */

.am-dialog {
	position: fixed;
	inset: 0;
	z-index: 90;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--am-4);
	background: rgba(16, 20, 26, 0.42);
	animation: am-fade 0.14s ease-out;
}

@keyframes am-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.am-dialog__panel {
	width: 100%;
	max-width: 34rem;
	max-height: calc(100vh - 2 * var(--am-5));
	/* On a phone the address bar eats into 100vh, so a tall dialog would push
	   its own footer - and therefore its confirm button - off the screen. */
	max-height: calc(100dvh - 2 * var(--am-5));
	display: flex;
	flex-direction: column;
	background: var(--am-bg-raised);
	border-radius: var(--am-radius-lg);
	box-shadow: var(--am-shadow-3);
	overflow: hidden;
}

.am-dialog__header {
	display: flex;
	align-items: flex-start;
	gap: var(--am-3);
	padding: var(--am-4);
	border-bottom: 1px solid var(--am-border);
}

.am-dialog__title {
	margin: 0;
	font-size: var(--am-text-lg);
	flex: 1;
}

.am-dialog__close {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--am-text-faint);
	font-size: 1.4rem;
	line-height: 1;
	width: 32px;
	height: 32px;
	border-radius: var(--am-radius);
	cursor: pointer;
	flex: none;
}

.am-dialog__close:hover {
	background: var(--am-bg-sunken);
	color: var(--am-text);
}

.am-dialog__body {
	padding: var(--am-4);
	overflow-y: auto;
	flex: 1;
}

.am-dialog__footer {
	display: flex;
	justify-content: flex-end;
	gap: var(--am-2);
	padding: var(--am-3) var(--am-4);
	border-top: 1px solid var(--am-border);
	background: var(--am-bg-sunken);
}

body.am-dialog-open {
	overflow: hidden;
}

.am-share-row {
	display: flex;
	gap: var(--am-2);
	margin: var(--am-3) 0;
}

.am-share-row .am-input {
	flex: 1;
	font-family: var(--am-font-mono);
	font-size: var(--am-text-sm);
}

/* --------------------------------------------------------------- Picker. */

.am-picker__list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 22rem;
	overflow-y: auto;
}

.am-picker__list li {
	margin: 0;
}

.am-picker__item {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: var(--am-3);
	width: 100%;
	padding: var(--am-3);
	border: 0;
	border-bottom: 1px solid var(--am-border);
	background: transparent;
	font-family: inherit;
	font-size: var(--am-text-base);
	text-align: left;
	cursor: pointer;
	color: var(--am-text);
}

.am-picker__item:hover {
	background: var(--am-accent-soft);
}

.am-picker__title {
	font-weight: 600;
}

.am-picker__meta {
	font-size: var(--am-text-sm);
	color: var(--am-text-muted);
	flex: none;
}

/* --------------------------------------------------------------- Toasts. */

.am-toasts {
	position: fixed;
	left: 50%;
	bottom: var(--am-5);
	transform: translateX(-50%);
	z-index: 95;
	display: flex;
	flex-direction: column;
	gap: var(--am-2);
	width: min(28rem, calc(100vw - 2 * var(--am-4)));
	pointer-events: none;
}

.am-toast {
	display: flex;
	align-items: center;
	gap: var(--am-3);
	padding: var(--am-3) var(--am-4);
	border-radius: var(--am-radius);
	background: #1b1f25;
	color: #f4f5f7;
	box-shadow: var(--am-shadow-2);
	font-size: var(--am-text-sm);
	pointer-events: auto;
	animation: am-toast-in 0.18s ease-out;
}

@keyframes am-toast-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

.am-toast.is-leaving {
	opacity: 0;
	transition: opacity 0.18s ease;
}

.am-toast__text {
	flex: 1;
}

.am-toast__close {
	appearance: none;
	border: 0;
	background: transparent;
	color: inherit;
	opacity: 0.7;
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 0 0 var(--am-2);
}

.am-toast__close:hover {
	opacity: 1;
}

.am-toast--error {
	background: #6d1f1e;
}

.am-toast--success {
	background: #1d4e35;
}

/* --------------------------------------------------------------- Homepage. */

.am-hero {
	padding-block: var(--am-7) var(--am-6);
	border-bottom: 1px solid var(--am-border);
}

.am-hero__inner {
	max-width: 44rem;
}

.am-hero__title {
	font-size: clamp(1.9rem, 5vw, 2.75rem);
	line-height: 1.15;
	letter-spacing: -0.02em;
	margin-bottom: var(--am-3);
}

.am-hero__lead {
	font-size: var(--am-text-lg);
	color: var(--am-text-muted);
	margin-bottom: var(--am-5);
	line-height: 1.55;
}

.am-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-3);
	align-items: center;
}

.am-hero__note {
	margin-top: var(--am-4);
	font-size: var(--am-text-sm);
	color: var(--am-text-faint);
}

.am-section {
	padding-block: var(--am-6);
}

.am-section--sunken {
	background: var(--am-bg-sunken);
	border-block: 1px solid var(--am-border);
}

.am-section__head {
	margin-bottom: var(--am-4);
}

.am-section__title {
	font-size: var(--am-text-xl);
	margin-bottom: var(--am-1);
}

.am-section__lead {
	color: var(--am-text-muted);
	margin: 0;
	max-width: 42rem;
}

.am-steps {
	display: grid;
	gap: var(--am-4);
	grid-template-columns: 1fr;
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: am-step;
}

@media (min-width: 720px) {
	.am-steps {
		grid-template-columns: repeat(4, 1fr);
	}
}

.am-steps li {
	margin: 0;
	padding-top: var(--am-4);
	border-top: 2px solid var(--am-accent-line);
	counter-increment: am-step;
}

.am-steps li::before {
	content: counter(am-step);
	display: block;
	font-size: var(--am-text-sm);
	font-weight: 700;
	color: var(--am-accent);
	margin-bottom: var(--am-1);
}

.am-steps__title {
	font-size: var(--am-text-base);
	font-weight: 640;
	margin-bottom: var(--am-1);
}

.am-steps p {
	font-size: var(--am-text-sm);
	color: var(--am-text-muted);
	margin: 0;
}

/* --------------------------------------------------------------- Tool page copy. */

.am-prose {
	max-width: var(--am-prose-width);
}

.am-prose h2 {
	margin-top: var(--am-6);
	font-size: var(--am-text-xl);
}

.am-prose h2:first-child {
	margin-top: 0;
}

.am-prose h3 {
	margin-top: var(--am-5);
	font-size: var(--am-text-md);
}

.am-prose dl {
	margin: 0 0 var(--am-4);
}

.am-prose dt {
	font-weight: 640;
	margin-top: var(--am-3);
}

.am-prose dd {
	margin: 0;
	color: var(--am-text-muted);
}

.am-faq {
	border-top: 1px solid var(--am-border);
}

.am-faq__item {
	border-bottom: 1px solid var(--am-border);
	padding-block: var(--am-3);
}

.am-faq__q {
	font-size: var(--am-text-base);
	font-weight: 620;
	margin-bottom: var(--am-1);
}

.am-faq__a {
	margin: 0;
	color: var(--am-text-muted);
}

.am-related {
	display: grid;
	gap: var(--am-3);
	grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

/* --------------------------------------------------------------- Convert strip. */

.am-convert {
	padding: var(--am-4);
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius-lg);
	background: var(--am-bg-sunken);
	margin-block: var(--am-5);
}

.am-convert__title {
	font-size: var(--am-text-md);
	margin-bottom: var(--am-1);
}

.am-convert__lead {
	font-size: var(--am-text-sm);
	color: var(--am-text-muted);
	margin-bottom: var(--am-3);
}

.am-convert__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-2);
	list-style: none;
	margin: 0;
	padding: 0;
}

.am-convert__list li {
	margin: 0;
}
