/* ==========================================================================
   Публічний каталог завдань: хаб, предмет, клас, розділ, тема.
   Кольори й радіуси — зі змінних теми, власних не заводимо.
   ========================================================================== */

.cat-page {
	padding-block: clamp(24px, 5vw, 56px);
	max-width: 56rem;
}

.cat-crumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 18px;
	font-size: 0.875rem;
	color: var(--ink-3);
}

.cat-crumbs a { color: var(--ink-2); }
.cat-crumbs__sep { color: var(--ink-4); }

.cat-preview {
	margin: 0 0 20px;
	padding: 12px 16px;
	border-radius: var(--r-md, 12px);
	background: var(--ochre-tint, #fdf1e6);
	border: 1px solid var(--ochre-tint-line, #f0d9c2);
	color: var(--ochre-tint-ink, #7a3405);
	font-size: 0.9375rem;
}

.cat-head { margin-bottom: 28px; }
.cat-head .z-sub { margin-top: 8px; color: var(--ink-2); }

.cat-block { margin-top: 36px; }
.cat-block > .z-h2 { margin-bottom: 14px; }

.cat-hint {
	margin: -6px 0 16px;
	color: var(--ink-3);
	font-size: 0.9375rem;
}

/* Сітка предметів на хабі -------------------------------------------------- */

.cat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cat-card a {
	display: block;
	padding: 16px 18px;
	border: 1px solid var(--line);
	border-radius: var(--r-md, 12px);
	background: var(--card);
	text-decoration: none;
	color: inherit;
	transition: border-color 0.15s ease;
}

.cat-card a:hover { border-color: var(--ink); }
.cat-card strong { display: block; }
.cat-card span {
	display: block;
	margin-top: 4px;
	color: var(--ink-3);
	font-size: 0.875rem;
}

.cat-soon {
	margin-top: 14px;
	color: var(--ink-3);
	font-size: 0.9375rem;
}

/* Списки тем -------------------------------------------------------------- */

.cat-section { margin-top: 20px; }
.cat-section__title { margin: 0 0 8px; font-size: 1.0625rem; }

.cat-topics,
.cat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cat-topics { flex-direction: column; gap: 6px; }
.cat-topics--lg { font-size: 1.0625rem; gap: 10px; }

.cat-chips .z-chip { text-decoration: none; }

/* Пояснення й приклади ---------------------------------------------------- */

.cat-intro {
	margin-top: 8px;
	font-size: 1.0625rem;
	line-height: 1.65;
}

.cat-sample {
	margin-bottom: 14px;
	padding: 16px 18px;
	border: 1px solid var(--line);
	border-left: 3px solid var(--ochre);
	border-radius: var(--r-md, 12px);
	background: var(--card);
}

.cat-sample__stem { margin: 0; font-size: 1.0625rem; }

.cat-sample__options {
	margin: 12px 0 0;
	padding-left: 20px;
	color: var(--ink-2);
}

.cat-sample__answer { margin-top: 12px; }
.cat-sample__answer summary { cursor: pointer; color: var(--ochre-link); }
.cat-sample__answer p { margin: 8px 0 0; }

.cat-mistakes__list {
	margin: 0;
	padding-left: 20px;
	line-height: 1.7;
}

.cat-faq__item { margin-bottom: 18px; }
.cat-faq__q { margin: 0 0 6px; font-size: 1.0625rem; }
.cat-faq__a { margin: 0; color: var(--ink-2); }

/* Параграфи підручника ---------------------------------------------------- */

.cat-paras { margin: 0; padding: 0; list-style: none; }

.cat-para {
	display: flex;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px solid var(--line-soft, var(--line));
}

.cat-para__no {
	flex: none;
	min-width: 3.5rem;
	color: var(--ink-3);
	font-variant-numeric: tabular-nums;
}

/* Сусідні теми ------------------------------------------------------------ */

.cat-nav {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
	gap: 10px;
	margin-top: 36px;
	padding-top: 24px;
	border-top: 1px solid var(--line);
}

.cat-nav a {
	display: block;
	padding: 12px 14px;
	border: 1px solid var(--line);
	border-radius: var(--r-md, 12px);
	text-decoration: none;
	color: inherit;
}

.cat-nav a:hover { border-color: var(--ink); }
.cat-nav span { display: block; color: var(--ink-3); font-size: 0.8125rem; }
.cat-nav strong { display: block; margin-top: 2px; }

/* Заклики ----------------------------------------------------------------- */

.cat-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 24px;
}

.cat-cta__note { color: var(--ink-3); font-size: 0.875rem; }

.cat-steps {
	margin: 0;
	padding-left: 22px;
	line-height: 1.8;
}

/* Хаб: усі предмети, готові й у роботі ----------------------------------- */

.cat-grid--subjects {
	grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
}

.cat-card > div {
	display: block;
	padding: 16px 18px;
	border: 1px dashed var(--line);
	border-radius: var(--r-md, 12px);
	color: var(--ink-3);
}

.cat-card--soon strong {
	color: var(--ink-2);
}

.cat-card > div span {
	display: block;
	margin-top: 4px;
	font-size: 0.875rem;
}

/* ==========================================================================
   Сторінка теми — для вчителя
   ========================================================================== */

.cat-topic {
	max-width: 60rem;
	padding-bottom: 96px; /* місце під закріплену панель на телефоні */
}

/* Перший екран ------------------------------------------------------------ */

.tp-hero {
	margin-bottom: 36px;
}

.tp-hero__pill { margin-bottom: 14px; }

.tp-hero__title {
	max-width: 22ch;
	margin: 0;
}

.tp-hero__lead {
	max-width: 46rem;
	margin: 16px 0 0;
	font-size: 1.125rem;
	line-height: 1.55;
	color: var(--ink-2);
}

.tp-hero__lead strong { color: var(--ink); }

.tp-hero__cta {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 24px;
}

.tp-hero__trust {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 22px;
	margin: 18px 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.9rem;
	color: var(--ink-2);
}

.tp-hero__trust li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.tp-hero__trust .z-icon { color: var(--green); }

/* Блоки -------------------------------------------------------------------- */

.tp-block { margin-top: 44px; }
.tp-block__head { margin-bottom: 18px; }
.tp-block__head .z-h2 { margin-bottom: 6px; }
.tp-block__sub { margin: 0; color: var(--ink-3); max-width: 46rem; }

/* Приклади ----------------------------------------------------------------- */

.tp-samples__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
	gap: 14px;
}

.tp-sample {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 18px 20px;
	border: 1px solid var(--line);
	border-radius: 18px;
	background: var(--card);
	box-shadow: 0 10px 28px -24px rgba(25, 33, 46, 0.4);
}

.tp-sample__label {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin: 0;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--ink-3);
}

.tp-sample__variants {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--green-tint);
	color: var(--green-ink);
	text-transform: none;
	letter-spacing: 0;
	font-size: 0.78rem;
}

.tp-sample__stem {
	font-size: 1.125rem;
	line-height: 1.5;
}

.tp-sample__stem math { font-size: 1.15em; }

.tp-sample__options {
	margin: 0;
	padding-left: 22px;
	color: var(--ink-2);
	line-height: 1.7;
}

.tp-sample__answer {
	margin-top: auto;
	padding-top: 6px;
}

.tp-sample__answer summary {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	list-style: none;
	font-weight: 600;
	color: var(--ochre-link);
}

.tp-sample__answer summary::-webkit-details-marker { display: none; }
.tp-sample__answer summary::marker { content: ""; }

.tp-sample__answer[open] summary { color: var(--ink-3); }

.tp-sample__answer p {
	margin: 8px 0 0;
	padding: 10px 14px;
	border-radius: 12px;
	background: var(--green-tint);
	color: var(--green-ink);
}

.tp-samples__more {
	margin: 16px 0 0;
	color: var(--ink-3);
	font-size: 0.9375rem;
}

/* Цінність для вчителя ------------------------------------------------------ */

.tp-value__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: 14px;
}

.tp-tile {
	padding: 20px 20px 22px;
	border: 1px solid var(--line);
	border-radius: 18px;
	background: var(--paper-3);
}

.tp-tile .z-iconbox { margin-bottom: 14px; }
.tp-tile h3 { margin: 0 0 6px; font-size: 1.0625rem; }
.tp-tile p { margin: 0; color: var(--ink-2); font-size: 0.9375rem; line-height: 1.5; }

/* Помилки ------------------------------------------------------------------ */

.tp-mistakes__list {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tp-mistakes__list li {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 12px 16px;
	border-radius: 14px;
	background: var(--red-tint);
	color: var(--red-ink);
	line-height: 1.5;
}

.tp-mistakes__list .z-icon { flex: none; margin-top: 4px; }

/* Повторний заклик ------------------------------------------------------------ */

.tp-repeat { margin-top: 44px; }

.tp-repeat__panel {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 28px 32px;
	border-radius: 22px;
	background: var(--ochre);
	color: #fff;
}

.tp-repeat__panel h2 {
	margin: 0 0 6px;
	font-family: var(--font-display);
	font-size: 1.375rem;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.tp-repeat__panel p { margin: 0; opacity: 0.9; }
.tp-repeat__panel .z-btn { flex: none; }

/* Конспект для учня ----------------------------------------------------------- */

.tp-notes__details {
	border: 1px solid var(--line);
	border-radius: 18px;
	background: var(--card);
}

.tp-notes__details summary {
	display: grid;
	gap: 4px;
	padding: 20px 24px;
	cursor: pointer;
	list-style: none;
}

.tp-notes__details summary::-webkit-details-marker { display: none; }
.tp-notes__details summary::marker { content: ""; }

.tp-notes__details summary::after {
	content: "Розгорнути";
	margin-top: 8px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ochre-link);
}

.tp-notes__details[open] summary::after { content: "Згорнути"; }

.tp-notes__eyebrow {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ochre);
}

.tp-notes__hint { font-size: 0.9rem; color: var(--ink-3); }

.tp-notes__body {
	padding: 4px 24px 24px;
	border-top: 1px solid var(--line-soft);
}

.tp-notes__body h3 { margin: 22px 0 8px; font-size: 1.0625rem; }

/* Повʼязане ------------------------------------------------------------------ */

.tp-related {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
	gap: 24px;
}

.tp-related .z-h3 { margin-bottom: 10px; }

/* Закріплена панель ---------------------------------------------------------- */

.tp-sticky {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 40;
	padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--line);
	background: rgba(251, 246, 236, 0.94);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	transform: translateY(110%);
	transition: transform 0.22s ease;
}

.tp-sticky.is-visible { transform: none; }

.tp-sticky__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
}

.tp-sticky__title {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
}

@media (min-width: 761px) {
	.tp-sticky {
		top: var(--header-h, 76px);
		bottom: auto;
		padding: 10px 0;
		border-top: 0;
		border-bottom: 1px solid var(--line);
		transform: translateY(-120%);
	}
	.cat-topic { padding-bottom: 40px; }
}

@media (max-width: 760px) {
	.tp-hero__title { max-width: none; }
	.tp-hero__cta .z-btn { flex: 1 1 100%; justify-content: center; }
	.tp-repeat__panel { flex-direction: column; align-items: flex-start; padding: 24px; }
	.tp-repeat__panel .z-btn { width: 100%; justify-content: center; }
	.tp-sticky__title { display: none; }
	.tp-sticky .z-btn { width: 100%; justify-content: center; }
}

/* ==========================================================================
   Сторінка предмета — для вчителя
   ========================================================================== */

.sp { max-width: 64rem; padding-bottom: 96px; }

.sp-hero { margin-bottom: 26px; }
.sp-hero__pill { margin-bottom: 14px; }
.sp-hero__title { margin: 0; max-width: 24ch; }

.sp-hero__lead {
	max-width: 48rem;
	margin: 16px 0 0;
	font-size: 1.125rem;
	line-height: 1.55;
	color: var(--ink-2);
}

.sp-hero__lead strong { color: var(--ink); }

.sp-hero__stats {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 28px;
	margin: 18px 0 0;
	padding: 0;
	list-style: none;
}

.sp-hero__stats li { display: grid; gap: 2px; }
.sp-hero__stats strong { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; }
.sp-hero__stats span { font-size: 0.8125rem; color: var(--ink-3); }

/* Класи ------------------------------------------------------------------- */

.sp-grades {
	display: flex;
	gap: 10px;
	margin-bottom: 26px;
	padding-bottom: 4px;
	overflow-x: auto;
	scrollbar-width: none;
}

.sp-grades::-webkit-scrollbar { display: none; }

.sp-grade {
	flex: none;
	display: grid;
	gap: 2px;
	min-width: 8.5rem;
	padding: 12px 16px;
	border: 1.5px solid var(--line);
	border-radius: 16px;
	background: var(--card);
	color: inherit;
	text-decoration: none;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.sp-grade strong { font-size: 1.0625rem; }
.sp-grade span { font-size: 0.8125rem; color: var(--ink-3); }

.sp-grade:hover { border-color: var(--ink); }

.sp-grade.is-active {
	border-color: var(--ochre);
	background: var(--ochre-tint);
}

.sp-grade.is-active span { color: var(--ochre-tint-ink); }

.sp-grade--soon {
	border-style: dashed;
	background: transparent;
	color: var(--ink-3);
}

/* Блок класу ----------------------------------------------------------------- */

.sp-grade-block { display: none; }
.sp-grade-block.is-active { display: block; }

/* Без скрипта видно всі класи підряд. */
html:not(.js-tabs) .sp-grade-block { display: block; margin-top: 36px; }

.sp-grade-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 14px 24px;
	margin-bottom: 18px;
}

.sp-grade-head .z-h2 { margin: 0; }
.sp-grade-head__meta { margin: 6px 0 0; color: var(--ink-3); font-size: 0.9375rem; }
.sp-grade-head__cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* Пошук ------------------------------------------------------------------- */

.sp-search {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: 30rem;
	margin: 0 0 18px;
	padding: 0 14px;
	border: 1.5px solid var(--line);
	border-radius: 14px;
	background: var(--card);
	color: var(--ink-3);
}

.sp-search:focus-within { border-color: var(--ink); }

.sp-search input {
	flex: 1;
	min-width: 0;
	padding: 11px 0;
	border: 0;
	background: transparent;
	font: inherit;
	color: var(--ink);
	outline: none;
}

.sp-search__count { font-size: 0.8125rem; white-space: nowrap; }

/* Картки розділів ----------------------------------------------------------- */

.sp-sections {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
	gap: 14px;
}

.sp-section {
	display: flex;
	flex-direction: column;
	padding: 18px 18px 14px;
	border: 1px solid var(--line);
	border-radius: 18px;
	background: var(--card);
}

.sp-section__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 10px;
}

.sp-section__title { margin: 0; font-size: 1.0625rem; line-height: 1.3; }
.sp-section__title a { color: inherit; text-decoration: none; }
.sp-section__title a:hover { color: var(--ochre); }
.sp-section__count { flex: none; font-size: 0.8125rem; color: var(--ink-3); }

.sp-topics { margin: 0; padding: 0; list-style: none; }

.sp-topic {
	display: flex;
	align-items: center;
	gap: 8px;
	border-top: 1px solid var(--line-soft);
}

.sp-topic__link {
	flex: 1;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	min-width: 0;
	padding: 9px 0;
	color: var(--ink);
	text-decoration: none;
}

.sp-topic__link:hover .sp-topic__title { color: var(--ochre); }
.sp-topic__title { font-size: 0.9375rem; }
.sp-topic__n { flex: none; font-size: 0.75rem; color: var(--ink-4); }

.sp-topic__assign {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	border-radius: 999px;
	background: var(--paper-2);
	color: var(--ink-2);
	font-size: 0.75rem;
	font-weight: 600;
	text-decoration: none;
	opacity: 0;
	transition: opacity 0.12s ease, background 0.12s ease;
}

.sp-topic:hover .sp-topic__assign,
.sp-topic__assign:focus-visible { opacity: 1; }
.sp-topic__assign:hover { background: var(--ochre); color: #fff; }

.sp-section--long .sp-topic--extra { display: none; }
.sp-section.is-expanded .sp-topic--extra { display: flex; }

.sp-section__more {
	align-self: flex-start;
	margin-top: 8px;
	padding: 6px 0;
	color: var(--ochre-link);
	font-weight: 600;
	font-size: 0.9rem;
}

.sp-section.is-expanded .sp-section__more { display: none; }

.sp-topic.is-hidden { display: none; }
.sp-section.is-hidden { display: none; }
.sp-empty { margin: 20px 0 0; color: var(--ink-2); }

/* Довіра ---------------------------------------------------------------------- */

.sp-trust {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: 14px;
	margin-top: 44px;
}

.sp-trust article {
	padding: 20px 20px 22px;
	border: 1px solid var(--line);
	border-radius: 18px;
	background: var(--paper-3);
}

.sp-trust .z-iconbox { margin-bottom: 12px; }
.sp-trust h3 { margin: 0 0 6px; font-size: 1.0625rem; }
.sp-trust p { margin: 0; color: var(--ink-2); font-size: 0.9375rem; line-height: 1.5; }

@media (min-width: 761px) {
	.sp { padding-bottom: 40px; }
}

@media (max-width: 760px) {
	.sp-hero__title { max-width: none; }
	.sp-grade-head__cta { width: 100%; }
	.sp-grade-head__cta .z-btn { flex: 1 1 100%; justify-content: center; }
	.sp-topic__assign { opacity: 1; }
	.sp-topic__assign span { display: none; }
	.sp-sections { grid-template-columns: 1fr; }
}
