/**
 * Asmae — primitives
 *
 * Five building blocks. Everything in the product is made of these; a sixth
 * primitive means the system has a gap worth discussing, not a file worth
 * editing.
 *
 * Design System v2, section 4.
 *
 * @package Asmae
 */

/* ==================================================================
   Shared foundations
   ================================================================== */

.asmae-page,
.asmae-block,
.asmae-footer-nav {
	direction: rtl;
	text-align: right;
	font-family: var(--asmae-font-text);
	font-size: var(--asmae-size-body);
	line-height: var(--asmae-lh-body);
	color: var(--asmae-ink-800);
}

.asmae-page {
	max-width: var(--asmae-max);
	margin: 0 auto;
	padding: var(--asmae-space-5) var(--asmae-space-3) var(--asmae-space-6);
}

.asmae-page > * {
	max-width: var(--asmae-measure);
}

/* Grids and panels use the full container; prose keeps its measure. */
.asmae-page > .asmae-grid,
.asmae-page--archive > * {
	max-width: none;
}

.asmae-block {
	max-width: var(--asmae-max);
	margin: 0 auto var(--asmae-section);
	padding-inline: var(--asmae-space-3);
}

.asmae-block:last-child {
	margin-bottom: 0;
}

/* All links opt out of the theme explicitly. Inheritance is what broke the
   previous build. */
.asmae-page a,
.asmae-block a,
.asmae-footer-nav a {
	text-decoration: none;
	color: inherit;
}

.asmae-page a:focus-visible,
.asmae-block a:focus-visible,
.asmae-footer-nav a:focus-visible,
.asmae-page button:focus-visible,
.asmae-block button:focus-visible,
.asmae-block input:focus-visible {
	outline: 2px solid var(--asmae-primary-600);
	outline-offset: 2px;
	border-radius: var(--asmae-r-sm);
}

/* ==================================================================
   Type roles
   ================================================================== */

.asmae-display {
	font-family: var(--asmae-font-display);
	font-size: var(--asmae-size-display);
	font-weight: 700;
	line-height: var(--asmae-lh-display);
	margin: 0;
}

.asmae-title,
.asmae-card__title,
.asmae-browse__title,
.asmae-archive-title {
	font-family: var(--asmae-font-display);
	font-size: var(--asmae-size-title);
	font-weight: 700;
	line-height: var(--asmae-lh-title);
	color: var(--asmae-ink-800);
	margin: 0 0 var(--asmae-space-4);
}

.asmae-prose {
	color: var(--asmae-ink-600);
	max-width: var(--asmae-measure);
}

.asmae-prose p {
	margin: 0 0 0.85em;
}

.asmae-prose p:last-child {
	margin-bottom: 0;
}

.asmae-label {
	font-size: var(--asmae-size-micro);
	font-weight: 600;
	letter-spacing: 0.06em;
	color: var(--asmae-ink-400);
}

.asmae-count {
	font-variant-numeric: tabular-nums;
	font-size: var(--asmae-size-micro);
	color: var(--asmae-ink-400);
}

/* ==================================================================
   1 — Surface
   ================================================================== */

.asmae-card,
.asmae-item,
.asmae-fact,
.asmae-way,
.asmae-collection,
.asmae-root-cell,
.asmae-letter {
	background: #fff;
	border: 1px solid transparent;
	border-radius: var(--asmae-r-md);
	box-shadow: var(--asmae-e-card);
	transition: border-color var(--asmae-fast) var(--asmae-ease),
	            box-shadow var(--asmae-fast) var(--asmae-ease);
}

.asmae-card {
	padding: var(--asmae-space-4);
	margin-bottom: var(--asmae-space-4);
}

/* --panel */
.asmae-panel {
	background: #fff;
	border-radius: var(--asmae-r-lg);
	box-shadow: var(--asmae-e-2);
	padding: var(--asmae-space-5);
}

/* --tint */
.asmae-tint {
	background: var(--asmae-ink-050);
	border: 0;
}

/* ==================================================================
   2 — Chip
   ================================================================== */

.asmae-chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--asmae-space-2);
}

.asmae-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--asmae-space-1);
	min-height: 36px;
	margin-block: var(--asmae-space-1);
	padding: 0 var(--asmae-space-3);
	border: 1px solid var(--asmae-ink-100);
	border-radius: 999px;
	background: #fff;
	color: var(--asmae-ink-800);
	font-size: var(--asmae-size-small);
	box-shadow: none;
	transition: background-color var(--asmae-fast) var(--asmae-ease),
	            border-color var(--asmae-fast) var(--asmae-ease);
}

.asmae-chip:hover {
	border-color: var(--asmae-primary-600);
}

/* filled — meaning */
.asmae-chip--theme {
	background: var(--asmae-green-100);
	border-color: transparent;
	color: var(--asmae-green-600);
}

.asmae-chip--theme:hover {
	border-color: var(--asmae-green-600);
}

/* outlined — origin and categories */
.asmae-chip--category {
	background: transparent;
	border-color: var(--asmae-primary-100);
	color: var(--asmae-primary-700);
}

.asmae-chip--category:hover {
	border-color: var(--asmae-primary-600);
}

/* selected */
.asmae-chip--selected {
	background: var(--asmae-primary-100);
	border-color: var(--asmae-primary-600);
	color: var(--asmae-primary-700);
}

/* on dark bands */
.asmae-band--dark .asmae-chip,
.asmae-chip--soft {
	background: transparent;
	border-color: rgba(255, 255, 255, 0.28);
	color: #fff;
}

.asmae-band--dark .asmae-chip:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.5);
}

/* A chip on a light surface that carries no link */
.asmae-card .asmae-chip--soft {
	background: var(--asmae-ink-050);
	border-color: var(--asmae-ink-100);
	color: var(--asmae-ink-600);
}

/* ==================================================================
   3 — Button
   ================================================================== */

.asmae-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 var(--asmae-space-4);
	border: 1px solid transparent;
	border-radius: var(--asmae-r-md);
	font-family: inherit;
	font-size: var(--asmae-size-body);
	font-weight: 600;
	cursor: pointer;
	transition: background-color var(--asmae-fast) var(--asmae-ease),
	            border-color var(--asmae-fast) var(--asmae-ease);
}

.asmae-btn--primary,
.asmae-block a.asmae-btn--primary,
.asmae-block .asmae-featured__link,
.asmae-search__submit {
	background: var(--asmae-primary-600);
	color: #fff;
}

.asmae-btn--primary:hover,
.asmae-block .asmae-featured__link:hover,
.asmae-search__submit:hover {
	background: var(--asmae-primary-700);
	color: #fff;
}

.asmae-btn--secondary {
	background: #fff;
	border-color: var(--asmae-ink-100);
	color: var(--asmae-ink-800);
}

.asmae-btn--secondary:hover {
	background: var(--asmae-ink-050);
}

.asmae-btn--ghost {
	color: var(--asmae-primary-600);
	font-weight: 600;
}

.asmae-btn--ghost:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ==================================================================
   4 — Input
   ================================================================== */

.asmae-search__field {
	flex: 1;
	min-height: 48px;
	padding: 0 var(--asmae-space-3);
	border: 1px solid var(--asmae-ink-100);
	border-radius: var(--asmae-r-md);
	background: #fff;
	font-family: inherit;
	font-size: var(--asmae-size-body);
	color: var(--asmae-ink-800);
}

.asmae-search__field::placeholder {
	color: var(--asmae-ink-400);
}

.asmae-search__field:focus {
	outline: 2px solid var(--asmae-primary-600);
	outline-offset: 2px;
	border-color: transparent;
}

/* ==================================================================
   5 — Band
   ================================================================== */

.asmae-band {
	border-radius: var(--asmae-r-lg);
	padding: var(--asmae-space-5) var(--asmae-space-4);
}

.asmae-band--tint {
	background: var(--asmae-ink-050);
}

.asmae-band--dark {
	background: var(--asmae-ink-900);
	color: #fff;
}

.asmae-band--green {
	background: var(--asmae-green-050);
	border: 1px solid var(--asmae-green-line);
	color: var(--asmae-green-800);
}

.asmae-band--dark .asmae-browse__title,
.asmae-band--dark .asmae-head__title {
	color: #fff;
}

.asmae-band--green .asmae-browse__title,
.asmae-band--green .asmae-head__title {
	color: var(--asmae-green-800);
}

.asmae-band--green .asmae-head__title::before {
	background: var(--asmae-green-600);
}

.asmae-band--dark a:focus-visible {
	outline-color: #fff;
}

/* Chips on the light green band */
.asmae-band--green .asmae-chip {
	background: #fff;
	border-color: var(--asmae-green-line);
	color: var(--asmae-green-600);
	box-shadow: none;
}

.asmae-band--green .asmae-chip:hover {
	border-color: var(--asmae-green-600);
}

/*
 * The girih ground: one utility, tinted by currentColor, applied to any
 * dark band. Two hand-built patterns would have been two things to
 * maintain and two chances to drift.
 */
.asmae-band--dark {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

.asmae-band--dark::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	opacity: 0.05;
	pointer-events: none;
	background-image:
		repeating-linear-gradient(45deg, currentColor 0 1px, transparent 1px 26px),
		repeating-linear-gradient(-45deg, currentColor 0 1px, transparent 1px 26px);
	-webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
	mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}

/* ==================================================================
   Section heading
   ================================================================== */

.asmae-head {
	display: flex;
	align-items: baseline;
	gap: var(--asmae-space-3);
	margin-bottom: var(--asmae-space-4);
}

.asmae-head__title {
	font-family: var(--asmae-font-display);
	font-size: var(--asmae-size-title);
	font-weight: 700;
	line-height: var(--asmae-lh-title);
	color: var(--asmae-ink-800);
	margin: 0;
	display: flex;
	align-items: center;
	gap: var(--asmae-space-2);
}

.asmae-head__title::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--asmae-primary-600);
	flex: none;
}

.asmae-head--green .asmae-head__title::before {
	background: var(--asmae-green-600);
}

.asmae-head--violet .asmae-head__title::before {
	background: var(--asmae-primary-600);
}

/* The link sits at the far end of the row, opposite the title. */
/*
 * The route out of a section closes it. `end` resolves to the left under
 * RTL, which is the corner the reader's eye finishes on.
 */
.asmae-more {
	margin: var(--asmae-space-3) 0 0;
	text-align: end;
}

.asmae-more a {
	font-size: var(--asmae-size-small);
	font-weight: 600;
	color: var(--asmae-primary-600);
}

.asmae-more a::after {
	content: "\2190";
	margin-inline-start: var(--asmae-space-1);
	display: inline-block;
	transition: transform var(--asmae-fast) var(--asmae-ease);
}

.asmae-more a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.asmae-more a:hover::after {
	transform: translateX(-3px);
}

.asmae-more--green a {
	color: var(--asmae-green-600);
}

/* ==================================================================
   Section separator
   One white page. Alternating tinted grounds were doing the job of
   telling sections apart; a hairline does it more quietly and works on
   any section added later without a colour decision.
   ================================================================== */

.asmae-sep {
	position: relative;
	max-width: var(--asmae-max);
	margin: var(--asmae-space-6) auto;
	padding-inline: var(--asmae-space-3);
	height: 1px;
}

.asmae-sep::before {
	content: "";
	position: absolute;
	inset-inline: var(--asmae-space-3);
	top: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--asmae-ink-100) 18%, var(--asmae-ink-100) 82%, transparent);
}

/* A small diamond breaks the rule at its centre — the page's only
   decorative mark, and it costs nothing. */
.asmae-sep::after {
	content: "";
	position: absolute;
	top: -3px;
	left: 50%;
	width: 7px;
	height: 7px;
	margin-left: -3.5px;
	border: 1px solid var(--asmae-ink-100);
	background: #fff;
	transform: rotate(45deg);
}

/* ==================================================================
   Section grounds and separators
   ================================================================== */

/*
 * One ground colour for the whole page. The alternating grey and lavender
 * tints were standing in for separators and doing it badly — a hairline
 * says "new section" without tinting a third of the page.
 */

.asmae-ground {
	position: relative;
	isolation: isolate;
	padding-block: var(--asmae-space-6);
}

/*
 * A hairline between sections, inset from the container edges and fading at
 * both ends so it reads as punctuation rather than as a full-width rule.
 */
.asmae-ground + .asmae-ground::before {
	content: "";
	position: absolute;
	inset-block-start: 0;
	inset-inline: 12%;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--asmae-ink-100) 20%,
	            var(--asmae-ink-100) 80%, transparent);
	pointer-events: none;
}

/* A ground already supplies the vertical rhythm. */
.asmae-ground > .asmae-block {
	margin-bottom: 0;
}

@media (max-width: 640px) {

	.asmae-ground {
		padding-block: var(--asmae-space-5);
	}

	.asmae-ground + .asmae-ground::before {
		inset-inline: var(--asmae-space-3);
	}
}

/* ==================================================================
   Motion preference
   ================================================================== */

@media (prefers-reduced-motion: reduce) {

	.asmae-page *,
	.asmae-block * {
		transition: none !important;
		animation: none !important;
	}
}
