/**
 * NotyLab tools catalogue — /tools/.
 *
 * Loaded after unica-core-home.css and scoped to `.uc-tools`, which always
 * sits on the same element as `.uc-home`. The tokens (--nl-*), the bands, the
 * buttons, the cards and the scale-bar motif all come from that file; this
 * one adds only what a catalogue needs:
 *
 *   1. a search field,
 *   2. a sheet of tool glyphs for the hero,
 *   3. a pinned group navigation,
 *   4. the featured row,
 *   5. tool rows, grouped.
 *
 * No new colours, radii or shadows: every value below is a token or a mix of
 * tokens, so light, dark and the accent presets follow without extra rules.
 * Layout uses logical properties throughout, so right-to-left needs only the
 * few overrides at the end.
 */

.uc-tools {
	--nl-tools-nav-h: 3.75rem;
	/* Where content clears both pinned bars: the site header and the group navigation. */
	--nl-tools-pin: calc(var(--header-height, 64px) + var(--nl-tools-nav-h));
}

/* Rows, groups and the featured block are filtered with the `hidden`
   attribute; any `display` set on their classes would otherwise defeat it. */
.uc-tools [hidden] {
	display: none !important;
}

.uc-tools .nl-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ── 1. Hero ──────────────────────────────────────────────────────── */
.nl-tools-hero {
	padding-block: clamp(0.75rem, 1.6vw, 1.5rem) clamp(3.5rem, 6vw, 5.5rem);
}

.nl-tools-hero .breadcrumbs {
	margin-bottom: clamp(1.25rem, 3vw, 2.75rem);
	font-size: 0.8125rem;
}

.uc-tools .nl-tools-hero__title {
	margin-block: 1.2rem 1.3rem;
	font-size: clamp(2.3rem, 4.5vw, 3.7rem);
	line-height: 1.05;
}

.nl-tools-hero .nl-hero__lead {
	margin-bottom: 1.75rem;
}

/* The field. One control, built as a frame around a bare input so the icon,
   the shortcut hint and the clear button sit inside the same outline. */
.nl-search {
	position: relative;
	display: flex;
	align-items: center;
	max-width: 34rem;
	height: 3.75rem;
	border: 1px solid color-mix(in srgb, var(--nl-fg) 20%, transparent);
	border-radius: var(--nl-r-card);
	background: var(--nl-surface);
	box-shadow: var(--nl-shadow-rest);
	transition: border-color 0.2s, box-shadow 0.2s;
}

.nl-search:hover {
	border-color: color-mix(in srgb, var(--nl-fg) 36%, transparent);
}

.nl-search:focus-within {
	border-color: var(--nl-brand);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--nl-brand) 18%, transparent), var(--nl-shadow-rest);
}

.nl-search__icon {
	flex: none;
	display: grid;
	place-items: center;
	width: 3.4rem;
	color: var(--nl-fg-dim);
	pointer-events: none;
}

.nl-search:focus-within .nl-search__icon {
	color: var(--nl-brand);
}

.uc-tools .nl-search__field {
	flex: 1;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--nl-fg);
	font: inherit;
	font-size: 1.0625rem;
	line-height: 1.3;
	-webkit-appearance: none;
	appearance: none;
}

.uc-tools .nl-search__field:focus,
.uc-tools .nl-search__field:focus-visible {
	outline: none;
	border: 0;
	box-shadow: none;
}

.uc-tools .nl-search__field::placeholder {
	color: var(--nl-fg-dim);
	opacity: 0.85;
}

.uc-tools .nl-search__field::-webkit-search-cancel-button,
.uc-tools .nl-search__field::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
}

/* The "/" hint: only where the shortcut exists (script running, a keyboard
   likely) and only while the field is empty. */
.nl-search__key {
	display: none;
	flex: none;
	min-width: 1.7rem;
	margin-inline-end: 1rem;
	padding: 0.22rem 0.5rem;
	border: 1px solid var(--nl-line);
	border-radius: 4px;
	background: var(--nl-paper);
	color: var(--nl-fg-dim);
	font-family: var(--nl-f-mono);
	font-size: 0.8125rem;
	line-height: 1.2;
	text-align: center;
}

@media (hover: hover) and (pointer: fine) {
	.uc-tools.is-enhanced .nl-search__field:placeholder-shown:not(:focus) ~ .nl-search__key {
		display: block;
	}
}

.uc-tools .nl-search__clear {
	flex: none;
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	margin: 0;
	margin-inline-end: 0.4rem;
	padding: 0;
	border: 0;
	border-radius: var(--nl-r-plate);
	background: transparent;
	color: var(--nl-fg-dim);
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}

.uc-tools .nl-search__clear:hover {
	background: var(--nl-tint);
	color: var(--nl-fg);
}

.uc-tools .nl-search__clear:focus-visible {
	border-radius: var(--nl-r-plate);
	outline-offset: 0;
}

/* Under the field, one slot shared by two lines: suggestions while it is
   empty, the result count while it is not. Stacking them in one grid cell
   keeps the slot the same height either way, so nothing below it jumps. */
.nl-search__meta {
	display: grid;
	max-width: 34rem;
	margin-top: 0.85rem;
	font-size: 0.875rem;
	line-height: 1.5;
}

.nl-search__meta > * {
	grid-area: 1 / 1;
	min-width: 0;
}

.nl-search__status {
	visibility: hidden;
	padding-block: 0.2rem;
	color: var(--nl-fg);
	font-weight: 600;
}

.uc-tools.is-searching .nl-search__status {
	visibility: visible;
}

.uc-tools.is-searching .nl-suggest {
	visibility: hidden;
}

.nl-suggest {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
}

.nl-suggest__label {
	margin-inline-end: 0.15rem;
	color: var(--nl-fg-dim);
}

.uc-tools .nl-suggest__term {
	padding: 0.2rem 0.7rem;
	border: 1px solid var(--nl-line);
	border-radius: 999px;
	background: var(--nl-surface);
	color: var(--nl-fg);
	font-size: 0.8125rem;
	font-weight: 500;
	white-space: nowrap;
	transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.uc-tools .nl-suggest__term:hover {
	border-color: var(--nl-brand);
	background: var(--nl-tint);
	color: var(--nl-brand);
}

.uc-tools .nl-suggest__term:focus-visible {
	border-radius: 999px;
	outline-offset: 2px;
}

.nl-tools-hero .nl-ticks {
	margin-top: 1.5rem;
}

/* During a search the page is a results list: close the gap between the
   field and the rows it filters. */
.uc-tools.is-searching .nl-tools-hero {
	padding-bottom: clamp(2rem, 3vw, 2.75rem);
}

.uc-tools.is-searching .nl-tools-catalogue {
	padding-top: clamp(1.5rem, 3vw, 2.5rem);
}

/* ── 2. The kit: the modules' own glyphs on a figure sheet ────────── */
.nl-kit {
	display: none;
}

.nl-kit__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.625rem;
}

.uc-tools .nl-kit__tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	aspect-ratio: 1 / 0.9;
	padding: 0.5rem;
	border-radius: 3px;
	background: #f2f6f7;
	color: var(--nl-plate-dim);
	transition: background-color 0.25s;
}

.uc-tools .nl-kit__tile:hover {
	background: color-mix(in srgb, var(--nl-plate-brand) 10%, #ffffff);
}

.nl-kit__tile img {
	width: 2.75rem;
	height: 2.75rem;
	transition: transform 0.35s var(--nl-ease);
}

.nl-kit__tile:hover img {
	transform: translateY(-2px) scale(1.06);
}

.nl-kit__name {
	max-width: 100%;
	font-family: var(--nl-f-mono);
	font-size: 0.8125rem;
	line-height: 1.25;
	text-align: center;
	text-wrap: balance;
}

.nl-kit__caption {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.95rem 0.25rem 1rem;
	font-size: 0.875rem;
	line-height: 1.4;
	color: var(--nl-plate-dim);
}

@media (min-width: 1024px) {
	.nl-tools-hero__grid {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
		gap: clamp(2.5rem, 5vw, 5rem);
	}

	.nl-kit {
		display: block;
		width: 100%;
		max-width: 29rem;
		margin-inline-start: auto;
	}
}

/* ── 3. Group navigation ──────────────────────────────────────────── */
.nl-tools-nav {
	position: sticky;
	top: var(--header-height, 64px);
	z-index: 20;
	border-bottom: 1px solid var(--nl-line);
	background: var(--nl-paper);
}

.nl-tools-nav__list {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	height: var(--nl-tools-nav-h);
	margin-inline: calc(-1 * var(--nl-gutter));
	padding-inline: var(--nl-gutter);
	overflow-x: auto;
	scroll-padding-inline: var(--nl-gutter);
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.nl-tools-nav__list::-webkit-scrollbar {
	display: none;
}

.nl-tools-nav__list li {
	flex: none;
}

.uc-tools .nl-tools-nav__chip {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	min-height: 2.5rem;
	padding: 0.4rem 0.6rem 0.4rem 1rem;
	padding-inline: 1rem 0.6rem;
	border: 1px solid var(--nl-line);
	border-radius: 999px;
	background: var(--nl-surface);
	color: var(--nl-fg);
	font-size: 0.9063rem;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}

.uc-tools .nl-tools-nav__chip:hover {
	border-color: var(--nl-brand);
	color: var(--nl-brand);
}

.uc-tools .nl-tools-nav__chip:focus-visible {
	border-radius: 999px;
	outline-offset: 2px;
}

.nl-tools-nav__count {
	min-width: 1.6rem;
	padding: 0.18rem 0.4rem;
	border-radius: 999px;
	background: var(--nl-paper-alt);
	color: var(--nl-fg-dim);
	font-family: var(--nl-f-mono);
	font-size: 0.8125rem;
	font-weight: 500;
	text-align: center;
	transition: background-color 0.2s, color 0.2s;
}

.uc-tools .nl-tools-nav__chip.is-active {
	border-color: var(--nl-brand);
	background: var(--nl-brand);
	color: var(--nl-on-brand);
}

.nl-tools-nav__chip.is-active .nl-tools-nav__count {
	background: color-mix(in srgb, var(--nl-on-brand) 20%, transparent);
	color: var(--nl-on-brand);
}

/* A group the search has emptied. */
.uc-tools .nl-tools-nav__chip.is-empty {
	opacity: 0.45;
	pointer-events: none;
}

/* ── 4. Featured ──────────────────────────────────────────────────── */
.nl-tools-featured {
	padding-block: clamp(3rem, 5.5vw, 5rem) clamp(3rem, 6vw, 5.5rem);
}

.nl-tools-featured .nl-head {
	margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}

.uc-tools .nl-tools-featured .nl-h2 {
	margin-bottom: 0;
	font-size: clamp(1.75rem, 2.8vw, 2.4rem);
}

.nl-tools-featured__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.25rem;
}

.nl-tools-featured__grid--2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nl-tools-card {
	flex-direction: column;
}

.nl-tools-card .nl-card__plate {
	flex: none;
	aspect-ratio: 16 / 10;
}

.nl-tools-card .nl-card__plate > img {
	position: absolute;
	inset: 0;
}

.nl-tools-card .nl-card__body {
	flex: 1;
}

.nl-tools-card .nl-card__text {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
}

/* A micrograph's scale bar sits in its bottom-right corner: keep it in frame. */
.nl-tools-card--task_scale .nl-card__plate > img {
	object-position: right bottom;
}

/* A chart is a print, not a photograph: pinned by its top-left corner and
   running off the card's edge, as on the front page. */
.nl-tools-card--task_plot .nl-card__plate {
	padding: 1.25rem 0 0 1.25rem;
}

.nl-tools-card--task_plot .nl-card__plate > img {
	position: static;
	border-top-left-radius: var(--nl-r-plate);
	object-position: left top;
	box-shadow: 0 0 0 1px rgb(11 38 53 / 0.1), -8px 12px 30px -18px rgb(11 38 53 / 0.5);
	transform-origin: left top;
}

/* ── 5. Catalogue ─────────────────────────────────────────────────── */
.nl-tools-catalogue {
	padding-block: clamp(3rem, 6vw, 5.5rem) clamp(4rem, 8vw, 7rem);
}

.nl-tools-group {
	--nl-tools-gap: clamp(2.75rem, 5.5vw, 5rem);
	position: relative;
	gap: clamp(2rem, 4.5vw, 4.5rem);
	scroll-margin-top: calc(var(--nl-tools-pin) + 1.75rem);
}

/* Spacing and a hairline between groups — measured from the previous group
   that is still showing, so a search that hides one leaves no stray rule. */
.nl-tools-group:not([hidden]) ~ .nl-tools-group {
	margin-top: var(--nl-tools-gap);
}

.nl-tools-group:not([hidden]) ~ .nl-tools-group::before {
	content: "";
	position: absolute;
	inset-inline: 0;
	top: calc(var(--nl-tools-gap) / -2);
	border-top: 1px solid var(--nl-line);
}

.uc-tools .nl-tools-group__head {
	top: calc(var(--nl-tools-pin) + 1.75rem);
}

.nl-tools-group__meta {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.nl-tools-group__number {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	color: var(--nl-fg);
	font-weight: 600;
}

.nl-tools-group__number::after {
	content: "";
	width: 1.75rem;
	border-top: 1px solid color-mix(in srgb, var(--nl-fg) 35%, transparent);
}

.uc-tools .nl-tools-group__title {
	margin-block: 0.75rem 0.7rem;
	font-size: clamp(1.6rem, 2.4vw, 2.1rem);
	line-height: 1.12;
}

.nl-tools-group__text {
	max-width: 36ch;
	font-size: 0.9688rem;
	line-height: 1.6;
	text-wrap: pretty;
}

/* The rows of one group share a single surface. */
.nl-tools-list {
	overflow: hidden;
	border: 1px solid var(--nl-line);
	border-radius: var(--nl-r-card);
	background: var(--nl-surface);
	box-shadow: var(--nl-shadow-rest);
}

.nl-tool-row:not([hidden]) ~ .nl-tool-row {
	border-top: 1px solid var(--nl-line);
}

.uc-tools .nl-tool-row__link {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 1.15rem;
	padding: 1.1rem 1.4rem;
	color: var(--nl-fg-dim);
	transition: background-color 0.2s;
}

.uc-tools .nl-tool-row__link:hover,
.uc-tools .nl-tool-row__link:focus-visible {
	background: var(--nl-tint);
}

.uc-tools .nl-tool-row__link:focus-visible {
	border-radius: 0;
	outline-offset: -3px;
}

.uc-tools .nl-tool-row:first-child .nl-tool-row__link:focus-visible {
	border-start-start-radius: var(--nl-r-card);
	border-start-end-radius: var(--nl-r-card);
}

.uc-tools .nl-tool-row:last-child .nl-tool-row__link:focus-visible {
	border-end-start-radius: var(--nl-r-card);
	border-end-end-radius: var(--nl-r-card);
}

/* Icon tile: a small white print, in both themes — the glyphs carry their
   own colours and need a light ground to be read. */
.nl-tool-icon {
	flex: none;
	display: grid;
	place-items: center;
	width: 3.25rem;
	height: 3.25rem;
	overflow: hidden;
	border-radius: var(--nl-r-plate);
	background: var(--nl-plate);
	box-shadow: inset 0 0 0 1px rgb(11 38 53 / 0.1);
	transition: transform 0.3s var(--nl-ease);
}

.nl-tool-icon img {
	width: 1.75rem;
	height: 1.75rem;
}

.nl-tool-icon--photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* No glyph yet: a two-letter monogram, set like an element symbol. */
.nl-tool-icon--mono {
	background: var(--nl-tint);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nl-brand) 24%, transparent);
	color: var(--nl-brand);
	font-family: var(--nl-f-mono);
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1;
}

.nl-tool-row__link:hover .nl-tool-icon {
	transform: scale(1.06);
}

.nl-tool-row__main {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 0;
}

.nl-tool-row__top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem 0.6rem;
}

.nl-tool-row__name {
	color: var(--nl-fg);
	font-size: 1.0938rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.012em;
}

.nl-tool-row__link:hover .nl-tool-row__name {
	color: var(--nl-brand);
}

.nl-tool-row__text {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.nl-tool-row__label {
	padding: 0.16rem 0.55rem;
	border: 1px solid var(--nl-line);
	border-radius: 999px;
	color: var(--nl-fg-dim);
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
}

.nl-tool-row__label--free {
	border-color: transparent;
	background: color-mix(in srgb, var(--nl-brand) 13%, var(--nl-surface));
	color: var(--nl-brand);
}

.nl-tool-row__go {
	color: var(--nl-brand);
	opacity: 0.4;
	transition: opacity 0.2s, transform 0.3s var(--nl-ease);
}

.nl-tool-row__link:hover .nl-tool-row__go,
.nl-tool-row__link:focus-visible .nl-tool-row__go {
	opacity: 1;
	transform: translateX(3px);
}

/* Nothing matched. */
.nl-tools-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.9rem;
	padding: clamp(2rem, 5vw, 4rem) 1rem;
	text-align: center;
}

.uc-tools .nl-tools-empty__title {
	max-width: 24ch;
	color: var(--nl-fg);
	font-size: clamp(1.5rem, 2.6vw, 2rem);
	line-height: 1.2;
	overflow-wrap: anywhere;
}

.nl-tools-empty__text {
	max-width: 44ch;
	margin-bottom: 0.6rem;
}

/* ── Right-to-left ────────────────────────────────────────────────── */
/* Tracking pulls joined Arabic-script letters apart; set it back to none
   wherever the left-to-right design uses it. */
[dir="rtl"] .uc-tools :is(.nl-eyebrow, .nl-tool, .nl-tool-row__name, .nl-card__title, .nl-btn) {
	letter-spacing: 0;
}

/* The monospace stack has no Persian letters worth showing; where the mono
   voice carries translated words or Persian digits, use the theme's face. */
[dir="rtl"] .uc-tools :is(.nl-tools-group__meta, .nl-tools-nav__count) {
	font-family: var(--nl-f-sans);
}

[dir="rtl"] .uc-tools .nl-tools-hero__title {
	font-size: clamp(2rem, 3.7vw, 3rem);
	line-height: 1.3;
}

[dir="rtl"] .uc-tools .nl-tools-group__title {
	font-size: clamp(1.45rem, 2.1vw, 1.85rem);
	line-height: 1.35;
}

[dir="rtl"] .nl-tool-row__link:hover .nl-tool-row__go,
[dir="rtl"] .nl-tool-row__link:focus-visible .nl-tool-row__go {
	transform: translateX(-3px);
}

/* Tool copy marked dir="auto" takes its own direction (an English
   description on a Persian page reads left to right, full stop at the end),
   but stays aligned with the rest of its row. */
.uc-tools [dir="auto"] {
	text-align: left;
}

[dir="rtl"] .uc-tools [dir="auto"] {
	text-align: right;
}

/* Tool names and the glyph sheet stay left-to-right: they are product names. */
[dir="rtl"] .uc-tools :is(.nl-kit__name, .nl-tool-icon--mono) {
	direction: ltr;
}

/* ── Tablet ───────────────────────────────────────────────────────── */
@media (max-width: 1023.98px) {
	/* Featured: a native snap row with the next card peeking in. */
	.nl-tools-featured__grid,
	.nl-tools-featured__grid--2 {
		display: flex;
		gap: 1rem;
		margin-inline: calc(-1 * var(--nl-gutter));
		padding-inline: var(--nl-gutter);
		padding-bottom: 0.75rem;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scroll-padding-inline: var(--nl-gutter);
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.nl-tools-featured__grid::-webkit-scrollbar {
		display: none;
	}

	.nl-tools-card {
		flex: 0 0 min(22rem, 44%);
		scroll-snap-align: start;
	}

	/* The snap row clips what a lifted card would need above it. */
	.nl-tools-card:hover,
	.nl-tools-card:focus-within {
		transform: none;
	}

	.uc-tools .nl-tools-group__head {
		margin-bottom: 1.5rem;
	}

	.nl-tools-group__text {
		max-width: 56ch;
	}
}

/* ── Phone ────────────────────────────────────────────────────────── */
@media (max-width: 639.98px) {
	.uc-tools {
		--nl-tools-nav-h: 3.5rem;
	}

	.nl-tools-hero {
		padding-top: 0.5rem;
		padding-bottom: 3.25rem;
	}

	.uc-tools .nl-tools-hero__title {
		margin-block: 1rem 1rem;
		font-size: clamp(2rem, 9.4vw, 2.6rem);
	}

	[dir="rtl"] .uc-tools .nl-tools-hero__title {
		font-size: clamp(1.75rem, 8vw, 2.25rem);
	}

	.nl-tools-hero .nl-hero__lead {
		margin-bottom: 1.4rem;
	}

	.nl-search {
		height: 3.5rem;
	}

	.nl-search__icon {
		width: 3rem;
	}

	.nl-tools-card {
		flex-basis: 82%;
	}

	.uc-tools .nl-tool-row__link {
		align-items: start;
		gap: 0.9rem;
		padding: 1rem;
	}

	.nl-tool-icon {
		width: 2.75rem;
		height: 2.75rem;
	}

	.nl-tool-icon img {
		width: 1.5rem;
		height: 1.5rem;
	}

	.nl-tool-icon--mono {
		font-size: 0.9375rem;
	}

	.nl-tool-row__go {
		align-self: center;
	}

	.nl-tool-row__text {
		font-size: 0.9063rem;
	}
}

/* ── Print ────────────────────────────────────────────────────────── */
@media print {
	.nl-tools-nav,
	.nl-search,
	.nl-search__meta {
		display: none;
	}
}
