:root {
  /* Семантика доходности и предупреждений — расширение бренд-палитры,
     подобрано под контраст ≥ 4.5:1 на светлых подложках. */
  --bf-positive: #0E7A46;
  --bf-positive-tint: #E6F6EE;
  --bf-negative: #C0341D;
  --bf-negative-tint: #FDECEA;
  --bf-attention: #A05A00;
  --bf-attention-tint: #FFF3E0;

  --bf-shadow: 0 4px 20px rgba(10, 10, 12, 0.06);
  --bf-shadow-hover: 0 8px 28px rgba(10, 10, 12, 0.12);
  --bf-scrim: rgba(10, 10, 12, 0.5);
  --bf-text-on-dark: rgba(255, 255, 255, 0.62);
  --bf-text-on-dark-strong: #FFFFFF;
  --bf-text-on-dark-muted: rgba(255, 255, 255, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--bf-font);
  color: var(--bf-text);
  background: var(--bf-surface);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }

/* Технические подписи — моно по гайду айдентики */
.yield-pos,
.yield-neg,
.yield-periods__item b,
.stat-card__value,
.filters__count,
.hero__updated span,
.compare-table td .yield-pos,
.compare-table td .yield-neg {
  font-family: var(--bf-font-mono);
  font-weight: 500;
}

:focus-visible {
  outline: 2px solid var(--bf-accent-on-dark);
  outline-offset: 2px;
  border-radius: var(--bf-radius-xs);
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bf-surface);
  border-bottom: 1px solid var(--bf-divider);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding-top: 16px;
  padding-bottom: 16px;
}
/* Компактный локап: знак 28 px + слово, gap 11 px */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  transition: opacity 120ms ease;
}
.logo:hover { opacity: .8; }
.logo__mark { width: 28px; height: 28px; display: block; margin-left: -3.5px; }
.logo__word {
  font-weight: var(--bf-logo-weight);
  font-size: 18px;
  letter-spacing: var(--bf-logo-tracking);
  line-height: 1;
  color: var(--bf-ink);
}
.nav { display: flex; gap: 26px; }
.nav a {
  color: var(--bf-text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: color var(--bf-duration) var(--bf-ease);
}
.nav a:hover { color: var(--bf-ink); }

/* Hero */
.hero {
  background: var(--bf-surface-2);
  color: var(--bf-ink);
  padding: 52px 0 60px;
}
.hero__inner { text-align: center; }
.hero h1 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  max-width: 560px;
  margin: 0 auto 14px;
}
.hero__subtitle {
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--bf-text-secondary);
  max-width: 480px;
  margin: 0 auto 28px;
}
.hero__actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero__updated {
  margin-top: 24px;
  font-size: 13px;
  color: var(--bf-text-muted);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: var(--bf-radius-sm);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn--primary {
  background: var(--bf-accent);
  color: var(--bf-text-on-accent);
}
.btn--primary:hover { background: var(--bf-accent-hover); box-shadow: var(--bf-shadow-hover); }
.btn--primary:active { background: var(--bf-accent-active); }
.btn--secondary {
  background: var(--bf-surface);
  color: var(--bf-ink);
  border-color: var(--bf-border);
}
.btn--secondary:hover { background: var(--bf-accent-tint); border-color: var(--bf-accent); }
.btn--ghost {
  background: transparent;
  color: var(--bf-ink);
  border-color: var(--bf-border);
}
.btn--ghost:hover { background: var(--bf-surface-2); border-color: var(--bf-accent); }
.btn--small { padding: 8px 18px; font-size: 13px; }

/* Picker */
.picker { margin-top: -36px; position: relative; z-index: 2; }
.picker__card {
  background: var(--bf-surface);
  border-radius: var(--bf-radius-lg);
  box-shadow: var(--bf-shadow-hover);
  padding: 36px;
  border: 1px solid var(--bf-border);
}
.picker__card h2 { margin: 0 0 8px; font-size: 26px; color: var(--bf-ink); }
.picker__lead { color: var(--bf-text-secondary); margin: 0 0 24px; }

.quiz__step {
  padding: 18px 0;
  border-top: 1px solid var(--bf-border);
}
.quiz__step:first-of-type { border-top: none; }
.quiz__step h3 { margin: 0 0 12px; font-size: 16px; color: var(--bf-ink); }
.quiz__options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.quiz__options label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius-pill);
  cursor: pointer;
  font-size: 14px;
  background: var(--bf-surface-2);
  transition: all 0.12s ease;
}
.quiz__options label:hover { border-color: var(--bf-accent); }
.quiz__options input { accent-color: var(--bf-accent); }
.quiz__options label:has(input:checked) {
  background: var(--bf-accent-tint);
  border-color: var(--bf-accent);
  color: var(--bf-ink);
  font-weight: 600;
}
.quiz__actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
}

.quiz-result {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 2px solid var(--bf-border);
}
.quiz-result h3 { color: var(--bf-ink); margin: 0 0 6px; }
.quiz-result__hint { color: var(--bf-text-secondary); margin: 0 0 18px; }

.disclaimer {
  font-size: 13px;
  color: var(--bf-text-secondary);
  background: var(--bf-surface-2);
  padding: 14px 18px;
  border-radius: var(--bf-radius-sm);
  margin-top: 20px;
}

/* Stats */
.stats { margin: 56px auto; }
.stats__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--bf-surface-2);
  border-radius: var(--bf-radius-lg);
  padding: 22px;
  text-align: center;
}
.stat-card__value {
  font-size: 28px;
  font-weight: 800;
  color: var(--bf-ink);
}
.stat-card__label {
  font-size: 13px;
  color: var(--bf-text-secondary);
  margin-top: 6px;
}

/* Catalog */
.catalog { margin: 56px auto; }
.catalog h2, .compare h2, .learn h2, .warnings h2 {
  font-size: 28px;
  color: var(--bf-ink);
  margin-bottom: 18px;
}
.section-lead { color: var(--bf-text-secondary); }

.filters {
  background: var(--bf-surface-2);
  border-radius: var(--bf-radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.filters__search {
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--bf-radius-pill);
  border: 1px solid var(--bf-border);
  font-size: 15px;
  margin-bottom: 14px;
}
.filters__row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.filter-group {
  flex: 1;
  min-width: 150px;
}
.filter-group label {
  display: block;
  font-size: 12px;
  color: var(--bf-text-secondary);
  margin-bottom: 4px;
  font-weight: 600;
}
.filter-group select {
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--bf-radius-sm);
  border: 1px solid var(--bf-border);
  background: var(--bf-surface);
  font-size: 14px;
}
.filter-group--range { min-width: 220px; }
.range-pair {
  display: flex;
  gap: 8px;
  align-items: center;
}
.range-pair input { flex: 1; accent-color: var(--bf-accent); }
.filters__row--actions {
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.filters__count {
  font-size: 13px;
  color: var(--bf-text-secondary);
}

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.fund-card {
  background: var(--bf-surface);
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius-lg);
  padding: 20px;
  box-shadow: var(--bf-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.fund-card:hover { box-shadow: var(--bf-shadow-hover); transform: translateY(-2px); }
.fund-card__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 9px;
  border-radius: var(--bf-radius-xs);
  background: var(--bf-accent-tint);
  color: var(--bf-accent-active);
}
.tag--passive { background: var(--bf-positive-tint); color: var(--bf-positive); }
.tag--income { background: var(--bf-attention-tint); color: var(--bf-attention); }
.tag--warn { background: var(--bf-negative-tint); color: var(--bf-negative); }
.fund-card__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--bf-ink);
  line-height: 1.35;
  margin: 0;
}
.fund-card__company {
  font-size: 13px;
  color: var(--bf-text-secondary);
}
.fund-card__row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  border-top: 1px dashed var(--bf-border);
  padding-top: 8px;
}
.fund-card__row span:first-child { color: var(--bf-text-secondary); }
.fund-card__row span:last-child { font-weight: 600; text-align: right; }
.yield-periods {
  display: flex;
  gap: 12px;
  font-size: 12px;
  margin-top: -2px;
}
.yield-periods__item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.yield-periods__item i {
  font-style: normal;
  color: var(--bf-text-secondary);
}
.yield-periods__item b { font-weight: 600; }
.yield-periods--wide { gap: 20px; font-size: 13px; margin-top: 0; }
.yield-pos { color: var(--bf-positive); }
.yield-neg { color: var(--bf-negative); }
.fund-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.fund-card__actions .btn { padding: 8px 14px; font-size: 13px; }
.fund-card__site {
  font-size: 13px;
  color: var(--bf-accent-active);
  text-decoration: none;
  font-weight: 600;
  align-self: center;
}
.fund-card__site:hover { text-decoration: underline; }

.empty-state {
  text-align: center;
  color: var(--bf-text-secondary);
  padding: 40px;
  background: var(--bf-surface-2);
  border-radius: var(--bf-radius-lg);
}
.catalog__more { text-align: center; margin-top: 24px; }

/* Compare */
.compare { margin: 56px auto; }
.compare-table-wrap { overflow-x: auto; margin-top: 16px; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bf-surface);
  border-radius: var(--bf-radius-lg);
  overflow: hidden;
  box-shadow: var(--bf-shadow);
  min-width: 600px;
}
.compare-table th, .compare-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bf-border);
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}
.compare-table th {
  background: var(--bf-surface-2);
  color: var(--bf-ink);
  font-weight: 700;
  white-space: nowrap;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table td:first-child {
  font-weight: 600;
  color: var(--bf-text-secondary);
  white-space: nowrap;
  background: var(--bf-surface-2);
}
#compare-clear { margin-top: 14px; }

/* Learn */
.learn { margin: 56px auto; }
.learn__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.learn__item {
  background: var(--bf-surface-2);
  border-radius: var(--bf-radius-lg);
  padding: 22px;
}
.learn__item h3 { margin: 0 0 8px; color: var(--bf-ink); font-size: 17px; }
.learn__item p { margin: 0; font-size: 14px; color: var(--bf-text); }

/* Warnings */
.warnings { margin: 56px auto 64px; }
.warnings__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.warning-card {
  background: var(--bf-negative-tint);
  color: var(--bf-negative);
  border-radius: var(--bf-radius-sm);
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 600;
}

/* Footer */
.footer {
  background: var(--bf-surface-dark);
  color: var(--bf-text-on-dark);
  padding: 32px 0;
  font-size: 13px;
  text-align: left;
}
/* Основной локап в футере: пропорции гайда (знак : кегль : отступ = 88 : 38 : 22),
   собран версткой, а не <img>, — иначе SVG не видит Manrope и не тянется под тему. */
.footer__logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.footer__logo-mark { width: 48px; height: 48px; display: block; margin-left: -6px; }
.footer__logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.footer__logo-word {
  font-weight: var(--bf-logo-weight);
  font-size: 21px;
  letter-spacing: var(--bf-logo-tracking);
  line-height: 1;
  color: var(--bf-text-on-dark-strong);
}
.footer__logo-descriptor {
  font-weight: 500;
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--bf-text-on-dark-muted);
}
.footer p { max-width: 720px; margin: 0; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] {
  display: none;
}
.modal__overlay {
  position: absolute;
  inset: 0;
  background: var(--bf-scrim);
}
.modal__content {
  position: relative;
  background: var(--bf-surface);
  border-radius: var(--bf-radius-lg);
  padding: 28px;
  max-width: 600px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--bf-shadow-hover);
}
.modal__close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: none;
  background: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--bf-text-secondary);
}
.modal__content h3 { color: var(--bf-ink); margin-top: 0; }
.modal__content dl { margin: 0; }
.modal__content dt { font-size: 12px; color: var(--bf-text-secondary); margin-top: 12px; font-weight: 600; }
.modal__content dd { margin: 2px 0 0; font-size: 14px; white-space: pre-line; }

/* Responsive: планшеты */
@media (max-width: 1024px) {
  .container { padding: 0 18px; }
  .hero { padding: 56px 0 44px; }
  .hero h1 { font-size: 36px; }
  .nav { gap: 16px; }
  .nav a { font-size: 14px; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* Responsive: мобильные устройства */
@media (max-width: 720px) {
  .header__inner { min-height: 0; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }
  /* Меню переносится на вторую строку вместо горизонтальной прокрутки:
     при скролле последний пункт обрезался посреди слова. */
  .nav {
    width: 100%;
    column-gap: 12px;
    row-gap: 6px;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .nav a {
    flex: 0 0 auto;
    padding: 4px 0;
    font-size: 13px;
    white-space: nowrap;
  }
  .hero { padding: 40px 0 36px; }
  .hero h1 { font-size: 28px; }
  .hero__subtitle { font-size: 16px; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { text-align: center; }
  .picker { margin-top: -20px; }
  .picker__card { padding: 18px; }
  .picker__card h2 { font-size: 22px; }
  .quiz__options { flex-direction: column; }
  .quiz__options label { width: 100%; }
  .quiz__actions { flex-direction: column; }
  .quiz__actions .btn { width: 100%; text-align: center; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); }
  .cards-grid { grid-template-columns: 1fr; }
  .filters__row { flex-direction: column; }
  .filter-group { min-width: 0; }
  .fund-card__actions { flex-direction: column; align-items: stretch; }
  .fund-card__actions .btn,
  .fund-card__site { text-align: center; }
  .modal__content { padding: 20px; width: 94%; }
  .catalog h2, .compare h2, .learn h2, .warnings h2 { font-size: 22px; }
}

@media (max-width: 420px) {
  .stats__grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 24px; }
}

/* Самые узкие экраны: ужимаем меню, чтобы оно осталось в одну строку */
@media (max-width: 360px) {
  .nav { column-gap: 6px; }
  .nav a { font-size: 12px; }
}


/* Тёмная тема: бренд-токены переопределяются в brand-tokens.css через
   [data-theme="dark"], здесь — системная тема и семантика доходности. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bf-surface: #0A0A0C;
    --bf-surface-2: #1E1E26;
    --bf-text: #FFFFFF;
    --bf-text-secondary: rgba(255, 255, 255, .62);
    --bf-text-muted: rgba(255, 255, 255, .5);
    --bf-ink: #FFFFFF;
    --bf-accent: #8A7BFF;
    --bf-accent-hover: #9C90FF;
    --bf-accent-active: #B0A6FF;
    --bf-accent-tint: rgba(138, 123, 255, .16);
    --bf-border: rgba(255, 255, 255, .14);
    --bf-divider: rgba(255, 255, 255, .08);

    --bf-positive: #4ED08A;
    --bf-positive-tint: rgba(78, 208, 138, .14);
    --bf-negative: #FF8069;
    --bf-negative-tint: rgba(255, 128, 105, .14);
    --bf-attention: #E8A33D;
    --bf-attention-tint: rgba(232, 163, 61, .14);

    --bf-shadow: 0 4px 20px rgba(0, 0, 0, .4);
    --bf-shadow-hover: 0 8px 28px rgba(0, 0, 0, .55);
    --bf-scrim: rgba(0, 0, 0, .65);
    --bf-text-on-accent: #0A0A0C;
  }
  :root:not([data-theme="light"]) .logo__mark--light { display: none; }
  :root:not([data-theme="light"]) .logo__mark--dark { display: block; }
}
.logo__mark--dark { display: none; }
