/* Страницы-калькуляторы формул (программное SEO) и виджет /embed/.
   Все классы префиксованы fc-, файл самодостаточен: виджет подключает
   ТОЛЬКО эту таблицу (без bootstrap/style.css), поэтому здесь нет
   зависимости от базовых стилей сайта. */

.fc-page {
  max-width: 920px;
}

/* --- верхняя строка: хлебные крошки + переключатель языка ------------- */
.fc-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.fc-crumbs {
  font-size: 12px;
  color: #97958d;
  line-height: 1.5;
}

.fc-crumbs a {
  color: #97958d;
  text-decoration: none;
}

.fc-crumbs a:hover {
  color: #185fa5;
  text-decoration: underline;
}

.fc-crumb-sep {
  margin: 0 6px;
  color: #c3c2b7;
}

.fc-langs {
  display: flex;
  gap: 6px;
}

.fc-lang {
  display: inline-block;
  padding: 2px 12px;
  font-size: 13px;
  color: #5f5e5a;
  text-decoration: none;
  border: 1px solid #e1e0d9;
  border-radius: 6px;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.fc-lang:hover {
  border-color: #a5a49a;
}

.fc-lang.is-active {
  background: #f0efec;
  border-color: #c3c2b7;
  color: #20201f;
}

/* --- заголовки -------------------------------------------------------- */
.fc-h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 16px;
}

.fc-h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px;
}

/* --- карточки --------------------------------------------------------- */
.fc-card {
  display: block;
  background: #fff;
  border: 1px solid #e7e6e1;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  color: #20201f;
}

.fc-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.fc-grid-2 > .fc-card {
  margin-bottom: 0;
}

.fc-label {
  font-size: 13px;
  color: #7b7974;
  margin: 0 0 6px;
}

.fc-text {
  font-size: 14px;
  line-height: 1.6;
  color: #454442;
  margin: 8px 0 0;
}

.fc-prose {
  font-size: 14px;
  line-height: 1.65;
  color: #383835;
}

.fc-prose p:first-child {
  margin-top: 0;
}

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

/* --- калькулятор ------------------------------------------------------ */
.fc-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.fc-field {
  min-width: 0;
}

.fc-control {
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 6px 12px;
  font-size: 15px;
  font-family: inherit;
  color: #20201f;
  background: #fff;
  border: 1px solid #d2d1c7;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.fc-control:hover {
  border-color: #a5a49a;
}

.fc-control:focus {
  border-color: #2a78d6;
  box-shadow: 0 0 0 3px rgba(42, 120, 214, 0.15);
}

select.fc-control {
  cursor: pointer;
}

.fc-calc-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  border-top: 1px solid #edece8;
  margin-top: 14px;
  padding-top: 12px;
  min-height: 24px;
}

.fc-result {
  font-size: 24px;
  font-weight: 500;
  color: #111111;
}

/* Строка формулы с подстановкой (p = F / S = 100 / 0,02) — отдельным
   заметным блоком; содержимое типсетит MathJax. */
.fc-formula {
  display: inline-block;
  box-sizing: border-box;
  max-width: 100%;
  padding: 7px 12px;
  font-size: 17px;
  line-height: 1.45;
  color: #383835;
  background: #f9f9f7;
  border: 1px solid #e7e6e1;
  border-radius: 8px;
}

.fc-formula:empty {
  display: none;
}

/* Каждая строка вывода (формула / подстановка) — с новой строки. */
.fc-fml-line {
  display: block;
}

.fc-fml-line + .fc-fml-line {
  margin-top: 4px;
}

/* --- формула, объяснение, пример -------------------------------------- */
.fc-latex {
  margin: 4px 0 6px;
  text-align: center;
  font-size: 18px;
}

.fc-solution {
  margin-top: 12px;
}

.fc-btn {
  display: inline-block;
  box-sizing: border-box;
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  color: #20201f;
  background: #fff;
  border: 1px solid #c3c2b7;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}

.fc-btn:hover {
  background: #f6f6f4;
  border-color: #a5a49a;
}

.fc-solution summary {
  list-style: none;
}

.fc-solution summary::-webkit-details-marker {
  display: none;
}

.fc-sol-hide {
  display: none;
}

.fc-solution[open] .fc-sol-show {
  display: none;
}

.fc-solution[open] .fc-sol-hide {
  display: inline;
}

.fc-solution-body {
  margin-top: 12px;
  padding-left: 12px;
  border-left: 3px solid #91d68b;
}

/* --- FAQ -------------------------------------------------------------- */
.fc-faq {
  border-top: 1px solid #edece8;
  padding: 10px 0;
}

.fc-faq:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.fc-faq-q {
  font-size: 14px;
  font-weight: 500;
  color: #20201f;
  cursor: pointer;
  list-style: none;
}

.fc-faq-q::-webkit-details-marker {
  display: none;
}

.fc-faq-q::before {
  content: "›";
  display: inline-block;
  margin-right: 8px;
  color: #898781;
  transition: transform 0.15s;
}

.fc-faq[open] .fc-faq-q::before {
  transform: rotate(90deg);
}

.fc-faq-a {
  font-size: 14px;
  line-height: 1.6;
  color: #454442;
  margin: 8px 0 0;
}

/* --- задачи и перелинковка ------------------------------------------- */
.fc-task-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.9;
}

.fc-task-list a {
  color: #185fa5;
  text-decoration: none;
}

.fc-task-list a:hover {
  text-decoration: underline;
}

.fc-more {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  color: #185fa5;
  text-decoration: none;
}

.fc-more:hover {
  text-decoration: underline;
}

.fc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fc-chip {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  color: #383835;
  text-decoration: none;
  background: #f9f9f7;
  border: 1px solid #e1e0d9;
  border-radius: 9999px;
  transition: border-color 0.15s, background 0.15s;
}

.fc-chip:hover {
  border-color: #86b6ef;
  background: #ebf4fc;
}

/* --- встраивание и CTA ------------------------------------------------ */
.fc-embed-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #52514e;
  background: #f6f6f4;
  border: 1px solid #e7e6e1;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 8px 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.fc-cta {
  background: #ebf4fc;
  border-color: #cde2fb;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.fc-cta:hover {
  background: #ddebfa;
  border-color: #9ec5f4;
}

.fc-cta-title {
  font-size: 14px;
  font-weight: 500;
  color: #185fa5;
  margin: 0 0 4px;
}

.fc-cta-desc {
  font-size: 13px;
  color: #2a78d6;
  margin: 0 0 10px;
}

.fc-cta-btn {
  display: inline-block;
  padding: 7px 14px;
  font-size: 13px;
  color: #fff;
  background: #2a78d6;
  border-radius: 6px;
}

.fc-cta:hover .fc-cta-btn {
  background: #185fa5;
}

/* --- индекс /<предмет>/formulas/ -------------------------------------- */
/* Юнит (раздел) — карточка с заголовком и счётчиком формул. */
.fc-index-unit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.fc-index-unit-head .fc-h2 {
  margin: 0;
}

.fc-count {
  flex: none;
  min-width: 26px;
  box-sizing: border-box;
  padding: 1px 8px;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
  color: #5f5e5a;
  background: #f0efec;
  border: 1px solid #e1e0d9;
  border-radius: 9999px;
}

.fc-index-chapter {
  margin-top: 16px;
}

.fc-index-chapter:first-of-type {
  margin-top: 6px;
}

/* Тема — микро-заголовок капслоком над сеткой своих формул. */
.fc-index-chapter-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7b7974;
}

.fc-index-num {
  font-weight: 500;
  letter-spacing: 0;
  color: #a5a49a;
}

/* Сетка карточек-формул: TeX-превью, название, описание. */
.fc-fgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.fc-fcard {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 12px 14px;
  text-decoration: none;
  background: #f9f9f7;
  border: 1px solid #e7e6e1;
  border-radius: 10px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.fc-fcard:hover {
  background: #fff;
  border-color: #86b6ef;
  box-shadow: 0 2px 8px rgba(32, 32, 31, 0.07);
}

.fc-fcard-math {
  display: block;
  min-height: 32px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #edece8;
  font-size: 16px;
  text-align: center;
  color: #383835;
  overflow-x: auto;
}

/* Отбиваем поля MathJax от внутренних отступов карточки. */
.fc-fcard-math mjx-container[display="true"] {
  margin: 0;
}

.fc-fcard-title {
  font-size: 14px;
  font-weight: 500;
  color: #185fa5;
}

.fc-fcard:hover .fc-fcard-title {
  text-decoration: underline;
}

.fc-fcard-desc {
  display: -webkit-box;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: #7b7974;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Сырой TeX ($$…$$) в карточках не показываем до отрисовки MathJax. */
html.fc-premath .fc-fcard-math {
  visibility: hidden;
}

/* --- подсказки и константы калькулятора ------------------------------- */
.fc-hint {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: #97958d;
  margin-top: 4px;
}

.fc-consts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid #edece8;
  font-size: 13px;
  color: #6d6b67;
}

.fc-const {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}


/* --- виджет /embed/ --------------------------------------------------- */
.fc-embed-body {
  margin: 0;
  padding: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f9f9f7;
  color: #20201f;
}

.fc-embed {
  max-width: 720px;
  margin: 0 auto;
}

.fc-embed .fc-card {
  margin-bottom: 10px;
}

.fc-powered {
  text-align: center;
  font-size: 12px;
  margin: 10px 0 0;
}

.fc-powered a {
  color: #97958d;
  text-decoration: none;
}

.fc-powered a:hover {
  color: #6d6b67;
  text-decoration: underline;
}
